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/java/org | |
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/java/org')
4 files changed, 72 insertions, 4 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); |