import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
+import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class ShardTest extends AbstractActorTest {
}
}.get(); // this extracts the received message
- assertTrue(out.matches(
- "akka:\\/\\/test\\/user\\/testCreateTransactionChain\\/\\$.*"));
- // Will wait for the rest of the 3 seconds
+ assertEquals("Unexpected transaction path " + out,
+ "akka://test/user/testCreateTransactionChain/$a",
+ out);
+
expectNoMsg();
}
protected void run() {
subject.tell(
- new UpdateSchemaContext(TestModel.createTestContext()),
+ new UpdateSchemaContext(SchemaContextHelper.full()),
getRef());
subject.tell(new RegisterChangeListener(TestModel.TEST_PATH,
- getRef().path(), AsyncDataBroker.DataChangeScope.BASE),
+ getRef().path(), AsyncDataBroker.DataChangeScope.BASE).toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof RegisterChangeListenerReply) {
+ if (in.getClass().equals(RegisterChangeListenerReply.SERIALIZABLE_CLASS)) {
RegisterChangeListenerReply reply =
- (RegisterChangeListenerReply) in;
+ RegisterChangeListenerReply.fromSerializable(getSystem(),in);
return reply.getListenerRegistrationPath()
.toString();
} else {
new UpdateSchemaContext(TestModel.createTestContext()),
getRef());
- subject.tell(new CreateTransaction(),
+ subject.tell(new CreateTransaction("txn-1"),
getRef());
final String out = new ExpectMsg<String>("match hint") {
if (in instanceof CreateTransactionReply) {
CreateTransactionReply reply =
(CreateTransactionReply) in;
- return reply.getTransactionPath()
+ return reply.getTransactionActorPath()
.toString();
} else {
throw noMatch();
}
}.get(); // this extracts the received message
- assertTrue(out.matches(
- "akka:\\/\\/test\\/user\\/testCreateTransaction\\/\\$.*"));
- // Will wait for the rest of the 3 seconds
+ assertEquals("Unexpected transaction path " + out,
+ "akka://test/user/testCreateTransaction/shard-txn-1",
+ out);
expectNoMsg();
}