diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2018-09-18 18:57:39 -0400 |
---|---|---|
committer | Kajur, Harish (vk250x) <vk250x@att.com> | 2018-09-18 19:40:01 -0400 |
commit | 2c21dc155715070b99797243f82166b26ffb303c (patch) | |
tree | fa4109fd43db06aee4b33d85f9adceb46e06d045 /src/test | |
parent | d13dd0ed905109546950b4fdd1e3f9e0471ec8e7 (diff) |
Add unit tests for dupeTool, datasnapshot
and also for the audit oxm
Issue-ID: AAI-1633
Change-Id: If5ead46eaa9e7d012054713268009957d0103477
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'src/test')
6 files changed, 75 insertions, 6 deletions
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"}]}} |