import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
private static final InMemoryDOMDataStore store =
new InMemoryDOMDataStore("OPER", storeExecutor);
+ private static final SchemaContext testSchemaContext = TestModel.createTestContext();
+
static {
- store.onGlobalContextUpdated(TestModel.createTestContext());
+ store.onGlobalContextUpdated(testSchemaContext);
}
@Test
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
final ActorRef subject = getSystem().actorOf(props, "testReadData");
new Within(duration("1 seconds")) {
protected void run() {
subject.tell(
- new ReadData(InstanceIdentifier.builder().build()),
+ new ReadData(InstanceIdentifier.builder().build()).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 ReadDataReply) {
- if (((ReadDataReply) in).getNormalizedNode()
- != null) {
+ if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) {
+ if (ReadDataReply.fromSerializable(testSchemaContext,InstanceIdentifier.builder().build(), in)
+ .getNormalizedNode()!= null) {
return "match";
}
return null;
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound");
new Within(duration("1 seconds")) {
protected void run() {
subject.tell(
- new ReadData(TestModel.TEST_PATH),
+ new ReadData(TestModel.TEST_PATH).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 ReadDataReply) {
- if (((ReadDataReply) in).getNormalizedNode()
+ if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) {
+ if (ReadDataReply.fromSerializable(testSchemaContext,TestModel.TEST_PATH, in)
+ .getNormalizedNode()
== null) {
return "match";
}
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testWriteData");
protected void run() {
subject.tell(new WriteData(TestModel.TEST_PATH,
- ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+ ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
final ActorRef subject =
getSystem().actorOf(props, "testMergeData");
protected void run() {
subject.tell(new MergeData(TestModel.TEST_PATH,
- ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+ ImmutableNodes.containerNode(TestModel.TEST_QNAME), testSchemaContext).toSerializable(),
getRef());
- final String out = new ExpectMsg<String>("match hint") {
+ final String out = new ExpectMsg<String>(duration("500 milliseconds"), "match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
if (in instanceof MergeDataReply) {
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testDeleteData");
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new DeleteData(TestModel.TEST_PATH), getRef());
+ subject.tell(new DeleteData(TestModel.TEST_PATH).toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testReadyTransaction");
new JavaTestKit(getSystem()) {{
final ActorRef shard = getSystem().actorOf(Shard.props("config"));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testCloseTransaction");