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)));
}
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[*]")));
}
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"));
}
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);
}
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;
}
Aggregations