use of org.onap.so.adapters.nwrest.QueryNetworkResponse in project so by onap.
the class NetworkAdapterClientIT method queryNetworkTest.
@Test
public void queryNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
QueryNetworkResponse mockResponse = new QueryNetworkResponse();
mockResponse.setNetworkExists(true);
wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)).withQueryParam("tenantId", equalTo(TESTING_ID)).withQueryParam("networkStackId", equalTo("networkStackId")).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)));
QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId", true, "testRequestId", "serviceInstanceId");
assertEquals("Testing QueryVfModule response", true, response.getNetworkExists());
}
use of org.onap.so.adapters.nwrest.QueryNetworkResponse in project so by onap.
the class NetworkAdapterClientImpl method queryNetwork.
@Override
public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) throws NetworkAdapterClientException {
UriBuilder builder = this.getUri("/" + aaiNetworkId);
if (cloudSiteId != null) {
builder.queryParam("cloudSiteId", cloudSiteId);
}
if (tenantId != null) {
builder.queryParam("tenantId", tenantId);
}
if (networkStackId != null) {
builder.queryParam("networkStackId", networkStackId);
}
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_XML, MediaType.APPLICATION_XML).get(QueryNetworkResponse.class).get();
} catch (InternalServerErrorException e) {
throw new NetworkAdapterClientException(e.getMessage());
}
}
Aggregations