use of com.ctrip.xpipe.redis.console.model.ClusterTbl in project x-pipe by ctripcorp.
the class ClusterMetaServiceTest method testFindMigratingClusterMeta.
@Test
@DirtiesContext
public void testFindMigratingClusterMeta() {
ClusterTbl cluster = clusterService.find(clusterName2);
Assert.assertEquals(ClusterStatus.Migrating.toString(), cluster.getStatus());
ClusterMeta clusterMetaA = clusterMetaService.getClusterMeta(dcA, clusterName2);
ClusterMeta clusterMetaB = clusterMetaService.getClusterMeta(dcB, clusterName2);
Assert.assertEquals(dcA, clusterMetaA.getActiveDc());
Assert.assertEquals(dcB, clusterMetaB.getActiveDc());
}
use of com.ctrip.xpipe.redis.console.model.ClusterTbl in project x-pipe by ctripcorp.
the class ClusterMetaServiceTest method testFindNonMigratingClusterMeta.
@Test
@DirtiesContext
public void testFindNonMigratingClusterMeta() {
ClusterMeta clusterMetaA = clusterMetaService.getClusterMeta(dcA, clusterName1);
ClusterMeta clusterMetaB = clusterMetaService.getClusterMeta(dcB, clusterName1);
ClusterTbl cluster = clusterService.find(clusterName1);
Assert.assertEquals(ClusterStatus.Normal.toString(), cluster.getStatus());
Assert.assertNotNull(clusterMetaA);
Assert.assertNotNull(clusterMetaB);
Assert.assertEquals(dcA, clusterMetaA.getActiveDc());
Assert.assertEquals(dcA, clusterMetaB.getActiveDc());
}
use of com.ctrip.xpipe.redis.console.model.ClusterTbl in project x-pipe by ctripcorp.
the class ClusterMetaServiceTest method testGetDifferentActiveDcForDcMetaWhileMigrating.
@Test
@DirtiesContext
public void testGetDifferentActiveDcForDcMetaWhileMigrating() {
ClusterTbl clusterA = clusterService.find(clusterName1);
Assert.assertEquals(ClusterStatus.Normal.toString(), clusterA.getStatus());
ClusterTbl clusterB = clusterService.find(clusterName2);
Assert.assertEquals(ClusterStatus.Migrating.toString(), clusterB.getStatus());
DcMeta dcAMeta = dcMetaService.getDcMeta(dcA);
DcMeta dcBMeta = dcMetaService.getDcMeta(dcB);
Assert.assertEquals(dcA, dcAMeta.findCluster(clusterName1).getActiveDc());
Assert.assertEquals(dcA, dcBMeta.findCluster(clusterName1).getActiveDc());
Assert.assertEquals(dcA, dcAMeta.findCluster(clusterName2).getActiveDc());
Assert.assertEquals(dcB, dcBMeta.findCluster(clusterName2).getActiveDc());
}
use of com.ctrip.xpipe.redis.console.model.ClusterTbl in project x-pipe by ctripcorp.
the class MigrationServiceTest method createTest.
@Test
@DirtiesContext
public void createTest() throws ComponentLookupException {
long eventId = migrationService.createMigrationEvent(createEventDemo(1, 2));
MigrationEventTbl result = migrationService.find(eventId);
MigrationClusterTbl result_cluster = migrationService.findMigrationCluster(eventId, 1);
ClusterTbl cluster = clusterService.find(1);
List<MigrationShardTbl> result_shards = migrationService.findMigrationShards(result_cluster.getId());
Assert.assertEquals(eventId, result.getId());
Assert.assertEquals("unit test", result.getOperator());
Assert.assertNotNull(result_cluster);
Assert.assertEquals(1, result_cluster.getClusterId());
Assert.assertEquals(2, result_cluster.getDestinationDcId());
Assert.assertEquals(MigrationStatus.Initiated.toString(), result_cluster.getStatus());
Assert.assertEquals(ClusterStatus.Lock.toString(), cluster.getStatus());
Assert.assertEquals(2, result_shards.size());
}
Aggregations