Search in sources :

Example 11 with VirtualDataCenterRestRep

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());
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) Test(org.junit.Test)

Example 12 with VirtualDataCenterRestRep

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();
}
Also used : VirtualDataCenters(com.emc.vipr.client.core.VirtualDataCenters) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) ViPRClientHelper(com.emc.storageos.usermanagement.util.ViPRClientHelper) BeforeClass(org.junit.BeforeClass)

Example 13 with VirtualDataCenterRestRep

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());
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) Test(org.junit.Test)

Example 14 with VirtualDataCenterRestRep

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();
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) Test(org.junit.Test)

Example 15 with VirtualDataCenterRestRep

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());
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) Test(org.junit.Test)

Aggregations

VirtualDataCenterRestRep (com.emc.storageos.model.vdc.VirtualDataCenterRestRep)18 Test (org.junit.Test)6 URI (java.net.URI)4 FlashException (controllers.util.FlashException)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 VirtualDataCenterAddParam (com.emc.storageos.model.vdc.VirtualDataCenterAddParam)2 VirtualDataCenterList (com.emc.storageos.model.vdc.VirtualDataCenterList)2 Restrictions (controllers.deadbolt.Restrictions)2 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)1 RoleAssignmentChanges (com.emc.storageos.model.auth.RoleAssignmentChanges)1 RoleAssignmentEntry (com.emc.storageos.model.auth.RoleAssignmentEntry)1 VirtualDataCenterModifyParam (com.emc.storageos.model.vdc.VirtualDataCenterModifyParam)1 ViPRClientHelper (com.emc.storageos.usermanagement.util.ViPRClientHelper)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 VirtualDataCenters (com.emc.vipr.client.core.VirtualDataCenters)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 WebResource (com.sun.jersey.api.client.WebResource)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 GET (javax.ws.rs.GET)1