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);
}
}
Aggregations