This drops exception declarations which are never used.
Change-Id: Icc8938b9c3b437a0d5961ec1b481fd06c52d47f2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
}
@Override
- public void close() throws Exception {
+ public void close() {
LOG.info("NtfbenchmarkProvider closed");
}
}
@Override
- public void close() throws Exception {
+ public void close() {
shutdownGracefully(0, 1, TimeUnit.SECONDS);
}
}
@Override
- public void close() throws Exception {
+ public void close() {
stop();
}
import com.google.common.base.Optional;
import java.io.Closeable;
-import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
}
@Override
- public void close() throws IOException {
+ public void close() {
executor.shutdown();
}
import com.google.common.base.Preconditions;
import java.io.Closeable;
-import java.io.IOException;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.concurrent.ThreadSafe;
}
@Override
- public void close() throws IOException {
+ public void close() {
}
public String getNamePrefix() {
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
clientId = ClientIdentifier.readFrom(in);
final byte header = WritableObjects.readLongHeader(in);
abstract T object();
@Test
- public void getCauseTest() throws Exception {
+ public void getCauseTest() {
Assert.assertEquals(CAUSE, object().getCause());
}
@Test
- public void isHardFailureTest() throws Exception {
+ public void isHardFailureTest() {
Assert.assertTrue(object().isHardFailure());
}
}
@Test
- public void testIsSuccessful() throws Exception {
+ public void testIsSuccessful() {
Assert.assertEquals(true, OBJECT.isSuccessful());
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ConnectClientFailure clone = OBJECT.cloneAsVersion(ABIVersion.current());
Assert.assertEquals(OBJECT.getTarget(), clone.getTarget());
Assert.assertEquals(OBJECT.getSequence(), clone.getSequence());
}
@Test
- public void getMinVersionTest() throws Exception {
+ public void getMinVersionTest() {
Assert.assertEquals(MIN_VERSION, OBJECT.getMinVersion());
}
@Test
- public void getMaxVersionTest() throws Exception {
+ public void getMaxVersionTest() {
Assert.assertEquals(MAX_VERSION, OBJECT.getMaxVersion());
}
@Test
- public void toRequestFailureTest() throws Exception {
+ public void toRequestFailureTest() {
final RequestException exception = new DeadTransactionException(ImmutableRangeSet.of());
final ConnectClientFailure failure = OBJECT.toRequestFailure(exception);
Assert.assertNotNull(failure);
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ConnectClientRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertNotNull(clone);
Assert.assertEquals(ABIVersion.BORON, clone.getVersion());
}
@Test
- public void addToStringAttributesTest() throws Exception {
+ public void addToStringAttributesTest() {
final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
Assert.assertTrue(result.toString().contains("minVersion=" + MIN_VERSION));
Assert.assertTrue(result.toString().contains("maxVersion=" + MAX_VERSION));
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ConnectClientSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ABIVersion cloneVersion = ABIVersion.TEST_FUTURE_VERSION;
final ExistsTransactionRequest clone = OBJECT.cloneAsVersion(cloneVersion);
Assert.assertEquals(cloneVersion, clone.getVersion());
}
@Test
- public void getExistsTest() throws Exception {
+ public void getExistsTest() {
final boolean result = OBJECT.getExists();
Assert.assertEquals(EXISTS, result);
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ExistsTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
@Test
- public void addToStringAttributesTest() throws Exception {
+ public void addToStringAttributesTest() {
final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
Assert.assertTrue(result.toString().contains("exists=" + EXISTS));
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final LocalHistoryFailure clone = OBJECT.cloneAsVersion(ABIVersion.current());
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final LocalHistorySuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT.getSequence(), clone.getSequence());
Assert.assertEquals(OBJECT.getTarget(), clone.getTarget());
new ModifyTransactionRequestBuilder(transactionIdentifier, actorRef);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
modifyTransactionRequestBuilder.setSequence(0L);
modifyTransactionRequestBuilder.addModification(transactionModification);
assertEquals(1, modifyTransactionRequestBuilder.size());
}
@Test
- public void testGetIdentifier() throws Exception {
+ public void testGetIdentifier() {
final TransactionIdentifier identifier = modifyTransactionRequestBuilder.getIdentifier();
Assert.assertEquals(transactionIdentifier, identifier);
}
@Test
- public void testBuildReady() throws Exception {
+ public void testBuildReady() {
modifyTransactionRequestBuilder.setReady();
final ModifyTransactionRequest modifyTransactionRequest = modifyTransactionRequestBuilder.build();
Assert.assertEquals(PersistenceProtocol.READY, modifyTransactionRequest.getPersistenceProtocol().get());
}
@Test
- public void testBuildAbort() throws Exception {
+ public void testBuildAbort() {
modifyTransactionRequestBuilder.setAbort();
final ModifyTransactionRequest modifyTransactionRequest = modifyTransactionRequestBuilder.build();
Assert.assertEquals(PersistenceProtocol.ABORT, modifyTransactionRequest.getPersistenceProtocol().get());
}
@Test
- public void testBuildCommitTrue() throws Exception {
+ public void testBuildCommitTrue() {
modifyTransactionRequestBuilder.setCommit(true);
final ModifyTransactionRequest modifyTransactionRequest = modifyTransactionRequestBuilder.build();
Assert.assertEquals(PersistenceProtocol.THREE_PHASE, modifyTransactionRequest.getPersistenceProtocol().get());
}
@Test
- public void testBuildCommitFalse() throws Exception {
+ public void testBuildCommitFalse() {
modifyTransactionRequestBuilder.setCommit(false);
final ModifyTransactionRequest modifyTransactionRequest = modifyTransactionRequestBuilder.build();
Assert.assertEquals(PersistenceProtocol.SIMPLE, modifyTransactionRequest.getPersistenceProtocol().get());
}
@Test
- public void getPersistenceProtocolTest() throws Exception {
+ public void getPersistenceProtocolTest() {
final Optional<PersistenceProtocol> result = OBJECT.getPersistenceProtocol();
Assert.assertTrue(result.isPresent());
Assert.assertEquals(PROTOCOL, result.get());
}
@Test
- public void getModificationsTest() throws Exception {
+ public void getModificationsTest() {
final List<TransactionModification> result = OBJECT.getModifications();
Assert.assertNotNull(result);
Assert.assertTrue(result.isEmpty());
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ModifyTransactionRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void getPersistenceProtocolTest() throws Exception {
+ public void getPersistenceProtocolTest() {
final Optional<PersistenceProtocol> result = OBJECT.getPersistenceProtocol();
Assert.assertTrue(result.isPresent());
Assert.assertEquals(PROTOCOL, result.get());
}
@Test
- public void getModificationsTest() throws Exception {
+ public void getModificationsTest() {
final List<TransactionModification> result = OBJECT.getModifications();
Assert.assertNotNull(result);
Assert.assertEquals(MODIFICATIONS, result);
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ModifyTransactionRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ModifyTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT.getVersion(), clone.getVersion());
Assert.assertEquals(OBJECT.getSequence(), clone.getSequence());
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ABIVersion cloneVersion = ABIVersion.TEST_FUTURE_VERSION;
final ReadTransactionRequest clone = OBJECT.cloneAsVersion(cloneVersion);
Assert.assertEquals(cloneVersion, clone.getVersion());
}
@Test
- public void getDataTest() throws Exception {
+ public void getDataTest() {
final Optional<NormalizedNode<?, ?>> result = OBJECT.getData();
Assert.assertFalse(result.isPresent());
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ReadTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void getDataTest() throws Exception {
+ public void getDataTest() {
final Optional<NormalizedNode<?, ?>> result = OBJECT.getData();
Assert.assertTrue(result.isPresent());
Assert.assertEquals(NODE.getValue(), result.get().getValue());
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final ReadTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionAbortRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionAbortSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionCanCommitSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionCommitSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionDoCommitRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionFailure clone = OBJECT.cloneAsVersion(ABIVersion.current());
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionPreCommitRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionPreCommitSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionPurgeRequest clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void cloneAsVersionTest() throws Exception {
+ public void cloneAsVersionTest() {
final TransactionPurgeResponse clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
Assert.assertEquals(OBJECT, clone);
}
}
@Test
- public void testProxySerializationDeserialization() throws Exception {
+ public void testProxySerializationDeserialization() {
final byte[] serializedBytes = SerializationUtils.serialize(envelope);
final Object deserialize = SerializationUtils.deserialize(serializedBytes);
checkDeserialized((E) deserialize);
}
@Test
- public void testCompareTo() throws Exception {
+ public void testCompareTo() {
Assert.assertTrue(object().compareTo(equalObject()) == 0);
Assert.assertTrue(object().compareTo(differentObject()) < 0);
}
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
system.terminate();
}
}
\ No newline at end of file
protected TestProbe replyToProbe;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
backendProbe = new TestProbe(system);
protected abstract T createConnection();
@Test
- public void testLocalActor() throws Exception {
+ public void testLocalActor() {
Assert.assertEquals(contextProbe.ref(), connection.localActor());
}
@Test
- public abstract void testReconnectConnection() throws Exception;
+ public abstract void testReconnectConnection();
@Test
- public void testPoison() throws Exception {
+ public void testPoison() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
final Request<?, ?> request = createRequest(replyToProbe.ref());
final ConnectionEntry entry = new ConnectionEntry(request, callback, 0L);
}
@Test
- public void testSendRequestReceiveResponse() throws Exception {
+ public void testSendRequestReceiveResponse() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
final Request<?, ?> request = createRequest(replyToProbe.ref());
connection.sendRequest(request, callback);
}
@Test
- public void testRun() throws Exception {
+ public void testRun() {
final ClientActorBehavior<U> behavior = mock(ClientActorBehavior.class);
Assert.assertSame(behavior, connection.runTimer(behavior));
}
@Test
- public void testCheckTimeoutEmptyQueue() throws Exception {
+ public void testCheckTimeoutEmptyQueue() {
final Optional<Long> timeout = connection.checkTimeout(context.ticker().read());
Assert.assertFalse(timeout.isPresent());
}
@Test
- public void testCheckTimeout() throws Exception {
+ public void testCheckTimeout() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
connection.sendRequest(createRequest(replyToProbe.ref()), callback);
final long now = context.ticker().read();
}
@Test
- public void testReplay() throws Exception {
+ public void testReplay() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
final Request<?, ?> request1 = createRequest(replyToProbe.ref());
final Request<?, ?> request2 = createRequest(replyToProbe.ref());
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
protected abstract T createQueue();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
system = ActorSystem.apply();
probe = new TestProbe(system);
queue = createQueue();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Test
- public abstract void testCanTransmitCount() throws Exception;
+ public abstract void testCanTransmitCount();
@Test(expected = UnsupportedOperationException.class)
- public abstract void testTransmit() throws Exception;
+ public abstract void testTransmit();
@Test
- public void testAsIterable() throws Exception {
+ public void testAsIterable() {
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
final long now = Ticker.systemTicker().read();
}
@Test
- public void testTicksStalling() throws Exception {
+ public void testTicksStalling() {
final long now = Ticker.systemTicker().read();
Assert.assertEquals(0, queue.ticksStalling(now));
}
@Test
- public void testCompleteReponseNotMatchingRequest() throws Exception {
+ public void testCompleteReponseNotMatchingRequest() {
final long requestSequence = 0L;
final long txSequence = 0L;
final long sessionId = 0L;
}
@Test
- public void testIsEmpty() throws Exception {
+ public void testIsEmpty() {
Assert.assertTrue(queue.isEmpty());
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
}
@Test
- public void testPeek() throws Exception {
+ public void testPeek() {
final Request<?, ?> request1 = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Request<?, ?> request2 = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 1L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
}
@Test
- public void testPoison() throws Exception {
+ public void testPoison() {
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
final long now = Ticker.systemTicker().read();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Test
- public void testInitialBehavior() throws Exception {
+ public void testInitialBehavior() {
final InternalCommand<BackendInfo> cmd = mock(InternalCommand.class);
when(cmd.execute(any())).thenReturn(initialBehavior);
mockedActor.tell(cmd, ActorRef.noSender());
}
@Test
- public void testCommandStashing() throws Exception {
+ public void testCommandStashing() {
system.stop(mockedActor);
mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
final InternalCommand<BackendInfo> cmd = mock(InternalCommand.class);
}
@Test
- public void testRecoveryAfterRestart() throws Exception {
+ public void testRecoveryAfterRestart() {
system.stop(mockedActor);
mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
final MockedSnapshotStore.SaveRequest newSaveRequest =
}
@Test
- public void testRecoveryAfterRestartFrontendIdMismatch() throws Exception {
+ public void testRecoveryAfterRestartFrontendIdMismatch() {
system.stop(mockedActor);
//start actor again
mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
}
@Test
- public void testRecoveryAfterRestartSaveSnapshotFail() throws Exception {
+ public void testRecoveryAfterRestartSaveSnapshotFail() {
system.stop(mockedActor);
mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
probe.watch(mockedActor);
}
@Test
- public void testRecoveryAfterRestartDeleteSnapshotsFail() throws Exception {
+ public void testRecoveryAfterRestartDeleteSnapshotsFail() {
system.stop(mockedActor);
mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
probe.watch(mockedActor);
}
@Test
- public void testExecuteInActor() throws Exception {
+ public void testExecuteInActor() {
ctx.executeInActor(command);
probe.expectMsg(command);
}
@Test
- public void testExecuteInActorScheduled() throws Exception {
+ public void testExecuteInActorScheduled() {
final FiniteDuration delay = Duration.apply(1, TimeUnit.SECONDS);
ctx.executeInActor(command, delay);
probe.expectMsg(command);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
}
extends AbstractClientConnectionTest<ConnectedClientConnection<BackendInfo>, BackendInfo> {
@Test
- public void testCheckTimeoutConnectionTimedout() throws Exception {
+ public void testCheckTimeoutConnectionTimedout() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
connection.sendRequest(createRequest(replyToProbe.ref()), callback);
final long now = context.ticker().read() + ConnectedClientConnection.DEFAULT_BACKEND_ALIVE_TIMEOUT_NANOS;
@Override
@Test
- public void testReconnectConnection() throws Exception {
+ public void testReconnectConnection() {
final ClientActorBehavior<BackendInfo> behavior = mock(ClientActorBehavior.class);
connection.lockedReconnect(behavior, mock(RequestException.class));
verify(behavior).reconnectConnection(same(connection), any(ReconnectingClientConnection.class));
}
@Test
- public void testRunTimeoutEmpty() throws NoProgressException {
+ public void testRunTimeoutEmpty() {
Optional<Long> ret = queue.checkTimeout(ticker.read());
assertNotNull(ret);
assertFalse(ret.isPresent());
}
@Test
- public void testRunTimeoutWithoutShift() throws NoProgressException {
+ public void testRunTimeoutWithoutShift() {
queue.sendRequest(mockRequest, mockCallback);
Optional<Long> ret = queue.checkTimeout(ticker.read());
assertNotNull(ret);
}
@Test
- public void testRunTimeoutWithTimeoutLess() throws NoProgressException {
+ public void testRunTimeoutWithTimeoutLess() {
queue.sendRequest(mockRequest, mockCallback);
ticker.advance(AbstractClientConnection.DEFAULT_BACKEND_ALIVE_TIMEOUT_NANOS - 1);
}
@Test
- public void testRunTimeoutWithTimeoutExact() throws NoProgressException {
+ public void testRunTimeoutWithTimeoutExact() {
setupBackend();
queue.sendRequest(mockRequest, mockCallback);
}
@Test
- public void testRunTimeoutWithTimeoutMore() throws NoProgressException {
+ public void testRunTimeoutWithTimeoutMore() {
setupBackend();
queue.sendRequest(mockRequest, mockCallback);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- public void testRunTimeoutWithoutProgressExact() throws NoProgressException {
+ public void testRunTimeoutWithoutProgressExact() {
queue.sendRequest(mockRequest, mockCallback);
ticker.advance(AbstractClientConnection.DEFAULT_NO_PROGRESS_TIMEOUT_NANOS);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- public void testRunTimeoutWithoutProgressMore() throws NoProgressException {
+ public void testRunTimeoutWithoutProgressMore() {
queue.sendRequest(mockRequest, mockCallback);
ticker.advance(AbstractClientConnection.DEFAULT_NO_PROGRESS_TIMEOUT_NANOS + 1);
}
@Test
- public void testRunTimeoutEmptyWithoutProgressExact() throws NoProgressException {
+ public void testRunTimeoutEmptyWithoutProgressExact() {
ticker.advance(AbstractClientConnection.DEFAULT_NO_PROGRESS_TIMEOUT_NANOS);
// No problem
}
@Test
- public void testRunTimeoutEmptyWithoutProgressMore() throws NoProgressException {
+ public void testRunTimeoutEmptyWithoutProgressMore() {
ticker.advance(AbstractClientConnection.DEFAULT_NO_PROGRESS_TIMEOUT_NANOS + 1);
// No problem
}
@Test
- public void testProgressRecord() throws NoProgressException {
+ public void testProgressRecord() {
setupBackend();
queue.sendRequest(mockRequest, mockCallback);
@Test
@Override
- public void testCanTransmitCount() throws Exception {
+ public void testCanTransmitCount() {
Assert.assertFalse(queue.canTransmitCount(0) > 0);
}
@Test(expected = UnsupportedOperationException.class)
@Override
- public void testTransmit() throws Exception {
+ public void testTransmit() {
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
final long now = Ticker.systemTicker().read();
private ScheduledExecutorService executor;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
lock = new InversibleLock();
executor = Executors.newScheduledThreadPool(1);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
executor.shutdownNow();
}
@Test(timeout = 2000)
- public void testWriteLockUnlock() throws Exception {
+ public void testWriteLockUnlock() {
final long stamp = lock.writeLock();
Assert.assertTrue(lock.validate(stamp));
executor.schedule(() -> lock.unlockWrite(stamp), 500, TimeUnit.MILLISECONDS);
}
@Test
- public void testLockAfterRead() throws Exception {
+ public void testLockAfterRead() {
final long readStamp = lock.optimisticRead();
lock.writeLock();
Assert.assertFalse(lock.validate(readStamp));
final Promise<T> promise = new scala.concurrent.impl.Promise.DefaultPromise<>();
future.onComplete(new OnComplete<Object>() {
@Override
- public void onComplete(final Throwable failure, final Object success) throws Throwable {
+ public void onComplete(final Throwable failure, final Object success) {
if (success instanceof Throwable) {
promise.failure((Throwable) success);
return;
extends AbstractClientConnectionTest<ReconnectingClientConnection<BackendInfo>, BackendInfo> {
@Test
- public void testCheckTimeoutConnectionTimedout() throws Exception {
+ public void testCheckTimeoutConnectionTimedout() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
connection.sendRequest(createRequest(replyToProbe.ref()), callback);
final long now = context.ticker().read() + ConnectedClientConnection.DEFAULT_BACKEND_ALIVE_TIMEOUT_NANOS;
@Override
@Test
- public void testReconnectConnection() throws Exception {
+ public void testReconnectConnection() {
final ClientActorBehavior<BackendInfo> behavior = mock(ClientActorBehavior.class);
Assert.assertSame(behavior, connection.lockedReconnect(behavior, mock(RequestException.class)));
}
@Override
@Test
- public void testSendRequestReceiveResponse() throws Exception {
+ public void testSendRequestReceiveResponse() {
final Consumer<Response<?, ?>> callback = mock(Consumer.class);
final Request<?, ?> request = createRequest(replyToProbe.ref());
connection.sendRequest(request, callback);
}
@Test
- public void testComplete() throws Exception {
+ public void testComplete() {
final long sequence1 = 0L;
final long sequence2 = 1L;
final Request<?, ?> request1 = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, sequence1, probe.ref());
}
@Test
- public void testEnqueueCanTransmit() throws Exception {
+ public void testEnqueueCanTransmit() {
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
final long now = now();
}
@Test
- public void testEnqueueBackendFull() throws Exception {
+ public void testEnqueueBackendFull() {
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
final long now = now();
@Test
@Override
- public void testCanTransmitCount() throws Exception {
+ public void testCanTransmitCount() {
assertTrue(queue.canTransmitCount(getMaxInFlightMessages() - 1) > 0);
assertFalse(queue.canTransmitCount(getMaxInFlightMessages()) > 0);
}
@Test
@Override
- public void testTransmit() throws Exception {
+ public void testTransmit() {
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
final Consumer<Response<?, ?>> callback = createConsumerMock();
final long now = now();
}
@Test
- public void testSetForwarder() throws Exception {
+ public void testSetForwarder() {
final FakeTicker ticker = new FakeTicker();
ticker.setAutoIncrementStep(1, TimeUnit.MICROSECONDS);
final Request<?, ?> request = new TransactionPurgeRequest(TRANSACTION_IDENTIFIER, 0L, probe.ref());
}
@Test
- public void testRequestSlicingOnTransmit() throws Exception {
+ public void testRequestSlicingOnTransmit() {
doReturn(true).when(mockMessageSlicer).slice(any());
ModifyTransactionRequestBuilder reqBuilder = new ModifyTransactionRequestBuilder(
}
@Test
- public void testSlicingFailureOnTransmit() throws Exception {
+ public void testSlicingFailureOnTransmit() {
doAnswer(invocation -> {
invocation.getArgumentAt(0, SliceOptions.class).getOnFailureCallback().accept(new Exception("mock"));
return Boolean.FALSE;
}
@Test
- public void testSlicedRequestOnComplete() throws Exception {
+ public void testSlicedRequestOnComplete() {
doReturn(true).when(mockMessageSlicer).slice(any());
ModifyTransactionRequestBuilder reqBuilder = new ModifyTransactionRequestBuilder(
@Override
@SuppressWarnings("checkstyle:RegexpSingleLineJava")
- public Object execute() throws Exception {
+ public Object execute() {
for (TracingDOMDataBroker tracingDOMDataBroker : tracingDOMDataBrokers) {
tracingDOMDataBroker.printOpenTransactions(System.out);
}
EventSourceTopology eventSourceTopologyMock;
@BeforeClass
- public static void initTestClass() throws IllegalAccessException, InstantiationException {
+ public static void initTestClass() {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
EventSource eventSourceMock = mock(EventSource.class);
eventSourceTopologyMock = mock(EventSourceTopology.class);
eventSourceRegistrationImplLocal = new EventSourceRegistrationImplLocal(eventSourceMock,
EventSourceTopology eventSourceTopologyMock;
@BeforeClass
- public static void initTestClass() throws IllegalAccessException, InstantiationException {
+ public static void initTestClass() {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
final NotificationPattern notificationPattern = new NotificationPattern("value1");
eventSourceServiceMock = mock(EventSourceService.class);
doReturn(RpcResultBuilder.success(new JoinTopicOutputBuilder().setStatus(JoinTopicStatus.Up).build())
RpcRegistration<EventAggregatorService> aggregatorRpcReg;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
dataBrokerMock = mock(DataBroker.class);
rpcProviderRegistryMock = mock(RpcProviderRegistry.class);
}
TopicDOMNotification topicDOMNotification;
@BeforeClass
- public static void initTestClass() throws IllegalAccessException, InstantiationException {
+ public static void initTestClass() {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
containerNodeBodyMock = mock(ContainerNode.class);
doReturn(CONTAINER_NODE_BODY_MOCK_TO_STRING).when(containerNodeBodyMock).toString();
topicDOMNotification = new TopicDOMNotification(containerNodeBodyMock);
}
@Test
- public void testExpandQname() throws Exception {
+ public void testExpandQname() {
// match no path because the list of the allowed paths is empty
{
final List<SchemaPath> paths = new ArrayList<>();
return Props.create(ClientActor.class, target);
}
- @Override public void onReceive(Object message) throws Exception {
+ @Override public void onReceive(Object message) {
if (message instanceof KeyValue) {
target.tell(message, getSelf());
} else if (message instanceof KeyValueSaved) {
}
@Override
- protected void handleReceive(Object message) throws Exception {
+ protected void handleReceive(Object message) {
if (message instanceof RegisterListener) {
// called by the scheduler at intervals to register any unregistered notifiers
sendRegistrationRequests();
@Override
- public void close() throws Exception {
+ public void close() {
registrationSchedule.cancel();
}
}
import akka.actor.ActorRef;
import com.google.common.io.ByteSource;
-import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;
import org.opendaylight.controller.cluster.raft.persisted.EmptyState;
}
@Override
- public State deserializeSnapshot(ByteSource snapshotBytes) throws IOException {
+ public State deserializeSnapshot(ByteSource snapshotBytes) {
return EmptyState.INSTANCE;
}
}
import com.google.common.base.Preconditions;
import java.io.Externalizable;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
}
protected Object readResolve() {
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) throws IOException {
long term = in.readLong();
boolean voteGranted = in.readBoolean();
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
applyEntries = new ApplyJournalEntries(in.readLong());
}
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
deleteEntries = new DeleteEntries(in.readLong());
}
}
protected void verifySnapshot(final String prefix, final Snapshot snapshot, final long lastAppliedTerm,
- final long lastAppliedIndex, final long lastTerm, final long lastIndex)
- throws Exception {
+ final long lastAppliedIndex, final long lastTerm, final long lastIndex) {
assertEquals(prefix + " Snapshot getLastAppliedTerm", lastAppliedTerm, snapshot.getLastAppliedTerm());
assertEquals(prefix + " Snapshot getLastAppliedIndex", lastAppliedIndex, snapshot.getLastAppliedIndex());
assertEquals(prefix + " Snapshot getLastTerm", lastTerm, snapshot.getLastTerm());
* appropriately.
*/
@Test
- public void testLeaderIsolationWithAllPriorEntriesCommitted() throws Exception {
+ public void testLeaderIsolationWithAllPriorEntriesCommitted() {
testLog.info("testLeaderIsolationWithAllPriorEntriesCommitted starting");
createRaftActors();
* sides should reconcile their logs appropriately.
*/
@Test
- public void testLeaderIsolationWithPriorUncommittedEntryAndOneConflictingEntry() throws Exception {
+ public void testLeaderIsolationWithPriorUncommittedEntryAndOneConflictingEntry() {
testLog.info("testLeaderIsolationWithPriorUncommittedEntryAndOneConflictingEntry starting");
createRaftActors();
* and both sides should reconcile their logs appropriately.
*/
@Test
- public void testLeaderIsolationWithPriorUncommittedEntryAndMultipleConflictingEntries() throws Exception {
+ public void testLeaderIsolationWithPriorUncommittedEntryAndMultipleConflictingEntries() {
testLog.info("testLeaderIsolationWithPriorUncommittedEntryAndMultipleConflictingEntries starting");
createRaftActors();
}
@Test
- public void testRequestLeadershipTransferToFollower2WithOtherFollowersDown() throws Exception {
+ public void testRequestLeadershipTransferToFollower2WithOtherFollowersDown() {
testLog.info("testRequestLeadershipTransferToFollower2WithOtherFollowersDown starting");
createRaftActors();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
factory.close();
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
private DefaultConfigParamsImpl followerConfigParams;
@Test
- public void testUnComittedEntryOnLeaderChange() throws Exception {
+ public void testUnComittedEntryOnLeaderChange() {
testLog.info("testUnComittedEntryOnLeaderChange starting");
createRaftActors();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
actorFactory.close();
}
@Test
- public void testAddServerWithExistingFollower() throws Exception {
+ public void testAddServerWithExistingFollower() {
LOG.info("testAddServerWithExistingFollower starting");
setupNewFollower();
RaftActorContextImpl followerActorContext = newFollowerContext(FOLLOWER_ID, followerActor);
}
@Test
- public void testAddServerWithNoExistingFollower() throws Exception {
+ public void testAddServerWithNoExistingFollower() {
LOG.info("testAddServerWithNoExistingFollower starting");
setupNewFollower();
}
@Test
- public void testAddServersAsNonVoting() throws Exception {
+ public void testAddServersAsNonVoting() {
LOG.info("testAddServersAsNonVoting starting");
setupNewFollower();
}
@Test
- public void testAddServerWithOperationInProgress() throws Exception {
+ public void testAddServerWithOperationInProgress() {
LOG.info("testAddServerWithOperationInProgress starting");
setupNewFollower();
}
@Test
- public void testAddServerWithPriorSnapshotInProgress() throws Exception {
+ public void testAddServerWithPriorSnapshotInProgress() {
LOG.info("testAddServerWithPriorSnapshotInProgress starting");
setupNewFollower();
}
@Test
- public void testAddServerWithPriorSnapshotCompleteTimeout() throws Exception {
+ public void testAddServerWithPriorSnapshotCompleteTimeout() {
LOG.info("testAddServerWithPriorSnapshotCompleteTimeout starting");
setupNewFollower();
}
@Test
- public void testAddServerWithLeaderChangeBeforePriorSnapshotComplete() throws Exception {
+ public void testAddServerWithLeaderChangeBeforePriorSnapshotComplete() {
LOG.info("testAddServerWithLeaderChangeBeforePriorSnapshotComplete starting");
setupNewFollower();
}
@Test
- public void testAddServerWithLeaderChangeDuringInstallSnapshot() throws Exception {
+ public void testAddServerWithLeaderChangeDuringInstallSnapshot() {
LOG.info("testAddServerWithLeaderChangeDuringInstallSnapshot starting");
setupNewFollower();
}
@Test
- public void testAddServerWithInstallSnapshotTimeout() throws Exception {
+ public void testAddServerWithInstallSnapshotTimeout() {
LOG.info("testAddServerWithInstallSnapshotTimeout starting");
setupNewFollower();
}
@Test
- public void testRemoveServer() throws Exception {
+ public void testRemoveServer() {
LOG.info("testRemoveServer starting");
DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
factory.close();
InMemoryJournal.clear();
InMemorySnapshotStore.clear();
@Test
- public void testRaftActorRecoveryWithPersistenceEnabled() throws Exception {
+ public void testRaftActorRecoveryWithPersistenceEnabled() {
TEST_LOG.info("testRaftActorRecoveryWithPersistenceEnabled starting");
TestKit kit = new TestKit(getSystem());
}
@Test
- public void testRaftActorRecoveryWithPersistenceDisabled() throws Exception {
+ public void testRaftActorRecoveryWithPersistenceDisabled() {
String persistenceId = factory.generateActorId("follower-");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
}
@Test
- public void testUpdateElectionTermPersistedWithPersistenceDisabled() throws Exception {
+ public void testUpdateElectionTermPersistedWithPersistenceDisabled() {
final TestKit kit = new TestKit(getSystem());
String persistenceId = factory.generateActorId("follower-");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
}
@Test
- public void testApplyState() throws Exception {
+ public void testApplyState() {
String persistenceId = factory.generateActorId("leader-");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
}
@Test
- public void testUpdateConfigParam() throws Exception {
+ public void testUpdateConfigParam() {
DefaultConfigParamsImpl emptyConfig = new DefaultConfigParamsImpl();
String persistenceId = factory.generateActorId("follower-");
ImmutableMap<String, String> peerAddresses =
}
@Test
- public void testGetSnapshot() throws Exception {
+ public void testGetSnapshot() {
TEST_LOG.info("testGetSnapshot starting");
final TestKit kit = new TestKit(getSystem());
}
@Test
- public void testRestoreFromSnapshot() throws Exception {
+ public void testRestoreFromSnapshot() {
TEST_LOG.info("testRestoreFromSnapshot starting");
String persistenceId = factory.generateActorId("test-actor-");
}
@Test
- public void testNonVotingOnRecovery() throws Exception {
+ public void testNonVotingOnRecovery() {
TEST_LOG.info("testNonVotingOnRecovery starting");
DefaultConfigParamsImpl config = new DefaultConfigParamsImpl();
}
@Test
- public void testLeaderTransitioning() throws Exception {
+ public void testLeaderTransitioning() {
TEST_LOG.info("testLeaderTransitioning starting");
ActorRef notifierActor = factory.createActor(MessageCollectorActor.props());
@Test
- public void testJournalReplayAfterSnapshotWithSingleNode() throws Exception {
+ public void testJournalReplayAfterSnapshotWithSingleNode() {
String persistenceId = factory.generateActorId("singleNode");
TestActorRef<AbstractRaftActorIntegrationTest.TestRaftActor> singleNodeActorRef =
}
@Test
- public void testFollowerRecoveryAfterInstallSnapshot() throws Exception {
+ public void testFollowerRecoveryAfterInstallSnapshot() {
send2InitialPayloads();
private MockPayload payload7;
@Test
- public void runTest() throws Exception {
+ public void runTest() {
testLog.info("testReplicationAndSnapshots starting");
// Setup the persistent journal for the leader. We'll start up with 3 journal log entries (one less
* scenario, the follower consensus and application of state is delayed until after the snapshot
* completes.
*/
- private void testFirstSnapshot() throws Exception {
+ private void testFirstSnapshot() {
testLog.info("testFirstSnapshot starting");
expSnapshotState.add(recoveredPayload0);
* Send one more payload to trigger another snapshot. In this scenario, we delay the snapshot until
* consensus occurs and the leader applies the state.
*/
- private void testSecondSnapshot() throws Exception {
+ private void testSecondSnapshot() {
testLog.info("testSecondSnapshot starting");
expSnapshotState.add(payload3);
* caught up via AppendEntries.
*/
@Test
- public void testReplicationsWithLaggingFollowerCaughtUpViaAppendEntries() throws Exception {
+ public void testReplicationsWithLaggingFollowerCaughtUpViaAppendEntries() {
testLog.info("testReplicationsWithLaggingFollowerCaughtUpViaAppendEntries starting: sending 2 new payloads");
setup();
* sent by the leader.
*/
@Test
- public void testLeaderSnapshotWithLaggingFollowerCaughtUpViaAppendEntries() throws Exception {
+ public void testLeaderSnapshotWithLaggingFollowerCaughtUpViaAppendEntries() {
testLog.info("testLeaderSnapshotWithLaggingFollowerCaughtUpViaAppendEntries starting");
setup();
* installed by the leader.
*/
@Test
- public void testLeaderSnapshotWithLaggingFollowerCaughtUpViaInstallSnapshot() throws Exception {
+ public void testLeaderSnapshotWithLaggingFollowerCaughtUpViaInstallSnapshot() {
testLog.info("testLeaderSnapshotWithLaggingFollowerCaughtUpViaInstallSnapshot starting");
setup();
* by the leader.
*/
@Test
- public void testLeaderSnapshotTriggeredByMemoryThresholdExceededWithLaggingFollower() throws Exception {
+ public void testLeaderSnapshotTriggeredByMemoryThresholdExceededWithLaggingFollower() {
testLog.info("testLeaderSnapshotTriggeredByMemoryThresholdExceededWithLaggingFollower starting");
snapshotBatchCount = 5;
* Send another payload to verify another snapshot is not done since the last snapshot trimmed the
* first log entry so the memory threshold should not be exceeded.
*/
- private void verifyNoSubsequentSnapshotAfterMemoryThresholdExceededSnapshot() throws Exception {
+ private void verifyNoSubsequentSnapshotAfterMemoryThresholdExceededSnapshot() {
ApplyState applyState;
CaptureSnapshot captureSnapshot;
* Resume the lagging follower 2 and verify it receives an install snapshot from the leader.
*/
private void verifyInstallSnapshotToLaggingFollower(long lastAppliedIndex,
- @Nullable ServerConfigurationPayload expServerConfig) throws Exception {
+ @Nullable ServerConfigurationPayload expServerConfig) {
testLog.info("verifyInstallSnapshotToLaggingFollower starting");
MessageCollectorActor.clearMessages(leaderCollectorActor);
* Do another round of payloads and snapshot to verify replicatedToAllIndex gets back on track and
* snapshots works as expected after doing a follower snapshot. In this step we don't lag a follower.
*/
- private long verifyReplicationsAndSnapshotWithNoLaggingAfterInstallSnapshot() throws Exception {
+ private long verifyReplicationsAndSnapshotWithNoLaggingAfterInstallSnapshot() {
testLog.info(
"verifyReplicationsAndSnapshotWithNoLaggingAfterInstallSnapshot starting: replicatedToAllIndex: {}",
leader.getReplicatedToAllIndex());
public class ReplicationWithSlicedPayloadIntegrationTest extends AbstractRaftActorIntegrationTest {
@Test
- public void runTest() throws Exception {
+ public void runTest() {
testLog.info("ReplicationWithSlicedPayloadIntegrationTest starting");
// Create the leader and 2 follower actors.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
- public void testCaptureToInstall() throws Exception {
+ public void testCaptureToInstall() {
// Force capturing toInstall = true
snapshotManager.captureToInstall(new SimpleReplicatedLogEntry(0, 1,
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
- public void testCapture() throws Exception {
+ public void testCapture() {
boolean capture = snapshotManager.capture(new SimpleReplicatedLogEntry(9, 1,
new MockRaftActorContext.MockPayload()), 9);
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
- public void testCaptureWithNullLastLogEntry() throws Exception {
+ public void testCaptureWithNullLastLogEntry() {
boolean capture = snapshotManager.capture(null, 1);
assertTrue(capture);
}
@Test
- public void testCaptureWithCreateProcedureError() throws Exception {
+ public void testCaptureWithCreateProcedureError() {
doThrow(new RuntimeException("mock")).when(mockProcedure).accept(anyObject());
boolean capture = snapshotManager.capture(new SimpleReplicatedLogEntry(9, 1,
@SuppressWarnings("unchecked")
@Test
- public void testIllegalCapture() throws Exception {
+ public void testIllegalCapture() {
boolean capture = snapshotManager.capture(new SimpleReplicatedLogEntry(9, 1,
new MockRaftActorContext.MockPayload()), 9);
}
@Test
- public void testPersistWhenReplicatedToAllIndexMinusOne() throws Exception {
+ public void testPersistWhenReplicatedToAllIndexMinusOne() {
doReturn(7L).when(mockReplicatedLog).getSnapshotIndex();
doReturn(1L).when(mockReplicatedLog).getSnapshotTerm();
}
@Test
- public void testPersistWhenReplicatedToAllIndexNotMinus() throws Exception {
+ public void testPersistWhenReplicatedToAllIndexNotMinus() {
doReturn(45L).when(mockReplicatedLog).getSnapshotIndex();
doReturn(6L).when(mockReplicatedLog).getSnapshotTerm();
ReplicatedLogEntry replicatedLogEntry = mock(ReplicatedLogEntry.class);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
* that regardless of whether followers respond or not we schedule heartbeats.
*/
@Test
- public void testLeaderSchedulesHeartbeatsEvenWhenNoFollowersRespondToInitialAppendEntries() throws Exception {
+ public void testLeaderSchedulesHeartbeatsEvenWhenNoFollowersRespondToInitialAppendEntries() {
logStart("testLeaderSchedulesHeartbeatsEvenWhenNoFollowersRespondToInitialAppendEntries");
String leaderActorId = actorFactory.generateActorId("leader");
import static org.junit.Assert.assertEquals;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import org.apache.commons.lang.SerializationUtils;
import org.junit.Test;
public class FollowerIdentifierTest {
@Test
- public void testSerialization() throws FileNotFoundException, IOException {
+ public void testSerialization() {
FollowerIdentifier expected = new FollowerIdentifier("follower1");
FollowerIdentifier cloned = (FollowerIdentifier) SerializationUtils.clone(expected);
assertEquals("cloned", expected, cloned);
}
@Test
- public void testHandleMessageWithThreeMembers() throws Exception {
+ public void testHandleMessageWithThreeMembers() {
String followerAddress1 = "akka://test/user/$a";
String followerAddress2 = "akka://test/user/$b";
}
@Test
- public void testHandleMessageWithFiveMembers() throws Exception {
+ public void testHandleMessageWithFiveMembers() {
String followerAddress1 = "akka://test/user/$a";
String followerAddress2 = "akka://test/user/$b";
String followerAddress3 = "akka://test/user/$c";
}
@Test
- public void testHandleMessageFromAnotherLeader() throws Exception {
+ public void testHandleMessageFromAnotherLeader() {
String followerAddress1 = "akka://test/user/$a";
String followerAddress2 = "akka://test/user/$b";
}
@Test
- public void testHandleMessageForUnknownMessage() throws Exception {
+ public void testHandleMessageForUnknownMessage() {
logStart("testHandleMessageForUnknownMessage");
leader = new Leader(createActorContext());
}
@Test
- public void testThatLeaderSendsAHeartbeatMessageToAllFollowers() throws Exception {
+ public void testThatLeaderSendsAHeartbeatMessageToAllFollowers() {
logStart("testThatLeaderSendsAHeartbeatMessageToAllFollowers");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testHandleReplicateMessageSendAppendEntriesToFollower() throws Exception {
+ public void testHandleReplicateMessageSendAppendEntriesToFollower() {
logStart("testHandleReplicateMessageSendAppendEntriesToFollower");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testHandleReplicateMessageWithHigherTermThanPreviousEntry() throws Exception {
+ public void testHandleReplicateMessageWithHigherTermThanPreviousEntry() {
logStart("testHandleReplicateMessageWithHigherTermThanPreviousEntry");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testHandleReplicateMessageCommitIndexIncrementedBeforeConsensus() throws Exception {
+ public void testHandleReplicateMessageCommitIndexIncrementedBeforeConsensus() {
logStart("testHandleReplicateMessageCommitIndexIncrementedBeforeConsensus");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testMultipleReplicateShouldNotCauseDuplicateAppendEntriesToBeSent() throws Exception {
+ public void testMultipleReplicateShouldNotCauseDuplicateAppendEntriesToBeSent() {
logStart("testHandleReplicateMessageSendAppendEntriesToFollower");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testMultipleReplicateWithReplyShouldResultInAppendEntries() throws Exception {
+ public void testMultipleReplicateWithReplyShouldResultInAppendEntries() {
logStart("testMultipleReplicateWithReplyShouldResultInAppendEntries");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testDuplicateAppendEntriesWillBeSentOnHeartBeat() throws Exception {
+ public void testDuplicateAppendEntriesWillBeSentOnHeartBeat() {
logStart("testDuplicateAppendEntriesWillBeSentOnHeartBeat");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testHeartbeatsAreAlwaysSentIfTheHeartbeatIntervalHasElapsed() throws Exception {
+ public void testHeartbeatsAreAlwaysSentIfTheHeartbeatIntervalHasElapsed() {
logStart("testHeartbeatsAreAlwaysSentIfTheHeartbeatIntervalHasElapsed");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testSendingReplicateImmediatelyAfterHeartbeatDoesReplicate() throws Exception {
+ public void testSendingReplicateImmediatelyAfterHeartbeatDoesReplicate() {
logStart("testSendingReplicateImmediatelyAfterHeartbeatDoesReplicate");
MockRaftActorContext actorContext = createActorContextWithFollower();
@Test
- public void testHandleReplicateMessageWhenThereAreNoFollowers() throws Exception {
+ public void testHandleReplicateMessageWhenThereAreNoFollowers() {
logStart("testHandleReplicateMessageWhenThereAreNoFollowers");
MockRaftActorContext actorContext = createActorContext();
}
@Test
- public void testSendAppendEntriesSnapshotScenario() throws Exception {
+ public void testSendAppendEntriesSnapshotScenario() {
logStart("testSendAppendEntriesSnapshotScenario");
final MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testInitiateInstallSnapshot() throws Exception {
+ public void testInitiateInstallSnapshot() {
logStart("testInitiateInstallSnapshot");
MockRaftActorContext actorContext = createActorContextWithFollower();
@Test
- public void testInstallSnapshot() throws Exception {
+ public void testInstallSnapshot() {
logStart("testInstallSnapshot");
final MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testForceInstallSnapshot() throws Exception {
+ public void testForceInstallSnapshot() {
logStart("testForceInstallSnapshot");
final MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testSendSnapshotfromInstallSnapshotReply() throws Exception {
+ public void testSendSnapshotfromInstallSnapshotReply() {
logStart("testSendSnapshotfromInstallSnapshotReply");
MockRaftActorContext actorContext = createActorContextWithFollower();
@Test
- public void testHandleInstallSnapshotReplyWithInvalidChunkIndex() throws Exception {
+ public void testHandleInstallSnapshotReplyWithInvalidChunkIndex() {
logStart("testHandleInstallSnapshotReplyWithInvalidChunkIndex");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testHandleSnapshotSendsPreviousChunksHashCodeWhenSendingNextChunk() throws Exception {
+ public void testHandleSnapshotSendsPreviousChunksHashCodeWhenSendingNextChunk() {
logStart("testHandleSnapshotSendsPreviousChunksHashCodeWhenSendingNextChunk");
MockRaftActorContext actorContext = createActorContextWithFollower();
}
@Test
- public void testLeaderCreatedWithCommitIndexLessThanLastIndex() throws Exception {
+ public void testLeaderCreatedWithCommitIndexLessThanLastIndex() {
logStart("testLeaderCreatedWithCommitIndexLessThanLastIndex");
final MockRaftActorContext leaderActorContext = createActorContextWithFollower();
}
@Test
- public void testLeaderCreatedWithCommitIndexLessThanFollowersCommitIndex() throws Exception {
+ public void testLeaderCreatedWithCommitIndexLessThanFollowersCommitIndex() {
logStart("testLeaderCreatedWithCommitIndexLessThanFollowersCommitIndex");
final MockRaftActorContext leaderActorContext = createActorContext();
}
@Test
- public void testHandleAppendEntriesReplySuccess() throws Exception {
+ public void testHandleAppendEntriesReplySuccess() {
logStart("testHandleAppendEntriesReplySuccess");
MockRaftActorContext leaderActorContext = createActorContextWithFollower();
}
@Test
- public void testIsolatedLeaderCheckTwoFollowers() throws Exception {
+ public void testIsolatedLeaderCheckTwoFollowers() {
logStart("testIsolatedLeaderCheckTwoFollowers");
RaftActorBehavior newBehavior = setupIsolatedLeaderCheckTestWithTwoFollowers(DefaultRaftPolicy.INSTANCE);
}
@Test
- public void testIsolatedLeaderCheckTwoFollowersWhenElectionsAreDisabled() throws Exception {
+ public void testIsolatedLeaderCheckTwoFollowersWhenElectionsAreDisabled() {
logStart("testIsolatedLeaderCheckTwoFollowersWhenElectionsAreDisabled");
RaftActorBehavior newBehavior = setupIsolatedLeaderCheckTestWithTwoFollowers(createRaftPolicy(false, true));
}
@Test
- public void testLaggingFollowerStarvation() throws Exception {
+ public void testLaggingFollowerStarvation() {
logStart("testLaggingFollowerStarvation");
String leaderActorId = actorFactory.generateActorId("leader");
* sends a heartbeat first when connectivity is re-established.
*/
@Test
- public void runTest1() throws Exception {
+ public void runTest1() {
testLog.info("PartitionedLeadersElectionScenarioTest 1 starting");
setupInitialMemberBehaviors();
* sends a heartbeat first when connectivity is re-established.
*/
@Test
- public void runTest2() throws Exception {
+ public void runTest2() {
testLog.info("PartitionedLeadersElectionScenarioTest 2 starting");
setupInitialMemberBehaviors();
testLog.info("sendInitialElectionTimeoutToFollowerMember3 ending");
}
- private void sendInitialElectionTimeoutToFollowerMember2() throws Exception {
+ private void sendInitialElectionTimeoutToFollowerMember2() {
testLog.info("sendInitialElectionTimeoutToFollowerMember2 starting");
// Send ElectionTimeout to member 2 to simulate no heartbeat from the Leader (member 1).
testLog.info("sendInitialElectionTimeoutToFollowerMember2 ending");
}
- private void setupInitialMemberBehaviors() throws Exception {
+ private void setupInitialMemberBehaviors() {
testLog.info("setupInitialMemberBehaviors starting");
// Create member 2's behavior initially as Follower
}
@Test
- public void testUpdate() throws Exception {
+ public void testUpdate() {
SyncStatusTracker tracker = new SyncStatusTracker(listener, "commit-tracker", 10);
// When leader-1 sends the first update message the listener should receive a syncStatus notification
import akka.actor.UntypedActor;
public class DoNothingActor extends UntypedActor {
- @Override public void onReceive(Object message) throws Exception {
+ @Override public void onReceive(Object message) {
}
}
public class EchoActor extends UntypedActor {
@Override
- public void onReceive(Object message) throws Exception {
+ public void onReceive(Object message) {
getSender().tell(message, getSelf());
}
}
@Override
- public final void start(BundleContext bundleContext) throws Exception {
+ public final void start(BundleContext bundleContext) {
this.context = bundleContext;
startImpl(bundleContext);
tracker = new ServiceTracker<>(bundleContext, BindingAwareBroker.class, customizer);
@Override
- public final void stop(BundleContext bundleContext) throws Exception {
+ public final void stop(BundleContext bundleContext) {
if (tracker != null) {
tracker.close();
}
.weakKeys().build(new CacheLoader<DOMMountPoint, BindingMountPointAdapter>() {
@Override
- public BindingMountPointAdapter load(DOMMountPoint key) throws Exception {
+ public BindingMountPointAdapter load(DOMMountPoint key) {
return new BindingMountPointAdapter(codec,key);
}
});
}
@Override
- public void close() throws Exception {
+ public void close() {
}
}
@Override
- public void close() throws Exception {
+ public void close() {
}
.build(new CacheLoader<Class<? extends RpcService>, RpcServiceAdapter>() {
@Override
- public RpcServiceAdapter load(final Class<? extends RpcService> key) throws Exception {
+ public RpcServiceAdapter load(final Class<? extends RpcService> key) {
return createProxy(key);
}
.weakKeys().build(new CacheLoader<Class<?>, ContextReferenceExtractor>() {
@Override
- public ContextReferenceExtractor load(final Class<?> key) throws Exception {
+ public ContextReferenceExtractor load(final Class<?> key) {
return create(key);
}
});
}
@Override
- public DOMRpcResult checkedGet() throws DOMRpcException {
+ public DOMRpcResult checkedGet() {
try {
return get();
} catch (InterruptedException | ExecutionException e) {
}
@Override
- public DOMRpcResult checkedGet(final long timeout, final TimeUnit unit) throws TimeoutException, DOMRpcException {
+ public DOMRpcResult checkedGet(final long timeout, final TimeUnit unit) throws TimeoutException {
try {
return get(timeout, unit);
} catch (InterruptedException | ExecutionException e) {
}
@Override
- public Object invoke(final Object proxyObj, final Method method, final Object[] args) throws Throwable {
+ public Object invoke(final Object proxyObj, final Method method, final Object[] args) {
final RpcInvocationStrategy rpc = rpcNames.get(method);
if (rpc != null) {
}
@Override
- public void close() throws Exception {
+ public void close() {
// FIXME: Close all sessions
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
- public void testDataTreeChangeListener() throws Exception {
+ public void testDataTreeChangeListener() {
DataBroker dataBroker = getDataBroker();
DataTreeChangeListener<ListItem> listener = mock(DataTreeChangeListener.class);
@SuppressWarnings("unchecked")
@Test
- public void testWildcardNotificationOfPreexistingData() throws Exception {
+ public void testWildcardNotificationOfPreexistingData() {
InstanceIdentifier<Top> id = InstanceIdentifier.builder(Top.class).build();
ArrayList<TopLevelList> list = new ArrayList<>();
list.add(new TopLevelListBuilder().setName("name").build());
}
@Override
- public void close() throws Exception {
+ public void close() {
}
}
@After
- public void teardown() throws Exception {
+ public void teardown() {
testContext.close();
}
* @throws java.lang.Exception
*/
@After
- public void teardown() throws Exception {
+ public void teardown() {
testContext.close();
}
}
}
@Override
- public void close() throws Exception {
+ public void close() {
registration.close();
}
}
@Override
- public final void close() throws Exception {
+ public final void close() {
alreadyRetrievedServices = null;
serviceProvider = null;
}
final scala.concurrent.Promise<Object> makeLeaderLocalAsk = akka.dispatch.Futures.promise();
localShardReply.onComplete(new OnComplete<ActorRef>() {
@Override
- public void onComplete(final Throwable failure, final ActorRef actorRef) throws Throwable {
+ public void onComplete(final Throwable failure, final ActorRef actorRef) {
if (failure != null) {
LOG.warn("No local shard found for {} datastoreType {} - Cannot request leadership transfer to"
+ " local shard.", shardName, failure);
final SettableFuture<RpcResult<MakeLeaderLocalOutput>> future = SettableFuture.create();
makeLeaderLocalAsk.future().onComplete(new OnComplete<Object>() {
@Override
- public void onComplete(final Throwable failure, final Object success) throws Throwable {
+ public void onComplete(final Throwable failure, final Object success) {
if (failure != null) {
LOG.error("Leadership transfer failed for shard {}.", shardName, failure);
future.set(RpcResultBuilder.<MakeLeaderLocalOutput>failed().withError(ErrorType.APPLICATION,
}
@Override
- public final void onReceive(final Object message) throws Exception {
+ public final void onReceive(final Object message) {
if (message instanceof ExecuteInSelfMessage) {
((ExecuteInSelfMessage) message).run();
} else {
* it should call {@link #ignoreMessage(Object)} or {@link #unknownMessage(Object)}.
*
* @param message the incoming message
- * @throws Exception on message failure
*/
- protected abstract void handleReceive(Object message) throws Exception;
+ protected abstract void handleReceive(Object message);
protected final void ignoreMessage(final Object message) {
LOG.debug("Ignoring unhandled message {}", message);
LOG.debug("Unhandled message {} ", message);
}
- protected void unknownMessage(final Object message) throws Exception {
+ protected void unknownMessage(final Object message) {
LOG.debug("Received unhandled message {}", message);
unhandled(message);
}
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import java.io.IOException;
import java.net.URI;
import java.util.LinkedList;
import java.util.List;
@SuppressWarnings("unchecked")
@Override
public void leafNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, Object value)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
@Override
public void startLeafSet(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.leafSetBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startOrderedLeafSet(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int str)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.orderedLeafSetBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@SuppressWarnings({ "unchecked" })
@Override
- public void leafSetEntryNode(QName name, Object value) throws IOException, IllegalArgumentException {
+ public void leafSetEntryNode(QName name, Object value) throws IllegalArgumentException {
checkNotSealed();
NormalizedNodeBuilderWrapper parent = stack.peek();
@Override
public void startContainerNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.containerBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startYangModeledAnyXmlNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
public void startUnkeyedList(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.unkeyedListBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startUnkeyedListItem(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalStateException {
+ throws IllegalStateException {
checkNotSealed();
addBuilder(Builders.unkeyedListEntryBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startMapNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.mapBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startMapEntryNode(YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates,
- int count) throws IOException, IllegalArgumentException {
+ int count) throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.mapEntryBuilder().withNodeIdentifier(nodeIdentifierWithPredicates),
@Override
public void startOrderedMapNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.orderedMapBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startChoiceNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, int count)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
addBuilder(Builders.choiceBuilder().withNodeIdentifier(nodeIdentifier), nodeIdentifier);
@Override
public void startAugmentationNode(YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
@SuppressWarnings("unchecked")
@Override
public void anyxmlNode(YangInstanceIdentifier.NodeIdentifier nodeIdentifier, Object value)
- throws IOException, IllegalArgumentException {
+ throws IllegalArgumentException {
checkNotSealed();
NormalizedNodeBuilderWrapper parent = stack.peek();
@SuppressWarnings("unchecked")
@Override
- public void endNode() throws IOException, IllegalStateException {
+ public void endNode() throws IllegalStateException {
checkNotSealed();
NormalizedNodeBuilderWrapper child = stack.pop();
}
@Override
- public void close() throws IOException {
+ public void close() {
sealed = true;
}
@Override
- public void flush() throws IOException {
+ public void flush() {
}
}
@Override
- public void close() throws Exception {
+ public void close() {
registeredListeners.clear();
}
}
private final ReentrantLock lock = new ReentrantLock();
@BeforeClass
- public static void setUp() throws Exception {
+ public static void setUp() {
config = new CommonConfig.Builder<>("testsystem").withConfigReader(ConfigFactory::load).build();
actorSystem = ActorSystem.create("testsystem", config.get());
}
@AfterClass
- public static void tearDown() throws Exception {
+ public static void tearDown() {
if (actorSystem != null) {
actorSystem.terminate();
actorSystem = null;
}
@Test
- public void shouldSendMsgToDeadLetterWhenQueueIsFull() throws InterruptedException {
+ public void shouldSendMsgToDeadLetterWhenQueueIsFull() {
final TestKit mockReceiver = new TestKit(actorSystem);
actorSystem.eventStream().subscribe(mockReceiver.testActor(), DeadLetter.class);
}
@Override
- public void onReceive(final Object message) throws Exception {
+ public void onReceive(final Object message) {
lock.lock();
try {
if ("ping".equals(message)) {
private ActorRef actor;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
actor = system.actorOf(QuarantinedMonitorActor.props(callback));
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import java.net.URISyntaxException;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
}
private void readObject(final ObjectInputStream stream)
- throws IOException, ClassNotFoundException, URISyntaxException {
+ throws IOException {
NormalizedNodeDataInput reader = NormalizedNodeInputOutput.newDataInput(stream);
this.input = reader.readNormalizedNode();
}
private static final QName CONTAINER_Q_NAME = QName.create("ns-1", "2017-03-17", "container1");
@Test
- public void testSerializeDeserializeNodes() throws Exception {
+ public void testSerializeDeserializeNodes() {
final NormalizedNode<?, ?> normalizedNode = createNormalizedNode();
final byte[] bytes = SerializationUtils.serializeNormalizedNode(normalizedNode);
Assert.assertEquals(normalizedNode, SerializationUtils.deserializeNormalizedNode(bytes));
}
@Test
- public void testSerializeDeserializePath() throws Exception {
+ public void testSerializeDeserializePath() {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final DataOutput out = new DataOutputStream(bos);
final YangInstanceIdentifier path = YangInstanceIdentifier.builder()
}
@Test
- public void testSerializeDeserializePathAndNode() throws Exception {
+ public void testSerializeDeserializePathAndNode() {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final DataOutput out = new DataOutputStream(bos);
final NormalizedNode<?, ?> node = createNormalizedNode();
protected InputStream mockInputStream;
@BeforeClass
- public static void setupClass() throws IOException {
+ public static void setupClass() {
ACTOR_SYSTEM = ActorSystem.create("test");
}
}
@Test
- public void testAssembledMessageStateExpiration() throws IOException {
+ public void testAssembledMessageStateExpiration() {
final int expiryDuration = 200;
try (MessageAssembler assembler = newMessageAssemblerBuilder("testAssembledMessageStateExpiration")
.expireStateAfterInactivity(expiryDuration, TimeUnit.MILLISECONDS).build()) {
private ActorRef notifier;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
system = ActorSystem.apply();
notifier = system.actorOf(RoleChangeNotifier.getProps(MEMBER_ID));
listeners = new ArrayList<>(LISTENER_COUNT);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Test
- public void testHandleReceiveRoleChange() throws Exception {
+ public void testHandleReceiveRoleChange() {
registerListeners();
final RoleChanged msg = new RoleChanged(MEMBER_ID, "old", "new");
notifier.tell(msg, ActorRef.noSender());
}
@Test
- public void testHandleReceiveLeaderStateChanged() throws Exception {
+ public void testHandleReceiveLeaderStateChanged() {
registerListeners();
final LeaderStateChanged msg = new LeaderStateChanged(MEMBER_ID, "leader", (short) 0);
notifier.tell(msg, ActorRef.noSender());
}
@Test
- public void testHandleReceiveRegistrationAfterRoleChange() throws Exception {
+ public void testHandleReceiveRegistrationAfterRoleChange() {
final RoleChanged roleChanged1 = new RoleChanged(MEMBER_ID, "old1", "new1");
final RoleChanged lastRoleChanged = new RoleChanged(MEMBER_ID, "old2", "new2");
notifier.tell(roleChanged1, ActorRef.noSender());
}
@Test
- public void testHandleReceiveRegistrationAfterLeaderStateChange() throws Exception {
+ public void testHandleReceiveRegistrationAfterLeaderStateChange() {
final LeaderStateChanged leaderStateChanged1 = new LeaderStateChanged(MEMBER_ID, "leader1", (short) 0);
final LeaderStateChanged lastLeaderStateChanged = new LeaderStateChanged(MEMBER_ID, "leader2", (short) 1);
notifier.tell(leaderStateChanged1, ActorRef.noSender());
}
@Test
- public void testDoLoadAsyncWithNoSnapshots() throws IOException {
+ public void testDoLoadAsyncWithNoSnapshots() {
TestKit probe = new TestKit(system);
snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
@Override
protected DataNormalizationOperation<?> fromLocalSchemaAndQName(final DataNodeContainer schema,
- final QName child) throws DataNormalizationException {
+ final QName child) {
final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
if (!potential.isPresent()) {
return null;
}
@Override
- public DataNormalizationOperation<?> getChild(final PathArgument child) throws DataNormalizationException {
+ public DataNormalizationOperation<?> getChild(final PathArgument child) {
return null;
}
@Override
- public DataNormalizationOperation<?> getChild(final QName child) throws DataNormalizationException {
+ public DataNormalizationOperation<?> getChild(final QName child) {
return null;
}
tree.removeTransactionChain(getIdentifier());
}
- private FrontendTransaction createTransaction(final TransactionRequest<?> request, final TransactionIdentifier id)
- throws RequestException {
+ private FrontendTransaction createTransaction(final TransactionRequest<?> request, final TransactionIdentifier id) {
if (request instanceof CommitLocalTransactionRequest) {
LOG.debug("{}: allocating new ready transaction {}", persistenceId(), id);
tree.getStats().incrementReadWriteTransactionCount();
return createOpenTransaction(id);
}
- abstract FrontendTransaction createOpenSnapshot(TransactionIdentifier id) throws RequestException;
+ abstract FrontendTransaction createOpenSnapshot(TransactionIdentifier id);
- abstract FrontendTransaction createOpenTransaction(TransactionIdentifier id) throws RequestException;
+ abstract FrontendTransaction createOpenTransaction(TransactionIdentifier id);
abstract FrontendTransaction createReadyTransaction(TransactionIdentifier id, DataTreeModification mod)
- throws RequestException;
+ ;
abstract ShardDataTreeCohort createFailedCohort(TransactionIdentifier id, DataTreeModification mod,
Exception failure);
new ModifyTransactionSuccess(request.getTarget(), request.getSequence())));
}
- private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request)
- throws RequestException {
+ private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request) {
final Optional<NormalizedNode<?, ?>> data = openTransaction.getSnapshot().readNode(request.getPath());
return recordSuccess(request.getSequence(), new ExistsTransactionSuccess(openTransaction.getIdentifier(),
request.getSequence(), data.isPresent()));
}
- private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request)
- throws RequestException {
+ private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request) {
final Optional<NormalizedNode<?, ?>> data = openTransaction.getSnapshot().readNode(request.getPath());
return recordSuccess(request.getSequence(), new ReadTransactionSuccess(openTransaction.getIdentifier(),
request.getSequence(), data));
}
}
- private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request)
- throws RequestException {
+ private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request) {
final Optional<NormalizedNode<?, ?>> data = checkOpen().getSnapshot().readNode(request.getPath());
return recordSuccess(request.getSequence(), new ExistsTransactionSuccess(getIdentifier(), request.getSequence(),
data.isPresent()));
}
- private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request)
- throws RequestException {
+ private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request) {
final Optional<NormalizedNode<?, ?>> data = checkOpen().getSnapshot().readNode(request.getPath());
return recordSuccess(request.getSequence(), new ReadTransactionSuccess(getIdentifier(), request.getSequence(),
data));
}
private LocalHistorySuccess handleDestroyHistory(final DestroyLocalHistoryRequest request,
- final RequestEnvelope envelope, final long now)
- throws RequestException {
+ final RequestEnvelope envelope, final long now) {
final LocalHistoryIdentifier id = request.getTarget();
final LocalFrontendHistory existing = localHistories.get(id);
if (existing == null) {
}
private LocalHistorySuccess handlePurgeHistory(final PurgeLocalHistoryRequest request,
- final RequestEnvelope envelope, final long now) throws RequestException {
+ final RequestEnvelope envelope, final long now) {
final LocalHistoryIdentifier id = request.getTarget();
final LocalFrontendHistory existing = localHistories.remove(id);
if (existing == null) {
import java.util.Optional;
import java.util.SortedSet;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
-import org.opendaylight.controller.cluster.access.concepts.RequestException;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
}
@Override
- FrontendTransaction createOpenSnapshot(final TransactionIdentifier id) throws RequestException {
+ FrontendTransaction createOpenSnapshot(final TransactionIdentifier id) {
return FrontendReadOnlyTransaction.create(this, chain.newReadOnlyTransaction(id));
}
@Override
- FrontendTransaction createOpenTransaction(final TransactionIdentifier id) throws RequestException {
+ FrontendTransaction createOpenTransaction(final TransactionIdentifier id) {
return FrontendReadWriteTransaction.createOpen(this, chain.newReadWriteTransaction(id));
}
@Override
- FrontendTransaction createReadyTransaction(final TransactionIdentifier id, final DataTreeModification mod)
- throws RequestException {
+ FrontendTransaction createReadyTransaction(final TransactionIdentifier id, final DataTreeModification mod) {
return FrontendReadWriteTransaction.createReady(this, id, mod);
}
transaction.getIdentifier());
ret.onComplete(new OnComplete<ActorSelection>() {
@Override
- public void onComplete(final Throwable failure, final ActorSelection success) throws Throwable {
+ public void onComplete(final Throwable failure, final ActorSelection success) {
if (failure != null) {
LOG.info("Failed to prepare transaction {} on backend", transaction.getIdentifier(), failure);
transactionAborted(transaction);
final Future<Object> messageFuture = initiateCommit(true, Optional.empty());
messageFuture.onComplete(new OnComplete<Object>() {
@Override
- public void onComplete(final Throwable failure, final Object message) throws Throwable {
+ public void onComplete(final Throwable failure, final Object message) {
if (failure != null) {
LOG.error("Failed to prepare transaction {} on backend", transaction.getIdentifier(), failure);
transactionAborted(transaction);
}
@SuppressWarnings("checkstyle:IllegalCatch")
- private void applyRecoveryCandidate(final DataTreeCandidate candidate) throws DataValidationFailedException {
+ private void applyRecoveryCandidate(final DataTreeCandidate candidate) {
final PruningDataTreeModification mod = wrapWithPruning(dataTree.takeSnapshot().newModification());
DataTreeCandidates.applyToModification(mod, candidate);
mod.ready();
* @throws IOException when the snapshot fails to deserialize
* @throws DataValidationFailedException when the snapshot fails to apply
*/
- void applyRecoveryPayload(@Nonnull final Payload payload) throws IOException, DataValidationFailedException {
+ void applyRecoveryPayload(@Nonnull final Payload payload) throws IOException {
if (payload instanceof CommitTransactionPayload) {
final Entry<TransactionIdentifier, DataTreeCandidate> e =
((CommitTransactionPayload) payload).getCandidate();
}
@Override
- public ShardTransaction create() throws Exception {
+ public ShardTransaction create() {
final ShardTransaction tx;
switch (type) {
case READ_ONLY:
import java.util.SortedSet;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
-import org.opendaylight.controller.cluster.access.concepts.RequestException;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
}
@Override
- FrontendTransaction createOpenSnapshot(final TransactionIdentifier id) throws RequestException {
+ FrontendTransaction createOpenSnapshot(final TransactionIdentifier id) {
return FrontendReadOnlyTransaction.create(this, tree.newReadOnlyTransaction(id));
}
@Override
- FrontendTransaction createOpenTransaction(final TransactionIdentifier id) throws RequestException {
+ FrontendTransaction createOpenTransaction(final TransactionIdentifier id) {
return FrontendReadWriteTransaction.createOpen(this, tree.newReadWriteTransaction(id));
}
@Override
- FrontendTransaction createReadyTransaction(final TransactionIdentifier id, final DataTreeModification mod)
- throws RequestException {
+ FrontendTransaction createReadyTransaction(final TransactionIdentifier id, final DataTreeModification mod) {
return FrontendReadWriteTransaction.createReady(this, id, mod);
}
}
@Override
- public void onReceive(Object message) throws Exception {
+ public void onReceive(Object message) {
if (message instanceof Terminated) {
Terminated terminated = (Terminated) message;
LOG.debug("Actor terminated : {}", terminated.actor());
combinedFuture.onComplete(new OnComplete<Iterable<Object>>() {
@Override
- public void onComplete(final Throwable failure, final Iterable<Object> responses) throws Throwable {
+ public void onComplete(final Throwable failure, final Iterable<Object> responses) {
Throwable exceptionToPropagate = failure;
if (exceptionToPropagate == null) {
for (Object response: responses) {
private Cancellable killSchedule;
@Override
- protected void handleReceive(Object message) throws Exception {
+ protected void handleReceive(Object message) {
if (message instanceof CloseDataTreeNotificationListenerRegistration) {
closeListenerRegistration();
if (isValidSender(getSender())) {
}
@Override
- protected void handleReceive(final Object message) throws Exception {
+ protected void handleReceive(final Object message) {
if (message instanceof SerializeSnapshot) {
onSerializeSnapshot((SerializeSnapshot) message);
} else {
}
final String[] strategyClassAndDelay = ((String) properties.get(key)).split(",");
- final Class<? extends EntityOwnerSelectionStrategy> aClass;
- try {
- aClass = loadClass(strategyClassAndDelay[0]);
- } catch (final ClassNotFoundException e) {
- LOG.error("Failed to load class {}, ignoring it", strategyClassAndDelay[0], e);
- continue;
- }
+ final Class<? extends EntityOwnerSelectionStrategy> aClass = loadClass(strategyClassAndDelay[0]);
final long delay;
if (strategyClassAndDelay.length > 1) {
}
@SuppressWarnings("unchecked")
- private static Class<? extends EntityOwnerSelectionStrategy> loadClass(final String strategyClassAndDelay)
- throws ClassNotFoundException {
+ private static Class<? extends EntityOwnerSelectionStrategy> loadClass(final String strategyClassAndDelay) {
final Class<?> clazz;
try {
clazz = EntityOwnerSelectionStrategyConfigReader.class.getClassLoader().loadClass(strategyClassAndDelay);
*/
package org.opendaylight.controller.cluster.datastore.messages;
-import java.io.ObjectStreamException;
import java.io.Serializable;
public final class CloseDataTreeNotificationListenerRegistration implements Serializable {
return INSTANCE;
}
- private Object readResolve() throws ObjectStreamException {
+ private Object readResolve() {
return INSTANCE;
}
}
*/
package org.opendaylight.controller.cluster.datastore.messages;
-import java.io.ObjectStreamException;
import java.io.Serializable;
public final class CloseDataTreeNotificationListenerRegistrationReply implements Serializable {
return INSTANCE;
}
- private Object readResolve() throws ObjectStreamException {
+ private Object readResolve() {
return INSTANCE;
}
}
*/
package org.opendaylight.controller.cluster.datastore.messages;
-import java.io.ObjectStreamException;
import java.io.Serializable;
public final class DataTreeChangedReply implements Serializable {
return INSTANCE;
}
- private Object readResolve() throws ObjectStreamException {
+ private Object readResolve() {
return INSTANCE;
}
}
package org.opendaylight.controller.cluster.datastore.messages;
import java.io.Externalizable;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
public class EmptyExternalizable implements Externalizable {
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
}
}
package org.opendaylight.controller.cluster.datastore.modification;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
setPath(SerializationUtils.deserializePath(in));
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
SerializationUtils.serializePath(getPath(), out);
}
- public static DeleteModification fromStream(ObjectInput in, short version)
- throws ClassNotFoundException, IOException {
+ public static DeleteModification fromStream(ObjectInput in, short version) {
DeleteModification mod = new DeleteModification(version);
mod.readExternal(in);
return mod;
package org.opendaylight.controller.cluster.datastore.modification;
-import java.io.IOException;
import java.io.ObjectInput;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
return MERGE;
}
- public static MergeModification fromStream(ObjectInput in, short version)
- throws ClassNotFoundException, IOException {
+ public static MergeModification fromStream(ObjectInput in, short version) {
MergeModification mod = new MergeModification(version);
mod.readExternal(in);
return mod;
package org.opendaylight.controller.cluster.datastore.modification;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
SerializationUtils.deserializePathAndNode(in, this, APPLIER);
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
SerializationUtils.serializePathAndNode(getPath(), data, out);
}
- public static WriteModification fromStream(ObjectInput in, short version)
- throws ClassNotFoundException, IOException {
+ public static WriteModification fromStream(ObjectInput in, short version) {
WriteModification mod = new WriteModification(version);
mod.readExternal(in);
return mod;
}
@Override
- public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public final void readExternal(final ObjectInput in) throws IOException {
final int length = in.readInt();
serialized = new byte[length];
in.readFully(serialized);
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
final int length = in.readInt();
serialized = new byte[length];
in.readFully(serialized);
}
}
- public static FrontendClientMetadata readFrom(final DataInput in) throws IOException, ClassNotFoundException {
+ public static FrontendClientMetadata readFrom(final DataInput in) throws IOException {
final ClientIdentifier id = ClientIdentifier.readFrom(in);
final int purgedSize = in.readInt();
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
final int size = in.readInt();
final List<FrontendClientMetadata> readedClients = new ArrayList<>(size);
for (int i = 0; i < size ; ++i) {
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
snapshotState = new ShardSnapshotState(ShardDataTreeSnapshot.deserialize(in));
}
final scala.concurrent.Promise<Object> makeLeaderLocalAsk = Futures.promise();
localShardReply.onComplete(new OnComplete<ActorRef>() {
@Override
- public void onComplete(final Throwable failure, final ActorRef actorRef) throws Throwable {
+ public void onComplete(final Throwable failure, final ActorRef actorRef) {
if (failure instanceof LocalShardNotFoundException) {
LOG.debug("No local shard found for {} - Cannot request leadership transfer to local shard.",
getShardIdentifier(), failure);
//create shard registration for DEFAULT_SHARD
- try {
- initDefaultShard(LogicalDatastoreType.CONFIGURATION);
- } catch (final InterruptedException | ExecutionException e) {
- throw new IllegalStateException("Unable to create default shard frontend for config shard", e);
- }
-
- try {
- initDefaultShard(LogicalDatastoreType.OPERATIONAL);
- } catch (final InterruptedException | ExecutionException e) {
- throw new IllegalStateException("Unable to create default shard frontend for operational shard", e);
- }
+ initDefaultShard(LogicalDatastoreType.CONFIGURATION);
+ initDefaultShard(LogicalDatastoreType.OPERATIONAL);
}
private ListenableFuture<List<Void>> handleConfigShardLookup() {
ask.onComplete(new OnComplete<Object>() {
@Override
- public void onComplete(final Throwable throwable, final Object result) throws Throwable {
+ public void onComplete(final Throwable throwable, final Object result) {
if (throwable != null) {
future.setException(throwable);
} else {
}
@SuppressWarnings("checkstyle:IllegalCatch")
- private void initDefaultShard(final LogicalDatastoreType logicalDatastoreType)
- throws ExecutionException, InterruptedException {
+ private void initDefaultShard(final LogicalDatastoreType logicalDatastoreType) {
final PrefixedShardConfigWriter writer = writerMap.get(logicalDatastoreType);
}
@Override
- protected void handleReceive(final Object message) throws Exception {
+ protected void handleReceive(final Object message) {
if (message instanceof RoleChangeNotification) {
ignoreMessage(message);
} else if (message instanceof LeaderStateChanged) {
package org.opendaylight.controller.cluster.sharding;
-import static akka.actor.ActorRef.noSender;
-
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
}
@Override
- protected void handleRecover(final Object message) throws Exception {
+ protected void handleRecover(final Object message) {
LOG.debug("Received a recover message {}", message);
}
@Override
- protected void handleCommand(final Object message) throws Exception {
+ protected void handleCommand(final Object message) {
LOG.debug("{} : Received {}", clusterWrapper.getCurrentMemberName(), message);
if (message instanceof ClusterEvent.MemberUp) {
memberUp((ClusterEvent.MemberUp) message);
// fastpath if we have no peers
if (resolver.getShardingServicePeerActorAddresses().isEmpty()) {
- getSender().tell(new Status.Success(null), noSender());
+ getSender().tell(new Status.Success(null), ActorRef.noSender());
}
final ActorRef sender = getSender();
futures.toArray(new CompletableFuture[futures.size()]));
combinedFuture
- .thenRun(() -> sender.tell(new Success(null), noSender()))
+ .thenRun(() -> sender.tell(new Success(null), ActorRef.noSender()))
.exceptionally(throwable -> {
sender.tell(new Status.Failure(throwable), self());
return null;
final ActorProducerRegistration registration = idToProducer.remove(message.getSubtrees().iterator().next());
if (registration == null) {
LOG.warn("The notification contained a path on which no producer is registered, throwing away");
- getSender().tell(new Status.Success(null), noSender());
+ getSender().tell(new Status.Success(null), ActorRef.noSender());
return;
}
try {
registration.close();
- getSender().tell(new Status.Success(null), noSender());
+ getSender().tell(new Status.Success(null), ActorRef.noSender());
} catch (final DOMDataTreeProducerException e) {
LOG.error("Unable to close producer", e);
- getSender().tell(new Status.Failure(e), noSender());
+ getSender().tell(new Status.Failure(e), ActorRef.noSender());
}
}
localShardFuture.onComplete(new OnComplete<ActorRef>() {
@Override
- public void onComplete(Throwable throwable, ActorRef actorRef) throws Throwable {
+ public void onComplete(Throwable throwable, ActorRef actorRef) {
if (throwable != null) {
tryReschedule(throwable);
} else {
ask.onComplete(new OnComplete<Object>() {
@Override
- public void onComplete(final Throwable throwable, final Object findLeaderReply) throws Throwable {
+ public void onComplete(final Throwable throwable, final Object findLeaderReply) {
if (throwable != null) {
tryReschedule(throwable);
} else {
shardingService.lookupShardFrontend(toLookup);
if (entry != null && tableEntryIdCheck(entry, toLookup) && entry.getValue() != null) {
- replyTo.tell(new Success(null), noSender());
+ replyTo.tell(new Success(null), ActorRef.noSender());
} else {
tryReschedule(null);
}
localShardFuture.onComplete(new OnComplete<ActorRef>() {
@Override
- public void onComplete(Throwable throwable, ActorRef actorRef) throws Throwable {
+ public void onComplete(Throwable throwable, ActorRef actorRef) {
if (throwable != null) {
//TODO Shouldn't we check why findLocalShard failed?
LOG.debug("Backend shard[{}] removal lookup successful notifying the registration future",
toLookup);
- replyTo.tell(new Success(null), noSender());
+ replyTo.tell(new Success(null), ActorRef.noSender());
} else {
tryReschedule(null);
}
tryReschedule(null);
} else {
LOG.debug("Local backend for prefix configuration shard lookup successful");
- replyTo.tell(new Status.Success(null), noSender());
+ replyTo.tell(new Status.Success(null), ActorRef.noSender());
}
}
}
ask.onComplete(new OnComplete<Object>() {
@Override
- public void onComplete(final Throwable throwable, final Object findLeaderReply) throws Throwable {
+ public void onComplete(final Throwable throwable, final Object findLeaderReply) {
if (throwable != null) {
tryReschedule(throwable);
} else {
// leader is found, backend seems ready, check if the frontend is ready
LOG.debug("{} - Leader for config shard is ready. Ending lookup.",
clusterWrapper.getCurrentMemberName());
- replyTo.tell(new Status.Success(null), noSender());
+ replyTo.tell(new Status.Success(null), ActorRef.noSender());
} else {
tryReschedule(null);
}
private ClientSnapshot clientSnapshot;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
final SchemaContext schemaContext = TestModel.createTestContext();
}
@Test
- public void testCreateTransactionChain() throws Exception {
+ public void testCreateTransactionChain() {
try (ClientBackedDataStore clientBackedDataStore = new ClientBackedDataStore(
actorContext, UNKNOWN_ID, clientActor)) {
final DOMStoreTransactionChain txChain = clientBackedDataStore.createTransactionChain();
}
@Test
- public void testNewReadOnlyTransaction() throws Exception {
+ public void testNewReadOnlyTransaction() {
try (ClientBackedDataStore clientBackedDataStore = new ClientBackedDataStore(
actorContext, UNKNOWN_ID, clientActor)) {
final DOMStoreReadTransaction tx = clientBackedDataStore.newReadOnlyTransaction();
}
@Test
- public void testNewWriteOnlyTransaction() throws Exception {
+ public void testNewWriteOnlyTransaction() {
try (ClientBackedDataStore clientBackedDataStore = new ClientBackedDataStore(
actorContext, UNKNOWN_ID, clientActor)) {
final DOMStoreWriteTransaction tx = clientBackedDataStore.newWriteOnlyTransaction();
}
@Test
- public void testNewReadWriteTransaction() throws Exception {
+ public void testNewReadWriteTransaction() {
try (ClientBackedDataStore clientBackedDataStore = new ClientBackedDataStore(
actorContext, UNKNOWN_ID, clientActor)) {
final DOMStoreReadWriteTransaction tx = clientBackedDataStore.newReadWriteTransaction();
private ClientSnapshot delegate;
@Override
- ClientBackedReadTransaction object() throws Exception {
+ ClientBackedReadTransaction object() {
return object;
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
Mockito.doReturn(CLIENT_ID).when(clientContext).getIdentifier();
private DOMStoreThreePhaseCommitCohort readyCohort;
@Override
- ClientBackedReadWriteTransaction object() throws Exception {
+ ClientBackedReadWriteTransaction object() {
return object;
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
Mockito.doReturn(TRANSACTION_ID).when(delegate).getIdentifier();
private ClientTransaction transaction;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
final FrontendIdentifier frontendId = FrontendIdentifier.create(
}
@Test
- public void testNewReadOnlyTransaction() throws Exception {
+ public void testNewReadOnlyTransaction() {
Assert.assertNotNull(chain.newReadOnlyTransaction());
Mockito.verify(history).takeSnapshot();
}
@Test
- public void testNewReadWriteTransaction() throws Exception {
+ public void testNewReadWriteTransaction() {
Assert.assertNotNull(chain.newReadWriteTransaction());
Mockito.verify(history).createTransaction();
}
@Test
- public void testNewWriteOnlyTransaction() throws Exception {
+ public void testNewWriteOnlyTransaction() {
Assert.assertNotNull(chain.newWriteOnlyTransaction());
Mockito.verify(history).createTransaction();
}
@Test
- public void testClose() throws Exception {
+ public void testClose() {
chain.newReadOnlyTransaction();
chain.close();
Mockito.verify(snapshot).abort();
}
@Test
- public void testSnapshotClosed() throws Exception {
+ public void testSnapshotClosed() {
chain.snapshotClosed(snapshot);
// snap is removed, so cannot be aborted
chain.close();
private static LocalHistoryIdentifier HISTORY_ID = new LocalHistoryIdentifier(CLIENT_ID, 0);
protected static final TransactionIdentifier TRANSACTION_ID = new TransactionIdentifier(HISTORY_ID, 0);
- abstract T object() throws Exception;
+ abstract T object();
@Test
- public void testClose() throws Exception {
+ public void testClose() {
final AbstractClientHandle<?> delegate = object().delegate();
object().close();
Mockito.verify(delegate).abort();
private DOMStoreThreePhaseCommitCohort readyCohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
Mockito.doReturn(TRANSACTION_ID).when(delegate).getIdentifier();
}
@Override
- ClientBackedWriteTransaction object() throws Exception {
+ ClientBackedWriteTransaction object() {
return object;
}
@Test
- public void testWrite() throws Exception {
+ public void testWrite() {
object().write(path, data);
Mockito.verify(delegate).write(path, data);
}
@Test
- public void testMerge() throws Exception {
+ public void testMerge() {
object().merge(path, data);
Mockito.verify(delegate).merge(path, data);
}
@Test
- public void testDelete() throws Exception {
+ public void testDelete() {
object().delete(path);
Mockito.verify(delegate).delete(path);
}
@Test
- public void testReady() throws Exception {
+ public void testReady() {
final DOMStoreThreePhaseCommitCohort result = object().ready();
Assert.assertNotNull(result);
Mockito.verify(delegate).ready();
protected abstract void doHandleOperation(T handle);
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Test
- public void testGetIdentifier() throws Exception {
+ public void testGetIdentifier() {
Assert.assertEquals(TRANSACTION_ID, handle.getIdentifier());
}
}
@Test
- public void testEnsureClosed() throws Exception {
+ public void testEnsureClosed() {
doHandleOperation(handle);
final Collection<AbstractProxyTransaction> transactions = handle.ensureClosed();
Assert.assertNotNull(transactions);
}
@Test
- public void testEnsureProxy() throws Exception {
+ public void testEnsureProxy() {
final Function<Long, AbstractProxyTransaction> function = mock(Function.class);
final AbstractProxyTransaction expected = mock(AbstractProxyTransaction.class);
when(function.apply(0L)).thenReturn(expected);
}
@Test
- public void testParent() throws Exception {
+ public void testParent() {
Assert.assertEquals(parent, handle.parent());
}
protected abstract ClientActorContext clientActorContext();
@Test
- public abstract void testDoCreateSnapshot() throws Exception;
+ public abstract void testDoCreateSnapshot();
@Test
- public abstract void testDoCreateTransaction() throws Exception;
+ public abstract void testDoCreateTransaction();
@Test
- public abstract void testCreateHistoryProxy() throws Exception;
+ public abstract void testCreateHistoryProxy();
@Test
- public abstract void testOnTransactionComplete() throws Exception;
+ public abstract void testOnTransactionComplete();
@Test
- public abstract void testOnTransactionAbort() throws Exception;
+ public abstract void testOnTransactionAbort();
@Test
- public abstract void testOnTransactionReady() throws Exception;
+ public abstract void testOnTransactionReady();
@Test
- public abstract void testOnTransactionReadyDuplicate() throws Exception;
+ public abstract void testOnTransactionReadyDuplicate();
@Test
- public void testCreateSnapshotProxy() throws Exception {
+ public void testCreateSnapshotProxy() {
final AbstractProxyTransaction snapshotProxy = object().createSnapshotProxy(TRANSACTION_ID, 0L);
Assert.assertNotNull(snapshotProxy);
Assert.assertNotEquals(TRANSACTION_ID, snapshotProxy.getIdentifier());
}
@Test
- public void testCreateTransactionProxy() throws Exception {
+ public void testCreateTransactionProxy() {
AbstractProxyTransaction transactionProxy = object().createTransactionProxy(TRANSACTION_ID, 0L);
Assert.assertNotNull(transactionProxy);
Assert.assertNotEquals(TRANSACTION_ID, transactionProxy.getIdentifier());
}
@Test
- public void testState() throws Exception {
+ public void testState() {
Assert.assertEquals(AbstractClientHistory.State.IDLE, object().state());
}
@Test
- public void testUpdateState() throws Exception {
+ public void testUpdateState() {
object().updateState(AbstractClientHistory.State.IDLE, AbstractClientHistory.State.CLOSED);
Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
}
@Test
- public void testDoClose() throws Exception {
+ public void testDoClose() {
object().createTransactionProxy(TRANSACTION_ID, 0L);
object().doClose();
Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
}
@Test
- public void testGetIdentifier() throws Exception {
+ public void testGetIdentifier() {
Assert.assertEquals(HISTORY_ID, object().getIdentifier());
}
@Test
- public void testNextTx() throws Exception {
+ public void testNextTx() {
Assert.assertTrue(object().nextTx() + 1 == object().nextTx());
}
@Test
- public void testResolveShardForPath() throws Exception {
+ public void testResolveShardForPath() {
final Long shardForPath = object().resolveShardForPath(YangInstanceIdentifier.EMPTY);
Assert.assertEquals(0L, shardForPath.longValue());
}
@Test
- public void testLocalAbort() throws Exception {
+ public void testLocalAbort() {
object().localAbort(new Throwable());
Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
}
@Test
- public void testOnProxyDestroyed() throws Exception {
+ public void testOnProxyDestroyed() {
final ProxyHistory proxyHistory = Mockito.mock(ProxyHistory.class);
when(proxyHistory.getIdentifier()).thenReturn(HISTORY_ID);
}
@Test
- public void testCreateTransaction() throws Exception {
+ public void testCreateTransaction() {
final ClientTransaction transaction = object().createTransaction();
Assert.assertNotNull(transaction);
}
@Test
- public void testTakeSnapshot() throws Exception {
+ public void testTakeSnapshot() {
final ClientSnapshot clientSnapshot = object().takeSnapshot();
Assert.assertEquals(object().getIdentifier(), clientSnapshot.getIdentifier().getHistoryId());
}
@Test
- public void testStartReconnect() throws Exception {
+ public void testStartReconnect() {
// cookie and shard are the same
final Long cookie = 0L;
final Long shard = cookie;
}
@Test
- public void testStartReconnectMissingOldProxy() throws Exception {
+ public void testStartReconnectMissingOldProxy() {
// cookie and shard are different
final Long cookie = 1L;
final Long shard = 0L;
private AbstractDataStoreClientBehavior behavior;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
system = ActorSystem.apply();
clientActorProbe = new TestProbe(system, "client");
actorContextProbe = new TestProbe(system, "actor-context");
ActorContext context);
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Test
- public void testResolveShardForPath() throws Exception {
+ public void testResolveShardForPath() {
Assert.assertEquals(0L, behavior.resolveShardForPath(YangInstanceIdentifier.EMPTY).longValue());
}
@Test
- public void testHaltClient() throws Exception {
+ public void testHaltClient() {
behavior.haltClient(new RuntimeException());
}
@Test
- public void testOnCommand() throws Exception {
+ public void testOnCommand() {
final TestProbe probe = new TestProbe(system);
final GetClientRequest request = new GetClientRequest(probe.ref());
final AbstractDataStoreClientBehavior nextBehavior = behavior.onCommand(request);
}
@Test
- public void testOnCommandUnhandled() throws Exception {
+ public void testOnCommandUnhandled() {
final AbstractDataStoreClientBehavior nextBehavior = behavior.onCommand("unhandled");
Assert.assertSame(behavior, nextBehavior);
}
@Test
- public void testCreateLocalHistory() throws Exception {
+ public void testCreateLocalHistory() {
final ClientLocalHistory history = behavior.createLocalHistory();
Assert.assertEquals(behavior.getIdentifier(), history.getIdentifier().getClientId());
}
@Test
- public void testCreateTransaction() throws Exception {
+ public void testCreateTransaction() {
final ClientTransaction transaction = behavior.createTransaction();
Assert.assertEquals(behavior.getIdentifier(), transaction.getIdentifier().getHistoryId().getClientId());
}
@Test
- public void testCreateSnapshot() throws Exception {
+ public void testCreateSnapshot() {
final ClientSnapshot snapshot = behavior.createSnapshot();
Assert.assertEquals(behavior.getIdentifier(), snapshot.getIdentifier().getHistoryId().getClientId());
}
@Test
- public void testClose() throws Exception {
+ public void testClose() {
behavior.close();
final InternalCommand<ShardBackendInfo> internalCommand =
clientActorProbe.expectMsgClass(InternalCommand.class);
}
@Test
- public void testGetIdentifier() throws Exception {
+ public void testGetIdentifier() {
Assert.assertEquals(CLIENT_ID, behavior.getIdentifier());
}
@Test
- public void testGetConnection() throws Exception {
+ public void testGetConnection() {
//set up data tree mock
final CursorAwareDataTreeModification modification = mock(CursorAwareDataTreeModification.class);
when(modification.readNode(YangInstanceIdentifier.EMPTY)).thenReturn(Optional.empty());
protected T transaction;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
clientContextProbe = new TestProbe(system, "clientContext");
protected abstract T createTransaction(ProxyHistory parent, TransactionIdentifier id, DataTreeSnapshot snapshot);
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
public abstract void testRead() throws Exception;
@Test
- public abstract void testWrite() throws Exception;
+ public abstract void testWrite();
@Test
- public abstract void testMerge() throws Exception;
+ public abstract void testMerge();
@Test
- public abstract void testDelete() throws Exception;
+ public abstract void testDelete();
@Test
public abstract void testDirectCommit() throws Exception;
@Test
- public abstract void testCanCommit() throws Exception;
+ public abstract void testCanCommit();
@Test
- public abstract void testPreCommit() throws Exception;
+ public abstract void testPreCommit();
@Test
- public abstract void testDoCommit() throws Exception;
+ public abstract void testDoCommit();
@Test
- public abstract void testForwardToRemoteAbort() throws Exception;
+ public abstract void testForwardToRemoteAbort();
@Test
- public abstract void testForwardToRemoteCommit() throws Exception;
+ public abstract void testForwardToRemoteCommit();
@Test
- public void testAbortVotingFuture() throws Exception {
+ public void testAbortVotingFuture() {
testRequestResponse(f -> transaction.abort(f), TransactionAbortRequest.class, TransactionAbortSuccess::new);
}
@Test
- public void testForwardToRemotePurge() throws Exception {
+ public void testForwardToRemotePurge() {
final TestProbe probe = new TestProbe(system);
final TransactionPurgeRequest request = new TransactionPurgeRequest(TRANSACTION_ID, 0L, probe.ref());
testForwardToRemote(request, TransactionPurgeRequest.class);
}
@Test
- public void testReplayMessages() throws Exception {
+ public void testReplayMessages() {
final TestProbe probe = new TestProbe(system);
final List<ConnectionEntry> entries = new ArrayList<>();
final Consumer<Response<?, ?>> callback = createCallbackMock();
@SuppressWarnings("checkstyle:hiddenField")
protected <R extends TransactionRequest<R>> void testRequestResponse(final Consumer<VotingFuture<Void>> consumer,
final Class<R> expectedRequest,
- final BiFunction<TransactionIdentifier, Long, TransactionSuccess<?>> replySupplier) throws Exception {
+ final BiFunction<TransactionIdentifier, Long, TransactionSuccess<?>> replySupplier) {
final TransactionTester<T> tester = getTester();
final VotingFuture<Void> future = mock(VotingFuture.class);
transaction.seal();
verify(future).voteYes();
}
- protected <R extends TransactionRequest<R>> R testHandleForwardedRemoteRequest(final R request) throws Exception {
+ protected <R extends TransactionRequest<R>> R testHandleForwardedRemoteRequest(final R request) {
transaction.handleReplayedRemoteRequest(request, createCallbackMock(), Ticker.systemTicker().read());
final RequestEnvelope envelope = backendProbe.expectMsgClass(RequestEnvelope.class);
final R received = (R) envelope.getMessage();
private ClientTransaction transaction;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
}
@Test
- public void testClose() throws Exception {
+ public void testClose() {
object().close();
Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
}
@Override
@Test
- public void testDoCreateTransaction() throws Exception {
+ public void testDoCreateTransaction() {
final ClientTransaction clientTransaction = object().doCreateTransaction();
Assert.assertEquals(object().getIdentifier(), clientTransaction.getIdentifier().getHistoryId());
}
@Override
@Test
- public void testOnTransactionAbort() throws Exception {
+ public void testOnTransactionAbort() {
final ClientSnapshot clientSnapshot = object().doCreateSnapshot();
Assert.assertTrue(clientSnapshot.abort());
}
@Override
@Test
- public void testCreateHistoryProxy() throws Exception {
+ public void testCreateHistoryProxy() {
final AbstractClientConnection<ShardBackendInfo> clientConnection = behavior.getConnection(0L);
final ProxyHistory historyProxy = object().createHistoryProxy(HISTORY_ID, clientConnection);
Assert.assertEquals(object().getIdentifier(), historyProxy.getIdentifier());
@Override
@Test
- public void testDoCreateSnapshot() throws Exception {
+ public void testDoCreateSnapshot() {
final ClientSnapshot clientSnapshot = object().doCreateSnapshot();
Assert.assertEquals(new TransactionIdentifier(object().getIdentifier(), object().nextTx()).getHistoryId(),
clientSnapshot.getIdentifier().getHistoryId());
@Override
@Test
- public void testOnTransactionComplete() throws Exception {
+ public void testOnTransactionComplete() {
final ClientTransaction tx = object().createTransaction();
// make transaction ready
@Override
@Test
- public void testOnTransactionReady() throws Exception {
+ public void testOnTransactionReady() {
final AbstractTransactionCommitCohort result = object().onTransactionReady(
object().createTransaction(), cohort);
Assert.assertEquals(result, cohort);
@Override
@Test(expected = IllegalStateException.class)
- public void testOnTransactionReadyDuplicate() throws Exception {
+ public void testOnTransactionReadyDuplicate() {
final ClientTransaction tx = object().createTransaction();
object().onTransactionReady(tx, cohort);
object().onTransactionReady(tx, cohort);
}
@Test
- public void testOnTransactionReadyAndComplete() throws Exception {
+ public void testOnTransactionReadyAndComplete() {
object().updateState(AbstractClientHistory.State.IDLE, AbstractClientHistory.State.TX_OPEN);
final AbstractTransactionCommitCohort transactionCommitCohort =
object().onTransactionReady(transaction, cohort);
}
@Test
- public void testOnTransactionReadyAndCompleteStateClosed() throws Exception {
+ public void testOnTransactionReadyAndCompleteStateClosed() {
object().updateState(AbstractClientHistory.State.IDLE, AbstractClientHistory.State.CLOSED);
final AbstractTransactionCommitCohort transactionCommitCohort =
object().onTransactionReady(transaction, cohort);
}
@Test(expected = IllegalStateException.class)
- public void testOnTransactionReadyAndCompleteIdleFail() throws Exception {
+ public void testOnTransactionReadyAndCompleteIdleFail() {
object().onTransactionReady(transaction, cohort);
}
}
private ClientTransactionCommitCohort cohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
final TestProbe clientContextProbe = new TestProbe(system, "clientContext");
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
private ClientTransactionCursor cursor;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
cursor = new ClientTransactionCursor(transaction);
}
@Test
- public void testEnterOneNode() throws Exception {
+ public void testEnterOneNode() {
cursor.enter(YangInstanceIdentifier.NodeIdentifier.create(NODE_1));
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_2));
final YangInstanceIdentifier expected = createId(NODE_1, NODE_2);
}
@Test
- public void testEnterNodeIterables() throws Exception {
+ public void testEnterNodeIterables() {
final Iterable<YangInstanceIdentifier.PathArgument> collect = toPathArg(NODE_1, NODE_2);
cursor.enter(collect);
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_3));
}
@Test
- public void testEnterNodeVarargs() throws Exception {
+ public void testEnterNodeVarargs() {
cursor.enter(YangInstanceIdentifier.NodeIdentifier.create(NODE_1),
YangInstanceIdentifier.NodeIdentifier.create(NODE_2));
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_3));
}
@Test
- public void testExitOneLevel() throws Exception {
+ public void testExitOneLevel() {
cursor.enter(toPathArg(NODE_1, NODE_2));
cursor.exit();
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_2));
}
@Test
- public void testExitTwoLevels() throws Exception {
+ public void testExitTwoLevels() {
cursor.enter(toPathArg(NODE_1, NODE_2, NODE_3));
cursor.exit(2);
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_2));
}
@Test
- public void testClose() throws Exception {
+ public void testClose() {
cursor.close();
verify(transaction).closeCursor(cursor);
}
@Test
- public void testDelete() throws Exception {
+ public void testDelete() {
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_1));
final YangInstanceIdentifier expected = createId(NODE_1);
verify(transaction).delete(expected);
}
@Test
- public void testMerge() throws Exception {
+ public void testMerge() {
final YangInstanceIdentifier.NodeIdentifier path = YangInstanceIdentifier.NodeIdentifier.create(NODE_1);
final ContainerNode data = createData(path.getNodeType());
cursor.merge(path, data);
}
@Test
- public void testWrite() throws Exception {
+ public void testWrite() {
final YangInstanceIdentifier.NodeIdentifier path = YangInstanceIdentifier.NodeIdentifier.create(NODE_1);
final ContainerNode data = createData(path.getNodeType());
cursor.write(path, data);
}
@Test
- public void testOpenCloseCursor() throws Exception {
+ public void testOpenCloseCursor() {
final DOMDataTreeWriteCursor cursor = getHandle().openCursor();
getHandle().closeCursor(cursor);
getHandle().openCursor().delete(PATH.getLastPathArgument());
}
@Test
- public void testDelete() throws Exception {
+ public void testDelete() {
getHandle().delete(PATH);
verify(modification).delete(PATH);
}
@Test
- public void testMerge() throws Exception {
+ public void testMerge() {
getHandle().merge(PATH, DATA);
verify(modification).merge(PATH, DATA);
}
@Test
- public void testWrite() throws Exception {
+ public void testWrite() {
getHandle().write(PATH, DATA);
verify(modification).write(PATH, DATA);
}
private DirectTransactionCommitCohort cohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
final TestProbe clientContextProbe = new TestProbe(system, "clientContext");
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
private EmptyTransactionCommitCohort cohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
cohort = new EmptyTransactionCommitCohort(history, TRANSACTION_ID);
}
}
@Test
- public void testAbort() throws Exception {
+ public void testAbort() {
transaction.abort();
getTester().expectTransactionRequest(AbortLocalTransactionRequest.class);
}
}
@Test
- public void testHandleForwardedRemoteReadRequest() throws Exception {
+ public void testHandleForwardedRemoteReadRequest() {
final TestProbe probe = createProbe();
final ReadTransactionRequest request =
new ReadTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
}
@Test
- public void testHandleForwardedRemoteExistsRequest() throws Exception {
+ public void testHandleForwardedRemoteExistsRequest() {
final TestProbe probe = createProbe();
final ExistsTransactionRequest request =
new ExistsTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
}
@Test
- public void testHandleForwardedRemotePurgeRequest() throws Exception {
+ public void testHandleForwardedRemotePurgeRequest() {
final TestProbe probe = createProbe();
final TransactionPurgeRequest request =
new TransactionPurgeRequest(TRANSACTION_ID, 0L, probe.ref());
@Override
@Test
- public void testForwardToRemoteAbort() throws Exception {
+ public void testForwardToRemoteAbort() {
final TestProbe probe = createProbe();
final AbortLocalTransactionRequest request = new AbortLocalTransactionRequest(TRANSACTION_ID, probe.ref());
final ModifyTransactionRequest modifyRequest = testForwardToRemote(request, ModifyTransactionRequest.class);
@Override
@Test
- public void testForwardToRemoteCommit() throws Exception {
+ public void testForwardToRemoteCommit() {
final TestProbe probe = createProbe();
final CursorAwareDataTreeModification modification = mock(CursorAwareDataTreeModification.class);
final CommitLocalTransactionRequest request =
}
@Test
- public void testForwardToLocalAbort() throws Exception {
+ public void testForwardToLocalAbort() {
final TestProbe probe = createProbe();
final AbortLocalTransactionRequest request = new AbortLocalTransactionRequest(TRANSACTION_ID, probe.ref());
testForwardToLocal(request, AbortLocalTransactionRequest.class);
}
@Test
- public void testForwardToLocalPurge() throws Exception {
+ public void testForwardToLocalPurge() {
final TestProbe probe = createProbe();
final TransactionPurgeRequest request = new TransactionPurgeRequest(TRANSACTION_ID, 0L, probe.ref());
testForwardToLocal(request, TransactionPurgeRequest.class);
@Override
@Test(expected = UnsupportedOperationException.class)
- public void testDirectCommit() throws Exception {
+ public void testDirectCommit() {
transaction.directCommit();
}
@Override
@Test(expected = UnsupportedOperationException.class)
- public void testCanCommit() throws Exception {
+ public void testCanCommit() {
transaction.canCommit(new VotingFuture<>(new Object(), 1));
}
@Override
@Test(expected = UnsupportedOperationException.class)
- public void testPreCommit() throws Exception {
+ public void testPreCommit() {
transaction.preCommit(new VotingFuture<>(new Object(), 1));
}
@Override
@Test(expected = UnsupportedOperationException.class)
- public void testDoCommit() throws Exception {
+ public void testDoCommit() {
transaction.doCommit(new VotingFuture<>(new Object(), 1));
}
}
@Test
- public void testApplyModifyTransactionRequest() throws Exception {
+ public void testApplyModifyTransactionRequest() {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder =
new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
}
@Test
- public void testIsSnapshotOnly() throws Exception {
+ public void testIsSnapshotOnly() {
Assert.assertFalse(transaction.isSnapshotOnly());
}
@Test
- public void testReadOnlyView() throws Exception {
+ public void testReadOnlyView() {
Assert.assertEquals(modification, transaction.readOnlyView());
}
@Test
@Override
- public void testDelete() throws Exception {
+ public void testDelete() {
transaction.delete(PATH_1);
verify(modification).delete(PATH_1);
}
@Test
@Override
- public void testCanCommit() throws Exception {
+ public void testCanCommit() {
testRequestResponse(transaction::canCommit, CommitLocalTransactionRequest.class,
TransactionCanCommitSuccess::new);
}
@Test
@Override
- public void testPreCommit() throws Exception {
+ public void testPreCommit() {
testRequestResponse(transaction::preCommit, TransactionPreCommitRequest.class,
TransactionPreCommitSuccess::new);
}
@Test
@Override
- public void testDoCommit() throws Exception {
+ public void testDoCommit() {
testRequestResponse(transaction::doCommit, TransactionDoCommitRequest.class, TransactionCommitSuccess::new);
}
@Test
@Override
- public void testMerge() throws Exception {
+ public void testMerge() {
transaction.merge(PATH_1, DATA_1);
verify(modification).merge(PATH_1, DATA_1);
}
@Test
@Override
- public void testWrite() throws Exception {
+ public void testWrite() {
transaction.write(PATH_1, DATA_1);
verify(modification).write(PATH_1, DATA_1);
}
@Test
- public void testCommitRequest() throws Exception {
+ public void testCommitRequest() {
transaction.doWrite(PATH_1, DATA_1);
final boolean coordinated = true;
final CommitLocalTransactionRequest request = transaction.commitRequest(coordinated);
}
@Test
- public void testFlushState() throws Exception {
+ public void testFlushState() {
final TransactionTester<RemoteProxyTransaction> transactionTester = createRemoteProxyTransactionTester();
final RemoteProxyTransaction successor = transactionTester.getTransaction();
doAnswer(LocalProxyTransactionTest::applyToCursorAnswer).when(modification).applyToCursor(any());
}
@Test
- public void testApplyModifyTransactionRequestCoordinated() throws Exception {
+ public void testApplyModifyTransactionRequestCoordinated() {
applyModifyTransactionRequest(true);
}
@Test
- public void testApplyModifyTransactionRequestSimple() throws Exception {
+ public void testApplyModifyTransactionRequestSimple() {
applyModifyTransactionRequest(false);
}
@Test
- public void testApplyModifyTransactionRequestAbort() throws Exception {
+ public void testApplyModifyTransactionRequestAbort() {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder =
new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
}
@Test
- public void testHandleForwardedRemotePreCommitRequest() throws Exception {
+ public void testHandleForwardedRemotePreCommitRequest() {
final TestProbe probe = createProbe();
final TransactionPreCommitRequest request =
new TransactionPreCommitRequest(TRANSACTION_ID, 0L, probe.ref());
}
@Test
- public void testHandleForwardedRemoteDoCommitRequest() throws Exception {
+ public void testHandleForwardedRemoteDoCommitRequest() {
final TestProbe probe = createProbe();
final TransactionDoCommitRequest request =
new TransactionDoCommitRequest(TRANSACTION_ID, 0L, probe.ref());
}
@Test
- public void testHandleForwardedRemoteAbortRequest() throws Exception {
+ public void testHandleForwardedRemoteAbortRequest() {
final TestProbe probe = createProbe();
final TransactionAbortRequest request =
new TransactionAbortRequest(TRANSACTION_ID, 0L, probe.ref());
}
@Test
- public void testForwardToLocalCommit() throws Exception {
+ public void testForwardToLocalCommit() {
final TestProbe probe = createProbe();
final DataTreeModification mod = mock(DataTreeModification.class);
final TransactionRequest<?> request =
private DataTree dataTree;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
contextProbe = new TestProbe(system, "context");
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Test
- public void testResolveShardForPathNonNullCookie() throws Exception {
+ public void testResolveShardForPathNonNullCookie() {
when(shardStrategy.findShard(YangInstanceIdentifier.EMPTY)).thenReturn("default");
final Long cookie = moduleShardBackendResolver.resolveShardForPath(YangInstanceIdentifier.EMPTY);
Assert.assertEquals(0L, cookie.longValue());
}
@Test
- public void testResolveShardForPathNullCookie() throws Exception {
+ public void testResolveShardForPathNullCookie() {
when(shardStrategy.findShard(YangInstanceIdentifier.EMPTY)).thenReturn("foo");
final Long cookie = moduleShardBackendResolver.resolveShardForPath(YangInstanceIdentifier.EMPTY);
Assert.assertEquals(1L, cookie.longValue());
@Override
@Test
- public void testWrite() throws Exception {
+ public void testWrite() {
final YangInstanceIdentifier path = PATH_1;
testModification(() -> transaction.write(path, DATA_1), TransactionWrite.class, path);
}
@Override
@Test
- public void testMerge() throws Exception {
+ public void testMerge() {
final YangInstanceIdentifier path = PATH_2;
testModification(() -> transaction.merge(path, DATA_2), TransactionMerge.class, path);
}
@Override
@Test
- public void testDelete() throws Exception {
+ public void testDelete() {
final YangInstanceIdentifier path = PATH_3;
testModification(() -> transaction.delete(path), TransactionDelete.class, path);
}
@Override
@Test
- public void testCanCommit() throws Exception {
+ public void testCanCommit() {
testRequestResponse(transaction::canCommit, ModifyTransactionRequest.class,
TransactionCanCommitSuccess::new);
}
@Override
@Test
- public void testPreCommit() throws Exception {
+ public void testPreCommit() {
testRequestResponse(transaction::preCommit, TransactionPreCommitRequest.class,
TransactionPreCommitSuccess::new);
}
@Override
@Test
- public void testDoCommit() throws Exception {
+ public void testDoCommit() {
testRequestResponse(transaction::doCommit, TransactionDoCommitRequest.class, TransactionCommitSuccess::new);
}
@Override
@Test
- public void testForwardToRemoteAbort() throws Exception {
+ public void testForwardToRemoteAbort() {
final TestProbe probe = createProbe();
final TransactionAbortRequest request = new TransactionAbortRequest(TRANSACTION_ID, 0L, probe.ref());
testForwardToRemote(request, TransactionAbortRequest.class);
}
@Override
- public void testForwardToRemoteCommit() throws Exception {
+ public void testForwardToRemoteCommit() {
final TestProbe probe = createProbe();
final TransactionAbortRequest request = new TransactionAbortRequest(TRANSACTION_ID, 0L, probe.ref());
testForwardToRemote(request, TransactionAbortRequest.class);
}
@Test
- public void testForwardToRemoteModifyCommitSimple() throws Exception {
+ public void testForwardToRemoteModifyCommitSimple() {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder =
new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
}
@Test
- public void testForwardToRemoteModifyCommit3Phase() throws Exception {
+ public void testForwardToRemoteModifyCommit3Phase() {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder =
new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
}
@Test
- public void testForwardToRemoteModifyAbort() throws Exception {
+ public void testForwardToRemoteModifyAbort() {
final TestProbe probe = createProbe();
final ModifyTransactionRequestBuilder builder =
new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
}
@Test
- public void testForwardToRemoteModifyRead() throws Exception {
+ public void testForwardToRemoteModifyRead() {
final TestProbe probe = createProbe();
final ReadTransactionRequest request =
new ReadTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, false);
}
@Test
- public void testForwardToRemoteModifyExists() throws Exception {
+ public void testForwardToRemoteModifyExists() {
final TestProbe probe = createProbe();
final ExistsTransactionRequest request =
new ExistsTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, false);
}
@Test
- public void testForwardToRemoteModifyPreCommit() throws Exception {
+ public void testForwardToRemoteModifyPreCommit() {
final TestProbe probe = createProbe();
final TransactionPreCommitRequest request =
new TransactionPreCommitRequest(TRANSACTION_ID, 0L, probe.ref());
}
@Test
- public void testForwardToRemoteModifyDoCommit() throws Exception {
+ public void testForwardToRemoteModifyDoCommit() {
final TestProbe probe = createProbe();
final TransactionDoCommitRequest request =
new TransactionDoCommitRequest(TRANSACTION_ID, 0L, probe.ref());
private AbstractTransactionCommitCohort cohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.apply();
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system);
}
@Override
@Test
- public void testDoCreateTransaction() throws Exception {
+ public void testDoCreateTransaction() {
final ClientTransaction clientTransaction = object().doCreateTransaction();
Assert.assertEquals(object().getIdentifier(), clientTransaction.getIdentifier().getHistoryId());
}
@Override
@Test
- public void testCreateHistoryProxy() throws Exception {
+ public void testCreateHistoryProxy() {
final AbstractClientConnection<ShardBackendInfo> clientConnection = behavior.getConnection(0L);
final ProxyHistory historyProxy = object().createHistoryProxy(HISTORY_ID, clientConnection);
Assert.assertEquals(object().getIdentifier(), historyProxy.getIdentifier());
@Override
@Test
- public void testDoCreateSnapshot() throws Exception {
+ public void testDoCreateSnapshot() {
final ClientSnapshot clientSnapshot = object().doCreateSnapshot();
Assert.assertEquals(new TransactionIdentifier(object().getIdentifier(), object().nextTx()).getHistoryId(),
clientSnapshot.getIdentifier().getHistoryId());
@Override
@Test
- public void testOnTransactionComplete() throws Exception {
+ public void testOnTransactionComplete() {
final ClientTransaction transaction = object().createTransaction();
// make transaction ready
object().onTransactionReady(transaction, cohort);
@Override
@Test
- public void testOnTransactionAbort() throws Exception {
+ public void testOnTransactionAbort() {
final ClientSnapshot clientSnapshot = object().doCreateSnapshot();
Assert.assertTrue(clientSnapshot.abort());
}
@Override
@Test
- public void testOnTransactionReady() throws Exception {
+ public void testOnTransactionReady() {
final AbstractTransactionCommitCohort result = object().onTransactionReady(
object().createTransaction(), cohort);
Assert.assertEquals(result, cohort);
@Override
@Test(expected = IllegalStateException.class)
- public void testOnTransactionReadyDuplicate() throws Exception {
+ public void testOnTransactionReadyDuplicate() {
final ClientTransaction transaction = object().createTransaction();
object().onTransactionReady(transaction, cohort);
object().onTransactionReady(transaction, cohort);
private VotingFuture<Object> future;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
result = new Object();
future = new VotingFuture<>(result, 3);
executor = Executors.newScheduledThreadPool(1);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
executor.shutdownNow();
}
import akka.actor.ActorSystem;
import akka.testkit.javadsl.TestKit;
-import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
private static ActorSystem system;
@BeforeClass
- public static void setUpClass() throws IOException {
+ public static void setUpClass() {
System.setProperty("shard.persistent", "false");
system = ActorSystem.create("test");
}
@AfterClass
- public static void tearDownClass() throws IOException {
+ public static void tearDownClass() {
TestKit.shutdownActorSystem(system);
system = null;
}
import akka.actor.ActorSystem;
import akka.testkit.javadsl.TestKit;
import com.typesafe.config.ConfigFactory;
-import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
private static ActorSystem system;
@BeforeClass
- public static void setUpClass() throws IOException {
+ public static void setUpClass() {
System.setProperty("shard.persistent", "false");
system = ActorSystem.create("test", ConfigFactory.load().getConfig("test-config"));
}
@AfterClass
- public static void tearDownClass() throws IOException {
+ public static void tearDownClass() {
TestKit.shutdownActorSystem(system, Boolean.TRUE);
system = null;
}
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
initMocks(this);
InMemoryJournal.clear();
}
public static NormalizedNode<?,?> readStore(final TestActorRef<? extends Shard> shard,
- final YangInstanceIdentifier id) throws ExecutionException, InterruptedException {
+ final YangInstanceIdentifier id) {
return shard.underlyingActor().getDataStore().readNode(id).orNull();
}
}
@SuppressWarnings("unchecked")
- static void verifyOuterListEntry(final TestActorRef<Shard> shard, final Object expIDValue) throws Exception {
+ static void verifyOuterListEntry(final TestActorRef<Shard> shard, final Object expIDValue) {
final NormalizedNode<?, ?> outerList = readStore(shard, TestModel.OUTER_LIST_PATH);
assertNotNull(TestModel.OUTER_LIST_QNAME.getLocalName() + " not found", outerList);
assertTrue(TestModel.OUTER_LIST_QNAME.getLocalName() + " value is not Iterable",
import com.google.common.util.concurrent.FluentFuture;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
.operationTimeoutInSeconds(operationTimeoutInSeconds);
@BeforeClass
- public static void setUpClass() throws IOException {
+ public static void setUpClass() {
Config config = ConfigFactory.parseMap(ImmutableMap.<String, Object>builder()
.put("akka.actor.default-dispatcher.type",
}
@AfterClass
- public static void tearDownClass() throws IOException {
+ public static void tearDownClass() {
TestKit.shutdownActorSystem(system);
system = null;
}
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.typesafe.config.ConfigFactory;
-import java.io.IOException;
import java.math.BigInteger;
import java.util.Collection;
import java.util.concurrent.ExecutionException;
DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100);
@BeforeClass
- public static void setUpClass() throws IOException {
+ public static void setUpClass() {
system = ActorSystem.create("cluster-test", ConfigFactory.load().getConfig("Member1"));
final Address member1Address = AddressFromURIString.parse("akka://cluster-test@127.0.0.1:2558");
Cluster.get(system).join(member1Address);
}
@AfterClass
- public static void tearDownClass() throws IOException {
+ public static void tearDownClass() {
TestKit.shutdownActorSystem(system);
system = null;
}
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Uninterruptibles;
import com.typesafe.config.ConfigFactory;
-import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
.shardHeartbeatIntervalInMillis(100);
@Before
- public void setUp() throws IOException {
+ public void setUp() {
InMemorySnapshotStore.clear();
InMemoryJournal.clear();
system = ActorSystem.create("cluster-test", ConfigFactory.load().getConfig("Member1"));
}
@After
- public void tearDown() throws IOException {
+ public void tearDown() {
TestKit.shutdownActorSystem(system, Boolean.TRUE);
system = null;
}
private Timeout shardElectionTimeout;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
schemaContext = TestModel.createTestContext();
public class ForwardingDataTreeChangeListenerTest extends AbstractActorTest {
@Test
- public void testOnDataChanged() throws Exception {
+ public void testOnDataChanged() {
final ActorRef actorRef = getSystem().actorOf(MessageCollectorActor.props());
ForwardingDataTreeChangeListener forwardingListener = new ForwardingDataTreeChangeListener(
}
@SuppressWarnings("checkstyle:IllegalCatch")
- void assertExceptionOnCall(final Callable<Void> callable, final Class<? extends Exception> expType)
- throws Exception {
+ void assertExceptionOnCall(final Callable<Void> callable, final Class<? extends Exception> expType) {
try {
callable.call();
fail("Expected " + expType.getSimpleName());
}
void assertExceptionOnTxChainCreates(final DOMStoreTransactionChain txChain,
- final Class<? extends Exception> expType) throws Exception {
+ final Class<? extends Exception> expType) {
assertExceptionOnCall(() -> {
txChain.newWriteOnlyTransaction();
return null;
public class RoleChangeNotifierTest extends AbstractActorTest {
@Test
- public void testHandleRegisterRoleChangeListener() throws Exception {
+ public void testHandleRegisterRoleChangeListener() {
new TestKit(getSystem()) {
{
String memberId = "testHandleRegisterRoleChangeListener";
}
@Test
- public void testHandleRaftRoleChanged() throws Exception {
+ public void testHandleRaftRoleChanged() {
new TestKit(getSystem()) {
{
String memberId = "testHandleRegisterRoleChangeListenerWithNotificationSet";
}
@Test
- public void testHandleLeaderStateChanged() throws Exception {
+ public void testHandleLeaderStateChanged() {
new TestKit(getSystem()) {
{
String actorId = "testHandleLeaderStateChanged";
* even though it isn't at the head of the queues.
*/
@Test
- public void testTwoTransactionsWithSameTwoParticipatingShards() throws Exception {
+ public void testTwoTransactionsWithSameTwoParticipatingShards() {
final String testName = "testTwoTransactionsWithSameTwoParticipatingShards";
LOG.info("{} starting", testName);
* CanCommit is requested.
*/
@Test
- public void testMultipleTransactionsWithMixedParticipatingShards() throws Exception {
+ public void testMultipleTransactionsWithMixedParticipatingShards() {
final String testName = "testMultipleTransactionsWithMixedParticipatingShards";
LOG.info("{} starting", testName);
* When the tx's re committed verify the ready order is preserved.
*/
@Test
- public void testTwoTransactionsWithOneCommonParticipatingShard1() throws Exception {
+ public void testTwoTransactionsWithOneCommonParticipatingShard1() {
final String testName = "testTwoTransactionsWithOneCommonParticipatingShard1";
LOG.info("{} starting", testName);
* When the tx's re committed verify the ready order is preserved.
*/
@Test
- public void testTwoTransactionsWithOneCommonParticipatingShard2() throws Exception {
+ public void testTwoTransactionsWithOneCommonParticipatingShard2() {
final String testName = "testTwoTransactionsWithOneCommonParticipatingShard2";
LOG.info("{} starting", testName);
LOG.info("{} ending", testName);
}
- static void verifyInnerListEntry(TestActorRef<Shard> shard, int outerID, String innerID)
- throws Exception {
+ static void verifyInnerListEntry(TestActorRef<Shard> shard, int outerID, String innerID) {
final YangInstanceIdentifier path = innerEntryPath(outerID, innerID);
final NormalizedNode<?, ?> innerListEntry = readStore(shard, path);
assertNotNull(path + " not found", innerListEntry);
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
}
@Test
- public void testWrite() throws ExecutionException, InterruptedException {
+ public void testWrite() {
modify(false, true, true);
}
@Test
- public void testMerge() throws ExecutionException, InterruptedException {
+ public void testMerge() {
modify(true, true, true);
}
- private void modify(final boolean merge, final boolean expectedCarsPresent, final boolean expectedPeoplePresent)
- throws ExecutionException, InterruptedException {
+ private void modify(final boolean merge, final boolean expectedCarsPresent, final boolean expectedPeoplePresent) {
immediatePayloadReplication(shardDataTree, mockShard);
assertEquals(fullSchema, shardDataTree.getSchemaContext());
}
@Test
- public void bug4359AddRemoveCarOnce() throws ExecutionException, InterruptedException {
+ public void bug4359AddRemoveCarOnce() {
immediatePayloadReplication(shardDataTree, mockShard);
final List<DataTreeCandidate> candidates = new ArrayList<>();
}
@Test
- public void bug4359AddRemoveCarTwice() throws ExecutionException, InterruptedException {
+ public void bug4359AddRemoveCarTwice() {
immediatePayloadReplication(shardDataTree, mockShard);
final List<DataTreeCandidate> candidates = new ArrayList<>();
}
@Test
- public void testPipelinedTransactionsWithImmediateReplication() throws Exception {
+ public void testPipelinedTransactionsWithImmediateReplication() {
immediatePayloadReplication(shardDataTree, mockShard);
final ShardDataTreeCohort cohort1 = newShardDataTreeCohort(snapshot ->
@SuppressWarnings("unchecked")
@Test
- public void testAbortWithFailedRebase() throws Exception {
+ public void testAbortWithFailedRebase() {
immediatePayloadReplication(shardDataTree, mockShard);
final ShardDataTreeCohort cohort1 = newShardDataTreeCohort(snapshot ->
return optional.get();
}
- private static DataTreeCandidate addCar(final ShardDataTree shardDataTree)
- throws ExecutionException, InterruptedException {
+ private static DataTreeCandidate addCar(final ShardDataTree shardDataTree) {
return addCar(shardDataTree, "altima");
}
- private static DataTreeCandidate addCar(final ShardDataTree shardDataTree, final String name)
- throws ExecutionException, InterruptedException {
+ private static DataTreeCandidate addCar(final ShardDataTree shardDataTree, final String name) {
return doTransaction(shardDataTree, snapshot -> {
snapshot.merge(CarsModel.BASE_PATH, CarsModel.emptyContainer());
snapshot.merge(CarsModel.CAR_LIST_PATH, CarsModel.newCarMapNode());
});
}
- private static DataTreeCandidate removeCar(final ShardDataTree shardDataTree)
- throws ExecutionException, InterruptedException {
+ private static DataTreeCandidate removeCar(final ShardDataTree shardDataTree) {
return doTransaction(shardDataTree, snapshot -> snapshot.delete(CarsModel.newCarPath("altima")));
}
}
private static DataTreeCandidate doTransaction(final ShardDataTree shardDataTree,
- final DataTreeOperation operation) throws ExecutionException, InterruptedException {
+ final DataTreeOperation operation) {
final ReadWriteShardDataTreeTransaction transaction =
shardDataTree.newReadWriteTransaction(nextTransactionId());
final DataTreeModification snapshot = transaction.getSnapshot();
}
private static DataTreeCandidate applyCandidates(final ShardDataTree shardDataTree,
- final List<DataTreeCandidate> candidates) throws ExecutionException, InterruptedException {
+ final List<DataTreeCandidate> candidates) {
final ReadWriteShardDataTreeTransaction transaction =
shardDataTree.newReadWriteTransaction(nextTransactionId());
final DataTreeModification snapshot = transaction.getSnapshot();
import com.google.common.base.Stopwatch;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.Uninterruptibles;
-import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor;
import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yangtools.concepts.Identifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
boolean firstElectionTimeout = true;
@Override
- public Shard create() throws Exception {
+ public Shard create() {
return new Shard(newShardBuilder()) {
@Override
public void handleCommand(final Object message) {
}
@Test
- public void testPeerAddressResolved() throws Exception {
+ public void testPeerAddressResolved() {
new ShardTestKit(getSystem()) {
{
final ShardIdentifier peerID = ShardIdentifier.create("inventory", MemberName.forName("member-2"),
}
}
- void onSuccess(final Object resp) throws Exception {
+ void onSuccess(final Object resp) {
}
}
}
@Override
- void onSuccess(final Object resp) throws Exception {
+ void onSuccess(final Object resp) {
final CanCommitTransactionReply canCommitReply =
CanCommitTransactionReply.fromSerializable(resp);
assertEquals("Can commit", true, canCommitReply.getCanCommit());
}
@Test
- public void testBatchedModificationsWithNoCommitOnReady() throws Exception {
+ public void testBatchedModificationsWithNoCommitOnReady() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testBatchedModificationsWithCommitOnReady() throws Exception {
+ public void testBatchedModificationsWithCommitOnReady() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testBatchedModificationsWithOperationFailure() throws Exception {
+ public void testBatchedModificationsWithOperationFailure() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testBatchedModificationsOnTransactionChain() throws Exception {
+ public void testBatchedModificationsOnTransactionChain() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
private static final long serialVersionUID = 1L;
@Override
- public Shard create() throws Exception {
+ public Shard create() {
return new Shard(newShardBuilder()) {
@Override
protected boolean isLeader() {
}
@Test
- public void testReadyWithReadWriteImmediateCommit() throws Exception {
+ public void testReadyWithReadWriteImmediateCommit() {
testReadyWithImmediateCommit(true);
}
@Test
- public void testReadyWithWriteOnlyImmediateCommit() throws Exception {
+ public void testReadyWithWriteOnlyImmediateCommit() {
testReadyWithImmediateCommit(false);
}
- private void testReadyWithImmediateCommit(final boolean readWrite) throws Exception {
+ private void testReadyWithImmediateCommit(final boolean readWrite) {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testReadyLocalTransactionWithImmediateCommit() throws Exception {
+ public void testReadyLocalTransactionWithImmediateCommit() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testReadyLocalTransactionWithThreePhaseCommit() throws Exception {
+ public void testReadyLocalTransactionWithThreePhaseCommit() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testReadWriteCommitWithPersistenceDisabled() throws Exception {
+ public void testReadWriteCommitWithPersistenceDisabled() {
dataStoreContextBuilder.persistent(false);
new ShardTestKit(getSystem()) {
{
}
@Test
- public void testAbortWithCommitPending() throws Exception {
+ public void testAbortWithCommitPending() {
new ShardTestKit(getSystem()) {
{
final Creator<Shard> creator = () -> new Shard(newShardBuilder()) {
// }
@Test
- public void testTransactionCommitWithPriorExpiredCohortEntries() throws Exception {
+ public void testTransactionCommitWithPriorExpiredCohortEntries() {
dataStoreContextBuilder.shardTransactionCommitTimeoutInSeconds(1);
new ShardTestKit(getSystem()) {
{
}
@Test
- public void testTransactionCommitWithSubsequentExpiredCohortEntry() throws Exception {
+ public void testTransactionCommitWithSubsequentExpiredCohortEntry() {
dataStoreContextBuilder.shardTransactionCommitTimeoutInSeconds(1);
new ShardTestKit(getSystem()) {
{
}
@Test
- public void testCanCommitBeforeReadyFailure() throws Exception {
+ public void testCanCommitBeforeReadyFailure() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testAbortAfterReady() throws Exception {
+ public void testAbortAfterReady() {
dataStoreContextBuilder.shardTransactionCommitTimeoutInSeconds(1);
new ShardTestKit(getSystem()) {
{
}
@Test
- public void testAbortQueuedTransaction() throws Exception {
+ public void testAbortQueuedTransaction() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
private void awaitAndValidateSnapshot(final NormalizedNode<?, ?> expectedRoot)
- throws InterruptedException, IOException {
+ throws InterruptedException {
assertEquals("Snapshot saved", true, latch.get().await(5, TimeUnit.SECONDS));
assertTrue("Invalid saved snapshot " + savedSnapshot.get(), savedSnapshot.get() instanceof Snapshot);
savedSnapshot.set(null);
}
- private void verifySnapshot(final Snapshot snapshot, final NormalizedNode<?, ?> expectedRoot)
- throws IOException {
+ private void verifySnapshot(final Snapshot snapshot, final NormalizedNode<?, ?> expectedRoot) {
final NormalizedNode<?, ?> actual = ((ShardSnapshotState)snapshot.getState()).getSnapshot()
.getRootNode().get();
assertEquals("Root node", expectedRoot, actual);
* This test simply verifies that the applySnapShot logic will work.
*/
@Test
- public void testInMemoryDataTreeRestore() throws ReadFailedException, DataValidationFailedException {
+ public void testInMemoryDataTreeRestore() throws DataValidationFailedException {
final DataTree store = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL,
SCHEMA_CONTEXT);
}
@Test
- public void testRegisterRoleChangeListener() throws Exception {
+ public void testRegisterRoleChangeListener() {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
}
@Test
- public void testFollowerInitialSyncStatus() throws Exception {
+ public void testFollowerInitialSyncStatus() {
final TestActorRef<Shard> shard = actorFactory.createTestActor(
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testFollowerInitialSyncStatus");
}
@Test
- public void testServerRemoved() throws Exception {
+ public void testServerRemoved() {
final TestActorRef<MessageCollectorActor> parent = actorFactory.createTestActor(MessageCollectorActor.props()
.withDispatcher(Dispatchers.DefaultDispatcherId()));
}
@Test
- public void testOnReceiveReadData() throws Exception {
+ public void testOnReceiveReadData() {
new TestKit(getSystem()) {
{
testOnReceiveReadData(newTransactionActor(RO, readOnlyTransaction(), "testReadDataRO"));
}
@Test
- public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
+ public void testOnReceiveReadDataWhenDataNotFound() {
new TestKit(getSystem()) {
{
testOnReceiveReadDataWhenDataNotFound(
}
@Test
- public void testOnReceiveDataExistsPositive() throws Exception {
+ public void testOnReceiveDataExistsPositive() {
new TestKit(getSystem()) {
{
testOnReceiveDataExistsPositive(
}
@Test
- public void testOnReceiveDataExistsNegative() throws Exception {
+ public void testOnReceiveDataExistsNegative() {
new TestKit(getSystem()) {
{
testOnReceiveDataExistsNegative(
}
@Test
- public void testOnReceiveBatchedModifications() throws Exception {
+ public void testOnReceiveBatchedModifications() {
new TestKit(getSystem()) {
{
ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
}
@Test
- public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() throws Exception {
+ public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() {
new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
}
@Test
- public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() throws Exception {
+ public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() {
new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
}
@Test
- public void testReadWriteTxOnReceiveCloseTransaction() throws Exception {
+ public void testReadWriteTxOnReceiveCloseTransaction() {
new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(),
}
@Test
- public void testWriteOnlyTxOnReceiveCloseTransaction() throws Exception {
+ public void testWriteOnlyTxOnReceiveCloseTransaction() {
new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
}
@Test
- public void testReadOnlyTxOnReceiveCloseTransaction() throws Exception {
+ public void testReadOnlyTxOnReceiveCloseTransaction() {
new TestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(TransactionType.READ_ONLY, readOnlyTransaction(),
private SimpleShardDataTreeCohort cohort;
@Before
- public void setup() throws Exception {
+ public void setup() {
MockitoAnnotations.initMocks(this);
doReturn(Optional.empty()).when(mockUserCohorts).commit();
}
@Test
- public void testCanCommitSuccess() throws Exception {
+ public void testCanCommitSuccess() {
canCommitSuccess();
}
verifyNoMoreInteractions(callback);
}
- private void testValidatationPropagates(final Exception cause) throws DataValidationFailedException {
+ private void testValidatationPropagates(final Exception cause) {
doAnswer(invocation -> {
invocation.getArgumentAt(0, SimpleShardDataTreeCohort.class).failedCanCommit(cause);
return null;
}
@Test
- public void testCanCommitWithConflictingModEx() throws DataValidationFailedException {
+ public void testCanCommitWithConflictingModEx() {
testValidatationPropagates(new ConflictingModificationAppliedException(YangInstanceIdentifier.EMPTY, "mock"));
}
@Test
- public void testCanCommitWithDataValidationEx() throws DataValidationFailedException {
+ public void testCanCommitWithDataValidationEx() {
testValidatationPropagates(new DataValidationFailedException(YangInstanceIdentifier.EMPTY, "mock"));
}
@Test
- public void testCanCommitWithIllegalArgumentEx() throws DataValidationFailedException {
+ public void testCanCommitWithIllegalArgumentEx() {
testValidatationPropagates(new IllegalArgumentException("mock"));
}
}
@Test
- public void testPreCommitAndCommitSuccess() throws Exception {
+ public void testPreCommitAndCommitSuccess() {
canCommitSuccess();
final DataTreeCandidateTip candidate = preCommitSuccess();
}
@Test
- public void testPreCommitWithIllegalArgumentEx() throws Exception {
+ public void testPreCommitWithIllegalArgumentEx() {
canCommitSuccess();
final Exception cause = new IllegalArgumentException("mock");
}
@Test
- public void testPreCommitWithReportedFailure() throws Exception {
+ public void testPreCommitWithReportedFailure() {
canCommitSuccess();
final Exception cause = new IllegalArgumentException("mock");
}
interface Invoker {
- FluentFuture<?> invoke(TransactionProxy proxy) throws Exception;
+ FluentFuture<?> invoke(TransactionProxy proxy);
}
@Test
}
@Test
- public void testWrite() throws Exception {
+ public void testWrite() {
dataStoreContextBuilder.shardBatchedModificationCount(1);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testMerge() throws Exception {
+ public void testMerge() {
dataStoreContextBuilder.shardBatchedModificationCount(1);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testDelete() throws Exception {
+ public void testDelete() {
dataStoreContextBuilder.shardBatchedModificationCount(1);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testReadWrite() throws Exception {
+ public void testReadWrite() {
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE);
final NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
}
@Test
- public void testReadyWithReadWrite() throws Exception {
+ public void testReadyWithReadWrite() {
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE);
final NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
}
@Test
- public void testReadyWithNoModifications() throws Exception {
+ public void testReadyWithNoModifications() {
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE);
doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync(
}
@Test
- public void testReadyWithMultipleShardWrites() throws Exception {
+ public void testReadyWithMultipleShardWrites() {
ActorRef actorRef1 = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
ActorRef actorRef2 = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY,
}
@Test
- public void testReadyWithWriteOnlyAndLastBatchPending() throws Exception {
+ public void testReadyWithWriteOnlyAndLastBatchPending() {
dataStoreContextBuilder.writeOnlyTransactionOptimizationsEnabled(true);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testReadyWithWriteOnlyAndLastBatchEmpty() throws Exception {
+ public void testReadyWithWriteOnlyAndLastBatchEmpty() {
dataStoreContextBuilder.shardBatchedModificationCount(1).writeOnlyTransactionOptimizationsEnabled(true);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testReadyWithReplyFailure() throws Exception {
+ public void testReadyWithReplyFailure() {
dataStoreContextBuilder.writeOnlyTransactionOptimizationsEnabled(true);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testReadyWithDebugContextEnabled() throws Exception {
+ public void testReadyWithDebugContextEnabled() {
dataStoreContextBuilder.transactionDebugContextEnabled(true);
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE);
}
@Test
- public void testReadyWithLocalTransaction() throws Exception {
+ public void testReadyWithLocalTransaction() {
ActorRef shardActorRef = getSystem().actorOf(Props.create(DoNothingActor.class));
doReturn(getSystem().actorSelection(shardActorRef.path())).when(mockActorContext)
}
@Test
- public void testReadyWithLocalTransactionWithFailure() throws Exception {
+ public void testReadyWithLocalTransactionWithFailure() {
ActorRef shardActorRef = getSystem().actorOf(Props.create(DoNothingActor.class));
doReturn(getSystem().actorSelection(shardActorRef.path())).when(mockActorContext)
verifyCohortFutures((SingleCommitCohortProxy)ready, RuntimeException.class);
}
- private void testWriteOnlyTxWithFindPrimaryShardFailure(final Exception toThrow) throws Exception {
+ private void testWriteOnlyTxWithFindPrimaryShardFailure(final Exception toThrow) {
doReturn(Futures.failed(toThrow)).when(mockActorContext).findPrimaryShardAsync(anyString());
TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
}
@Test
- public void testWriteOnlyTxWithPrimaryNotFoundException() throws Exception {
+ public void testWriteOnlyTxWithPrimaryNotFoundException() {
testWriteOnlyTxWithFindPrimaryShardFailure(new PrimaryNotFoundException("mock"));
}
@Test
- public void testWriteOnlyTxWithNotInitializedException() throws Exception {
+ public void testWriteOnlyTxWithNotInitializedException() {
testWriteOnlyTxWithFindPrimaryShardFailure(new NotInitializedException("mock"));
}
@Test
- public void testWriteOnlyTxWithNoShardLeaderException() throws Exception {
+ public void testWriteOnlyTxWithNoShardLeaderException() {
testWriteOnlyTxWithFindPrimaryShardFailure(new NoShardLeaderException("mock"));
}
@Test
- public void testReadyWithInvalidReplyMessageType() throws Exception {
+ public void testReadyWithInvalidReplyMessageType() {
dataStoreContextBuilder.writeOnlyTransactionOptimizationsEnabled(true);
ActorRef actorRef1 = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY);
}
@Test
- public void testClose() throws Exception {
+ public void testClose() {
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE);
doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync(
.getOperationTimeoutInMillis()) * 2);
}
- private void testModificationOperationBatching(final TransactionType type) throws Exception {
+ private void testModificationOperationBatching(final TransactionType type) {
int shardBatchedModificationCount = 3;
dataStoreContextBuilder.shardBatchedModificationCount(shardBatchedModificationCount);
}
@Test
- public void testReadWriteModificationOperationBatching() throws Exception {
+ public void testReadWriteModificationOperationBatching() {
testModificationOperationBatching(READ_WRITE);
}
@Test
- public void testWriteOnlyModificationOperationBatching() throws Exception {
+ public void testWriteOnlyModificationOperationBatching() {
testModificationOperationBatching(WRITE_ONLY);
}
@Test
- public void testOptimizedWriteOnlyModificationOperationBatching() throws Exception {
+ public void testOptimizedWriteOnlyModificationOperationBatching() {
dataStoreContextBuilder.writeOnlyTransactionOptimizationsEnabled(true);
testModificationOperationBatching(WRITE_ONLY);
}
}
@Test
- public void testReadRoot() throws ReadFailedException, InterruptedException, ExecutionException,
+ public void testReadRoot() throws InterruptedException, ExecutionException,
java.util.concurrent.TimeoutException {
SchemaContext schemaContext = SchemaContextHelper.full();
Configuration configuration = mock(Configuration.class);
}
@Test
- public void testOnReceiveCloseListenerRegistrationAfterSetRegistration() throws Exception {
+ public void testOnReceiveCloseListenerRegistrationAfterSetRegistration() {
new TestKit(getSystem()) {
{
final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
}
@Test
- public void testOnReceiveCloseListenerRegistrationBeforeSetRegistration() throws Exception {
+ public void testOnReceiveCloseListenerRegistrationBeforeSetRegistration() {
new TestKit(getSystem()) {
{
final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
}
@Test
- public void testOnReceiveSetRegistrationAfterPriorClose() throws Exception {
+ public void testOnReceiveSetRegistrationAfterPriorClose() {
new TestKit(getSystem()) {
{
DataTreeNotificationListenerRegistrationActor.killDelay = 1000;
import akka.actor.ActorSystem;
import akka.testkit.javadsl.TestKit;
import com.typesafe.config.ConfigFactory;
-import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
private static ActorSystem system;
@BeforeClass
- public static void setUpClass() throws IOException {
+ public static void setUpClass() {
system = ActorSystem.create("test", ConfigFactory.load().getConfig("test-config"));
}
@AfterClass
- public static void tearDownClass() throws IOException {
+ public static void tearDownClass() {
TestKit.shutdownActorSystem(system);
system = null;
}
}
@Test
- public void testOnRegisterCandidateLocal() throws Exception {
+ public void testOnRegisterCandidateLocal() {
testLog.info("testOnRegisterCandidateLocal starting");
ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testOnRegisterCandidateLocalWithNoInitialLeader() throws Exception {
+ public void testOnRegisterCandidateLocalWithNoInitialLeader() {
testLog.info("testOnRegisterCandidateLocalWithNoInitialLeader starting");
final ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testOnRegisterCandidateLocalWithNoInitialConsensus() throws Exception {
+ public void testOnRegisterCandidateLocalWithNoInitialConsensus() {
testLog.info("testOnRegisterCandidateLocalWithNoInitialConsensus starting");
final ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testOnRegisterCandidateLocalWithRemoteLeader() throws Exception {
+ public void testOnRegisterCandidateLocalWithRemoteLeader() {
testLog.info("testOnRegisterCandidateLocalWithRemoteLeader starting");
ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testOnUnregisterCandidateLocal() throws Exception {
+ public void testOnUnregisterCandidateLocal() {
testLog.info("testOnUnregisterCandidateLocal starting");
ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testOwnershipChanges() throws Exception {
+ public void testOwnershipChanges() {
testLog.info("testOwnershipChanges starting");
final ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testListenerRegistration() throws Exception {
+ public void testListenerRegistration() {
testLog.info("testListenerRegistration starting");
ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived() throws Exception {
+ public void testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived() {
testLog.info("testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived starting");
ShardTestKit kit = new ShardTestKit(getSystem());
}
@Test
- public void testDelayedEntityOwnerSelection() throws Exception {
+ public void testDelayedEntityOwnerSelection() {
testLog.info("testDelayedEntityOwnerSelection starting");
final ShardTestKit kit = new ShardTestKit(getSystem());
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class EntityOwnerSelectionStrategyConfigReaderTest {
@Before
- public void setup() throws IOException {
+ public void setup() {
MockitoAnnotations.initMocks(this);
}
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
shardStats.unregisterMBean();
}
final Creator<ShardManager> creator = new Creator<ShardManager>() {
private static final long serialVersionUID = 1L;
@Override
- public ShardManager create() throws Exception {
+ public ShardManager create() {
return new LocalShardManager(
new GenericCreator<>(LocalShardManager.class).datastoreContextFactory(mockFactory)
.primaryShardInfoCache(primaryShardInfoCache).configuration(mockConfig));
}
@Test
- public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception {
+ public void testOnReceiveFindPrimaryForNonExistentShard() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testOnReceiveFindPrimaryForLocalLeaderShard() throws Exception {
+ public void testOnReceiveFindPrimaryForLocalLeaderShard() {
LOG.info("testOnReceiveFindPrimaryForLocalLeaderShard starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp() throws Exception {
+ public void testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp() {
LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShardBeforeMemberUp starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryForNonLocalLeaderShard() throws Exception {
+ public void testOnReceiveFindPrimaryForNonLocalLeaderShard() {
LOG.info("testOnReceiveFindPrimaryForNonLocalLeaderShard starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryForUninitializedShard() throws Exception {
+ public void testOnReceiveFindPrimaryForUninitializedShard() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testOnReceiveFindPrimaryForInitializedShardWithNoRole() throws Exception {
+ public void testOnReceiveFindPrimaryForInitializedShardWithNoRole() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId() throws Exception {
+ public void testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId() {
LOG.info("testOnReceiveFindPrimaryForFollowerShardWithNoInitialLeaderId starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryWaitForShardLeader() throws Exception {
+ public void testOnReceiveFindPrimaryWaitForShardLeader() {
LOG.info("testOnReceiveFindPrimaryWaitForShardLeader starting");
datastoreContextBuilder.shardInitializationTimeout(10, TimeUnit.SECONDS);
new TestKit(getSystem()) {
}
@Test
- public void testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard() throws Exception {
+ public void testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard() {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithUninitializedShard starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryWaitForReadyWithCandidateShard() throws Exception {
+ public void testOnReceiveFindPrimaryWaitForReadyWithCandidateShard() {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithCandidateShard starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard() throws Exception {
+ public void testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard() {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithIsolatedLeaderShard starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard() throws Exception {
+ public void testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard() {
LOG.info("testOnReceiveFindPrimaryWaitForReadyWithNoRoleShard starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testOnReceiveFindPrimaryForRemoteShard() throws Exception {
+ public void testOnReceiveFindPrimaryForRemoteShard() {
LOG.info("testOnReceiveFindPrimaryForRemoteShard starting");
String shardManagerID = ShardManagerIdentifier.builder().type(shardMrgIDSuffix).build().toString();
}
@Test
- public void testShardAvailabilityOnChangeOfMemberReachability() throws Exception {
+ public void testShardAvailabilityOnChangeOfMemberReachability() {
LOG.info("testShardAvailabilityOnChangeOfMemberReachability starting");
String shardManagerID = ShardManagerIdentifier.builder().type(shardMrgIDSuffix).build().toString();
}
@Test
- public void testShardAvailabilityChangeOnMemberUnreachableAndLeadershipChange() throws Exception {
+ public void testShardAvailabilityChangeOnMemberUnreachableAndLeadershipChange() {
LOG.info("testShardAvailabilityChangeOnMemberUnreachableAndLeadershipChange starting");
String shardManagerID = ShardManagerIdentifier.builder().type(shardMrgIDSuffix).build().toString();
}
@Test
- public void testShardAvailabilityChangeOnMemberWithNameContainedInLeaderIdUnreachable() throws Exception {
+ public void testShardAvailabilityChangeOnMemberWithNameContainedInLeaderIdUnreachable() {
LOG.info("testShardAvailabilityChangeOnMemberWithNameContainedInLeaderIdUnreachable starting");
String shardManagerID = ShardManagerIdentifier.builder().type(shardMrgIDSuffix).build().toString();
}
@Test
- public void testOnReceiveFindLocalShardForNonExistentShard() throws Exception {
+ public void testOnReceiveFindLocalShardForNonExistentShard() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testOnReceiveFindLocalShardForExistentShard() throws Exception {
+ public void testOnReceiveFindLocalShardForExistentShard() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testOnReceiveFindLocalShardForNotInitializedShard() throws Exception {
+ public void testOnReceiveFindLocalShardForNotInitializedShard() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testByDefaultSyncStatusIsFalse() throws Exception {
+ public void testByDefaultSyncStatusIsFalse() {
TestShardManager shardManager = newTestShardManager();
assertEquals(false, shardManager.getMBean().getSyncStatus());
}
@Test
- public void testOnReceiveSwitchShardBehavior() throws Exception {
+ public void testOnReceiveSwitchShardBehavior() {
new TestKit(getSystem()) {
{
final ActorRef shardManager = actorFactory.createActor(newPropsShardMgrWithMockShardActor());
}
@Test
- public void testGetSnapshot() throws Exception {
+ public void testGetSnapshot() {
LOG.info("testGetSnapshot starting");
TestKit kit = new TestKit(getSystem());
}
@Test
- public void testRestoreFromSnapshot() throws Exception {
+ public void testRestoreFromSnapshot() {
LOG.info("testRestoreFromSnapshot starting");
datastoreContextBuilder.shardInitializationTimeout(3, TimeUnit.SECONDS);
}
@Test
- public void testAddShardReplicaForNonExistentShardConfig() throws Exception {
+ public void testAddShardReplicaForNonExistentShardConfig() {
new TestKit(getSystem()) {
{
ActorRef shardManager = actorFactory
}
@Test
- public void testAddShardReplica() throws Exception {
+ public void testAddShardReplica() {
LOG.info("testAddShardReplica starting");
MockConfiguration mockConfig = new MockConfiguration(
ImmutableMap.<String, List<String>>builder().put("default", Arrays.asList("member-1", "member-2"))
}
@Test
- public void testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader() throws Exception {
+ public void testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader() {
LOG.info("testAddShardReplicaWithPreExistingReplicaInRemoteShardLeader starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testAddShardReplicaWithPreExistingLocalReplicaLeader() throws Exception {
+ public void testAddShardReplicaWithPreExistingLocalReplicaLeader() {
LOG.info("testAddShardReplicaWithPreExistingLocalReplicaLeader starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testAddShardReplicaWithAddServerReplyFailure() throws Exception {
+ public void testAddShardReplicaWithAddServerReplyFailure() {
LOG.info("testAddShardReplicaWithAddServerReplyFailure starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testAddShardReplicaWithAlreadyInProgress() throws Exception {
+ public void testAddShardReplicaWithAlreadyInProgress() {
testServerChangeWhenAlreadyInProgress("astronauts", new AddShardReplica("astronauts"),
AddServer.class, new AddShardReplica("astronauts"));
}
@Test
- public void testAddShardReplicaWithFindPrimaryTimeout() throws Exception {
+ public void testAddShardReplicaWithFindPrimaryTimeout() {
LOG.info("testAddShardReplicaWithFindPrimaryTimeout starting");
datastoreContextBuilder.shardInitializationTimeout(100, TimeUnit.MILLISECONDS);
new TestKit(getSystem()) {
}
@Test
- public void testRemoveShardReplicaForNonExistentShard() throws Exception {
+ public void testRemoveShardReplicaForNonExistentShard() {
new TestKit(getSystem()) {
{
ActorRef shardManager = actorFactory
/**
* Primary is Local.
*/
- public void testRemoveShardReplicaLocal() throws Exception {
+ public void testRemoveShardReplicaLocal() {
new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
}
@Test
- public void testRemoveShardReplicaRemote() throws Exception {
+ public void testRemoveShardReplicaRemote() {
MockConfiguration mockConfig = new MockConfiguration(
ImmutableMap.<String, List<String>>builder().put("default", Arrays.asList("member-1", "member-2"))
.put("astronauts", Arrays.asList("member-1")).build());
}
@Test
- public void testRemoveShardReplicaWhenAnotherRemoveShardReplicaAlreadyInProgress() throws Exception {
+ public void testRemoveShardReplicaWhenAnotherRemoveShardReplicaAlreadyInProgress() {
testServerChangeWhenAlreadyInProgress("astronauts", new RemoveShardReplica("astronauts", MEMBER_2),
RemoveServer.class, new RemoveShardReplica("astronauts", MEMBER_3));
}
@Test
- public void testRemoveShardReplicaWhenAddShardReplicaAlreadyInProgress() throws Exception {
+ public void testRemoveShardReplicaWhenAddShardReplicaAlreadyInProgress() {
testServerChangeWhenAlreadyInProgress("astronauts", new AddShardReplica("astronauts"),
AddServer.class, new RemoveShardReplica("astronauts", MEMBER_2));
}
public void testServerChangeWhenAlreadyInProgress(final String shardName, final Object firstServerChange,
final Class<?> firstForwardedServerChangeClass,
- final Object secondServerChange) throws Exception {
+ final Object secondServerChange) {
new TestKit(getSystem()) {
{
TestKit mockShardLeaderKit = new TestKit(getSystem());
}
@Test
- public void testServerRemovedShardActorNotRunning() throws Exception {
+ public void testServerRemovedShardActorNotRunning() {
LOG.info("testServerRemovedShardActorNotRunning starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testServerRemovedShardActorRunning() throws Exception {
+ public void testServerRemovedShardActorRunning() {
LOG.info("testServerRemovedShardActorRunning starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testShardPersistenceWithRestoredData() throws Exception {
+ public void testShardPersistenceWithRestoredData() {
LOG.info("testShardPersistenceWithRestoredData starting");
new TestKit(getSystem()) {
{
}
@Test
- public void testChangeServersVotingStatus() throws Exception {
+ public void testChangeServersVotingStatus() {
new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
}
@Test
- public void testChangeServersVotingStatusWithNoLeader() throws Exception {
+ public void testChangeServersVotingStatusWithNoLeader() {
new TestKit(getSystem()) {
{
String memberId = "member-1-shard-default-" + shardMrgIDSuffix;
public class DefaultShardStrategyTest {
@Test
- public void testFindShard() throws Exception {
+ public void testFindShard() {
String shard = DefaultShardStrategy.getInstance().findShard(TestModel.TEST_PATH);
Assert.assertEquals(DefaultShardStrategy.DEFAULT_SHARD, shard);
}
@Test
- public void testFindShard() throws Exception {
+ public void testFindShard() {
ModuleShardStrategy moduleShardStrategy =
new ModuleShardStrategy("cars", configuration);
this.actorRef = actorRef;
}
- @Override public void onReceive(final Object message) throws Exception {
+ @Override public void onReceive(final Object message) {
if (message instanceof FindPrimary) {
FindPrimary fp = (FindPrimary)message;
Object resp = findPrimaryResponses.get(fp.getShardName());
}
@Override
- public MockShardManager create() throws Exception {
+ public MockShardManager create() {
return new MockShardManager(found, actorRef);
}
}
}
@Test
- public void testFindPrimaryShardAsyncPrimaryNotFound() throws Exception {
+ public void testFindPrimaryShardAsyncPrimaryNotFound() {
testFindPrimaryExceptions(new PrimaryNotFoundException("not found"));
}
@Test
- public void testFindPrimaryShardAsyncActorNotInitialized() throws Exception {
+ public void testFindPrimaryShardAsyncActorNotInitialized() {
testFindPrimaryExceptions(new NotInitializedException("not initialized"));
}
@SuppressWarnings("checkstyle:IllegalCatch")
- private static void testFindPrimaryExceptions(final Object expectedException) throws Exception {
+ private static void testFindPrimaryExceptions(final Object expectedException) {
ActorRef shardManager = getSystem().actorOf(MessageCollectorActor.props());
DatastoreContext dataStoreContext = DatastoreContext.newBuilder()
}
@Override
- public void onReceive(final Object obj) throws Exception {
+ public void onReceive(final Object obj) {
target.forward(obj, context());
}
import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
public class NormalizedNodeAggregatorTest {
@Test
- public void testAggregate() throws InterruptedException, ExecutionException, ReadFailedException,
- DataValidationFailedException {
+ public void testAggregate() throws InterruptedException, ExecutionException,
+ DataValidationFailedException {
SchemaContext schemaContext = SchemaContextHelper.full();
NormalizedNode<?, ?> expectedNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
NormalizedNode<?, ?> expectedNode2 = ImmutableNodes.containerNode(CarsModel.CARS_QNAME);
private DOMStoreThreePhaseCommitCohort commitCohort;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
shardedDOMDataTree = new ShardedDOMDataTree();
client = mock(DataStoreClient.class);
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
if (leaderDistributedDataStore != null) {
leaderDistributedDataStore.close();
}
@Test
@SuppressWarnings("checkstyle:IllegalCatch")
- public void testTransactionChainNotSealed() throws InterruptedException, ExecutionException, TimeoutException {
+ public void testTransactionChainNotSealed() throws InterruptedException, ExecutionException {
BlockingTransactionChainListener listener = new BlockingTransactionChainListener();
DOMTransactionChain txChain = domBroker.createTransactionChain(listener);
assertNotNull(txChain);
public class DummyShardManager extends UntypedActor {
public DummyShardManager(Configuration configuration, String memberName, String[] shardNames,
- String type) throws Exception {
+ String type) {
new DummyShardsCreator(configuration, context(), memberName, shardNames, type).create();
}
@Override
- public void onReceive(Object message) throws Exception {
+ public void onReceive(Object message) {
}
}
@Test(expected = IllegalStateException.class)
- public void testWriteWithTransactionReady() throws Exception {
+ public void testWriteWithTransactionReady() {
DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
}
@Test(expected = IllegalStateException.class)
- public void testReadyWithTransactionAlreadyReady() throws Exception {
+ public void testReadyWithTransactionAlreadyReady() {
DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
private final class FutureUpdater extends OnComplete<Object> {
@Override
- public void onComplete(final Throwable error, final Object reply) throws Throwable {
+ public void onComplete(final Throwable error, final Object reply) {
if (error != null) {
RemoteDOMRpcFuture.this.failNow(error);
} else if (reply instanceof RpcResponse) {
}
@Override
- protected void handleReceive(final Object message) throws Exception {
+ protected void handleReceive(final Object message) {
if (message instanceof UpdateRemoteEndpoints) {
updateRemoteEndpoints(((UpdateRemoteEndpoints) message).getEndpoints());
} else {
LOG.debug("Created TerminationMonitor");
}
- @Override public void onReceive(Object message) throws Exception {
+ @Override public void onReceive(Object message) {
if (message instanceof Terminated) {
Terminated terminated = (Terminated) message;
LOG.debug("Actor terminated : {}", terminated.actor());
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.Externalizable;
-import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(ObjectOutput out) {
SerializationUtils.serializeNormalizedNode(rpcResponse.getResultNormalizedNode(), out);
}
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(ObjectInput in) {
rpcResponse = new RpcResponse(SerializationUtils.deserializeNormalizedNode(in));
}
}
@Override
- protected final void handleRecover(final Object message) throws Exception {
+ protected final void handleRecover(final Object message) {
if (message instanceof RecoveryCompleted) {
if (incarnation != null) {
incarnation = incarnation + 1;
}
@Override
- protected void handleReceive(final Object message) throws Exception {
+ protected void handleReceive(final Object message) {
//Usually sent by self via gossip task defined above. But its not enforced.
//These ticks can be sent by another actor as well which is esp. useful while testing
if (GOSSIP_TICK.equals(message)) {
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
/**
protected DOMRpcService domRpcService2;
@BeforeClass
- public static void setup() throws InterruptedException {
+ public static void setup() {
config1 = new RemoteRpcProviderConfig.Builder("memberA").build();
config2 = new RemoteRpcProviderConfig.Builder("memberB").build();
node1 = ActorSystem.create("opendaylight-rpc", config1.get());
}
@Before
- public void setUp() throws ReactorException {
+ public void setUp() {
schemaContext = YangParserTestUtils.parseYangResources(AbstractRpcTest.class, "/test-rpc.yang");
MockitoAnnotations.initMocks(this);
}
@Override
- public void onReceive(Object message) throws Exception {
+ public void onReceive(Object message) {
}
/**
private RemoteRpcProviderConfig providerConfig;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
initMocks(this);
}
@Test
- public void testCreateInstance() throws Exception {
+ public void testCreateInstance() {
Assert.assertNotNull(RemoteRpcProviderFactory
.createInstance(providerService, rpcService, actorSystem, providerConfig));
}
@Test(expected = NullPointerException.class)
- public void testCreateInstanceMissingProvideService() throws Exception {
+ public void testCreateInstanceMissingProvideService() {
RemoteRpcProviderFactory.createInstance(null, rpcService, actorSystem, providerConfig);
}
@Test(expected = NullPointerException.class)
- public void testCreateInstanceMissingRpcService() throws Exception {
+ public void testCreateInstanceMissingRpcService() {
RemoteRpcProviderFactory.createInstance(providerService, null, actorSystem, providerConfig);
}
@Test(expected = NullPointerException.class)
- public void testCreateInstanceMissingActorSystem() throws Exception {
+ public void testCreateInstanceMissingActorSystem() {
RemoteRpcProviderFactory.createInstance(providerService, rpcService, null, providerConfig);
}
@Test(expected = NullPointerException.class)
- public void testCreateInstanceMissingProviderConfig() throws Exception {
+ public void testCreateInstanceMissingProviderConfig() {
RemoteRpcProviderFactory.createInstance(providerService, rpcService, actorSystem, null);
}
}
\ No newline at end of file
static RemoteRpcProviderConfig moduleConfig;
@BeforeClass
- public static void setup() throws InterruptedException {
+ public static void setup() {
moduleConfig = new RemoteRpcProviderConfig.Builder("odl-cluster-rpc")
.withConfigReader(ConfigFactory::load).build();
final Config config = moduleConfig.get();
private RpcErrorsException exception;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
final RpcError rpcError = RpcResultBuilder.newError(
RpcError.ErrorType.RPC, "error", "error message");
final RpcError rpcWarning = RpcResultBuilder.newWarning(
}
@Test
- public void testGetRpcErrors() throws Exception {
+ public void testGetRpcErrors() {
final List<RpcError> actualErrors = (List<RpcError>) exception.getRpcErrors();
Assert.assertEquals(rpcErrors.size(), actualErrors.size());
import akka.actor.ActorSystem;
import akka.testkit.javadsl.TestKit;
import com.typesafe.config.ConfigFactory;
-import java.net.URISyntaxException;
import java.util.Collections;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@BeforeClass
- public static void setup() throws InterruptedException {
+ public static void setup() {
system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
}
}
@Test
- public void testRouteAdd() throws URISyntaxException, InterruptedException {
+ public void testRouteAdd() {
new TestKit(system) {
{
// Test announcements
}
@Test
- public void testRouteRemove() throws URISyntaxException, InterruptedException {
+ public void testRouteRemove() {
new TestKit(system) {
{
// Test announcements
private RpcRegistrar rpcRegistrar;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
system = ActorSystem.create("test");
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system, true);
}
}
@Test
- public void testHandleReceiveAddEndpoint() throws Exception {
+ public void testHandleReceiveAddEndpoint() {
final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = ImmutableMap.of(
endpointAddress, Optional.of(firstEndpoint));
testActorRef.tell(new UpdateRemoteEndpoints(endpoints), ActorRef.noSender());
}
@Test
- public void testHandleReceiveRemoveEndpoint() throws Exception {
+ public void testHandleReceiveRemoveEndpoint() {
final Map<Address, Optional<RemoteRpcEndpoint>> endpoints = ImmutableMap.of(
endpointAddress, Optional.empty());
testActorRef.tell(new UpdateRemoteEndpoints(endpoints), ActorRef.noSender());
}
@Test
- public void testHandleReceiveUpdateEndpoint() throws Exception {
+ public void testHandleReceiveUpdateEndpoint() {
final InOrder inOrder = Mockito.inOrder(service, oldReg, newReg);
testActorRef.tell(new UpdateRemoteEndpoints(ImmutableMap.of(endpointAddress, Optional.of(firstEndpoint))),
private int routeIdCounter = 1;
@BeforeClass
- public static void staticSetup() throws InterruptedException {
+ public static void staticSetup() {
AkkaConfigurationReader reader = ConfigFactory::load;
RemoteRpcProviderConfig config1 = new RemoteRpcProviderConfig.Builder("memberA").gossipTickInterval("200ms")
* deleted
*/
@Test
- public void testAddRemoveRpcOnSameNode() throws Exception {
+ public void testAddRemoveRpcOnSameNode() {
LOG.info("testAddRemoveRpcOnSameNode starting");
Address nodeAddress = node1.provider().getDefaultAddress();
* 1 node, ensure 2nd node gets updated
*/
@Test
- public void testRpcAddRemoveInCluster() throws Exception {
+ public void testRpcAddRemoveInCluster() {
LOG.info("testRpcAddRemoveInCluster starting");
* Three node cluster. Register rpc on 2 nodes. Ensure 3rd gets updated.
*/
@Test
- public void testRpcAddedOnMultiNodes() throws Exception {
+ public void testRpcAddedOnMultiNodes() {
final TestKit testKit = new TestKit(node3);
// Add rpc on node 1
private Gossiper mockGossiper;
@BeforeClass
- public static void setup() throws InterruptedException {
+ public static void setup() {
system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("unit-test"));
system.actorOf(Props.create(TerminationMonitor.class), "termination-monitor");
private RemoteRpcRegistryMXBeanImpl mxBean;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
system = ActorSystem.create("test");
final DOMRpcIdentifier emptyRpcIdentifier = DOMRpcIdentifier.create(
}
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
TestKit.shutdownActorSystem(system, Boolean.TRUE);
}
@Test
- public void testGetGlobalRpcEmptyBuckets() throws Exception {
+ public void testGetGlobalRpcEmptyBuckets() {
final Set<String> globalRpc = mxBean.getGlobalRpc();
Assert.assertNotNull(globalRpc);
}
@Test
- public void testGetGlobalRpc() throws Exception {
+ public void testGetGlobalRpc() {
testActor.tell(new RpcRegistry.Messages.AddOrUpdateRoutes(Lists.newArrayList(buckets)), ActorRef.noSender());
final Set<String> globalRpc = mxBean.getGlobalRpc();
}
@Test
- public void testGetLocalRegisteredRoutedRpcEmptyBuckets() throws Exception {
+ public void testGetLocalRegisteredRoutedRpcEmptyBuckets() {
final Set<String> localRegisteredRoutedRpc = mxBean.getLocalRegisteredRoutedRpc();
Assert.assertNotNull(localRegisteredRoutedRpc);
}
@Test
- public void testGetLocalRegisteredRoutedRpc() throws Exception {
+ public void testGetLocalRegisteredRoutedRpc() {
testActor.tell(new RpcRegistry.Messages.AddOrUpdateRoutes(Lists.newArrayList(buckets)), ActorRef.noSender());
final Set<String> localRegisteredRoutedRpc = mxBean.getLocalRegisteredRoutedRpc();
}
@Test
- public void testFindRpcByNameEmptyBuckets() throws Exception {
+ public void testFindRpcByNameEmptyBuckets() {
final Map<String, String> rpcByName = mxBean.findRpcByName("");
Assert.assertNotNull(rpcByName);
}
@Test
- public void testFindRpcByName() throws Exception {
+ public void testFindRpcByName() {
testActor.tell(new RpcRegistry.Messages.AddOrUpdateRoutes(Lists.newArrayList(buckets)), ActorRef.noSender());
final Map<String, String> rpcByName = mxBean.findRpcByName("");
}
@Test
- public void testFindRpcByRouteEmptyBuckets() throws Exception {
+ public void testFindRpcByRouteEmptyBuckets() {
final Map<String, String> rpcByRoute = mxBean.findRpcByRoute("");
Assert.assertNotNull(rpcByRoute);
}
@Test
- public void testFindRpcByRoute() throws Exception {
+ public void testFindRpcByRoute() {
testActor.tell(new RpcRegistry.Messages.AddOrUpdateRoutes(Lists.newArrayList(buckets)), ActorRef.noSender());
final Map<String, String> rpcByRoute = mxBean.findRpcByRoute("");
}
@Test
- public void testGetBucketVersionsEmptyBuckets() throws Exception {
+ public void testGetBucketVersionsEmptyBuckets() {
final String bucketVersions = mxBean.getBucketVersions();
Assert.assertEquals(Collections.EMPTY_MAP.toString(), bucketVersions);
}
@Test
- public void testGetBucketVersions() throws Exception {
+ public void testGetBucketVersions() {
testActor.tell(new RpcRegistry.Messages.AddOrUpdateRoutes(Lists.newArrayList(buckets)), ActorRef.noSender());
final String bucketVersions = mxBean.getBucketVersions();
static ActorSystem system;
@BeforeClass
- public static void setup() throws InterruptedException {
+ public static void setup() {
system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
}
context.findLocalShardAsync(shardName).onComplete(new OnComplete<ActorRef>() {
@Override
- public void onComplete(final Throwable throwable, final ActorRef actorRef) throws Throwable {
+ public void onComplete(final Throwable throwable, final ActorRef actorRef) {
if (throwable != null) {
shutdownShardAsk.failure(throwable);
} else {
shutdownShardAsk.future().onComplete(new OnComplete<Boolean>() {
@Override
- public void onComplete(final Throwable throwable, final Boolean gracefulStopResult) throws Throwable {
+ public void onComplete(final Throwable throwable, final Boolean gracefulStopResult) {
if (throwable != null) {
final RpcResult<T> failedResult = RpcResultBuilder.<T>failed()
.withError(ErrorType.APPLICATION, "Failed to gracefully shutdown shard", throwable).build();
}
@Override
- public void close() throws Exception {
+ public void close() {
}
}