diff options
author | James Forsyth <jf2512@att.com> | 2019-01-02 22:01:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-01-02 22:01:23 +0000 |
commit | 1dd67efcaf40c5b4278ad8594b78f63a838514ca (patch) | |
tree | 75ea432b8fc5ac585f4031f87a7f07802e93d703 /aai-core/src/test | |
parent | e47092116ce15474412506a967f009a28ee396eb (diff) | |
parent | 69c5de8f6d5f4f05e152094bc1e40c03922dcd72 (diff) |
Merge "Update DBSerializer for relationships retrieving"
Diffstat (limited to 'aai-core/src/test')
-rw-r--r-- | aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java index 5041c7d1..42775cbf 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java @@ -47,6 +47,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.*; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -714,18 +715,27 @@ public class DbSerializerTest extends AAISetup { @Test public void addRelatedToPropertyTest() throws AAIException { + engine.startTransaction(); + + Vertex gvnf = engine.tx().addVertex("aai-node-type","generic-vnf", + "vnf-id","myname", + "vnf-name","myname", + "aai-uri", "/network/generic-vnfs/generic-vnf/myname" + ); + engine.tx().addVertex("aai-node-type","vnfc","vnfc-name","a-name", "aai-uri", "/network/vnfcs/vnfc/a-name"); Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getAppRootVersion()); Introspector gv = loader.introspectorFromName("generic-vnf"); gv.setValue("vnf-name", "myname"); + Introspector rel = loader.introspectorFromName("relationship"); DBSerializer dbser = new DBSerializer(schemaVersions.getAppRootVersion(), dbEngine, ModelType.MOXY, "AAI-TEST"); - dbser.addRelatedToProperty(rel, gv); + dbser.addRelatedToProperty(rel, gvnf, "generic-vnf"); List<Introspector> relToProps = rel.getWrappedListValue("related-to-property"); - assertTrue(relToProps.size() == 1); + assertThat(relToProps.size(), is(1)); Introspector relToProp = relToProps.get(0); - assertTrue("generic-vnf.vnf-name".equals(relToProp.getValue("property-key"))); - assertTrue("myname".equals(relToProp.getValue("property-value"))); + assertThat(relToProp.getValue("property-key"), is("generic-vnf.vnf-name")); + assertThat(relToProp.getValue("property-value"), is("myname")); } @Test |