ShardPeerAddressResolver implements PeerAddressResolver { @Override public String resolve(final String peerId) { if (peerId == null) { return null; } ShardIdentifier shardId = ShardIdentifier.fromShardIdString(peerId); return getShardActorAddress(shardId.getShardName(), shardId.getMemberName()); } ShardPeerAddressResolver(final String shardManagerType, final MemberName localMemberName); @Override String resolve(final String peerId); @Override void setResolved(final String peerId, final String address);  }
@Test public void testResolve() { String type = "config"; ShardPeerAddressResolver resolver = new ShardPeerAddressResolver(type, MEMBER_1); MemberName memberName = MEMBER_2; String peerId = ShardIdentifier.create("default", memberName, type).toString(); assertEquals("resolve", null, resolver.resolve(peerId)); Address address = new Address("tcp", "system"); resolver.addPeerAddress(memberName, address); String shardAddress = resolver.getShardActorAddress("default", memberName); assertEquals("getShardActorAddress", address.toString() + "/user/shardmanager-" + type + "/" + memberName.getName() + "-shard-default-" + type, shardAddress); assertEquals("resolve", shardAddress, resolver.resolve(peerId)); }