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;