use of org.onap.aai.domain.yang.OperationalEnvironment in project so by onap.
the class CreateVnfOperationalEnvironmentTest method testGetSearchKey.
@Test
public void testGetSearchKey() {
createVnfOpEnv.setRequest(request);
OperationalEnvironment ecompEnv = new OperationalEnvironment();
ecompEnv.setTenantContext("Test");
ecompEnv.setWorkloadContext("ECOMPL_PSL");
assertEquals("Test.ECOMPL_PSL.*", createVnfOpEnv.getSearchKey(ecompEnv));
}
use of org.onap.aai.domain.yang.OperationalEnvironment in project so by onap.
the class AAIClientHelperTest method testUpdateSuccess.
@Test
public void testUpdateSuccess() {
wireMockServer.stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
OperationalEnvironment ecompEnv = new OperationalEnvironment();
ecompEnv.setTenantContext("Test");
ecompEnv.setWorkloadContext("ECOMPL_PSL");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
doNothing().when(clientHelper).updateAaiOperationalEnvironment(any(String.class), any(OperationalEnvironment.class));
clientHelper.updateAaiOperationalEnvironment("EMOE-001", ecompEnv);
verify(clientHelper, times(1)).updateAaiOperationalEnvironment("EMOE-001", ecompEnv);
} catch (Exception e) {
fail("shouldn't reach here");
}
}
use of org.onap.aai.domain.yang.OperationalEnvironment in project so by onap.
the class AAIClientHelperTest method testcreateRelationshipSuccess.
@Test
public void testcreateRelationshipSuccess() {
wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
OperationalEnvironment ecompEnv = new OperationalEnvironment();
ecompEnv.setTenantContext("Test");
ecompEnv.setWorkloadContext("ECOMPL_PSL");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
doNothing().when(clientHelper).createRelationship(anyString(), anyString());
clientHelper.createRelationship("managingEcomp", "vnfOp");
verify(clientHelper, times(1)).createRelationship("managingEcomp", "vnfOp");
} catch (Exception e) {
fail("shouldn't reach here");
}
}
use of org.onap.aai.domain.yang.OperationalEnvironment in project so by onap.
the class AAIClientHelperTest method testGetAaiOperationalEnvironmentSuccess.
@Test
public void testGetAaiOperationalEnvironmentSuccess() throws Exception {
wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED)));
AAIResultWrapper wrapper = clientHelper.getAaiOperationalEnvironment("EMOE-001");
Optional<OperationalEnvironment> aaiOpEnv = wrapper.asBean(OperationalEnvironment.class);
assertEquals("EMOE-001", aaiOpEnv.get().getOperationalEnvironmentId());
}
use of org.onap.aai.domain.yang.OperationalEnvironment in project so by onap.
the class AAIClientHelperTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
OperationalEnvironment ecompEnv = new OperationalEnvironment();
ecompEnv.setOperationalEnvironmentId("opeEvnId");
ecompEnv.setTenantContext("Test");
ecompEnv.setWorkloadContext("ECOMPL_PSL");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
doNothing().when(clientHelper).createOperationalEnvironment(any(OperationalEnvironment.class));
clientHelper.createOperationalEnvironment(ecompEnv);
verify(clientHelper, times(1)).createOperationalEnvironment(ecompEnv);
} catch (Exception e) {
fail("shouldn't reach here");
}
}
Aggregations