@Test public void testCreateShard() { Shardable<PostShard, PostEntity> shardable = PostShardService.create(); Key<Account> accountKey = factory().allocateId(Account.class); Key<PostEntity> postKey = factory().allocateId(accountKey, PostEntity.class); Map<Ref<PostShard>, PostShard> map = shardable.createShardMapWithRef(postKey); assertEquals(ShardConfig.POST_SHARD_COUNTER, map.size()); for (int i = 1; i <= ShardConfig.POST_SHARD_COUNTER; i++) { Ref<PostShard> ref = Ref.create(PostShard.createKey(postKey, i)); assertTrue(map.containsKey(ref)); } }
private PostShard createShard(Key<PostEntity> postKey, Integer shardNum) { return PostShard .builder() .id(ShardUtil.generateShardId(postKey, shardNum)) .comments(0L) .votes(0L) .reports(0) .build(); }
PostShardService implements Shardable<PostShard, PostEntity> { private PostShard createShard(Key<PostEntity> postKey, Integer shardNum) { return PostShard .builder() .id(ShardUtil.generateShardId(postKey, shardNum)) .comments(0L) .votes(0L) .reports(0) .build(); } }
PostShardService implements Shardable<PostShard, PostEntity> { private PostShard createShard(Key<PostEntity> postKey, Integer shardNum) { return PostShard .builder() .id(ShardUtil.generateShardId(postKey, shardNum)) .comments(0L) .votes(0L) .reports(0) .build(); }  }
PostShardService implements Shardable<PostShard, PostEntity> { private PostShard createShard(Key<PostEntity> postKey, Integer shardNum) { return PostShard .builder() .id(ShardUtil.generateShardId(postKey, shardNum)) .comments(0L) .votes(0L) .reports(0) .build(); }  @Override Map<Ref<PostShard>, PostShard> createShardMapWithRef(Iterable<Key<PostEntity>> keys); @Override Map<Key<PostShard>, PostShard> createShardMapWithKey(Iterable<Key<PostEntity>> keys); @Override Map<Ref<PostShard>, PostShard> createShardMapWithRef(Key<PostEntity> key); @Override Map<Key<PostShard>, PostShard> createShardMapWithKey(Key<PostEntity> key); @Override Key<PostShard> getRandomShardKey(Key<PostEntity> entityKey); @Override Observable<List<PostEntity>> mergeShards(Collection<? extends PostEntity> entities); Observable<List<PostEntity>> mergeShards(Collection<? extends PostEntity> entities,
      Key<Account> accountKey); @Override Observable<PostEntity> mergeShards(PostEntity entity); Observable<PostEntity> mergeShards(PostEntity entity, Key<Account> accountKey); }
PostShardService implements Shardable<PostShard, PostEntity> { private PostShard createShard(Key<PostEntity> postKey, Integer shardNum) { return PostShard .builder() .id(ShardUtil.generateShardId(postKey, shardNum)) .comments(0L) .votes(0L) .reports(0) .build(); }  @Override Map<Ref<PostShard>, PostShard> createShardMapWithRef(Iterable<Key<PostEntity>> keys); @Override Map<Key<PostShard>, PostShard> createShardMapWithKey(Iterable<Key<PostEntity>> keys); @Override Map<Ref<PostShard>, PostShard> createShardMapWithRef(Key<PostEntity> key); @Override Map<Key<PostShard>, PostShard> createShardMapWithKey(Key<PostEntity> key); @Override Key<PostShard> getRandomShardKey(Key<PostEntity> entityKey); @Override Observable<List<PostEntity>> mergeShards(Collection<? extends PostEntity> entities); Observable<List<PostEntity>> mergeShards(Collection<? extends PostEntity> entities,
      Key<Account> accountKey); @Override Observable<PostEntity> mergeShards(PostEntity entity); Observable<PostEntity> mergeShards(PostEntity entity, Key<Account> accountKey);  }