summaryrefslogtreecommitdiffstats
path: root/common/src/test/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-10-16 16:46:17 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-10-17 10:02:42 -0400
commite761fa50f80b2d6888f510f67cab1d6e740fd28e (patch)
tree16bbf0ee87ad7234a0da6c1cc483cf96858f6f2a /common/src/test/java
parentdae0218b5134920ddbbc76be657aebcb3314e1bd (diff)
Bug fixes October 16
Treat the VfModule returned from PrepareUpdateAAIVfModule call as an AAI object collection create, connect instanceGroup to cloudRegion Fix a typo in the name of the method for getting a variable testing mapping of instance group role test NetworkInstanceGroup role to be SUB-INTERFACE use enum value with hyphen for subtype Some updates based on feedback to java codes updated client to use optional instead of passing null added case where client sends null due to mapping issue added generic response object and pinc returns response build relationship now correctly removes wrapper Ensure that no null object gets referenced while checking if VNF is empty. Change-Id: I6177877518475c1f2e8e4e9dbd2ad1e2f3e10d18 Issue-ID: SO-1144 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/test/java')
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 63f8f652ce..22dc1cac30 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -28,15 +28,18 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -183,6 +186,21 @@ public class AAIResourcesClientTest {
AAIResultWrapper result = client.get(path, NotFoundException.class);
}
+ @Test
+ public void buildRelationshipTest() {
+ AAIResourcesClient client = createClient();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+ Relationship relationship = new Relationship();
+ relationship.setRelatedLink(uri.build().toString());
+ Relationship actual = client.buildRelationship(uri);
+ assertThat("expect equal no label", actual, sameBeanAs(relationship));
+
+ relationship.setRelationshipLabel(AAIEdgeLabel.USES.toString());
+ actual = client.buildRelationship(uri, AAIEdgeLabel.USES);
+ assertThat("expect equal has label", actual, sameBeanAs(relationship));
+
+ }
+
private AAIResourcesClient createClient() {
AAIResourcesClient client = spy(new AAIResourcesClient());
doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();