X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardTransactionTest.java;h=0d65faa0600246761e25f12f5a9db6e5ec6be75e;hb=1b0f84c4957e464bad6f7cb7350a8171c3d1621b;hp=1c4ef31e93807831e0bc10fb27b702a1073ea8bf;hpb=5464f50be733df1bbbe31cf05665d542d3b7c5e7;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java index 1c4ef31e93..0d65faa060 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -50,6 +50,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class ShardTransactionTest extends AbstractActorTest { @@ -59,6 +60,7 @@ public class ShardTransactionTest extends AbstractActorTest { private static final ShardIdentifier SHARD_IDENTIFIER = ShardIdentifier.create("inventory", MEMBER_NAME, "config"); + private static final SchemaContext TEST_MODEL = TestModel.createTestContext(); private DatastoreContext datastoreContext = DatastoreContext.newBuilder().persistent(false).build(); @@ -70,7 +72,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Before public void setUp() { shard = actorFactory.createTestActor(Shard.builder().id(SHARD_IDENTIFIER).datastoreContext(datastoreContext) - .schemaContext(TestModel.createTestContext()).props() + .schemaContextProvider(() -> TEST_MODEL).props() .withDispatcher(Dispatchers.DefaultDispatcherId())); ShardTestKit.waitUntilLeader(shard); store = shard.underlyingActor().getDataStore(); @@ -80,7 +82,7 @@ public class ShardTransactionTest extends AbstractActorTest { final AbstractShardDataTreeTransaction transaction, final String name) { Props props = ShardTransaction.props(type, transaction, shard, datastoreContext, shard.underlyingActor().getShardMBean()); - return actorFactory.createActor(props, name); + return actorFactory.createActorNoVerify(props, name); } private ReadOnlyShardDataTreeTransaction readOnlyTransaction() { @@ -317,8 +319,8 @@ public class ShardTransactionTest extends AbstractActorTest { watcher.expectMsgClass(duration("5 seconds"), Terminated.class); if (failure != null) { - Throwables.propagateIfInstanceOf(failure.cause(), Exception.class); - Throwables.propagate(failure.cause()); + Throwables.propagateIfPossible(failure.cause(), Exception.class); + throw new RuntimeException(failure.cause()); } } }; @@ -346,8 +348,9 @@ public class ShardTransactionTest extends AbstractActorTest { watcher.expectMsgClass(duration("5 seconds"), Terminated.class); if (failure != null) { - Throwables.propagateIfInstanceOf(failure.cause(), Exception.class); - Throwables.propagate(failure.cause()); + Throwables.throwIfInstanceOf(failure.cause(), Exception.class); + Throwables.throwIfUnchecked(failure.cause()); + throw new RuntimeException(failure.cause()); } } };