Search in sources :

Example 1 with HttpAwareUri

use of org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri in project so by onap.

the class ServiceInstanceUriTest method oneKeyClone.

@Test
public void oneKeyClone() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
    ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
    ServiceInstanceUri spy = spy(instance);
    String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
    doReturn(Optional.of(uri)).when(spy).getCachedValue();
    final URI result = ((HttpAwareUri) spy.resourceVersion("1234").clone()).locateAndBuild();
    final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
    assertEquals("result is equal", expected, result);
}
Also used : HttpAwareUri(org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri) URI(java.net.URI) Test(org.junit.Test)

Example 2 with HttpAwareUri

use of org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri in project so by onap.

the class ServiceInstanceUriTest method oneKeyQueryParams.

@Test
public void oneKeyQueryParams() throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
    ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
    ServiceInstanceUri spy = spy(instance);
    doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getObjectById(any(Object.class));
    final URI result = ((HttpAwareUri) spy.resourceVersion("1234")).locateAndBuild();
    final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
    assertEquals("result is equal", expected, result);
}
Also used : HttpAwareUri(org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri) URI(java.net.URI) Test(org.junit.Test)

Aggregations

URI (java.net.URI)2 Test (org.junit.Test)2 HttpAwareUri (org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri)2