aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
authorIgor Dysko <igor1.dysko@orange.com>2021-08-10 14:00:45 +0200
committerIgor Dysko <igor1.dysko@orange.com>2021-08-10 14:11:32 +0200
commitf477ac5eafcfc9e1b074a9fea31e7095bbc75697 (patch)
tree2eb785c6ea32f1ffb49dc79c6226eb0082aac461 /src/test/java/org/onap
parent1f2bf6e92830e263d23d891b67a73913f707e903 (diff)
Increase java test coverage
Added new tests, removed unused code. Issue-ID: AAI-3278 Signed-off-by: Igor Dysko <igor1.dysko@orange.com> Change-Id: I046aa25c037850f3aa8a7d3e3d355b88c8f3b3c4
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/aai/graphgraph/ArgumentParserTest.java (renamed from src/test/java/org/onap/aai/graphgraph/AppTest.java)38
-rw-r--r--src/test/java/org/onap/aai/graphgraph/SchemaResourceTest.java33
2 files changed, 54 insertions, 17 deletions
diff --git a/src/test/java/org/onap/aai/graphgraph/AppTest.java b/src/test/java/org/onap/aai/graphgraph/ArgumentParserTest.java
index 5393d26..bfe7b29 100644
--- a/src/test/java/org/onap/aai/graphgraph/AppTest.java
+++ b/src/test/java/org/onap/aai/graphgraph/ArgumentParserTest.java
@@ -19,21 +19,33 @@
*/
package org.onap.aai.graphgraph;
-import static org.junit.Assert.assertTrue;
-
+import org.junit.Assert;
import org.junit.Test;
-/**
- * Unit test for simple App.
- */
-public class AppTest
-{
- /**
- * Rigorous Test :-)
- */
+public class ArgumentParserTest {
+
+ @Test
+ public void parsePrintHelpTest() {
+ ArgumentParser argumentParser = new ArgumentParser();
+ argumentParser.parseArguments(new String[] {"-h"});
+ Assert.assertTrue(argumentParser.isPrintHelp());
+ }
+
+ @Test
+ public void parseLocalRunTest() {
+ ArgumentParser argumentParser = new ArgumentParser();
+ argumentParser.parseArguments(new String[] {"-d"});
+ Assert.assertTrue(argumentParser.isRunLocally());
+ Assert.assertFalse(argumentParser.isPrintHelp());
+ }
+
@Test
- public void shouldAnswerWithTrue()
- {
- assertTrue( true );
+ public void parseGenerateModelTest() {
+ ArgumentParser argumentParser = new ArgumentParser();
+ argumentParser.parseArguments(new String[] {"-g", "v15"});
+ Assert.assertFalse(argumentParser.isRunLocally());
+ Assert.assertFalse(argumentParser.isPrintHelp());
+ Assert.assertTrue(argumentParser.shouldGenerateUrl());
+ Assert.assertEquals("v15", argumentParser.getSchemaVersion());
}
}
diff --git a/src/test/java/org/onap/aai/graphgraph/SchemaResourceTest.java b/src/test/java/org/onap/aai/graphgraph/SchemaResourceTest.java
index 84bcf2f..a857d83 100644
--- a/src/test/java/org/onap/aai/graphgraph/SchemaResourceTest.java
+++ b/src/test/java/org/onap/aai/graphgraph/SchemaResourceTest.java
@@ -23,7 +23,6 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.graphgraph.dto.Graph;
import org.onap.aai.graphgraph.dto.NodeName;
import org.onap.aai.graphgraph.dto.NodeProperty;
@@ -52,9 +51,6 @@ public class SchemaResourceTest {
private NodeIngestor nodeIngestor;
@Autowired
- private EdgeIngestor edgeIngestor;
-
- @Autowired
private MoxyLoaderRepository moxyLoaderRepository;
@Before
@@ -80,6 +76,20 @@ public class SchemaResourceTest {
}
@Test
+ public void loadCloudRegionGraphTest() {
+ Graph graph = schemaResource.loadGraph("v10", "cloud-region", 1, 1, 1, "Edgerules");
+
+ Assert.assertNotNull(graph.getEdges());
+ Assert.assertEquals(14, graph.getEdges().size());
+ Assert.assertEquals(15, graph.getNodeNames().size());
+ Assert.assertTrue(containsNodeName(graph.getNodeNames(), "image"));
+ Assert.assertTrue(containsNodeName(graph.getNodeNames(), "volume-group"));
+ Assert.assertTrue(containsNodeName(graph.getNodeNames(), "zone"));
+ Assert.assertTrue(containsNodeName(graph.getNodeNames(), "dvs-switch"));
+ Assert.assertTrue(containsNodeName(graph.getNodeNames(), "tenant"));
+ }
+
+ @Test
public void loadGraphPathsTest() {
Graph graph = schemaResource.loadGraphWithPaths("v10", "cloud-region", "image", "Edgerules");
@@ -110,6 +120,21 @@ public class SchemaResourceTest {
Assert.assertEquals(844919, schemaExport.length());
}
+ @Test
+ public void allVertexNamesTest() {
+ List<NodeName> nodeNames = schemaResource.loadVertexNames("v10", "Edgerules");
+ Assert.assertNotNull(nodeNames);
+ Assert.assertEquals(74, nodeNames.size());
+ Assert.assertTrue(containsNodeName(nodeNames, "connector"));
+ Assert.assertTrue(containsNodeName(nodeNames, "cvlan-tag"));
+ Assert.assertTrue(containsNodeName(nodeNames, "element-choice-set"));
+ Assert.assertTrue(containsNodeName(nodeNames, "image"));
+ Assert.assertTrue(containsNodeName(nodeNames, "model-constraint"));
+ Assert.assertTrue(containsNodeName(nodeNames, "pnf"));
+ Assert.assertTrue(containsNodeName(nodeNames, "service-capability"));
+ Assert.assertTrue(containsNodeName(nodeNames, "vlan"));
+ }
+
private boolean containsNodeProperty(List<NodeProperty> nodeProperties, String propertyName) {
for (NodeProperty nodeProperty : nodeProperties) {