本文整理汇总了Java中org.opendaylight.controller.cluster.datastore.utils.MockConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java MockConfiguration类的具体用法?Java MockConfiguration怎么用?Java MockConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MockConfiguration类属于org.opendaylight.controller.cluster.datastore.utils包,在下文中一共展示了MockConfiguration类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddShardReplicaWithFindPrimaryTimeout
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testAddShardReplicaWithFindPrimaryTimeout() throws Exception {
LOG.info("testAddShardReplicaWithFindPrimaryTimeout starting");
datastoreContextBuilder.shardInitializationTimeout(100, TimeUnit.MILLISECONDS);
new JavaTestKit(getSystem()) {
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("astronauts", Arrays.asList("member-2")).build());
final ActorRef newReplicaShardManager = actorFactory
.createActor(newTestShardMgrBuilder(mockConfig).shardActor(mockShardActor).props()
.withDispatcher(Dispatchers.DefaultDispatcherId()), shardMgrID);
newReplicaShardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
MockClusterWrapper.sendMemberUp(newReplicaShardManager, "member-2",
AddressFromURIString.parse("akka://[email protected]:5").toString());
newReplicaShardManager.tell(new AddShardReplica("astronauts"), getRef());
Status.Failure resp = expectMsgClass(duration("5 seconds"), Status.Failure.class);
assertEquals("Failure obtained", true, resp.cause() instanceof RuntimeException);
}
};
LOG.info("testAddShardReplicaWithFindPrimaryTimeout ending");
}
示例2: setUp
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
actorContext = new ActorContext(getSystem(), actorFactory.createActor(Props.create(DoNothingActor.class)),
new MockClusterWrapper(), new MockConfiguration(), DatastoreContext.newBuilder().build(),
new PrimaryShardInfoFutureCache()) {
@Override
public Timer getOperationTimer(final String operationName) {
return commitTimer;
}
@Override
public double getTxCreationLimit() {
return 10.0;
}
};
doReturn(commitTimerContext).when(commitTimer).time();
doReturn(commitSnapshot).when(commitTimer).getSnapshot();
for (int i = 1; i < 11; i++) {
// Keep on increasing the amount of time it takes to complete transaction for each tenth of a
// percentile. Essentially this would be 1ms for the 10th percentile, 2ms for 20th percentile and so on.
doReturn(TimeUnit.MILLISECONDS.toNanos(i) * 1D).when(commitSnapshot).getValue(i * 0.1);
}
}
示例3: testRestoreFromSnapshot
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testRestoreFromSnapshot() throws Exception {
LOG.info("testRestoreFromSnapshot starting");
datastoreContextBuilder.shardInitializationTimeout(3, TimeUnit.SECONDS);
JavaTestKit kit = new JavaTestKit(getSystem());
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("shard1", Collections.<String>emptyList()).put("shard2", Collections.<String>emptyList())
.put("astronauts", Collections.<String>emptyList()).build());
ShardManagerSnapshot snapshot =
new ShardManagerSnapshot(Arrays.asList("shard1", "shard2", "astronauts"), Collections.emptyMap());
DatastoreSnapshot restoreFromSnapshot = new DatastoreSnapshot(shardMrgIDSuffix, snapshot,
Collections.<ShardSnapshot>emptyList());
TestActorRef<TestShardManager> shardManager = actorFactory.createTestActor(newTestShardMgrBuilder(mockConfig)
.restoreFromSnapshot(restoreFromSnapshot).props().withDispatcher(Dispatchers.DefaultDispatcherId()));
shardManager.underlyingActor().waitForRecoveryComplete();
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), ActorRef.noSender());
waitForShardInitialized(shardManager, "shard1", kit);
waitForShardInitialized(shardManager, "shard2", kit);
waitForShardInitialized(shardManager, "astronauts", kit);
shardManager.tell(GetSnapshot.INSTANCE, kit.getRef());
DatastoreSnapshot datastoreSnapshot = expectMsgClassOrFailure(DatastoreSnapshot.class, kit, "GetSnapshot");
assertEquals("getType", shardMrgIDSuffix, datastoreSnapshot.getType());
assertNotNull("Expected ShardManagerSnapshot", datastoreSnapshot.getShardManagerSnapshot());
assertEquals("Shard names", Sets.newHashSet("shard1", "shard2", "astronauts"),
Sets.newHashSet(datastoreSnapshot.getShardManagerSnapshot().getShardList()));
LOG.info("testRestoreFromSnapshot ending");
}
示例4: testServerChangeWhenAlreadyInProgress
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
public void testServerChangeWhenAlreadyInProgress(final String shardName, final Object firstServerChange,
final Class<?> firstForwardedServerChangeClass,
final Object secondServerChange) throws Exception {
new JavaTestKit(getSystem()) {
{
JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
final JavaTestKit secondRequestKit = new JavaTestKit(getSystem());
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put(shardName, Arrays.asList("member-2")).build());
final TestActorRef<TestShardManager> shardManager = TestActorRef.create(getSystem(),
newTestShardMgrBuilder().configuration(mockConfig).shardActor(mockShardActor)
.cluster(new MockClusterWrapper()).props()
.withDispatcher(Dispatchers.DefaultDispatcherId()),
shardMgrID);
shardManager.underlyingActor()
.setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager.tell(firstServerChange, getRef());
mockShardLeaderKit.expectMsgClass(firstForwardedServerChangeClass);
shardManager.tell(secondServerChange, secondRequestKit.getRef());
secondRequestKit.expectMsgClass(duration("5 seconds"), Failure.class);
}
};
}
示例5: testServerRemovedShardActorRunning
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testServerRemovedShardActorRunning() throws Exception {
LOG.info("testServerRemovedShardActorRunning starting");
new JavaTestKit(getSystem()) {
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("default", Arrays.asList("member-1", "member-2"))
.put("astronauts", Arrays.asList("member-2"))
.put("people", Arrays.asList("member-1", "member-2")).build());
String shardId = ShardIdentifier.create("default", MEMBER_1, shardMrgIDSuffix).toString();
ActorRef shard = actorFactory.createActor(MessageCollectorActor.props(), shardId);
TestActorRef<TestShardManager> shardManager = actorFactory
.createTestActor(newTestShardMgrBuilder(mockConfig).addShardActor("default", shard).props()
.withDispatcher(Dispatchers.DefaultDispatcherId()));
shardManager.underlyingActor().waitForRecoveryComplete();
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager.tell(new ActorInitialized(), shard);
waitForShardInitialized(shardManager, "people", this);
waitForShardInitialized(shardManager, "default", this);
// Removed the default shard replica from member-1
shardManager.tell(new ServerRemoved(shardId), getRef());
shardManager.underlyingActor().verifySnapshotPersisted(Sets.newHashSet("people"));
MessageCollectorActor.expectFirstMatching(shard, Shutdown.class);
}
};
LOG.info("testServerRemovedShardActorRunning ending");
}
示例6: testShardPersistenceWithRestoredData
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testShardPersistenceWithRestoredData() throws Exception {
LOG.info("testShardPersistenceWithRestoredData starting");
new JavaTestKit(getSystem()) {
{
MockConfiguration mockConfig =
new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("default", Arrays.asList("member-1", "member-2"))
.put("astronauts", Arrays.asList("member-2"))
.put("people", Arrays.asList("member-1", "member-2")).build());
String[] restoredShards = {"default", "astronauts"};
ShardManagerSnapshot snapshot =
new ShardManagerSnapshot(Arrays.asList(restoredShards), Collections.emptyMap());
InMemorySnapshotStore.addSnapshot("shard-manager-" + shardMrgIDSuffix, snapshot);
// create shardManager to come up with restored data
TestActorRef<TestShardManager> newRestoredShardManager = actorFactory.createTestActor(
newShardMgrProps(mockConfig).withDispatcher(Dispatchers.DefaultDispatcherId()));
newRestoredShardManager.underlyingActor().waitForRecoveryComplete();
newRestoredShardManager.tell(new FindLocalShard("people", false), getRef());
LocalShardNotFound notFound = expectMsgClass(duration("5 seconds"), LocalShardNotFound.class);
assertEquals("for uninitialized shard", "people", notFound.getShardName());
// Verify a local shard is created for the restored shards,
// although we expect a NotInitializedException for the shards
// as the actor initialization
// message is not sent for them
newRestoredShardManager.tell(new FindLocalShard("default", false), getRef());
expectMsgClass(duration("5 seconds"), NotInitializedException.class);
newRestoredShardManager.tell(new FindLocalShard("astronauts", false), getRef());
expectMsgClass(duration("5 seconds"), NotInitializedException.class);
}
};
LOG.info("testShardPersistenceWithRestoredData ending");
}
示例7: testOnDataChanged
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testOnDataChanged() throws Exception {
final ActorRef actorRef = getSystem().actorOf(MessageCollectorActor.props());
DataChangeListenerProxy dataChangeListenerProxy = new DataChangeListenerProxy(
getSystem().actorSelection(actorRef.path()));
dataChangeListenerProxy.onDataChanged(new MockDataChangedEvent());
//Check if it was received by the remote actor
ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(
Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration());
Object messages = testContext
.executeOperation(actorRef, MessageCollectorActor.GET_ALL_MESSAGES);
Assert.assertNotNull(messages);
Assert.assertTrue(messages instanceof List);
List<?> listMessages = (List<?>) messages;
Assert.assertEquals(1, listMessages.size());
Assert.assertTrue(listMessages.get(0).getClass().equals(DataChanged.class));
}
示例8: newShardMgrProps
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
private Props newShardMgrProps() {
return newShardMgrProps(new MockConfiguration());
}
示例9: testOnReceiveFindPrimaryForRemoteShard
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testOnReceiveFindPrimaryForRemoteShard() throws Exception {
LOG.info("testOnReceiveFindPrimaryForRemoteShard starting");
String shardManagerID = ShardManagerIdentifier.builder().type(shardMrgIDSuffix).build().toString();
// Create an ActorSystem ShardManager actor for member-1.
final ActorSystem system1 = newActorSystem("Member1");
Cluster.get(system1).join(AddressFromURIString.parse("akka://[email protected]:2558"));
final TestActorRef<TestShardManager> shardManager1 = TestActorRef.create(system1,
newTestShardMgrBuilderWithMockShardActor().cluster(
new ClusterWrapperImpl(system1)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
// Create an ActorSystem ShardManager actor for member-2.
final ActorSystem system2 = newActorSystem("Member2");
Cluster.get(system2).join(AddressFromURIString.parse("akka://[email protected]:2558"));
final ActorRef mockShardActor2 = newMockShardActor(system2, "astronauts", "member-2");
MockConfiguration mockConfig2 = new MockConfiguration(
ImmutableMap.<String, List<String>>builder().put("default", Arrays.asList("member-1", "member-2"))
.put("astronauts", Arrays.asList("member-2")).build());
final TestActorRef<TestShardManager> shardManager2 = TestActorRef.create(system2,
newTestShardMgrBuilder(mockConfig2).shardActor(mockShardActor2).cluster(
new ClusterWrapperImpl(system2)).props().withDispatcher(
Dispatchers.DefaultDispatcherId()), shardManagerID);
new JavaTestKit(system1) {
{
shardManager1.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager2.tell(new ActorInitialized(), mockShardActor2);
String memberId2 = "member-2-shard-astronauts-" + shardMrgIDSuffix;
short leaderVersion = DataStoreVersions.CURRENT_VERSION - 1;
shardManager2.tell(
new ShardLeaderStateChanged(memberId2, memberId2, mock(DataTree.class), leaderVersion),
mockShardActor2);
shardManager2.tell(
new RoleChangeNotification(memberId2, RaftState.Candidate.name(), RaftState.Leader.name()),
mockShardActor2);
shardManager1.underlyingActor().waitForMemberUp();
shardManager1.tell(new FindPrimary("astronauts", false), getRef());
RemotePrimaryShardFound found = expectMsgClass(duration("5 seconds"), RemotePrimaryShardFound.class);
String path = found.getPrimaryPath();
assertTrue("Unexpected primary path " + path, path.contains("member-2-shard-astronauts-config"));
assertEquals("getPrimaryVersion", leaderVersion, found.getPrimaryVersion());
shardManager2.underlyingActor().verifyFindPrimary();
Cluster.get(system2).down(AddressFromURIString.parse("akka://[email protected]:2558"));
shardManager1.underlyingActor().waitForMemberRemoved();
shardManager1.tell(new FindPrimary("astronauts", false), getRef());
expectMsgClass(duration("5 seconds"), PrimaryNotFoundException.class);
}
};
LOG.info("testOnReceiveFindPrimaryForRemoteShard ending");
}
示例10: testWhenMultipleShardsPresentSyncStatusMustBeTrueForAllShards
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testWhenMultipleShardsPresentSyncStatusMustBeTrueForAllShards() throws Exception {
LOG.info("testWhenMultipleShardsPresentSyncStatusMustBeTrueForAllShards starting");
TestShardManager shardManager = newTestShardManager(newShardMgrProps(new MockConfiguration() {
@Override
public List<String> getMemberShardNames(final MemberName memberName) {
return Arrays.asList("default", "astronauts");
}
}));
// Initially will be false
assertEquals(false, shardManager.getMBean().getSyncStatus());
// Make default shard leader
String defaultShardId = "member-1-shard-default-" + shardMrgIDSuffix;
shardManager.onReceiveCommand(new RoleChangeNotification(defaultShardId,
RaftState.Follower.name(), RaftState.Leader.name()));
// default = Leader, astronauts is unknown so sync status remains false
assertEquals(false, shardManager.getMBean().getSyncStatus());
// Make astronauts shard leader as well
String astronautsShardId = "member-1-shard-astronauts-" + shardMrgIDSuffix;
shardManager.onReceiveCommand(new RoleChangeNotification(astronautsShardId,
RaftState.Follower.name(), RaftState.Leader.name()));
// Now sync status should be true
assertEquals(true, shardManager.getMBean().getSyncStatus());
// Make astronauts a Follower
shardManager.onReceiveCommand(new RoleChangeNotification(astronautsShardId,
RaftState.Leader.name(), RaftState.Follower.name()));
// Sync status is not true
assertEquals(false, shardManager.getMBean().getSyncStatus());
// Make the astronauts follower sync status true
shardManager.onReceiveCommand(new FollowerInitialSyncUpStatus(true, astronautsShardId));
// Sync status is now true
assertEquals(true, shardManager.getMBean().getSyncStatus());
LOG.info("testWhenMultipleShardsPresentSyncStatusMustBeTrueForAllShards ending");
}
示例11: testGetSnapshot
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testGetSnapshot() throws Exception {
LOG.info("testGetSnapshot starting");
JavaTestKit kit = new JavaTestKit(getSystem());
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("shard1", Arrays.asList("member-1")).put("shard2", Arrays.asList("member-1"))
.put("astronauts", Collections.<String>emptyList()).build());
TestActorRef<TestShardManager> shardManager = actorFactory.createTestActor(newShardMgrProps(mockConfig)
.withDispatcher(Dispatchers.DefaultDispatcherId()));
shardManager.tell(GetSnapshot.INSTANCE, kit.getRef());
Failure failure = kit.expectMsgClass(Failure.class);
assertEquals("Failure cause type", IllegalStateException.class, failure.cause().getClass());
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), ActorRef.noSender());
waitForShardInitialized(shardManager, "shard1", kit);
waitForShardInitialized(shardManager, "shard2", kit);
shardManager.tell(GetSnapshot.INSTANCE, kit.getRef());
DatastoreSnapshot datastoreSnapshot = expectMsgClassOrFailure(DatastoreSnapshot.class, kit, "GetSnapshot");
assertEquals("getType", shardMrgIDSuffix, datastoreSnapshot.getType());
assertNull("Expected null ShardManagerSnapshot", datastoreSnapshot.getShardManagerSnapshot());
Function<ShardSnapshot, String> shardNameTransformer = ShardSnapshot::getName;
assertEquals("Shard names", Sets.newHashSet("shard1", "shard2"), Sets.newHashSet(
Lists.transform(datastoreSnapshot.getShardSnapshots(), shardNameTransformer)));
// Add a new replica
JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
TestShardManager shardManagerInstance = shardManager.underlyingActor();
shardManagerInstance.setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));
shardManager.tell(new AddShardReplica("astronauts"), kit.getRef());
mockShardLeaderKit.expectMsgClass(AddServer.class);
mockShardLeaderKit.reply(new AddServerReply(ServerChangeStatus.OK, ""));
kit.expectMsgClass(Status.Success.class);
waitForShardInitialized(shardManager, "astronauts", kit);
// Send another GetSnapshot and verify
shardManager.tell(GetSnapshot.INSTANCE, kit.getRef());
datastoreSnapshot = expectMsgClassOrFailure(DatastoreSnapshot.class, kit, "GetSnapshot");
assertEquals("Shard names", Sets.newHashSet("shard1", "shard2", "astronauts"), Sets.newHashSet(
Lists.transform(datastoreSnapshot.getShardSnapshots(), shardNameTransformer)));
ShardManagerSnapshot snapshot = datastoreSnapshot.getShardManagerSnapshot();
assertNotNull("Expected ShardManagerSnapshot", snapshot);
assertEquals("Shard names", Sets.newHashSet("shard1", "shard2", "astronauts"),
Sets.newHashSet(snapshot.getShardList()));
LOG.info("testGetSnapshot ending");
}
示例12: testAddShardReplicaWithAddServerReplyFailure
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testAddShardReplicaWithAddServerReplyFailure() throws Exception {
LOG.info("testAddShardReplicaWithAddServerReplyFailure starting");
new JavaTestKit(getSystem()) {
{
JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("astronauts", Arrays.asList("member-2")).build());
ActorRef mockNewReplicaShardActor = newMockShardActor(getSystem(), "astronauts", "member-1");
final TestActorRef<TestShardManager> shardManager = actorFactory.createTestActor(
newTestShardMgrBuilder(mockConfig).shardActor(mockNewReplicaShardActor).props()
.withDispatcher(Dispatchers.DefaultDispatcherId()), shardMgrID);
shardManager.underlyingActor()
.setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
JavaTestKit terminateWatcher = new JavaTestKit(getSystem());
terminateWatcher.watch(mockNewReplicaShardActor);
shardManager.tell(new AddShardReplica("astronauts"), getRef());
AddServer addServerMsg = mockShardLeaderKit.expectMsgClass(AddServer.class);
assertEquals("AddServer serverId", "member-1-shard-astronauts-" + shardMrgIDSuffix,
addServerMsg.getNewServerId());
mockShardLeaderKit.reply(new AddServerReply(ServerChangeStatus.TIMEOUT, null));
Failure failure = expectMsgClass(duration("5 seconds"), Failure.class);
assertEquals("Failure cause", TimeoutException.class, failure.cause().getClass());
shardManager.tell(new FindLocalShard("astronauts", false), getRef());
expectMsgClass(duration("5 seconds"), LocalShardNotFound.class);
terminateWatcher.expectTerminated(mockNewReplicaShardActor);
shardManager.tell(new AddShardReplica("astronauts"), getRef());
mockShardLeaderKit.expectMsgClass(AddServer.class);
mockShardLeaderKit.reply(new AddServerReply(ServerChangeStatus.NO_LEADER, null));
failure = expectMsgClass(duration("5 seconds"), Failure.class);
assertEquals("Failure cause", NoShardLeaderException.class, failure.cause().getClass());
}
};
LOG.info("testAddShardReplicaWithAddServerReplyFailure ending");
}
示例13: testShutDown
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
@Test
public void testShutDown() throws Exception {
LOG.info("testShutDown starting");
new JavaTestKit(getSystem()) {
{
MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
.put("shard1", Arrays.asList("member-1")).put("shard2", Arrays.asList("member-1")).build());
String shardId1 = ShardIdentifier.create("shard1", MEMBER_1, shardMrgIDSuffix).toString();
ActorRef shard1 = actorFactory.createActor(MessageCollectorActor.props(), shardId1);
String shardId2 = ShardIdentifier.create("shard2", MEMBER_1, shardMrgIDSuffix).toString();
ActorRef shard2 = actorFactory.createActor(MessageCollectorActor.props(), shardId2);
ActorRef shardManager = actorFactory.createActor(newTestShardMgrBuilder(mockConfig)
.addShardActor("shard1", shard1).addShardActor("shard2", shard2).props());
shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
shardManager.tell(new ActorInitialized(), shard1);
shardManager.tell(new ActorInitialized(), shard2);
FiniteDuration duration = FiniteDuration.create(5, TimeUnit.SECONDS);
Future<Boolean> stopFuture = Patterns.gracefulStop(shardManager, duration, Shutdown.INSTANCE);
MessageCollectorActor.expectFirstMatching(shard1, Shutdown.class);
MessageCollectorActor.expectFirstMatching(shard2, Shutdown.class);
try {
Await.ready(stopFuture, FiniteDuration.create(500, TimeUnit.MILLISECONDS));
fail("ShardManager actor stopped without waiting for the Shards to be stopped");
} catch (TimeoutException e) {
// expected
}
actorFactory.killActor(shard1, this);
actorFactory.killActor(shard2, this);
Boolean stopped = Await.result(stopFuture, duration);
assertEquals("Stopped", Boolean.TRUE, stopped);
}
};
LOG.info("testShutDown ending");
}
示例14: AbstractGenericCreator
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; //导入依赖的package包/类
AbstractGenericCreator(final Class<C> shardManagerClass) {
this.shardManagerClass = shardManagerClass;
cluster(new MockClusterWrapper()).configuration(new MockConfiguration()).waitTillReadyCountDownLatch(ready)
.primaryShardInfoCache(new PrimaryShardInfoFutureCache());
}