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;
@Override
protected GraphInventoryUri getQueryUri() {
- return AAIUriFactory.createResourceUri(AAIObjectType.DSL);
+ return AAIUriFactory.createResourceUri(AAIObjectType.DSL).depth(Depth.ZERO);
}
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;
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;
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;
}
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", "");
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;
@Test
public void testCreateClient() {
- String depth = "testDepth";
+ Depth depth = Depth.ZERO;
GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR;
aaiQueryClient.depth(depth);
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());
}