use of org.onap.aaiclient.client.aai.entities.AAIResultWrapper in project so by onap.
the class AAIResourcesClientTest method verifyNotExistsGet.
@Test
public void verifyNotExistsGet() {
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test"));
wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())).willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
AAIResourcesClient client = aaiClient;
AAIResultWrapper result = client.get(path);
assertEquals("is empty", true, result.isEmpty());
}
use of org.onap.aaiclient.client.aai.entities.AAIResultWrapper in project so by onap.
the class AAIResourcesClientWithServiceInstanceUriTest method getAAIWrapper.
@Test
public void getAAIWrapper() {
AAIResourcesClient client = aaiClient;
AAIResultWrapper result = client.get(uri);
assertThat(result.isEmpty(), equalTo(true));
}
use of org.onap.aaiclient.client.aai.entities.AAIResultWrapper in project so by onap.
the class AAIResourcesClientWithServiceInstanceUriTest method getWithException.
@Test
public void getWithException() {
AAIResourcesClient client = aaiClient;
this.thrown.expect(IllegalArgumentException.class);
AAIResultWrapper result = client.get(uri, IllegalArgumentException.class);
}
use of org.onap.aaiclient.client.aai.entities.AAIResultWrapper in project so by onap.
the class ServiceInstanceUriTest method notfound.
@Test
public void notfound() throws IOException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json")));
ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3"));
ServiceInstanceUri spy = spy(instance);
AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class);
AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
when(mockResourcesClient.get(ArgumentMatchers.<AAIResourceUri>any(AAIResourceUri.class), ArgumentMatchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
when(wrapper.getJson()).thenReturn(content);
when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
exception.expect(GraphInventoryUriComputationException.class);
spy.locateAndBuild();
}
use of org.onap.aaiclient.client.aai.entities.AAIResultWrapper in project so by onap.
the class BBInputSetupTest method testMapConfigurations.
@Test
public void testMapConfigurations() throws JsonProcessingException {
org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration();
org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList();
org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship();
relationshipList.getRelationship().add(relationship);
expectedAAI.setRelationshipList(relationshipList);
Configuration expected = new Configuration();
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
AAIResultWrapper configurationWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
doReturn(expected).when(bbInputSetupMapperLayer).mapAAIConfiguration(isA(org.onap.aai.domain.yang.Configuration.class));
List<Configuration> configurations = new ArrayList<>();
SPY_bbInputSetup.mapConfigurations(Arrays.asList(new AAIResourceUri[] { aaiResourceUri }), configurations);
assertEquals(expected, configurations.get(0));
}
Aggregations