return cluster;
}
@Test
public void testMapping() throws Exception {
Cluster cluster1 = newCluster("cluster1", "colo1");
Cluster cluster2 = newCluster("cluster2", "colo1");
Cluster cluster3 = newCluster("cluster3", "colo2");
getStore().publish(EntityType.CLUSTER, cluster1);
getStore().publish(EntityType.CLUSTER, cluster2);
getStore().publish(EntityType.CLUSTER, cluster3);
ColoClusterRelation relation = ColoClusterRelation.get();
Set<String> clusters = relation.getClusters("colo1");
Assert.assertNotNull(clusters);
Assert.assertEquals(2, clusters.size());
Assert.assertTrue(clusters.contains(cluster1.getName()));
Assert.assertTrue(clusters.contains(cluster2.getName()));
clusters = relation.getClusters("colo2");
Assert.assertNotNull(clusters);
Assert.assertEquals(1, clusters.size());
Assert.assertTrue(clusters.contains(cluster3.getName()));
getStore().remove(EntityType.CLUSTER, cluster1.getName());
clusters = relation.getClusters("colo1");
Assert.assertNotNull(clusters);
Assert.assertEquals(1, clusters.size());