import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.*;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.*;
import org.onap.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.serialization.db.DBSerializer;
import org.onap.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.serialization.db.DBSerializer;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
private final static ModelType introspectorFactoryType = ModelType.MOXY;
private final static DBConnectionType type = DBConnectionType.REALTIME;
private static Loader loader;
private final static ModelType introspectorFactoryType = ModelType.MOXY;
private final static DBConnectionType type = DBConnectionType.REALTIME;
private static Loader loader;
@Mock private QueryParser uriQuery;
@Rule public ExpectedException thrown = ExpectedException.none();
@Mock private QueryParser uriQuery;
@Rule public ExpectedException thrown = ExpectedException.none();
@Parameterized.Parameter(value = 0)
public QueryStyle queryStyle;
@Parameterized.Parameters(name = "QueryStyle.{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
@Parameterized.Parameter(value = 0)
public QueryStyle queryStyle;
@Parameterized.Parameters(name = "QueryStyle.{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
graph.traversal().addV("aai-node-type", "model", "model-invariant-id", "key1", AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1").as("v1")
.addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key2", "model-version", "testValue", AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1/model-vers/model-ver/key2")
.addOutE("org.onap.relationships.inventory.BelongsTo", "v1", EdgeProperty.CONTAINS.toString(), true)
graph.traversal().addV("aai-node-type", "model", "model-invariant-id", "key1", AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1").as("v1")
.addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key2", "model-version", "testValue", AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1/model-vers/model-ver/key2")
.addOutE("org.onap.relationships.inventory.BelongsTo", "v1", EdgeProperty.CONTAINS.toString(), true)
@Test
public void runPopulatePersonaModelVer() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException {
@Test
public void runPopulatePersonaModelVer() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException {
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("model-invariant-id", "key1");
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("model-invariant-id", "key1");
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
- DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
+ DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
@Test
public void runPopulateModelVersionId() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException {
@Test
public void runPopulateModelVersionId() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException {
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("persona-model-id", "key1");
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("persona-model-id", "key1");
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
- DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
+ DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
@Test
public void verifyNestedSideEffect() throws URISyntaxException, AAIException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, IOException {
@Test
public void verifyNestedSideEffect() throws URISyntaxException, AAIException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, IOException {
final Introspector obj = loader.unmarshal("customer", this.getJsonString("nested-case.json"));
//System.out.println(obj.marshal(true));
TransactionalGraphEngine spy = spy(dbEngine);
final Introspector obj = loader.unmarshal("customer", this.getJsonString("nested-case.json"));
//System.out.println(obj.marshal(true));
TransactionalGraphEngine spy = spy(dbEngine);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(uriQuery.isDependent()).thenReturn(false);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(uriQuery.isDependent()).thenReturn(false);
- DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
+ DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
Vertex v= serializer.createNewVertex(obj);
serializer.serializeToDb(obj, v, uriQuery, obj.getURI(), "test");
Vertex v= serializer.createNewVertex(obj);
serializer.serializeToDb(obj, v, uriQuery, obj.getURI(), "test");
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("model-invariant-id", "key1");
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("model-invariant-id", "key1");
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
- DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
+ DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("model-invariant-id", "key3");
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
obj.setValue("model-invariant-id", "key3");
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
- DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
+ DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
final Introspector obj = loader.introspectorFromName("generic-vnf");
obj.setValue("vnf-id", "myId");
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
when(adminSpy.getTraversalSource()).thenReturn(traversal);
when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop);
when(prop.orElse(null)).thenReturn(obj.getURI());
- DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST");
+ DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();
SideEffectRunner runner = new SideEffectRunner
.Builder(spy, serializer).addSideEffect(DataCopy.class).build();