Make its callers invoke it in a static way, without an instance.
Change-Id: Ic444a74af5c714b9b3e49ebc61fc97cf24d59d71
Signed-off-by: Robert Varga <rovarga@cisco.com>
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
YangInstanceIdentifier entityId = ENTITY_ID1;
Entity entity = new Entity(ENTITY_TYPE, entityId);
YangInstanceIdentifier entityId = ENTITY_ID1;
Entity entity = new Entity(ENTITY_TYPE, entityId);
ImmutableMap.<String, String>builder().put(peerId, peer.path().toString()).build()).
withDispatcher(Dispatchers.DefaultDispatcherId()));
ImmutableMap.<String, String>builder().put(peerId, peer.path().toString()).build()).
withDispatcher(Dispatchers.DefaultDispatcherId()));
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
YangInstanceIdentifier entityId = ENTITY_ID1;
Entity entity = new Entity(ENTITY_TYPE, entityId);
YangInstanceIdentifier entityId = ENTITY_ID1;
Entity entity = new Entity(ENTITY_TYPE, entityId);
ImmutableMap.<String, String>builder().put(peerId, peer.path().toString()).build()).
withDispatcher(Dispatchers.DefaultDispatcherId()));
ImmutableMap.<String, String>builder().put(peerId, peer.path().toString()).build()).
withDispatcher(Dispatchers.DefaultDispatcherId()));
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
// Drop AppendEntries and wait enough time for the shard to switch to IsolatedLeader.
follower.dropAppendEntries = true;
// Drop AppendEntries and wait enough time for the shard to switch to IsolatedLeader.
follower.dropAppendEntries = true;
public void testOnUnregisterCandidateLocal() throws Exception {
ShardTestKit kit = new ShardTestKit(getSystem());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
public void testOnUnregisterCandidateLocal() throws Exception {
ShardTestKit kit = new ShardTestKit(getSystem());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
public void testOwnershipChanges() throws Exception {
ShardTestKit kit = new ShardTestKit(getSystem());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
public void testOwnershipChanges() throws Exception {
ShardTestKit kit = new ShardTestKit(getSystem());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
withDispatcher(Dispatchers.DefaultDispatcherId()), leaderId.toString());
leader.tell(new ElectionTimeout(), leader);
withDispatcher(Dispatchers.DefaultDispatcherId()), leaderId.toString());
leader.tell(new ElectionTimeout(), leader);
- kit.waitUntilLeader(leader);
+ ShardTestKit.waitUntilLeader(leader);
// Send PeerDown and PeerUp with no entities
// Send PeerDown and PeerUp with no entities
peer2.tell(new PeerDown(LOCAL_MEMBER_NAME, leaderId.toString()), ActorRef.noSender());
peer2.tell(new ElectionTimeout(), peer2);
peer2.tell(new PeerDown(LOCAL_MEMBER_NAME, leaderId.toString()), ActorRef.noSender());
peer2.tell(new ElectionTimeout(), peer2);
- kit.waitUntilLeader(peer2);
+ ShardTestKit.waitUntilLeader(peer2);
verifyOwner(peer2, ENTITY_TYPE, ENTITY_ID4, "");
verifyOwner(peer2, ENTITY_TYPE, ENTITY_ID3, peerMemberName2);
verifyOwner(peer2, ENTITY_TYPE, ENTITY_ID4, "");
verifyOwner(peer2, ENTITY_TYPE, ENTITY_ID3, peerMemberName2);
LOCAL_MEMBER_NAME, EntityOwnerSelectionStrategyConfig.newBuilder().build()).withDispatcher(Dispatchers.DefaultDispatcherId()), leaderId.toString());
leader.tell(new ElectionTimeout(), leader);
LOCAL_MEMBER_NAME, EntityOwnerSelectionStrategyConfig.newBuilder().build()).withDispatcher(Dispatchers.DefaultDispatcherId()), leaderId.toString());
leader.tell(new ElectionTimeout(), leader);
- kit.waitUntilLeader(leader);
+ ShardTestKit.waitUntilLeader(leader);
shard.tell(new PeerAddressResolved(leaderId.toString(), leader.path().toString()), ActorRef.noSender());
shard.tell(new PeerAddressResolved(leaderId.toString(), leader.path().toString()), ActorRef.noSender());
public void testListenerRegistration() throws Exception {
ShardTestKit kit = new ShardTestKit(getSystem());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
public void testListenerRegistration() throws Exception {
ShardTestKit kit = new ShardTestKit(getSystem());
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps());
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
String otherEntityType = "otherEntityType";
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
String otherEntityType = "otherEntityType";
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps(builder.build(),
ImmutableMap.of(peerId.toString(), peer.path().toString())));
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps(builder.build(),
ImmutableMap.of(peerId.toString(), peer.path().toString())));
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps(builder.build(),
ImmutableMap.of(follower1Id.toString(), follower2.path().toString(), follower2Id.toString(), follower2.path().toString())));
TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newShardProps(builder.build(),
ImmutableMap.of(follower1Id.toString(), follower2.path().toString(), follower2Id.toString(), follower2.path().toString())));
- kit.waitUntilLeader(shard);
+ ShardTestKit.waitUntilLeader(shard);
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();
Entity entity = new Entity(ENTITY_TYPE, ENTITY_ID1);
ShardDataTree shardDataTree = shard.underlyingActor().getDataStore();