use of org.onap.so.adapters.vnfrest.QueryVfModuleResponse in project so by onap.
the class VnfAdapterClientImpl method queryVfModule.
@Override
public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) throws VnfAdapterClientException {
UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId);
if (cloudSiteId != null) {
builder.queryParam("cloudSiteId", cloudSiteId);
}
if (tenantId != null) {
builder.queryParam("tenantId", tenantId);
}
if (vfModuleName != null) {
builder.queryParam("vfModuleName", vfModuleName);
}
builder.queryParam("skipAAI", skipAAI);
if (requestId != null) {
builder.queryParam("msoRequest.requestId", requestId);
}
if (serviceInstanceId != null) {
builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId);
}
try {
return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get();
} catch (InternalServerErrorException e) {
logger.error("InternalServerErrorException in queryVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
use of org.onap.so.adapters.vnfrest.QueryVfModuleResponse in project so by onap.
the class VnfAdapterClientIT method queryVfModuleTest.
@Test
public void queryVfModuleTest() throws JsonProcessingException, VnfAdapterClientException {
QueryVfModuleResponse mockResponse = new QueryVfModuleResponse();
mockResponse.setVnfId(AAI_VNF_ID);
mockResponse.setVfModuleId(AAI_VF_MODULE_ID);
wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)).withQueryParam("tenantId", equalTo(TESTING_ID)).withQueryParam("vfModuleName", equalTo("someName")).withQueryParam("skipAAI", equalTo("true")).withQueryParam("msoRequest.requestId", equalTo("testRequestId")).withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, "someName", true, "testRequestId", "serviceInstanceId");
assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId());
}
Aggregations