use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class CloudIdentityTest method testCloudIdentity.
@Test
public final void testCloudIdentity() {
CloudIdentity id = new CloudIdentity();
id.setAdminTenant("AdminTenant");
id.setId("id");
// id.setKeystoneUrl ("keystone");
id.setIdentityUrl("keystone");
id.setMemberRole("member");
id.setMsoId("msoId");
id.setMsoPass(CryptoUtils.encryptCloudConfigPassword("password"));
id.setTenantMetadata(true);
id.setIdentityServerType(null);
id.setIdentityAuthenticationType(null);
assertTrue(id.getAdminTenant().equals("AdminTenant"));
assertTrue(id.getId().equals("id"));
// assertTrue (id.getKeystoneUrl ().equals ("keystone"));
assertTrue(id.getMemberRole().equals("member"));
assertTrue(id.getMsoId().equals("msoId"));
assertTrue(CryptoUtils.decryptCloudConfigPassword(id.getMsoPass()).equals("password"));
assertTrue(id.getTenantMetadata());
// assertTrue (id.toString ().contains ("keystone"));
assertTrue(id.toString().contains("null"));
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class CloudIdentityTest method cloneTest.
@Test
public void cloneTest() {
cloudIdentity = setupCloudIdentity(cloudIdentity, ID, IDENTITY_URL, MSO_ID, MSO_PASS, ADMIN_TENANT, MEMBER_ROLE, TENANT_METADATA, ServerType.ORM, AuthenticationType.USERNAME_PASSWORD);
CloudIdentity cloudIdentity2 = cloudIdentity.clone();
assertEquals(cloudIdentity.getClass(), cloudIdentity2.getClass());
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class CloudConfigTest method createCloudSiteRest_TEST.
@Test
@Transactional
public void createCloudSiteRest_TEST() {
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
CloudSite cloudSite = new CloudSite();
cloudSite.setId("MTN7");
cloudSite.setClli("TESTCLLI");
cloudSite.setRegionId("regionId");
cloudSite.setCloudVersion("VERSION");
cloudSite.setPlatform("PLATFORM");
CloudIdentity cloudIdentity = new CloudIdentity();
cloudIdentity.setId("RANDOMID-test");
cloudIdentity.setIdentityUrl("URL");
cloudIdentity.setMsoId("MSO_ID");
cloudIdentity.setMsoPass("MSO_PASS");
cloudIdentity.setAdminTenant("ADMIN_TENANT");
cloudIdentity.setMemberRole("ROLE");
cloudIdentity.setIdentityServerType(ServerType.KEYSTONE);
cloudIdentity.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY);
cloudSite.setIdentityService(cloudIdentity);
String uri = "/cloudSite";
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + uri);
HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers);
ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, request, String.class);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value());
builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + uri + "/" + cloudSite.getId());
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
ResponseEntity<CloudSite> actualCloudSite = restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, CloudSite.class);
builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + uri);
ResponseEntity<String> cloudSiteString = restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
System.out.println(cloudSiteString.getBody());
assertEquals(Response.Status.OK.getStatusCode(), actualCloudSite.getStatusCode().value());
assertThat(actualCloudSite.getBody(), sameBeanAs(cloudSite).ignoring("created").ignoring("updated").ignoring("identityService.created").ignoring("identityService.updated"));
}
use of org.onap.so.db.catalog.beans.CloudIdentity 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");
}
use of org.onap.so.db.catalog.beans.CloudIdentity in project so by onap.
the class MsoMulticloudUtilsTest method createStackMulticloudClientIsNull.
@Ignore
@Test
public void createStackMulticloudClientIsNull() {
try {
multicloudUtilsMock.cloudConfig = cloudConfigMock;
CloudSite cloudSite = new CloudSite();
cloudSite.setIdentityService(new CloudIdentity());
when(cloudConfigMock.getCloudSite("MTN13")).thenReturn(Optional.of(cloudSite));
multicloudUtilsMock.createStack("MNT14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
} catch (MsoException e) {
assertEquals("0 : Multicloud client could not be initialized", e.toString());
return;
}
fail("MsoOpenstackException expected!");
}
Aggregations