use of com.ctrip.xpipe.redis.console.model.MigrationClusterTbl in project x-pipe by ctripcorp.
the class ClusterMetaServiceImplTest method testGetClusterMetaCurrentPrimaryDcNotMigrating.
@Test
public void testGetClusterMetaCurrentPrimaryDcNotMigrating() {
long currentActiveDcId = randomInt();
long clusterId = randomInt();
long destinationDcId = currentActiveDcId + 1;
DcTbl dcTbl = new DcTbl();
ClusterTbl clusterTbl = new ClusterTbl();
clusterTbl.setId(clusterId);
clusterTbl.setActivedcId(currentActiveDcId);
when(migrationService.findLatestUnfinishedMigrationCluster(clusterId)).thenReturn(new MigrationClusterTbl().setDestinationDcId(destinationDcId));
dcTbl.setId(destinationDcId);
for (ClusterStatus clusterStatus : ClusterStatus.values()) {
if (clusterStatus == ClusterStatus.Migrating) {
continue;
}
clusterTbl.setStatus(clusterStatus.toString());
Assert.assertEquals(currentActiveDcId, clusterMetaServiceImpl.getClusterMetaCurrentPrimaryDc(dcTbl, clusterTbl));
}
}
use of com.ctrip.xpipe.redis.console.model.MigrationClusterTbl in project x-pipe by ctripcorp.
the class DefaultMigrationClusterTest method prepare.
@Before
public void prepare() {
MockitoAnnotations.initMocks(this);
dcA = dcNames[0];
dcB = dcNames[1];
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);
}
use of com.ctrip.xpipe.redis.console.model.MigrationClusterTbl in project x-pipe by ctripcorp.
the class MigrationClusterDao method updatePublishInfoById.
public void updatePublishInfoById(long id, String publishInfo) {
MigrationClusterTbl migrationClusterTbl = new MigrationClusterTbl();
migrationClusterTbl.setId(id);
migrationClusterTbl.setPublishInfo(publishInfo);
queryHandler.handleUpdate(new DalQuery<Integer>() {
@Override
public Integer doQuery() throws DalException {
return migrationClusterTblDao.updatePublishInfoById(migrationClusterTbl, MigrationClusterTblEntity.UPDATESET_FULL);
}
});
}
use of com.ctrip.xpipe.redis.console.model.MigrationClusterTbl in project x-pipe by ctripcorp.
the class MigrationClusterDao method updateStatusAndEndTimeById.
public void updateStatusAndEndTimeById(long id, MigrationStatus status, Date endTime) {
MigrationClusterTbl migrationClusterTbl = new MigrationClusterTbl();
migrationClusterTbl.setId(id);
migrationClusterTbl.setEndTime(endTime);
migrationClusterTbl.setStatus(status.toString());
queryHandler.handleUpdate(new DalQuery<Integer>() {
@Override
public Integer doQuery() throws DalException {
return migrationClusterTblDao.updateStatusAndEndTimeById(migrationClusterTbl, MigrationClusterTblEntity.UPDATESET_FULL);
}
});
}
use of com.ctrip.xpipe.redis.console.model.MigrationClusterTbl in project x-pipe by ctripcorp.
the class MigrationClusterDao method updateStartTime.
public void updateStartTime(long id, Date date) {
MigrationClusterTbl migrationClusterTbl = new MigrationClusterTbl();
migrationClusterTbl.setId(id);
migrationClusterTbl.setStartTime(date);
queryHandler.handleUpdate(new DalQuery<Integer>() {
@Override
public Integer doQuery() throws DalException {
return migrationClusterTblDao.updateStartTimeById(migrationClusterTbl, MigrationClusterTblEntity.UPDATESET_FULL);
}
});
}
Aggregations