Search in sources :

Example 6 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class InternalVdcApiTest method testSetInUse.

@Test
public void testSetInUse() throws Exception {
    VirtualDataCenterList vdcResp = rSys.path("/vdc").get(VirtualDataCenterList.class);
    List<NamedRelatedResourceRep> vdcList = vdcResp.getVirtualDataCenters();
    Assert.assertTrue(!vdcList.isEmpty());
    URI vdcId = vdcList.get(0).getId();
    ClientResponse resp = internalVdcClient.setVdcInUse(vdcId, true);
    Assert.assertEquals(resp.getClientResponseStatus(), ClientResponse.Status.OK);
    resp = internalVdcClient.setVdcInUse(vdcId, false);
    Assert.assertEquals(resp.getClientResponseStatus(), ClientResponse.Status.OK);
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) VirtualDataCenterList(com.emc.storageos.model.vdc.VirtualDataCenterList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) Test(org.junit.Test)

Example 7 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class InternalVdcApiTest method testListVdc.

@Test
public void testListVdc() throws Exception {
    VirtualDataCenterList vdcResp = rSys.path("/vdc").get(VirtualDataCenterList.class);
    List<NamedRelatedResourceRep> vdcList = vdcResp.getVirtualDataCenters();
    VirtualDataCenterList vdcListFromInternalApi = internalVdcClient.listVdc();
    Assert.assertTrue(vdcListFromInternalApi != null);
    Assert.assertEquals(vdcList.size(), vdcListFromInternalApi.getVirtualDataCenters().size());
    Assert.assertTrue(!vdcList.isEmpty());
    URI vdcId = vdcList.get(0).getId();
    URI vdcIdFromInternalApi = vdcListFromInternalApi.getVirtualDataCenters().get(0).getId();
    Assert.assertEquals(vdcId, vdcIdFromInternalApi);
}
Also used : VirtualDataCenterList(com.emc.storageos.model.vdc.VirtualDataCenterList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) Test(org.junit.Test)

Example 8 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class InternalVdcApiTest method testGetVdc.

@Test
public void testGetVdc() throws Exception {
    VirtualDataCenterList vdcResp = rSys.path("/vdc").get(VirtualDataCenterList.class);
    List<NamedRelatedResourceRep> vdcList = vdcResp.getVirtualDataCenters();
    Assert.assertTrue(!vdcList.isEmpty());
    URI vdcId = vdcList.get(0).getId();
    VirtualDataCenterRestRep vdcFromInternalApi = internalVdcClient.getVdc(vdcId);
    Assert.assertTrue(vdcFromInternalApi != null);
    Assert.assertEquals(vdcId, vdcFromInternalApi.getId());
    Assert.assertEquals("vdc1", vdcFromInternalApi.getShortId());
}
Also used : VirtualDataCenterList(com.emc.storageos.model.vdc.VirtualDataCenterList) VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) Test(org.junit.Test)

Example 9 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class ApiTestVcenter method getVcenterIdsFromVcenterList.

private List<URI> getVcenterIdsFromVcenterList(VcenterList vcenterList) {
    List<URI> vcenterUris = new ArrayList<URI>();
    if (vcenterList == null || CollectionUtils.isEmpty(vcenterList.getVcenters())) {
        return vcenterUris;
    }
    Iterator<NamedRelatedResourceRep> vcentersIterator = vcenterList.getVcenters().iterator();
    while (vcentersIterator.hasNext()) {
        NamedRelatedResourceRep vCenter = vcentersIterator.next();
        vcenterUris.add(vCenter.getId());
    }
    return vcenterUris;
}
Also used : ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 10 with NamedRelatedResourceRep

use of com.emc.storageos.model.NamedRelatedResourceRep in project coprhd-controller by CoprHD.

the class ApiTestVcenter method getClusterIdsFromClusterList.

private List<URI> getClusterIdsFromClusterList(ClusterList clusterList) {
    List<URI> clusterUris = new ArrayList<URI>();
    if (clusterList == null || CollectionUtils.isEmpty(clusterList.getClusters())) {
        return clusterUris;
    }
    Iterator<NamedRelatedResourceRep> vcentersIterator = clusterList.getClusters().iterator();
    while (vcentersIterator.hasNext()) {
        NamedRelatedResourceRep cluster = vcentersIterator.next();
        clusterUris.add(cluster.getId());
    }
    return clusterUris;
}
Also used : ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5