jdbishard.dropwizard.testapp.staticsharding.StaticShardService Maven / Gradle / Ivy
The newest version!
package jdbishard.dropwizard.testapp.staticsharding;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import jdbishard.sharding.ImmutableShardInfo;
import jdbishard.sharding.ShardInfo;
import jdbishard.sharding.ShardService;
import jdbishard.testsupport.TestDbs;
import jdbishard.testsupport.TestIds;
public class StaticShardService implements ShardService {
@Override
public Set> retrieveShards() {
ShardInfo anya = ImmutableShardInfo.builder()
.id(TestIds.SHARD_ANYA_ID)
.name("igrew")
.url(TestDbs.SHARD_ANYA_DB_URL)
.build();
ShardInfo becky = ImmutableShardInfo.builder()
.id(TestIds.SHARD_BECKY_ID)
.name("igrew")
.url(TestDbs.SHARD_BECKY_DB_URL)
.build();
return ImmutableSet.of(anya, becky);
}
@Override
public Map retrieveShardMappings() {
return ImmutableMap.of(
TestIds.CLIENT_1_ID, TestIds.SHARD_ANYA_ID,
TestIds.CLIENT_2_ID, TestIds.SHARD_ANYA_ID,
TestIds.CLIENT_3_ID, TestIds.SHARD_ANYA_ID,
TestIds.CLIENT_4_ID, TestIds.SHARD_BECKY_ID);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy