Search in sources :

Example 6 with DefaultMigrationShard

use of com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationShard in project x-pipe by ctripcorp.

the class SingleShardMigrationTest method prepare.

@Before
public void prepare() {
    MockitoAnnotations.initMocks(this);
    MigrationClusterTbl migrationClusterTbl = migrationService.findMigrationCluster(1L, 1L);
    migrationCluster = new DefaultMigrationCluster(executors, scheduled, migrationEvent, migrationClusterTbl, dcService, clusterService, shardService, redisService, migrationService);
    Map<Long, DcTbl> dcs = new HashMap<>();
    for (DcTbl dc : dcService.findClusterRelatedDc("cluster1")) {
        dcs.put(dc.getId(), dc);
    }
    migrationShard = new DefaultMigrationShard(migrationCluster, migrationService.findMigrationShards(1).get(0), shardService.find(1), dcs, migrationService, migrationCommandBuilder);
    migrationCluster.addNewMigrationShard(migrationShard);
}
Also used : MigrationClusterTbl(com.ctrip.xpipe.redis.console.model.MigrationClusterTbl) DcTbl(com.ctrip.xpipe.redis.console.model.DcTbl) HashMap(java.util.HashMap) DefaultMigrationCluster(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationCluster) DefaultMigrationShard(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationShard) Before(org.junit.Before)

Aggregations

DefaultMigrationShard (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationShard)6 DefaultMigrationCluster (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationCluster)4 HashMap (java.util.HashMap)3 Before (org.junit.Before)3 DcTbl (com.ctrip.xpipe.redis.console.model.DcTbl)2 MigrationClusterTbl (com.ctrip.xpipe.redis.console.model.MigrationClusterTbl)2 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)1 BadRequestException (com.ctrip.xpipe.redis.console.exception.BadRequestException)1 MigrationCluster (com.ctrip.xpipe.redis.console.migration.model.MigrationCluster)1 MigrationEvent (com.ctrip.xpipe.redis.console.migration.model.MigrationEvent)1 DefaultMigrationEvent (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationEvent)1 DefaultShardMigrationResult (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultShardMigrationResult)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Test (org.junit.Test)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 DirtiesContext (org.springframework.test.annotation.DirtiesContext)1