diff options
author | Benjamin, Max <max.benjamin@att.com> | 2020-09-10 11:15:57 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-09-10 11:15:57 -0400 |
commit | f687d9f4ae7500556d78fff1b5dd461412440e01 (patch) | |
tree | d9da3e2f613886b855fe953422764ca82a2ff883 /graph-inventory/aai-client/src | |
parent | a714a448501d30fee850f878e85023db72b71f14 (diff) |
added fragment support to generated objects
added fragment support to generated objects
updated objects to support singular and plural fragments
Issue-ID: SO-3240
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ia010c99ad36422db5f5b3729af3991767fe5138f
Diffstat (limited to 'graph-inventory/aai-client/src')
16 files changed, 131 insertions, 22 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java new file mode 100644 index 0000000000..4733c55bf8 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java @@ -0,0 +1,20 @@ +package org.onap.aaiclient.client.aai.entities.uri; + +import java.io.Serializable; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment; + +public class AAIPluralFragment implements Serializable, GraphInventoryPluralFragment<AAIFluentPluralType> { + + private static final long serialVersionUID = 1L; + + private final AAIFluentPluralType type; + + public AAIPluralFragment(AAIFluentPluralType type) { + this.type = type; + } + + public AAIFluentPluralType get() { + return type; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java index 3d01258f71..3d7fc0e198 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java @@ -5,6 +5,6 @@ import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>, - GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> { + GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment> { } diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java index 40184b028b..041c02ff2d 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java @@ -26,7 +26,8 @@ import org.onap.aaiclient.client.aai.AAIObjectPlurals; import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.graphinventory.entities.uri.SimpleUri; -public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> +public class AAISimpleUri extends + SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment> implements AAIResourceUri { private static final long serialVersionUID = -6397024057188453229L; @@ -70,4 +71,16 @@ public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri return new AAISimplePluralUri(this, plural); } + @Override + public AAISimpleUri relatedTo(AAISingleFragment fragment) { + this.internalURI.path(relatedTo); + return new AAISimpleUri(this, fragment.get().build(), fragment.get().values()); + } + + @Override + public AAISimplePluralUri relatedTo(AAIPluralFragment fragment) { + this.internalURI.path(relatedTo); + return new AAISimplePluralUri(this, fragment.get().build()); + } + } diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java new file mode 100644 index 0000000000..a988899ed2 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java @@ -0,0 +1,19 @@ +package org.onap.aaiclient.client.aai.entities.uri; + +import java.io.Serializable; +import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment; + +public class AAISingleFragment implements Serializable, GraphInventorySingleFragment<AAIFluentSingleType> { + + private static final long serialVersionUID = 1L; + + private final AAIFluentSingleType type; + + public AAISingleFragment(AAIFluentSingleType type) { + this.type = type; + } + + public AAIFluentSingleType get() { + return type; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFluentTypeBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFluentTypeBase.java index 1a258fcd88..3970a36a0b 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFluentTypeBase.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFluentTypeBase.java @@ -1,16 +1,25 @@ package org.onap.aaiclient.client.graphinventory; +import java.util.Collections; import java.util.List; public interface GraphInventoryFluentTypeBase { public interface Info { - String getPartialUri(); + default String getPartialUri() { + return ""; + } - List<String> getPaths(); + default List<String> getPaths() { + return Collections.emptyList(); + } } - Object[] values(); + default Object[] values() { + return new Object[] {}; + } - String uriTemplate(); + default String uriTemplate() { + return ""; + } } diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java new file mode 100644 index 0000000000..b8cb64de30 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java @@ -0,0 +1,6 @@ +package org.onap.aaiclient.client.graphinventory; + +public interface GraphInventoryFragmentBase<T> { + + T get(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java new file mode 100644 index 0000000000..9fe3cda384 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java @@ -0,0 +1,9 @@ +package org.onap.aaiclient.client.graphinventory; + + + +public interface GraphInventoryPluralFragment<T extends GraphInventoryFluentType<? extends GraphInventoryObjectPlurals>> + extends GraphInventoryFragmentBase<T> { + + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java index c564c5d5cb..343e888ce1 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java @@ -33,8 +33,6 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel; import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper; import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; @@ -42,8 +40,10 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResou import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri; import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryMultipleItemsException; +import org.onap.so.client.RestClient; +import org.onap.so.client.RestProperties; -public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> { +public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> { protected GraphInventoryClient client; @@ -101,7 +101,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven * @return */ public void connect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); + GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); RestClient giRC = client.createClient(uriAClone.relationshipAPI()); giRC.put(this.buildRelationship(uriB)); } @@ -115,7 +115,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven * @return */ public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { - GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); + GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); RestClient giRC = client.createClient(uriAClone.relationshipAPI()); giRC.put(this.buildRelationship(uriB, label)); } @@ -128,7 +128,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven * @return */ public void disconnect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); + GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone(); RestClient giRC = client.createClient(uriAClone.relationshipAPI()); giRC.delete(this.buildRelationship(uriB)); } @@ -140,7 +140,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven * @return */ public void delete(SingleUri uri) { - GraphInventorySingleResourceUri<?, ?, ?, ?> clone = (SingleUri) uri.clone(); + GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> clone = (SingleUri) uri.clone(); RestClient giRC = client.createClient(clone); Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>() {}).orElseThrow( () -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName())); diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java new file mode 100644 index 0000000000..711b93d5b8 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java @@ -0,0 +1,7 @@ +package org.onap.aaiclient.client.graphinventory; + +public interface GraphInventorySingleFragment<T extends GraphInventoryFluentType<? extends GraphInventoryObjectType>> + extends GraphInventoryFragmentBase<T> { + + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java index 7f7822b900..4390e7e6bc 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java @@ -34,7 +34,7 @@ import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> { +public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> { protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class); diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java index 881b7e9a8e..cc286a6a6b 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java @@ -36,7 +36,7 @@ import org.onap.so.jsonpath.JsonPathUtil; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, Type extends GraphInventoryObjectType> { +public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, Type extends GraphInventoryObjectType> { protected final ObjectMapper mapper; protected Map<String, Object> map; diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java index ac0e4a0c94..fbd4130fb0 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java @@ -2,8 +2,10 @@ package org.onap.aaiclient.client.graphinventory.entities.uri; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment; +import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment; -public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals> +public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals, SingleFragment extends GraphInventorySingleFragment, PluralFragment extends GraphInventoryPluralFragment> extends GraphInventoryResourceUri<T, SingleObject> { public T resourceVersion(String version); @@ -13,4 +15,8 @@ public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleR public P relatedTo(PluralObject plural); public T relatedTo(SingleObject type, String... values); + + public P relatedTo(PluralFragment fragment); + + public T relatedTo(SingleFragment fragment); } diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java index b668f465e9..d1e9e91f48 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java @@ -22,7 +22,7 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParserSp import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; import org.springframework.web.util.UriUtils; -public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, S extends GraphInventoryObjectBase> +public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, S extends GraphInventoryObjectBase> implements GraphInventoryResourceUri<T, S> { private static final long serialVersionUID = -1011069933894179423L; diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java index d76661526c..1a3b38aff5 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java @@ -28,7 +28,7 @@ import javax.ws.rs.core.UriBuilder; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; -public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType> +public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType> extends SimpleBaseUri<T, Parent, PT> implements GraphInventoryPluralResourceUri<T, PT>, Serializable { private static final long serialVersionUID = -337701171277616439L; diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java index e6a162bfda..570856d7f4 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java @@ -27,9 +27,11 @@ import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment; +import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment; -public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals> - extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P> { +public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals, SF extends GraphInventorySingleFragment<?>, PF extends GraphInventoryPluralFragment<?>> + extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P, SF, PF> { private static final long serialVersionUID = -337701171277616439L; protected static final String relationshipAPI = "/relationship-list/relationship"; diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java index f8dd1726d3..92e74163a7 100644 --- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java @@ -32,6 +32,7 @@ import org.junit.Test; import org.onap.aaiclient.client.aai.AAIObjectPlurals; import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; public class AAISimpleUriTest { @@ -43,7 +44,14 @@ public class AAISimpleUriTest { AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER); String uriOutput = uri.build().toString(); - assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput); + + String expected = "/network/generic-vnfs/generic-vnf/test1/related-to/pservers"; + assertEquals(expected, uriOutput); + + uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") + .relatedTo(Types.PSERVERS.getFragment()); + uriOutput = uri.build().toString(); + assertEquals(expected, uriOutput); } @Test @@ -51,7 +59,17 @@ public class AAISimpleUriTest { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") .relatedTo(AAIObjectType.PSERVER, "test2"); String uriOutput = uri.build().toString(); - assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput); + + String expected = "/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2"; + assertEquals(expected, uriOutput); + + uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") + .relatedTo(Types.PSERVER.getFragment("test2")); + + uriOutput = uri.build().toString(); + + assertEquals(expected, uriOutput); + } @Test |