summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/aai/db/schema/AuditOXM.java8
-rw-r--r--src/main/java/org/onap/aai/db/schema/AuditorFactory.java5
-rw-r--r--src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java5
-rw-r--r--src/main/java/org/onap/aai/db/schema/ScriptDriver.java6
-rw-r--r--src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java12
-rw-r--r--src/test/java/org/onap/aai/db/schema/AuditOXMTest.java60
-rw-r--r--src/test/java/org/onap/aai/dbgen/DupeToolTest.java2
-rw-r--r--src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java2
-rw-r--r--src/test/resources/pserver2.graphson.P02
-rw-r--r--src/test/resources/pserver2.graphson.P13
10 files changed, 87 insertions, 18 deletions
diff --git a/src/main/java/org/onap/aai/db/schema/AuditOXM.java b/src/main/java/org/onap/aai/db/schema/AuditOXM.java
index 417824c..d7f7314 100644
--- a/src/main/java/org/onap/aai/db/schema/AuditOXM.java
+++ b/src/main/java/org/onap/aai/db/schema/AuditOXM.java
@@ -53,10 +53,12 @@ public class AuditOXM extends Auditor {
*
* @param version the version
*/
- public AuditOXM(LoaderFactory loaderFactory, SchemaVersion version) {
+ public AuditOXM(LoaderFactory loaderFactory, SchemaVersion version, EdgeIngestor ingestor) {
Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, version);
Set<String> objectNames = getAllObjects(loader);
+ this.ingestor = ingestor;
+
allObjects = new HashSet<>();
for (String key : objectNames) {
try {
@@ -220,8 +222,4 @@ public class AuditOXM extends Auditor {
public Set<Introspector> getAllIntrospectors() {
return this.allObjects;
}
-
- public void setEdgeIngestor(EdgeIngestor ingestor){
- this.ingestor = ingestor;
- }
}
diff --git a/src/main/java/org/onap/aai/db/schema/AuditorFactory.java b/src/main/java/org/onap/aai/db/schema/AuditorFactory.java
index 6d96f29..40dd047 100644
--- a/src/main/java/org/onap/aai/db/schema/AuditorFactory.java
+++ b/src/main/java/org/onap/aai/db/schema/AuditorFactory.java
@@ -20,6 +20,7 @@
package org.onap.aai.db.schema;
import org.janusgraph.core.JanusGraph;
+import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.SchemaVersion;
@@ -37,8 +38,8 @@ public class AuditorFactory {
* @param v the v
* @return the OXM auditor
*/
- public Auditor getOXMAuditor (SchemaVersion v) {
- return new AuditOXM(loaderFactory, v);
+ public Auditor getOXMAuditor (SchemaVersion v, EdgeIngestor ingestor) {
+ return new AuditOXM(loaderFactory, v, ingestor);
}
/**
diff --git a/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java b/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java
index dccc141..24aac9f 100644
--- a/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java
+++ b/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java
@@ -26,6 +26,7 @@ import org.janusgraph.core.schema.JanusGraphIndex;
import org.janusgraph.core.schema.JanusGraphManagement;
import org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder;
import org.janusgraph.core.schema.SchemaStatus;
+import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.SchemaVersion;
@@ -49,9 +50,9 @@ public class ManageJanusGraphSchema {
*
* @param graph the graph
*/
- public ManageJanusGraphSchema(final JanusGraph graph, AuditorFactory auditorFactory, SchemaVersions schemaVersions) {
+ public ManageJanusGraphSchema(final JanusGraph graph, AuditorFactory auditorFactory, SchemaVersions schemaVersions, EdgeIngestor edgeIngestor) {
this.graph = graph;
- oxmInfo = auditorFactory.getOXMAuditor(schemaVersions.getDefaultVersion());
+ oxmInfo = auditorFactory.getOXMAuditor(schemaVersions.getDefaultVersion(), edgeIngestor);
graphInfo = auditorFactory.getGraphAuditor(graph);
}
diff --git a/src/main/java/org/onap/aai/db/schema/ScriptDriver.java b/src/main/java/org/onap/aai/db/schema/ScriptDriver.java
index dca8e83..ebef01d 100644
--- a/src/main/java/org/onap/aai/db/schema/ScriptDriver.java
+++ b/src/main/java/org/onap/aai/db/schema/ScriptDriver.java
@@ -27,9 +27,9 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.codehaus.jackson.JsonGenerationException;
import org.onap.aai.dbmap.AAIGraphConfig;
+import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.logging.LoggingContext;
import org.onap.aai.logging.LoggingContext.StatusCode;
import org.onap.aai.util.AAIConfig;
@@ -47,7 +47,6 @@ public class ScriptDriver {
* @param args the arguments
* @throws AAIException the AAI exception
* @throws JsonGenerationException the json generation exception
- * @throws JsonMappingException the json mapping exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main (String[] args) throws AAIException, IOException, ConfigurationException {
@@ -76,6 +75,7 @@ public class ScriptDriver {
AuditorFactory auditorFactory = ctx.getBean(AuditorFactory.class);
SchemaVersions schemaVersions = ctx.getBean(SchemaVersions.class);
+ EdgeIngestor edgeIngestor = ctx.getBean(EdgeIngestor.class);
String config = cArgs.config;
AAIConfig.init();
@@ -94,7 +94,7 @@ public class ScriptDriver {
AuditDoc doc = null;
if ("oxm".equals(cArgs.type)) {
- doc = auditorFactory.getOXMAuditor(schemaVersions.getDefaultVersion()).getAuditDoc();
+ doc = auditorFactory.getOXMAuditor(schemaVersions.getDefaultVersion(), edgeIngestor).getAuditDoc();
} else if ("graph".equals(cArgs.type)) {
doc = auditorFactory.getGraphAuditor(graph).getAuditDoc();
}
diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
index 35e8aa2..63fd1fa 100644
--- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
+++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
@@ -31,6 +31,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.exceptions.AAIException;
import org.springframework.boot.test.rule.OutputCapture;
import java.io.File;
@@ -59,7 +60,7 @@ public class DataSnapshotTest extends AAISetup {
public OutputCapture outputCapture = new OutputCapture();
@Before
- public void setup(){
+ public void setup() throws AAIException {
JanusGraph graph = AAIGraph.getInstance().getGraph();
currentTransaction = graph.newTransaction();
g = currentTransaction.traversal();
@@ -347,7 +348,7 @@ public class DataSnapshotTest extends AAISetup {
DataSnapshot.main(args);
}
- private List<Vertex> setupPserverData(GraphTraversalSource g){
+ private List<Vertex> setupPserverData(GraphTraversalSource g) throws AAIException {
Vertex v1 = g.addV().property("aai-node-type", "pserver")
.property("hostname", "somerandomhostname")
.next();
@@ -356,6 +357,13 @@ public class DataSnapshotTest extends AAISetup {
Vertex v2 = g.addV().property("aai-node-type", "pserver")
.property("hostname", "somerandomhostname2")
.next();
+ Vertex pinterface = g.addV()
+ .property("aai-node-type", "p-interface")
+ .property("interface-name", "p-interface-name")
+ .property("in-maint", false)
+ .property("source-of-truth", "JUNIT")
+ .next();
+ edgeSerializer.addTreeEdge(g, v2, pinterface);
list.add(v2);
return list;
}
diff --git a/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java b/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java
new file mode 100644
index 0000000..cba202a
--- /dev/null
+++ b/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java
@@ -0,0 +1,60 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.db.schema;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.aai.AAISetup;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.setup.SchemaVersion;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.AdditionalMatchers.not;
+
+public class AuditOXMTest extends AAISetup {
+
+ private AuditOXM auditOXM;
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void getAllIntrospectors() {
+ auditOXM = new AuditOXM(loaderFactory, schemaVersions.getDefaultVersion(), edgeIngestor);
+ assertTrue(auditOXM.getAllIntrospectors().size() > 0);
+ }
+
+ @Test
+ public void setEdgeIngestor() {
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/dbgen/DupeToolTest.java b/src/test/java/org/onap/aai/dbgen/DupeToolTest.java
index 392ce97..1d3228e 100644
--- a/src/test/java/org/onap/aai/dbgen/DupeToolTest.java
+++ b/src/test/java/org/onap/aai/dbgen/DupeToolTest.java
@@ -100,7 +100,7 @@ public class DupeToolTest extends AAISetup {
}
@Test
- public void testDupeTool(){
+ public void testDupeToolForPInterface(){
//TODO: test does not find duplicates
String[] args = {
"-userId", "testuser",
diff --git a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java
index ddaad21..6d62098 100644
--- a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java
+++ b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java
@@ -98,7 +98,7 @@ public class ManageSchemaTest extends AAISetup {
" } ]\r\n" +
" }";
DBIndex index = mapper.readValue(content, DBIndex.class);
- ManageJanusGraphSchema schema = new ManageJanusGraphSchema(graph, auditorFactory, schemaVersions);
+ ManageJanusGraphSchema schema = new ManageJanusGraphSchema(graph, auditorFactory, schemaVersions, edgeIngestor);
JanusGraphManagement mgmt = graph.openManagement();
Set<String> instances = mgmt.getOpenInstances();
System.out.println(instances);
diff --git a/src/test/resources/pserver2.graphson.P0 b/src/test/resources/pserver2.graphson.P0
index 8c89c1c..59c9a7d 100644
--- a/src/test/resources/pserver2.graphson.P0
+++ b/src/test/resources/pserver2.graphson.P0
@@ -1 +1 @@
-{"id":4176,"label":"vertex","properties":{"hostname":[{"id":"sq-380-c3d1","value":"somerandomhostname"}],"aai-node-type":[{"id":"16y-380-5xc5","value":"pserver"}]}}
+{"id":4240,"label":"vertex","properties":{"hostname":[{"id":"sy-39s-c3d1","value":"somerandomhostname"}],"aai-node-type":[{"id":"176-39s-5xc5","value":"pserver"}]}}
diff --git a/src/test/resources/pserver2.graphson.P1 b/src/test/resources/pserver2.graphson.P1
index cbc864b..5a0ece5 100644
--- a/src/test/resources/pserver2.graphson.P1
+++ b/src/test/resources/pserver2.graphson.P1
@@ -1 +1,2 @@
-{"id":4296,"label":"vertex","properties":{"hostname":[{"id":"t5-3bc-c3d1","value":"somerandomhostname2"}],"aai-node-type":[{"id":"17d-3bc-5xc5","value":"pserver"}]}}
+{"id":8336,"label":"vertex","inE":{"tosca.relationships.network.BindsTo":[{"id":"4r6-9lc-f11-6fk","outV":12432,"properties":{"private":false,"aai-uuid":"42904b97-7d39-485d-8ac4-6a8022d714f2","prevent-delete":"NONE","delete-other-v":"IN","contains-other-v":"IN"}}]},"properties":{"hostname":[{"id":"1zm-6fk-c3d1","value":"somerandomhostname2"}],"aai-node-type":[{"id":"2du-6fk-5xc5","value":"pserver"}]}}
+{"id":12432,"label":"vertex","outE":{"tosca.relationships.network.BindsTo":[{"id":"4r6-9lc-f11-6fk","inV":8336,"properties":{"private":false,"aai-uuid":"42904b97-7d39-485d-8ac4-6a8022d714f2","prevent-delete":"NONE","delete-other-v":"IN","contains-other-v":"IN"}}]},"properties":{"in-maint":[{"id":"36a-9lc-2685","value":false}],"interface-name":[{"id":"3ki-9lc-3u9x","value":"p-interface-name"}],"source-of-truth":[{"id":"3yq-9lc-622t","value":"JUNIT"}],"aai-node-type":[{"id":"4cy-9lc-5xc5","value":"p-interface"}]}}