Search in sources :

Example 6 with OrganizationTbl

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

the class OrganizationServiceImplTest method testGetOrgTblUpdateList2.

@Test
public void testGetOrgTblUpdateList2() {
    List<OrganizationTbl> localDbOrgs = createOrganizationTblList(10);
    organizationDao.createBatchOrganizations(localDbOrgs);
    localDbOrgs = organizationService.getAllOrganizations();
    List<OrganizationTbl> remoteDbOrgs = Lists.newArrayList(localDbOrgs);
    OrganizationTbl org = new OrganizationTbl().setOrgId(remoteDbOrgs.get(0).getOrgId()).setOrgName("test-different");
    remoteDbOrgs.set(0, org);
    List<OrganizationTbl> toUpdate = organizationService.getOrgTblUpdateList(remoteDbOrgs, localDbOrgs);
    organizationDao.updateBatchOrganizations(toUpdate);
}
Also used : OrganizationTbl(com.ctrip.xpipe.redis.console.model.OrganizationTbl) Test(org.junit.Test)

Example 7 with OrganizationTbl

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

the class ClusterCreateInfo method fromClusterTbl.

public static ClusterCreateInfo fromClusterTbl(ClusterTbl clusterTbl, DcService dcService) {
    ClusterCreateInfo clusterCreateInfo = new ClusterCreateInfo();
    clusterCreateInfo.setDesc(clusterTbl.getClusterDescription());
    clusterCreateInfo.setClusterName(clusterTbl.getClusterName());
    OrganizationTbl organizationTbl = clusterTbl.getOrganizationInfo();
    clusterCreateInfo.setOrganizationId(organizationTbl != null ? organizationTbl.getOrgId() : 0L);
    clusterCreateInfo.setClusterAdminEmails(clusterTbl.getClusterAdminEmails());
    List<DcTbl> clusterRelatedDc = dcService.findClusterRelatedDc(clusterTbl.getClusterName());
    clusterRelatedDc.forEach(dcTbl -> {
        if (dcTbl.getId() == clusterTbl.getActivedcId()) {
            clusterCreateInfo.addFirstDc(dcTbl.getDcName());
        } else {
            clusterCreateInfo.addDc(dcTbl.getDcName());
        }
    });
    return clusterCreateInfo;
}
Also used : DcTbl(com.ctrip.xpipe.redis.console.model.DcTbl) OrganizationTbl(com.ctrip.xpipe.redis.console.model.OrganizationTbl)

Aggregations

OrganizationTbl (com.ctrip.xpipe.redis.console.model.OrganizationTbl)7 Test (org.junit.Test)4 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)2 ClusterTbl (com.ctrip.xpipe.redis.console.model.ClusterTbl)1 DcTbl (com.ctrip.xpipe.redis.console.model.DcTbl)1