Search in sources :

Example 31 with ClusterTbl

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());
}
Also used : ClusterTbl(com.ctrip.xpipe.redis.console.model.ClusterTbl) ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) AbstractConsoleIntegrationTest(com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 32 with ClusterTbl

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());
}
Also used : ClusterTbl(com.ctrip.xpipe.redis.console.model.ClusterTbl) ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) AbstractConsoleIntegrationTest(com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 33 with ClusterTbl

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());
}
Also used : ClusterTbl(com.ctrip.xpipe.redis.console.model.ClusterTbl) DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta) AbstractConsoleIntegrationTest(com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 34 with ClusterTbl

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());
}
Also used : MigrationClusterTbl(com.ctrip.xpipe.redis.console.model.MigrationClusterTbl) ClusterTbl(com.ctrip.xpipe.redis.console.model.ClusterTbl) MigrationClusterTbl(com.ctrip.xpipe.redis.console.model.MigrationClusterTbl) MigrationShardTbl(com.ctrip.xpipe.redis.console.model.MigrationShardTbl) MigrationEventTbl(com.ctrip.xpipe.redis.console.model.MigrationEventTbl) AbstractConsoleIntegrationTest(com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Aggregations

ClusterTbl (com.ctrip.xpipe.redis.console.model.ClusterTbl)34 Test (org.junit.Test)28 MigrationClusterTbl (com.ctrip.xpipe.redis.console.model.MigrationClusterTbl)20 DirtiesContext (org.springframework.test.annotation.DirtiesContext)19 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)10 ClusterMeta (com.ctrip.xpipe.redis.core.entity.ClusterMeta)10 AbstractMigrationTest (com.ctrip.xpipe.redis.console.migration.AbstractMigrationTest)6 DcMeta (com.ctrip.xpipe.redis.core.entity.DcMeta)5 DcTbl (com.ctrip.xpipe.redis.console.model.DcTbl)4 AbstractConsoleTest (com.ctrip.xpipe.redis.console.AbstractConsoleTest)3 RetMessage (com.ctrip.xpipe.redis.console.controller.api.RetMessage)3 ClusterCreateInfo (com.ctrip.xpipe.redis.console.controller.api.data.meta.ClusterCreateInfo)3 AbstractExceptionLogTask (com.ctrip.xpipe.concurrent.AbstractExceptionLogTask)1 XPipeConsoleConstant (com.ctrip.xpipe.redis.console.constant.XPipeConsoleConstant)1 KeeperContainerCreateInfo (com.ctrip.xpipe.redis.console.controller.api.data.meta.KeeperContainerCreateInfo)1 ClusterDao (com.ctrip.xpipe.redis.console.dao.ClusterDao)1 ServerException (com.ctrip.xpipe.redis.console.exception.ServerException)1 RetryCondition (com.ctrip.xpipe.redis.console.job.retry.RetryCondition)1 RetryNTimesOnCondition (com.ctrip.xpipe.redis.console.job.retry.RetryNTimesOnCondition)1 ClusterStatus (com.ctrip.xpipe.redis.console.migration.status.ClusterStatus)1