diff options
Diffstat (limited to 'graph-inventory/aai-client')
5 files changed, 13 insertions, 10 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java index 378db87d9b..8b8707e533 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java @@ -25,6 +25,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIFluentTypeReverseLookup; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient; import org.onap.aaiclient.client.graphinventory.entities.DSLQuery; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; import com.google.common.collect.ImmutableMap; @@ -41,7 +42,7 @@ public class AAIDSLQueryClient @Override protected GraphInventoryUri getQueryUri() { - return AAIUriFactory.createResourceUri(AAIObjectType.DSL); + return AAIUriFactory.createResourceUri(AAIObjectType.DSL).depth(Depth.ZERO); } diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java index 3b08761568..0e404e138b 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java @@ -45,6 +45,6 @@ public interface AAIRestClientI { Optional<ServiceInstance> getServiceInstanceById(String serviceInstanceId, String serviceType, String globalSubscriberId); - void updateServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId, + void updateServiceInstance(String serviceInstanceId, String serviceType, String globalSubscriberId, ServiceInstance serviceInstance); } diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java index c31d393b36..bf9ad56da7 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java @@ -106,8 +106,8 @@ public class AAIRestClientImpl implements AAIRestClientI { } @Override - public Optional<ServiceInstance> getServiceInstanceById(String globalSubscriberId, String serviceType, - String serviceInstanceId) { + public Optional<ServiceInstance> getServiceInstanceById(String serviceInstanceId, String serviceType, + String globalSubscriberId) { Response response = new AAIResourcesClient().getFullResponse( AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId) .serviceSubscription(serviceType).serviceInstance(serviceInstanceId))); @@ -115,7 +115,7 @@ public class AAIRestClientImpl implements AAIRestClientI { } @Override - public void updateServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId, + public void updateServiceInstance(String serviceInstanceId, String serviceType, String globalSubscriberId, ServiceInstance serviceInstance) { try { new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java index a192e3828a..1438dbe51a 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java @@ -32,6 +32,7 @@ import org.onap.aaiclient.client.aai.entities.Results; import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper; import org.onap.aaiclient.client.graphinventory.entities.Pathed; import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; import com.fasterxml.jackson.core.type.TypeReference; @@ -39,7 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInventoryResultWrapper<?>, Type extends GraphInventoryObjectType> { - private Optional<String> depth = Optional.empty(); + private Optional<Depth> depth = Optional.empty(); private boolean nodesOnly = false; private Optional<GraphInventorySubgraphType> subgraph = Optional.empty(); private GraphInventoryClient client; @@ -108,7 +109,7 @@ public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInven public abstract Type createType(String name, String uri); - public S depth(String depth) { + public S depth(Depth depth) { this.depth = Optional.of(depth); return (S) this; } @@ -128,7 +129,7 @@ public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInven protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { GraphInventoryUri clone = uri.clone(); if (this.depth.isPresent()) { - clone.queryParam("depth", depth.get()); + clone.queryParam("depth", depth.get().toString()); } if (this.nodesOnly) { clone.queryParam("nodesOnly", ""); diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java index 29d862478c..a3b026a420 100644 --- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java @@ -54,6 +54,7 @@ import org.onap.aaiclient.client.graphinventory.GraphInventoryClient; import org.onap.aaiclient.client.graphinventory.GraphInventorySubgraphType; import org.onap.aaiclient.client.graphinventory.entities.Pathed; import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.client.RestClient; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -92,7 +93,7 @@ public class AAIQueryClientTest { @Test public void testCreateClient() { - String depth = "testDepth"; + Depth depth = Depth.ZERO; GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR; aaiQueryClient.depth(depth); @@ -103,7 +104,7 @@ public class AAIQueryClientTest { doReturn(aaiUri).when(aaiUri).clone(); aaiQueryClient.setupQueryParams(aaiUri); - verify(aaiUri, times(1)).queryParam("depth", depth); + verify(aaiUri, times(1)).queryParam("depth", "0"); verify(aaiUri, times(1)).queryParam("nodesOnly", ""); verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString()); } |