Search in sources :

Example 1 with TestGeoObject

use of com.emc.storageos.db.client.model.TestGeoObject in project coprhd-controller by CoprHD.

the class VdcControllerTest method testRemoveVdcPreCheck.

/**
 * Remove vdc2 from vdc1
 */
// Test hanging in IDE and "gradlew test"
@Test
public void testRemoveVdcPreCheck() throws Exception {
    // create a mock db with 2 existing vdc
    dbClient.buildInitData(2);
    VirtualDataCenter vdc1 = dbClient.vdcList.get(0);
    VirtualDataCenter vdc2 = dbClient.vdcList.get(1);
    log.info("Testing precheck for removing vdc2 {} from vdc1 {}", vdc2.getId(), vdc1.getId());
    // create a geo object referencing a geo visible object in vdc2
    TestGeoObject obj = new TestGeoObject();
    obj.setId(URIUtil.createId(TestGeoObject.class));
    String varrayId = URIUtil.createId(VirtualArray.class).toString();
    varrayId = varrayId.replace("vdc1", "vdc2");
    obj.setVarray(new URI(varrayId));
    dbClient.testGeoList.add(obj);
    // Start execute vdc remove
    try {
        String reqId = "remove-taskid-0002";
        addTask(reqId, vdc2.getId());
        vdcController.removeVdc(vdc2, reqId, null);
        Assert.assertTrue("Precheck should throw an exception", false);
    } catch (Exception ex) {
        log.error("precheck error ", ex);
        Assert.assertTrue(ex instanceof FatalGeoException);
    }
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter) TestGeoObject(com.emc.storageos.db.client.model.TestGeoObject) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) FatalGeoException(com.emc.storageos.security.geo.exceptions.FatalGeoException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) BindException(java.net.BindException) ConnectionException(com.netflix.astyanax.connectionpool.exceptions.ConnectionException) GeoException(com.emc.storageos.security.geo.exceptions.GeoException) FatalGeoException(com.emc.storageos.security.geo.exceptions.FatalGeoException) Test(org.junit.Test)

Aggregations

CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 TestGeoObject (com.emc.storageos.db.client.model.TestGeoObject)1 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)1 VirtualDataCenter (com.emc.storageos.db.client.model.VirtualDataCenter)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 FatalGeoException (com.emc.storageos.security.geo.exceptions.FatalGeoException)1 GeoException (com.emc.storageos.security.geo.exceptions.GeoException)1 ConnectionException (com.netflix.astyanax.connectionpool.exceptions.ConnectionException)1 BindException (java.net.BindException)1 URI (java.net.URI)1 Test (org.junit.Test)1