import org.junit.Test;
import org.mockito.InOrder;
import org.mockito.Mockito;
+import org.opendaylight.controller.cluster.access.concepts.MemberName;
import org.opendaylight.controller.cluster.datastore.config.Configuration;
import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException;
import org.opendaylight.controller.cluster.datastore.exceptions.NotInitializedException;
static class TestException extends RuntimeException {
}
- static interface Invoker {
+ interface Invoker {
CheckedFuture<?, ReadFailedException> invoke(TransactionProxy proxy) throws Exception;
}
Object id = transactionProxy.getIdentifier();
assertNotNull("getIdentifier returned null", id);
- assertTrue("Invalid identifier: " + id, id.toString().startsWith(memberName));
+ assertTrue("Invalid identifier: " + id, id.toString().contains(memberName));
}
@Test
eq(actorSelection(actorRef)), isA(CloseTransaction.class));
}
- private static interface TransactionProxyOperation {
+ private interface TransactionProxyOperation {
void run(TransactionProxy transactionProxy);
}
ActorRef txActorRef = actorSystem.actorOf(Props.create(DoNothingActor.class));
String actorPath = txActorRef.path().toString();
- CreateTransactionReply createTransactionReply = new CreateTransactionReply(actorPath, "txn-1",
+ CreateTransactionReply createTransactionReply = new CreateTransactionReply(actorPath, nextTransactionId(),
DataStoreVersions.CURRENT_VERSION);
doReturn(actorSystem.actorSelection(actorPath)).when(mockActorContext).actorSelection(actorPath);
setUpReadData("test", NormalizedNodeAggregatorTest.getRootNode(expectedNode1, schemaContext));
setUpReadData("cars", NormalizedNodeAggregatorTest.getRootNode(expectedNode2, schemaContext));
- doReturn(memberName).when(mockActorContext).getCurrentMemberName();
+ doReturn(MemberName.forName(memberName)).when(mockActorContext).getCurrentMemberName();
doReturn(getSystem().dispatchers().defaultGlobalDispatcher()).when(mockActorContext).getClientDispatcher();
TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
Optional<NormalizedNode<?, ?>> readOptional = transactionProxy.read(
- YangInstanceIdentifier.builder().build()).get(5, TimeUnit.SECONDS);
+ YangInstanceIdentifier.EMPTY).get(5, TimeUnit.SECONDS);
assertEquals("NormalizedNode isPresent", true, readOptional.isPresent());
eqCreateTransaction(memberName, TransactionType.READ_ONLY), any(Timeout.class));
doReturn(readDataReply(expectedNode)).when(mockActorContext).executeOperationAsync(
- eq(actorSelection(txActorRef)), eqReadData(YangInstanceIdentifier.builder().build()), any(Timeout.class));
+ eq(actorSelection(txActorRef)), eqReadData(YangInstanceIdentifier.EMPTY), any(Timeout.class));
}
}