use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-aai-common by onap.
the class RelationshipGremlinQueryTest method setup.
@Before
public void setup() {
version = new SchemaVersion("v10");
dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, loaderFactory.createLoaderForVersion(ModelType.MOXY, version), false);
}
use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-aai-common by onap.
the class RelationshipQueryTest method setup.
@Before
public void setup() {
version = new SchemaVersion("v10");
dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, loaderFactory.createLoaderForVersion(ModelType.MOXY, version), false);
}
use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-aai-common by onap.
the class UniqueRelationshipQueryTest method setup.
/**
* Setup.
*
* @throws JAXBException the JAXB exception
*/
@Before
public void setup() throws JAXBException {
version = new SchemaVersion("v10");
dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, loaderFactory.createLoaderForVersion(ModelType.MOXY, version), false);
unmarshaller = context.createUnmarshaller();
unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json");
unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false);
unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);
}
use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-aai-common by onap.
the class UniqueURIQueryTest method parentQuery.
/**
* Parent query.
*
* @throws UnsupportedEncodingException the unsupported encoding exception
* @throws AAIException the AAI exception
*/
@Test
public void parentQuery() throws UnsupportedEncodingException, AAIException {
version = new SchemaVersion("v10");
dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, loaderFactory.createLoaderForVersion(ModelType.MOXY, version), false);
URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build();
String key = "complex/key1";
QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri);
GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", key);
String parentResultType = "";
String resultType = "complex";
String containerType = "";
testSet(query, expected, expected, parentResultType, resultType, containerType);
}
use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-aai-common by onap.
the class AbstractGraphTraversalBuilderOptmizationTest method setupData.
protected void setupData(int tenantNum, int vserverPerTenantNum, String prefix) throws Exception {
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
graph = AAIGraph.getInstance().getGraph();
dbEngine = new JanusGraphDBEngine(queryStyle, loader);
g = dbEngine.startTransaction().traversal();
dbser = new DBSerializer(schemaVersions.getDefaultVersion(), dbEngine, introspectorFactoryType, "AAI-TEST-" + prefix);
rand = new Random();
Vertex cr;
Vertex tenant;
Vertex vserver;
String crUri;
String tenantUri;
String vserverUri;
System.out.println("Data load started");
long startTime = System.currentTimeMillis();
for (int crCtr = 0; crCtr < 3; crCtr++) {
crUri = String.format(crUriPattern, prefix + "cloud-owner-" + crCtr, prefix + "cloud-region-id-" + crCtr);
// System.out.println(crUri);
cr = g.addV(CLOUD_REGION).property(AAIProperties.NODE_TYPE, CLOUD_REGION).property(CLOUD_REGION_ID, prefix + "cloud-region-id-" + crCtr).property(CLOUD_OWNER, prefix + "cloud-owner-" + crCtr).property(AAIProperties.AAI_URI, crUri).next();
for (int i = 0; i < tenantNum; i++) {
Introspector intro = loader.introspectorFromName(TENANT);
tenant = dbser.createNewVertex(intro);
edgeSer.addTreeEdge(g, cr, tenant);
intro.setValue(TENANT_ID, prefix + "tenant-id-" + i);
intro.setValue(TENANT_NAME, prefix + "tenant-name-" + i);
dbser.serializeSingleVertex(tenant, intro, "AAI-TEST-" + prefix);
// System.out.println("Tenant " + crCtr + " " + i);
for (int j = 0; j < vserverPerTenantNum; j++) {
intro = loader.introspectorFromName(VSERVER);
vserver = dbser.createNewVertex(intro);
edgeSer.addTreeEdge(g, tenant, vserver);
intro.setValue(VSERVER_ID, prefix + "vserver-id-" + i + "-" + j);
intro.setValue(VSERVER_NAME, prefix + "vserver-name-" + i + "-" + j);
intro.setValue(PROV_STATUS, RANDOM_VALUES.get(rand.nextInt(RANDOM_VALUES.size())));
intro.setValue(VSERVER_SELFLINK, RANDOM_VALUES.get(rand.nextInt(RANDOM_VALUES.size())));
dbser.serializeSingleVertex(vserver, intro, "AAI-TEST-" + prefix);
// System.out.println("Vserver " + crCtr + " " + i + " " + j);
}
}
}
// g.V().forEachRemaining(v -> v.properties().forEachRemaining(p -> System.out.println(p.key() + " : " +
// p.value())));
// g.E().forEachRemaining(e -> System.out.println(e.outVertex().property(AAIProperties.NODE_TYPE).value() + " :
// " + e.inVertex().property(AAIProperties.NODE_TYPE).value()));
long time = System.currentTimeMillis() - startTime;
System.out.println("Data load ended\n" + time);
}
Aggregations