import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.assertFutureEquals;
import akka.testkit.TestProbe;
+import com.google.common.base.Ticker;
import java.util.function.Consumer;
import org.junit.Assert;
import org.junit.Test;
final ReadTransactionRequest request =
new ReadTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
final Consumer<Response<?, ?>> callback = createCallbackMock();
- transaction.handleForwardedRemoteRequest(request, callback);
+ transaction.handleReplayedRemoteRequest(request, callback, Ticker.systemTicker().read());
final ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
verify(callback).accept(captor.capture());
- final Response value = captor.getValue();
+ final Response<?, ?> value = captor.getValue();
Assert.assertTrue(value instanceof ReadTransactionSuccess);
final ReadTransactionSuccess success = (ReadTransactionSuccess) value;
Assert.assertTrue(success.getData().isPresent());
final ExistsTransactionRequest request =
new ExistsTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), PATH_1, true);
final Consumer<Response<?, ?>> callback = createCallbackMock();
- transaction.handleForwardedRemoteRequest(request, callback);
+ transaction.handleReplayedRemoteRequest(request, callback, Ticker.systemTicker().read());
final ArgumentCaptor<Response> captor = ArgumentCaptor.forClass(Response.class);
verify(callback).accept(captor.capture());
- final Response value = captor.getValue();
+ final Response<?, ?> value = captor.getValue();
Assert.assertTrue(value instanceof ExistsTransactionSuccess);
final ExistsTransactionSuccess success = (ExistsTransactionSuccess) value;
Assert.assertTrue(success.getExists());
final TestProbe probe = createProbe();
final CursorAwareDataTreeModification modification = mock(CursorAwareDataTreeModification.class);
final CommitLocalTransactionRequest request =
- new CommitLocalTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), modification, true);
+ new CommitLocalTransactionRequest(TRANSACTION_ID, 0L, probe.ref(), modification, null, true);
doAnswer(this::applyToCursorAnswer).when(modification).applyToCursor(any());
final ModifyTransactionRequest modifyRequest = testForwardToRemote(request, ModifyTransactionRequest.class);
verify(modification).applyToCursor(any());
testForwardToLocal(request, TransactionPurgeRequest.class);
}
- protected <T extends TransactionRequest> T testForwardToLocal(final TransactionRequest toForward,
+ protected <T extends TransactionRequest<?>> T testForwardToLocal(final TransactionRequest<?> toForward,
final Class<T> expectedMessageClass) {
final Consumer<Response<?, ?>> callback = createCallbackMock();
final TransactionTester<LocalReadWriteProxyTransaction> transactionTester = createLocalProxy();
* @param invocation invocation
* @return void - always null
*/
- protected Answer applyToCursorAnswer(final InvocationOnMock invocation) {
+ protected Answer<?> applyToCursorAnswer(final InvocationOnMock invocation) {
final DataTreeModificationCursor cursor =
invocation.getArgumentAt(0, DataTreeModificationCursor.class);
cursor.write(PATH_1.getLastPathArgument(), DATA_1);