diff options
author | Rob Daugherty <rd472p@att.com> | 2018-10-18 12:43:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-18 12:43:33 +0000 |
commit | 5f95907dfa4213d8ac23e221c194f930f568b970 (patch) | |
tree | dfed1668aeaff9402e2d2cbd663dd1e9a9e6abbd /common/src/test | |
parent | 19ca704576ea511935f7bb5d41e49886ce9a097c (diff) | |
parent | e761fa50f80b2d6888f510f67cab1d6e740fd28e (diff) |
Merge "Bug fixes October 16"
Diffstat (limited to 'common/src/test')
-rw-r--r-- | common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java | 20 |
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(); |