Search in sources :

Example 6 with SchemaVersion

use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.

the class VersionedScenariosTest method verifyRelsOfOldViewOfGenericVnf.

@Test
public void verifyRelsOfOldViewOfGenericVnf() throws AAIException, UnsupportedEncodingException {
    SchemaVersion oldVersion = new SchemaVersion("v11");
    Loader oldLoader = loaderFactory.getLoaderStrategy(introspectorFactoryType, oldVersion);
    DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
    String gvnfOldView = oldSerializer.dbToObject(Collections.singletonList(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).next()), oldLoader.introspectorFromName("generic-vnf"), AAIProperties.MAXIMUM_DEPTH, false, "false").marshal(false);
    assertThat(gvnfOldView, hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*]", hasSize(2)));
    assertThat(gvnfOldView, hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].relationship-label", emptyCollectionOf(String.class)));
    assertThat(gvnfOldView, hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link", containsInAnyOrder("/aai/" + oldVersion + llDefaultUri, "/aai/" + oldVersion + llDefaultUri)));
}
Also used : SchemaVersion(org.onap.aai.setup.SchemaVersion) Loader(org.onap.aai.introspection.Loader)

Example 7 with SchemaVersion

use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.

the class VersionedScenariosTest method verifyRelsOfOldViewOfLLLabeled.

@Test
public void verifyRelsOfOldViewOfLLLabeled() throws AAIException, UnsupportedEncodingException {
    SchemaVersion oldVersion = new SchemaVersion("v11");
    Loader oldLoader = loaderFactory.getLoaderStrategy(introspectorFactoryType, oldVersion);
    DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
    String llLabeledtOldView = oldSerializer.dbToObject(Collections.singletonList(engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri).next()), oldLoader.introspectorFromName("logical-link"), AAIProperties.MAXIMUM_DEPTH, false, "false").marshal(false);
    assertThat(llLabeledtOldView, not(hasJsonPath("$.relationship-list.relationship[*]")));
}
Also used : SchemaVersion(org.onap.aai.setup.SchemaVersion) Loader(org.onap.aai.introspection.Loader)

Example 8 with SchemaVersion

use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.

the class DbSerializerTest method getVertexPropertiesRelationshipOldVersionNoEdgeLabelTest.

@Test
public void getVertexPropertiesRelationshipOldVersionNoEdgeLabelTest() throws AAIException, UnsupportedEncodingException {
    SchemaVersion version = schemaVersions.getAppRootVersion();
    DBSerializer dbser = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST");
    Loader loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, version);
    engine.startTransaction();
    Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "vnf-123", "aai-uri", "/network/generic-vnfs/generic-vnf/vnf-123");
    Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "vnfc-123", "aai-uri", "/network/vnfcs/vnfc/vnfc-123");
    edgeSer.addEdge(engine.tx().traversal(), gvnf, vnfc);
    Introspector obj = loader.introspectorFromName("generic-vnf");
    obj = dbser.dbToObject(Collections.singletonList(gvnf), obj, AAIProperties.MAXIMUM_DEPTH, false, "false");
    assertFalse("Relationship does not contain edge-property", obj.getWrappedValue("relationship-list").getWrappedListValue("relationship").get(0).hasProperty("relationship-label"));
}
Also used : Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) SchemaVersion(org.onap.aai.setup.SchemaVersion) Loader(org.onap.aai.introspection.Loader) Introspector(org.onap.aai.introspection.Introspector)

Example 9 with SchemaVersion

use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.

the class UrlBuilderTest method beforeV11Id.

@Test
public void beforeV11Id() throws AAIException {
    SchemaVersion version = new SchemaVersion("v10");
    UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
    String result = builder.id(v);
    assertEquals("has protocol and host", protocolAndHost + version + "/resources/id/" + vId, result);
}
Also used : SchemaVersion(org.onap.aai.setup.SchemaVersion) Test(org.junit.Test)

Example 10 with SchemaVersion

use of org.onap.aai.setup.SchemaVersion in project aai-aai-common by onap.

the class TestUtilConfigTranslatorforDataLink method getEdgeFiles.

@Override
public Map<SchemaVersion, List<String>> getEdgeFiles() {
    Map<SchemaVersion, List<String>> input = new TreeMap<>();
    input.put(new SchemaVersion("v1"), Arrays.asList("src/test/resources/dbedgerules/DbEdgerules_one.json"));
    input.put(new SchemaVersion("v2"), Arrays.asList("src/test/resources/dbedgerules/DbEdgerules_two.json"));
    input.put(new SchemaVersion("v3"), Arrays.asList("src/test/resources/dbedgerules/DbEdgerules_three.json"));
    input.put(new SchemaVersion("v4"), Arrays.asList("src/test/resources/dbedgerules/DbEdgerules_four.json"));
    return input;
}
Also used : SchemaVersion(org.onap.aai.setup.SchemaVersion)

Aggregations

SchemaVersion (org.onap.aai.setup.SchemaVersion)78 Test (org.junit.Test)32 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)25 ArrayList (java.util.ArrayList)19 List (java.util.List)16 Loader (org.onap.aai.introspection.Loader)13 TreeMap (java.util.TreeMap)12 AAIException (org.onap.aai.exceptions.AAIException)9 TransactionalGraphEngine (org.onap.aai.serialization.engines.TransactionalGraphEngine)8 Introspector (org.onap.aai.introspection.Introspector)7 JanusGraphDBEngine (org.onap.aai.serialization.engines.JanusGraphDBEngine)7 URI (java.net.URI)6 DynamicJAXBContext (org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext)6 QueryParser (org.onap.aai.parsers.query.QueryParser)5 IOException (java.io.IOException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 Before (org.junit.Before)4 ModelType (org.onap.aai.introspection.ModelType)4 URIToObject (org.onap.aai.parsers.uri.URIToObject)4 DBRequest (org.onap.aai.rest.db.DBRequest)4