*
* @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 {
public Set<Introspector> getAllIntrospectors() {
return this.allObjects;
}
-
- public void setEdgeIngestor(EdgeIngestor ingestor){
- this.ingestor = ingestor;
- }
}
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;
* @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);
}
/**
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;
*
* @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);
}
import org.apache.commons.configuration.PropertiesConfiguration;\r
import org.codehaus.jackson.JsonGenerationException;\r
import org.onap.aai.dbmap.AAIGraphConfig;\r
+import org.onap.aai.edges.EdgeIngestor;\r
import org.onap.aai.exceptions.AAIException;\r
import org.onap.aai.setup.SchemaVersions;\r
-import org.onap.aai.setup.SchemaVersion;\r
import org.onap.aai.logging.LoggingContext;\r
import org.onap.aai.logging.LoggingContext.StatusCode;\r
import org.onap.aai.util.AAIConfig;\r
* @param args the arguments\r
* @throws AAIException the AAI exception\r
* @throws JsonGenerationException the json generation exception\r
- * @throws JsonMappingException the json mapping exception\r
* @throws IOException Signals that an I/O exception has occurred.\r
*/\r
public static void main (String[] args) throws AAIException, IOException, ConfigurationException {\r
\r
AuditorFactory auditorFactory = ctx.getBean(AuditorFactory.class);\r
SchemaVersions schemaVersions = ctx.getBean(SchemaVersions.class);\r
+ EdgeIngestor edgeIngestor = ctx.getBean(EdgeIngestor.class);\r
\r
String config = cArgs.config;\r
AAIConfig.init();\r
\r
AuditDoc doc = null;\r
if ("oxm".equals(cArgs.type)) {\r
- doc = auditorFactory.getOXMAuditor(schemaVersions.getDefaultVersion()).getAuditDoc();\r
+ doc = auditorFactory.getOXMAuditor(schemaVersions.getDefaultVersion(), edgeIngestor).getAuditDoc();\r
} else if ("graph".equals(cArgs.type)) {\r
doc = auditorFactory.getGraphAuditor(graph).getAuditDoc();\r
}\r
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;
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();
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();
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;
}
--- /dev/null
+/**
+ * ============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
}
@Test
- public void testDupeTool(){
+ public void testDupeToolForPInterface(){
//TODO: test does not find duplicates
String[] args = {
"-userId", "testuser",
" } ]\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);
-{"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"}]}}
-{"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"}]}}