Search in sources :

Example 11 with CloudSite

use of org.onap.so.db.catalog.beans.CloudSite in project so by onap.

the class MsoHeatUtilsITTest method getHeatClientOpenStackConnectExceptionTest.

@Test(expected = MsoOpenstackException.class)
public final void getHeatClientOpenStackConnectExceptionTest() throws MsoException, IOException {
    CloudIdentity identity = getCloudIdentity();
    identity.setIdentityUrl("http://unreachable");
    CloudSite cloudSite = getCloudSite(identity);
    // mo mocks setup will cause 404 response from wiremock
    heatUtils.getHeatClient("MTN13", "TEST-tenant");
}
Also used : CloudIdentity(org.onap.so.db.catalog.beans.CloudIdentity) CloudSite(org.onap.so.db.catalog.beans.CloudSite) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 12 with CloudSite

use of org.onap.so.db.catalog.beans.CloudSite in project so by onap.

the class MsoHeatUtilsITTest method createStackSuccessTest.

@Test
public final void createStackSuccessTest() throws MsoException, IOException {
    CloudSite cloudSite = getCloudSite(getCloudIdentity());
    StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
    StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
    StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
    StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null, "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
    assertNotNull(stackInfo);
}
Also used : CloudSite(org.onap.so.db.catalog.beans.CloudSite) StackInfo(org.onap.so.openstack.beans.StackInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 13 with CloudSite

use of org.onap.so.db.catalog.beans.CloudSite in project so by onap.

the class MsoHeatUtilsITTest method getHeatClientSuccessTest.

@Test
public final void getHeatClientSuccessTest() throws MsoException, IOException {
    CloudSite cloudSite = getCloudSite(getCloudIdentity());
    StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
    Heat heatClient = heatUtils.getHeatClient("MTN13", "TEST-tenant");
    assertNotNull(heatClient);
}
Also used : Heat(com.woorea.openstack.heat.Heat) CloudSite(org.onap.so.db.catalog.beans.CloudSite) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 14 with CloudSite

use of org.onap.so.db.catalog.beans.CloudSite in project so by onap.

the class MsoHeatUtilsITTest method getHeatClientOpenStackResponseException401Test.

@Test(expected = MsoAdapterException.class)
public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException {
    CloudSite cloudSite = getCloudSite(getCloudIdentity());
    StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort);
    heatUtils.getHeatClient("MTN13", "TEST-tenant");
}
Also used : CloudSite(org.onap.so.db.catalog.beans.CloudSite) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 15 with CloudSite

use of org.onap.so.db.catalog.beans.CloudSite in project so by onap.

the class BaseTest method getCloudSite.

protected CloudSite getCloudSite(CloudIdentity identity) {
    CloudSite cloudSite = new CloudSite();
    cloudSite.setId("MTN13");
    cloudSite.setCloudVersion("3.0");
    cloudSite.setClli("MDT13");
    cloudSite.setRegionId("mtn13");
    cloudSite.setIdentityService(identity);
    return cloudSite;
}
Also used : CloudSite(org.onap.so.db.catalog.beans.CloudSite)

Aggregations

CloudSite (org.onap.so.db.catalog.beans.CloudSite)54 Test (org.junit.Test)25 MsoCloudSiteNotFound (org.onap.so.openstack.exceptions.MsoCloudSiteNotFound)13 CloudIdentity (org.onap.so.db.catalog.beans.CloudIdentity)12 MsoException (org.onap.so.openstack.exceptions.MsoException)12 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)9 StackInfo (org.onap.so.openstack.beans.StackInfo)8 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 BaseTest (org.onap.so.BaseTest)7 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)6 Keystone (com.woorea.openstack.keystone.Keystone)5 Quantum (com.woorea.openstack.quantum.Quantum)5 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)5 OpenStackRequest (com.woorea.openstack.base.client.OpenStackRequest)4 Heat (com.woorea.openstack.heat.Heat)4 Tenant (com.woorea.openstack.keystone.model.Tenant)4 Network (com.woorea.openstack.quantum.model.Network)4 MsoTenant (org.onap.so.openstack.beans.MsoTenant)4 JsonParseException (com.fasterxml.jackson.core.JsonParseException)3