use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterRestRepTest method testRejectLocal.
@Test
public void testRejectLocal() {
VirtualDataCenterRestRep vdc = new VirtualDataCenterRestRep();
vdc.setLocal(true);
vdc.setConnectionStatus("CONNECTED");
Assert.assertFalse("disconnect should fail on a local vdc", vdc.canDisconnect());
vdc.setConnectionStatus("DISCONNECTED");
Assert.assertFalse("reconnect should fail on a local vdc", vdc.canReconnect());
}
use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class GeoMode method setupGeoTenantModeBase.
@BeforeClass
public static void setupGeoTenantModeBase() throws Exception {
VirtualDataCenters vdcs = superUserClient.vdcs();
List<NamedRelatedResourceRep> list = vdcs.list();
for (NamedRelatedResourceRep vdc : list) {
VirtualDataCenterRestRep restRep = superUserClient.vdcs().get(vdc.getId());
vdcList.add(restRep);
}
if (vdcList.size() < 2) {
String errorMsg = "env check fail, only one VDC, Geo test need at least 2 vdcs";
logger.error(errorMsg);
throw new Exception(errorMsg);
}
logger.info("grant " + superUser + " security admin in both VDCs");
ViPRCoreClient vdc1RootClient = new ViPRCoreClient(getVdcEndpointByIndex(0), true).withLogin("root", rootPassword);
ViPRClientHelper vdc1Helper = new ViPRClientHelper(vdc1RootClient);
vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SecurityAdmin.toString());
vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemAdmin.toString());
vdc1Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemMonitor.toString());
vdc1RootClient.auth().logout();
ViPRCoreClient vdc2RootClient = new ViPRCoreClient(getVdcEndpointByIndex(1), true).withLogin("root", rootPassword);
ViPRClientHelper vdc2Helper = new ViPRClientHelper(vdc2RootClient);
vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SecurityAdmin.toString());
vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemAdmin.toString());
vdc2Helper.addRoleAssignment(null, superUser, RoleOrAcl.SystemMonitor.toString());
vdc2RootClient.auth().logout();
}
use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterRestRepTest method testShouldAlarm.
@Test
public void testShouldAlarm() {
VirtualDataCenterRestRep vdc = new VirtualDataCenterRestRep();
Assert.assertFalse("should not alarm if lastSeenTimeInMillis is null", vdc.shouldAlarm());
vdc.setLastSeenTimeInMillis(System.currentTimeMillis());
Assert.assertFalse("should not alarm if lastSeenTimeInMillis is now", vdc.shouldAlarm());
vdc.setLastSeenTimeInMillis(System.currentTimeMillis() - 24 * 3600 * 1000);
Assert.assertTrue("should alarm if lastSeenTimeInMillis is 1 days ago", vdc.shouldAlarm());
}
use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterRestRepTest method testNullSafe.
@Test
public void testNullSafe() {
VirtualDataCenterRestRep vdc = new VirtualDataCenterRestRep();
vdc.canDisconnect();
vdc.canReconnect();
vdc.setLocal(true);
vdc.canDisconnect();
vdc.canReconnect();
}
use of com.emc.storageos.model.vdc.VirtualDataCenterRestRep in project coprhd-controller by CoprHD.
the class VirtualDataCenterRestRepTest method testCanReconnect.
@Test
public void testCanReconnect() {
VirtualDataCenterRestRep vdc = new VirtualDataCenterRestRep();
vdc.setLocal(false);
vdc.setConnectionStatus("DISCONNECTED");
Assert.assertTrue("reconnect should work on a DISCONNECTED non-local vdc", vdc.canReconnect());
}
Aggregations