diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-08-14 10:47:31 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-08-14 14:20:40 +0200 |
commit | c8b9a55e5ff7d49fa30e53a1e5091e6ed436c2ea (patch) | |
tree | cb9fe9a52f6bba14e4f1858eae41578b2e0907a9 /src/test | |
parent | 49acf38a32a56065ad084d1d925718072b9740e4 (diff) |
Migrate graphadmin to Junit 5
Issue-ID: AAI-3964
Change-Id: I2f3f21c42bf3d13c5fa487592219ec9fa7594cd9
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'src/test')
64 files changed, 1695 insertions, 1504 deletions
diff --git a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java index 96d05db..2c99751 100644 --- a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java +++ b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java @@ -22,7 +22,11 @@ package org.onap.aai; import com.jayway.jsonpath.JsonPath; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; @@ -37,8 +41,6 @@ import org.springframework.context.annotation.Import; import org.springframework.http.*; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.rules.SpringClassRule; -import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.web.client.RestTemplate; import java.util.Base64; @@ -49,7 +51,7 @@ import java.util.Map; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; /** * A sample junit test using spring boot that provides the ability to spin @@ -76,12 +78,6 @@ import static org.junit.Assert.fail; ) public class AAIGremlinQueryTest { - @ClassRule - public static final SpringClassRule springClassRule = new SpringClassRule(); - - @Rule - public final SpringMethodRule springMethodRule = new SpringMethodRule(); - @Autowired RestTemplate restTemplate; @@ -94,7 +90,7 @@ public class AAIGremlinQueryTest { private String baseUrl; - @BeforeClass + @BeforeAll public static void setupConfig() throws AAIException { System.setProperty("AJSC_HOME", "./"); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/"); @@ -130,7 +126,7 @@ public class AAIGremlinQueryTest { } } - @Before + @BeforeEach public void setup() throws Exception { AAIConfig.init(); @@ -190,7 +186,7 @@ public class AAIGremlinQueryTest { assertThat(result, containsString("v[")); } - @After + @AfterEach public void tearDown() { JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/AAISetup.java b/src/test/java/org/onap/aai/AAISetup.java index d742ff1..49cc6c4 100644 --- a/src/test/java/org/onap/aai/AAISetup.java +++ b/src/test/java/org/onap/aai/AAISetup.java @@ -23,10 +23,9 @@ import org.apache.commons.io.IOUtils; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Rule; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; + import org.onap.aai.config.*; import org.onap.aai.db.schema.AuditorFactory; import org.onap.aai.edges.EdgeIngestor; @@ -41,17 +40,17 @@ import org.onap.aai.setup.SchemaVersion; import org.onap.aai.setup.SchemaVersions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.rules.SpringClassRule; -import org.springframework.test.context.junit4.rules.SpringMethodRule; import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.InputStream; import java.util.Map; -import static org.junit.Assert.assertNotNull; - +@SpringBootTest @ContextConfiguration(classes = { ConfigConfiguration.class, AAIConfigTranslator.class, @@ -104,16 +103,10 @@ public abstract class AAISetup { @Value("${schema.uri.base.path}") protected String basePath; - @ClassRule - public static final SpringClassRule springClassRule = new SpringClassRule(); - - @Rule - public final SpringMethodRule springMethodRule = new SpringMethodRule(); - protected static JanusGraph graph; protected static JanusGraphTransaction tx; - @BeforeClass + @BeforeAll public static void setupBundleconfig() throws Exception { System.setProperty("AJSC_HOME", "./"); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/"); @@ -122,7 +115,7 @@ public abstract class AAISetup { tx = graph.newTransaction(); } - @AfterClass + @AfterAll public static void cleanUpGraph() { tx.tx().rollback(); graph.close(); @@ -135,7 +128,7 @@ public abstract class AAISetup { .getResourceAsStream(filename); String message = String.format("Unable to find the %s in src/test/resources", filename); - assertNotNull(message, inputStream); + assertNotNull(inputStream, message); String resource = IOUtils.toString(inputStream); return resource; diff --git a/src/test/java/org/onap/aai/MetricsConfigurationTest.java b/src/test/java/org/onap/aai/MetricsConfigurationTest.java index 39a6673..481ff0a 100644 --- a/src/test/java/org/onap/aai/MetricsConfigurationTest.java +++ b/src/test/java/org/onap/aai/MetricsConfigurationTest.java @@ -20,19 +20,17 @@ package org.onap.aai; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.UnsupportedEncodingException; import java.util.Arrays; -import java.util.Base64; import java.util.Collections; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.config.SpringContextAware; import org.onap.aai.exceptions.AAIException; import org.onap.aai.restclient.PropertyPasswordConfiguration; @@ -48,8 +46,6 @@ import org.springframework.context.annotation.Import; import org.springframework.http.*; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.rules.SpringClassRule; -import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.web.client.RestTemplate; /** @@ -64,12 +60,6 @@ import org.springframework.web.client.RestTemplate; @TestPropertySource(locations = "classpath:application-test.properties") public class MetricsConfigurationTest { - @ClassRule - public static final SpringClassRule springClassRule = new SpringClassRule(); - - @Rule - public final SpringMethodRule springMethodRule = new SpringMethodRule(); - @Autowired RestTemplate restTemplate; @@ -86,13 +76,13 @@ public class MetricsConfigurationTest { private String actuatorUrl; private HttpHeaders headers; - @BeforeClass + @BeforeAll public static void setupConfig() throws AAIException { System.setProperty("AJSC_HOME", "./"); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/"); } - @Before + @BeforeEach public void setup() throws UnsupportedEncodingException { headers = new HttpHeaders(); diff --git a/src/test/java/org/onap/aai/PayloadUtil.java b/src/test/java/org/onap/aai/PayloadUtil.java index 8adc9d1..65f5d9f 100644 --- a/src/test/java/org/onap/aai/PayloadUtil.java +++ b/src/test/java/org/onap/aai/PayloadUtil.java @@ -22,14 +22,14 @@ package org.onap.aai; import org.apache.commons.io.IOUtils; import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.junit.Assert.assertNotNull; - public class PayloadUtil { private static final Map<String, String> cache = new HashMap<>(); @@ -40,7 +40,7 @@ public class PayloadUtil { InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/expected/" + fileName); String message = String.format("Unable to find the %s in src/test/resources", fileName); - assertNotNull(message, inputStream); + assertNotNull(inputStream, message); String resource = IOUtils.toString(inputStream); @@ -53,7 +53,7 @@ public class PayloadUtil { InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/resource/" + fileName); String message = String.format("Unable to find the %s in src/test/resources", fileName); - assertNotNull(message, inputStream); + assertNotNull(inputStream, message); String resource = IOUtils.toString(inputStream); @@ -66,7 +66,7 @@ public class PayloadUtil { InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/templates/" + fileName); String message = String.format("Unable to find the %s in src/test/resources", fileName); - assertNotNull(message, inputStream); + assertNotNull(inputStream, message); String resource; @@ -101,7 +101,7 @@ public class PayloadUtil { InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/named-queries/" + fileName); String message = String.format("Unable to find the %s in src/test/resources/payloads/named-queries", fileName); - assertNotNull(message, inputStream); + assertNotNull(inputStream, message); String resource = IOUtils.toString(inputStream); diff --git a/src/test/java/org/onap/aai/audit/AuditGraphson2SqlTest.java b/src/test/java/org/onap/aai/audit/AuditGraphson2SqlTest.java index aa8236e..73cb83f 100644 --- a/src/test/java/org/onap/aai/audit/AuditGraphson2SqlTest.java +++ b/src/test/java/org/onap/aai/audit/AuditGraphson2SqlTest.java @@ -21,12 +21,13 @@ package org.onap.aai.audit; import com.google.gson.JsonObject; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import static org.mockito.ArgumentMatchers.anyString; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.when; import org.onap.aai.AAISetup; @@ -38,8 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; import java.util.HashMap; -import static org.junit.Assert.*; - public class AuditGraphson2SqlTest extends AAISetup { @@ -51,7 +50,7 @@ public class AuditGraphson2SqlTest extends AAISetup { @Mock private ApertureService apertureServiceMock; - @Before + @BeforeEach public void setUp() { auditG2S = new AuditGraphson2Sql(ei, schemaVersions, loaderFactory, apertureServiceMock); @@ -119,7 +118,7 @@ public class AuditGraphson2SqlTest extends AAISetup { assertTrue(resultOk); } - @Ignore + @Disabled @Test public void testGetDateTimeStamp() { long dts = 0; @@ -184,7 +183,7 @@ public class AuditGraphson2SqlTest extends AAISetup { } - @Ignore + @Disabled @Test public void testGetCounts() throws IOException, EdgeRuleNotFoundException { Boolean resultOk = true; @@ -204,7 +203,7 @@ public class AuditGraphson2SqlTest extends AAISetup { } - @Ignore + @Disabled @Test public void testGoodRun() throws IOException, EdgeRuleNotFoundException { diff --git a/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java b/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java index d9eed16..c709fa0 100644 --- a/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java +++ b/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java @@ -26,12 +26,11 @@ import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.Ignore; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; @@ -42,9 +41,9 @@ import java.util.HashSet; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class DataGroomingTest extends AAISetup { private static final Logger logger = LoggerFactory.getLogger(DataGroomingTest.class); @@ -53,7 +52,7 @@ public class DataGroomingTest extends AAISetup { private Vertex cloudRegionVertex; - @Before + @BeforeEach public void setup() { dataGrooming = new DataGrooming(loaderFactory, schemaVersions); // deleteTool.SHOULD_EXIT_VM = false; @@ -345,7 +344,7 @@ public class DataGroomingTest extends AAISetup { } - @After + @AfterEach public void tearDown() { JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java index d3fbec7..b976fa8 100644 --- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java +++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java @@ -28,14 +28,18 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; -import org.springframework.boot.test.system.OutputCaptureRule; + +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import java.io.File; import java.io.IOException; @@ -51,38 +55,37 @@ import java.nio.file.Paths; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.*; - +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +@ExtendWith(OutputCaptureExtension.class) public class DataSnapshot4HistInitTest extends AAISetup { private GraphTraversalSource g; - + private JanusGraphTransaction currentTransaction; private List<Vertex> vertexes; - - private DataSnapshot4HistInit dataSnapshot4HistInit; - @Rule - public OutputCaptureRule outputCapture = new OutputCaptureRule(); + private DataSnapshot4HistInit dataSnapshot4HistInit; - @Before + @BeforeEach public void setup() throws AAIException { - dataSnapshot4HistInit = new DataSnapshot4HistInit(loaderFactory, schemaVersions); - + dataSnapshot4HistInit = new DataSnapshot4HistInit(loaderFactory, schemaVersions); + JanusGraph graph = AAIGraph.getInstance().getGraph(); currentTransaction = graph.newTransaction(); g = currentTransaction.traversal(); - + // Setup the graph so it has one pserver vertex vertexes = setupPserverData(g); currentTransaction.commit(); } - @After + @AfterEach public void tearDown(){ JanusGraph graph = AAIGraph.getInstance().getGraph(); @@ -92,9 +95,9 @@ public class DataSnapshot4HistInitTest extends AAISetup { vertexes.stream().forEach((v) -> g.V(v).next().remove()); currentTransaction.commit(); } - + @Test - public void testClearEntireDatabaseAndVerifyDataIsRemoved() throws IOException { + public void testClearEntireDatabaseAndVerifyDataIsRemoved(CapturedOutput outputCapture) throws IOException { // Copy the pserver.graphson file from src/test/resoures to ${AJSC_HOME}/logs/data/dataSnapshots/ folder String sourceFileName = "src/test/resources/pserver.graphson"; @@ -116,7 +119,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { @Test - public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase() throws IOException { + public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase(CapturedOutput outputCapture) throws IOException { // Create a empty file called empty.graphson in src/test/resources/ @@ -135,7 +138,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { assertThat(outputCapture.toString(), containsString("graphson had no data.")); } - + @Test public void testTakeSnapshotAndItShouldCreateASnapshotFileWithOneVertex() throws IOException, InterruptedException { @@ -163,7 +166,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { List<String> fileContents = Files.readAllLines(snapshotPathList.get(0)); assertThat(fileContents.get(0), containsString("id")); } - + @Test public void testTakeSnapshotMultiAndItShouldCreateMultipleSnapshotFiles() throws IOException { @@ -202,7 +205,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { // Run the clear dataSnapshot and this time it should fail String [] args = {"-c","THREADED_SNAPSHOT", "-threadCount","foo","-debugFlag", "DEBUG"}; - + dataSnapshot4HistInit.executeCommand(args); // For this test if there is only one vertex in the graph, not sure if it will create multiple files @@ -286,7 +289,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { dataSnapshot4HistInit.executeCommand(args); } - + @Test public void testReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException { @@ -307,7 +310,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { dataSnapshot4HistInit.executeCommand(args); } - + @Test public void testMultiReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException, AAIException { @@ -325,12 +328,12 @@ public class DataSnapshot4HistInitTest extends AAISetup { // After reload remove the added vertexes in the graph // The reason for this so each test is independent // as there shouldn't be dependencies and cause weird issues - + String [] args = {"-c","MULTITHREAD_RELOAD","-f", "pserver2.graphson"}; dataSnapshot4HistInit.executeCommand(args); - - } - + + } + @Test public void testMultiReloadDataWithNonExistentFilesAndItShouldFail() throws IOException { @@ -363,7 +366,7 @@ public class DataSnapshot4HistInitTest extends AAISetup { dataSnapshot4HistInit.executeCommand(args); } - + @Test public void testCanRetrieveNamesOfKeyProps() throws IOException { @@ -375,21 +378,21 @@ public class DataSnapshot4HistInitTest extends AAISetup { String nodeType = (String)entry.getKey(); ArrayList<String> keyNames = (ArrayList<String>)entry.getValue(); keyNamesHash.put(nodeType,keyNames); - } + } assertTrue(keyNamesHash != null ); assertFalse(keyNamesHash.isEmpty()); } - - + + private void showVertProperties(String propKey, String propVal) { - + Vertex v1 = g.V().has(propKey, propVal).next(); Iterator<VertexProperty<Object>> pI = v1.properties(); while( pI.hasNext() ){ VertexProperty<Object> tp = pI.next(); String infStr = " [" + tp.key() + "][" + tp.value() + "] "; - System.out.println("Regular ole properties are: " + infStr ); + System.out.println("Regular ole properties are: " + infStr ); Iterator<Property<Object>> fullPropI = tp.properties(); while( fullPropI.hasNext() ){ // Note - the 'real' key/value of a property are not part of this list, just the @@ -398,12 +401,12 @@ public class DataSnapshot4HistInitTest extends AAISetup { String infStr2 = " [" + propOfProp.key() + "][" + propOfProp.value() + "] "; System.out.println("For " + infStr + ", got sub-property:" + infStr2 ); } - } + } } - - + + private List<Vertex> setupOneHistoryNode(GraphTraversalSource g) throws AAIException { - + Vertex v1 = g.addV().property("aai-node-type", "pserver","start-ts", 9988707,"source-of-truth","N/A") .property("hostname", "historyHOstGuy--8","start-ts", 9988707,"source-of-truth","N/A") .property("equip-vendor", "historyVendor","start-ts", 9988707,"source-of-truth","N/A") @@ -411,12 +414,12 @@ public class DataSnapshot4HistInitTest extends AAISetup { .next(); List<Vertex> list = new ArrayList<>(); list.add(v1); - + Iterator<VertexProperty<Object>> pI = v1.properties(); while( pI.hasNext() ){ VertexProperty<Object> tp = pI.next(); String infStr = " [" + tp.key() + "|" + tp.value() + "] "; - System.out.println("Regular ole properties are: " + infStr ); + System.out.println("Regular ole properties are: " + infStr ); Iterator<Property<Object>> fullPropI = tp.properties(); while( fullPropI.hasNext() ){ // Note - the 'real' key/value of a property are not part of this list, just the @@ -425,10 +428,10 @@ public class DataSnapshot4HistInitTest extends AAISetup { String infStr2 = " [" + propOfProp.key() + "|" + propOfProp.value() + "] "; System.out.println("For " + infStr + ", got sub-property:" + infStr2 ); } - } + } return list; } - + private List<Vertex> setupPserverData(GraphTraversalSource g) throws AAIException { Vertex v1 = g.addV().property("aai-node-type", "pserver") .property("hostname", "somerandomhostname") @@ -456,4 +459,4 @@ public class DataSnapshot4HistInitTest extends AAISetup { FileUtils.copyFile(inputFile, outputFile); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java index c1e9528..c6c7b4b 100644 --- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java +++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java @@ -25,15 +25,18 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; -import org.springframework.boot.test.system.OutputCaptureRule; + +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import java.io.File; import java.io.IOException; @@ -46,9 +49,11 @@ import java.util.Set; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertTrue; +@ExtendWith(OutputCaptureExtension.class) public class DataSnapshotTest extends AAISetup { private GraphTraversalSource g; @@ -59,10 +64,7 @@ public class DataSnapshotTest extends AAISetup { private static final int DELAYSINGLETHREADTEST = 90; - @Rule - public OutputCaptureRule outputCapture = new OutputCaptureRule(); - - @Before + @BeforeEach public void setup() throws AAIException { JanusGraph graph = AAIGraph.getInstance().getGraph(); currentTransaction = graph.newTransaction(); @@ -73,7 +75,7 @@ public class DataSnapshotTest extends AAISetup { currentTransaction.commit(); } - @After + @AfterEach public void tearDown(){ JanusGraph graph = AAIGraph.getInstance().getGraph(); @@ -85,7 +87,7 @@ public class DataSnapshotTest extends AAISetup { } @Test - public void testClearEntireDatabaseAndVerifyDataIsRemoved() throws IOException { + public void testClearEntireDatabaseAndVerifyDataIsRemoved(CapturedOutput outputCapture) throws IOException { // Copy the pserver.graphson file from src/test/resoures to ${AJSC_HOME}/logs/data/dataSnapshots/ folder String sourceFileName = "src/test/resources/pserver.graphson"; @@ -107,7 +109,7 @@ public class DataSnapshotTest extends AAISetup { @Test - public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase() throws IOException { + public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase(CapturedOutput outputCapture) throws IOException { // Create a empty file called empty.graphson in src/test/resources/ diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java index 893a197..7682cdb 100644 --- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java +++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java @@ -28,16 +28,18 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + import org.onap.aai.AAISetup; -import org.onap.aai.datagrooming.DataGrooming; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import java.io.File; import java.io.IOException; @@ -53,37 +55,37 @@ import java.util.Set; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +@ExtendWith(OutputCaptureExtension.class) public class DataSnapshotTest4HistInit extends AAISetup { private GraphTraversalSource g; - + private JanusGraphTransaction currentTransaction; private List<Vertex> vertexes; - - private DataSnapshot4HistInit dataSnapshot4HistInit; - @Rule - public OutputCaptureRule outputCapture = new OutputCaptureRule(); + private DataSnapshot4HistInit dataSnapshot4HistInit; - @Before + @BeforeEach public void setup() throws AAIException { dataSnapshot4HistInit = new DataSnapshot4HistInit(loaderFactory, schemaVersions); - + JanusGraph graph = AAIGraph.getInstance().getGraph(); currentTransaction = graph.newTransaction(); g = currentTransaction.traversal(); - + // Setup the graph so it has one pserver vertex vertexes = setupPserverData(g); currentTransaction.commit(); } - @After + @AfterEach public void tearDown(){ JanusGraph graph = AAIGraph.getInstance().getGraph(); @@ -93,9 +95,9 @@ public class DataSnapshotTest4HistInit extends AAISetup { vertexes.stream().forEach((v) -> g.V(v).next().remove()); currentTransaction.commit(); } - + @Test - public void testClearEntireDatabaseAndVerifyDataIsRemoved() throws IOException { + public void testClearEntireDatabaseAndVerifyDataIsRemoved(CapturedOutput outputCapture) throws IOException { // Copy the pserver.graphson file from src/test/resoures to ${AJSC_HOME}/logs/data/dataSnapshots/ folder String sourceFileName = "src/test/resources/pserver.graphson"; @@ -117,7 +119,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { @Test - public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase() throws IOException { + public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase(CapturedOutput outputCapture) throws IOException { // Create a empty file called empty.graphson in src/test/resources/ @@ -136,7 +138,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { assertThat(outputCapture.toString(), containsString("graphson had no data.")); } - + @Test public void testTakeSnapshotAndItShouldCreateASnapshotFileWithOneVertex() throws IOException, InterruptedException { @@ -164,7 +166,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { List<String> fileContents = Files.readAllLines(snapshotPathList.get(0)); assertThat(fileContents.get(0), containsString("id")); } - + @Test public void testTakeSnapshotMultiAndItShouldCreateMultipleSnapshotFiles() throws IOException { @@ -204,7 +206,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { // Run the clear dataSnapshot and this time it should fail String [] args = {"-c","THREADED_SNAPSHOT", "-threadCount","foo","-debugFlag", "DEBUG"}; - + dataSnapshot4HistInit.executeCommand(args); // For this test if there is only one vertex in the graph, not sure if it will create multiple files @@ -292,7 +294,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { dataSnapshot4HistInit.executeCommand(args); } - + @Test public void testReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException { @@ -313,7 +315,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { dataSnapshot4HistInit.executeCommand(args); } - + @Test public void testMultiReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException, AAIException { @@ -331,12 +333,12 @@ public class DataSnapshotTest4HistInit extends AAISetup { // After reload remove the added vertexes in the graph // The reason for this so each test is independent // as there shouldn't be dependencies and cause weird issues - + String [] args = {"-c","MULTITHREAD_RELOAD","-f", "pserver2.graphson"}; dataSnapshot4HistInit.executeCommand(args); - - } - + + } + @Test public void testMultiReloadDataWithNonExistentFilesAndItShouldFail() throws IOException { @@ -369,7 +371,7 @@ public class DataSnapshotTest4HistInit extends AAISetup { dataSnapshot4HistInit.executeCommand(args); } - + @Test public void testCanRetrieveNamesOfKeyProps() throws IOException { @@ -382,21 +384,21 @@ public class DataSnapshotTest4HistInit extends AAISetup { ArrayList<String> keyNames = (ArrayList<String>)entry.getValue(); keyNamesHash.put(nodeType,keyNames); System.out.println("DEBUGjojo === for nType " + nodeType + ", got keys = [" + keyNames + "]"); - } + } assertTrue(keyNamesHash != null ); assertFalse(keyNamesHash.isEmpty()); } - + private void showVertProperties(String propKey, String propVal) { - + Vertex v1 = g.V().has(propKey, propVal).next(); Iterator<VertexProperty<Object>> pI = v1.properties(); while( pI.hasNext() ){ VertexProperty<Object> tp = pI.next(); String infStr = " [" + tp.key() + "][" + tp.value() + "] "; - System.out.println("Regular ole properties are: " + infStr ); + System.out.println("Regular ole properties are: " + infStr ); Iterator<Property<Object>> fullPropI = tp.properties(); while( fullPropI.hasNext() ){ // Note - the 'real' key/value of a property are not part of this list, just the @@ -405,12 +407,12 @@ public class DataSnapshotTest4HistInit extends AAISetup { String infStr2 = " [" + propOfProp.key() + "][" + propOfProp.value() + "] "; System.out.println("For " + infStr + ", got sub-property:" + infStr2 ); } - } + } } - - + + private List<Vertex> setupOneHistoryNode(GraphTraversalSource g) throws AAIException { - + Vertex v1 = g.addV().property("aai-node-type", "pserver","start-ts", 9988707,"source-of-truth","N/A") .property("hostname", "historyHOstGuy--8","start-ts", 9988707,"source-of-truth","N/A") .property("equip-vendor", "historyVendor","start-ts", 9988707,"source-of-truth","N/A") @@ -418,12 +420,12 @@ public class DataSnapshotTest4HistInit extends AAISetup { .next(); List<Vertex> list = new ArrayList<>(); list.add(v1); - + Iterator<VertexProperty<Object>> pI = v1.properties(); while( pI.hasNext() ){ VertexProperty<Object> tp = pI.next(); String infStr = " [" + tp.key() + "|" + tp.value() + "] "; - System.out.println("Regular ole properties are: " + infStr ); + System.out.println("Regular ole properties are: " + infStr ); Iterator<Property<Object>> fullPropI = tp.properties(); while( fullPropI.hasNext() ){ // Note - the 'real' key/value of a property are not part of this list, just the @@ -432,10 +434,10 @@ public class DataSnapshotTest4HistInit extends AAISetup { String infStr2 = " [" + propOfProp.key() + "|" + propOfProp.value() + "] "; System.out.println("For " + infStr + ", got sub-property:" + infStr2 ); } - } + } return list; } - + private List<Vertex> setupPserverData(GraphTraversalSource g) throws AAIException { Vertex v1 = g.addV().property("aai-node-type", "pserver") .property("hostname", "somerandomhostname") @@ -463,4 +465,4 @@ public class DataSnapshotTest4HistInit extends AAISetup { FileUtils.copyFile(inputFile, outputFile); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java b/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java index add77ff..8666170 100644 --- a/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java +++ b/src/test/java/org/onap/aai/db/schema/AuditOXMTest.java @@ -19,20 +19,21 @@ */ package org.onap.aai.db.schema; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class AuditOXMTest extends AAISetup { - @Before + @BeforeEach public void setUp() { } - @After + @AfterEach public void tearDown() { } diff --git a/src/test/java/org/onap/aai/dbgen/DupeToolTest.java b/src/test/java/org/onap/aai/dbgen/DupeToolTest.java index bd95bcb..5ba0f9e 100644 --- a/src/test/java/org/onap/aai/dbgen/DupeToolTest.java +++ b/src/test/java/org/onap/aai/dbgen/DupeToolTest.java @@ -25,15 +25,16 @@ import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class DupeToolTest extends AAISetup { @@ -41,7 +42,7 @@ public class DupeToolTest extends AAISetup { private DupeTool dupeTool; - @Before + @BeforeEach public void setup(){ dupeTool = new DupeTool(loaderFactory, schemaVersions, false); createGraph(); @@ -206,7 +207,7 @@ public class DupeToolTest extends AAISetup { } - @After + @AfterEach public void tearDown(){ JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java b/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java index 0ca8481..34e9da2 100644 --- a/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java +++ b/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java @@ -22,14 +22,16 @@ package org.onap.aai.dbgen; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraphTransaction; + +import static org.junit.jupiter.api.Assertions.fail; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; @@ -37,9 +39,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.List; -import static org.junit.Assert.fail; - -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class ForceDeleteToolTest extends AAISetup { private static final Logger logger = LoggerFactory.getLogger(ForceDeleteToolTest.class); @@ -48,7 +48,7 @@ public class ForceDeleteToolTest extends AAISetup { private Vertex cloudRegionVertex; - @Before + @BeforeEach public void setup(){ deleteTool = new ForceDeleteTool(); deleteTool.SHOULD_EXIT_VM = false; @@ -177,7 +177,7 @@ public class ForceDeleteToolTest extends AAISetup { deleteTool.main(args); System.setIn(systemInputStream); } - @After + @AfterEach public void tearDown(){ JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/dbgen/UpdateToolTest.java b/src/test/java/org/onap/aai/dbgen/UpdateToolTest.java index 229eb73..cfbdb67 100644 --- a/src/test/java/org/onap/aai/dbgen/UpdateToolTest.java +++ b/src/test/java/org/onap/aai/dbgen/UpdateToolTest.java @@ -25,18 +25,18 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.util.AAIConstants; -import static org.junit.Assert.fail; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -@Ignore("Test prevents Janusgraph update. Fails only in the pipeline") +@Disabled("Test prevents Janusgraph update. Fails only in the pipeline") public class UpdateToolTest extends AAISetup { private static final Logger logger = LoggerFactory.getLogger(UpdateToolTest.class); @@ -49,7 +49,7 @@ public class UpdateToolTest extends AAISetup { JanusGraphTransaction transaction; GraphTraversalSource g; - @Before + @BeforeEach public void setup(){ updatePropertyTool = new UpdatePropertyTool(); updatePropertyToolInternal = new UpdatePropertyToolInternal(); @@ -192,7 +192,7 @@ public class UpdateToolTest extends AAISetup { assertFalse(updatePropertyToolInternal.run(null, args)); } - @After + @AfterEach public void tearDown(){ JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java index b6d12cd..8c3d669 100644 --- a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java +++ b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java @@ -23,18 +23,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.After; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class SchemaMod4HistTest extends AAISetup { private static final Logger logger = LoggerFactory.getLogger(SchemaMod4HistTest.class); @@ -42,7 +42,7 @@ public class SchemaMod4HistTest extends AAISetup { private SchemaMod4Hist schemaMod4H; - @Before + @BeforeEach public void setup() { schemaMod4H = new SchemaMod4Hist(loaderFactory, schemaVersions); @@ -84,12 +84,12 @@ public class SchemaMod4HistTest extends AAISetup { executedWithoutError = false; } - assertTrue("Ran schemaMod without throwing exception ", executedWithoutError); + assertTrue(executedWithoutError, "Ran schemaMod without throwing exception "); } - @After + @AfterEach public void tearDown() { JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java index e66cca3..0b71fc0 100644 --- a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java +++ b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java @@ -24,17 +24,17 @@ import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class SchemaModTest extends AAISetup { private static final Logger logger = LoggerFactory.getLogger(SchemaModTest.class); @@ -45,7 +45,7 @@ public class SchemaModTest extends AAISetup { private boolean setUp = false; - @Before + @BeforeEach public void setup() { schemaMod = new SchemaMod(loaderFactory, schemaVersions); // deleteTool.SHOULD_EXIT_VM = false; @@ -97,7 +97,7 @@ public class SchemaModTest extends AAISetup { - @After + @AfterEach public void tearDown() { JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/historytruncate/HistoryTruncateTest.java b/src/test/java/org/onap/aai/historytruncate/HistoryTruncateTest.java index a3e8eb5..e6cf924 100644 --- a/src/test/java/org/onap/aai/historytruncate/HistoryTruncateTest.java +++ b/src/test/java/org/onap/aai/historytruncate/HistoryTruncateTest.java @@ -27,12 +27,11 @@ import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.Ignore; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; @@ -43,9 +42,9 @@ import java.util.HashSet; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class HistoryTruncateTest extends AAISetup { private static final Logger logger = LoggerFactory.getLogger(HistoryTruncateTest.class); @@ -58,7 +57,7 @@ public class HistoryTruncateTest extends AAISetup { private long todayMinusTwoMonthsTs; private long todayMinus55DaysTs; - @Before + @BeforeEach public void setup() { historyTruncate = new HistoryTruncate(); @@ -343,7 +342,7 @@ public class HistoryTruncateTest extends AAISetup { - @After + @AfterEach public void tearDown() { JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction(); diff --git a/src/test/java/org/onap/aai/migration/EdgeMigratorTest.java b/src/test/java/org/onap/aai/migration/EdgeMigratorTest.java index 299d017..cc532c9 100644 --- a/src/test/java/org/onap/aai/migration/EdgeMigratorTest.java +++ b/src/test/java/org/onap/aai/migration/EdgeMigratorTest.java @@ -27,9 +27,9 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.schema.JanusGraphManagement; import org.javatuples.Pair; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; @@ -47,7 +47,7 @@ import org.onap.aai.setup.SchemaVersions; import java.util.*; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -100,7 +100,7 @@ public class EdgeMigratorTest extends AAISetup { private Graph tx; private EdgeMigratorImpl edgeMigrator; - @Before + @BeforeEach public void setUp() { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); JanusGraphManagement janusgraphManagement = graph.openManagement(); @@ -148,7 +148,7 @@ public class EdgeMigratorTest extends AAISetup { edgeMigrator = new EdgeMigratorImpl(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -157,63 +157,57 @@ public class EdgeMigratorTest extends AAISetup { @Test public void verifyVnfHasOnlyNewEdgeTest() { edgeMigrator.rebuildEdges(g.E().toSet()); - assertTrue("edge direction and label were migrated", g.V().has(AAIProperties.NODE_TYPE, + assertTrue(g.V().has(AAIProperties.NODE_TYPE, "generic-vnf").has("vnf-id", "toscaMigration-test-vnf").inE() - .hasLabel("org.onap.relationships.inventory.BelongsTo").hasNext()); + .hasLabel("org.onap.relationships.inventory.BelongsTo").hasNext(), "edge direction and label were migrated"); - assertFalse("if we look for old edge, it should be gone", g.V().has(AAIProperties.NODE_TYPE, + assertFalse(g.V().has(AAIProperties.NODE_TYPE, "generic-vnf").has("vnf-id", "toscaMigration-test-vnf").outE() - .hasLabel("hasLInterface").hasNext()); + .hasLabel("hasLInterface").hasNext(), "if we look for old edge, it should be gone"); } @Test public void verifyGraphHasNoOldEdgeLabelsTest() { edgeMigrator.rebuildEdges(g.E().toSet()); - assertEquals("Graph should have none of the old edge label" - , Long.valueOf(0) - , g.E().hasLabel("hasLInterface","usesLogicalLink").count().next()); - assertEquals("Graph should have none of the old edge label" - , Long.valueOf(3) + assertEquals(Long.valueOf(0) + , g.E().hasLabel("hasLInterface","usesLogicalLink").count().next(), "Graph should have none of the old edge label"); + assertEquals(Long.valueOf(3) , g.E().hasLabel("org.onap.relationships.inventory.BelongsTo", "tosca.relationships.network.LinksTo","org.onap.relationships.inventory.Source") - .count().next()); + .count().next(), "Graph should have none of the old edge label"); } @Test public void verifyGenericVnfHas1EdgeTest() { edgeMigrator.rebuildEdges(g.E().toSet()); - assertEquals("Generic vnf should have 1 edge" - , Long.valueOf(1) + assertEquals(Long.valueOf(1) , g.V().has(AAIProperties.NODE_TYPE, "generic-vnf") .both() - .count().next()); + .count().next(), "Generic vnf should have 1 edge"); } @Test public void verifyLogicalLinkHas2EdgesTest() { edgeMigrator.rebuildEdges(g.E().toSet()); - assertEquals("Logical Link should have 2 edges" - , Long.valueOf(2) + assertEquals(Long.valueOf(2) , g.V().has(AAIProperties.NODE_TYPE, "logical-link") .both() - .count().next()); + .count().next(), "Logical Link should have 2 edges"); - assertTrue("Logical Link has source edge" - , g.V().has(AAIProperties.NODE_TYPE, "logical-link") - .bothE("org.onap.relationships.inventory.Source").hasNext()); + assertTrue(g.V().has(AAIProperties.NODE_TYPE, "logical-link") + .bothE("org.onap.relationships.inventory.Source").hasNext(), "Logical Link has source edge"); - assertTrue("Logical Link has default edge" - , g.V().has(AAIProperties.NODE_TYPE, "logical-link") - .bothE("tosca.relationships.network.LinksTo").hasNext()); + assertTrue(g.V().has(AAIProperties.NODE_TYPE, "logical-link") + .bothE("tosca.relationships.network.LinksTo").hasNext(), "Logical Link has default edge"); } @Test public void checkThatEdgeWithNoRulesDoesNotGetMigratedTest() { edgeMigrator.rebuildEdges(g.E().toSet()); - assertTrue("Edge with no rule did not get migrated ", g.E().hasLabel("blah").hasNext()); + assertTrue(g.E().hasLabel("blah").hasNext(), "Edge with no rule did not get migrated "); } @Test diff --git a/src/test/java/org/onap/aai/migration/EdgeSwingMigratorTest.java b/src/test/java/org/onap/aai/migration/EdgeSwingMigratorTest.java index 54b11b5..313ccec 100644 --- a/src/test/java/org/onap/aai/migration/EdgeSwingMigratorTest.java +++ b/src/test/java/org/onap/aai/migration/EdgeSwingMigratorTest.java @@ -27,8 +27,8 @@ import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.schema.JanusGraphManagement; import org.javatuples.Pair; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; @@ -44,8 +44,8 @@ import org.onap.aai.setup.SchemaVersions; import java.util.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -61,7 +61,7 @@ public class EdgeSwingMigratorTest extends AAISetup { private Vertex modelVer3 = null; - @Before + @BeforeEach public void setUp() throws Exception { JanusGraphManagement janusgraphManagement = graph.openManagement(); g = graph.traversal(); @@ -216,8 +216,8 @@ public class EdgeSwingMigratorTest extends AAISetup { } } - assertTrue("New IsA edge has aai-uuid property ", haveUuidProp ); - assertTrue("New IsA edge has delete-other-v property ", haveDelOtherVProp ); + assertTrue(haveUuidProp, "New IsA edge has aai-uuid property " ); + assertTrue(haveDelOtherVProp, "New IsA edge has delete-other-v property " ); } diff --git a/src/test/java/org/onap/aai/migration/MigrationControllerInternalTest.java b/src/test/java/org/onap/aai/migration/MigrationControllerInternalTest.java index 9701217..37e600b 100644 --- a/src/test/java/org/onap/aai/migration/MigrationControllerInternalTest.java +++ b/src/test/java/org/onap/aai/migration/MigrationControllerInternalTest.java @@ -24,10 +24,11 @@ import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import java.io.ByteArrayOutputStream; @@ -42,7 +43,7 @@ public class MigrationControllerInternalTest extends AAISetup { private MigrationControllerInternal migrationControllerInternal; - @Before + @BeforeEach public void setup() { migrationControllerInternal = new MigrationControllerInternal(loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); clearGraph(); @@ -199,7 +200,7 @@ public class MigrationControllerInternalTest extends AAISetup { } } - @Ignore + @Disabled @Test public void testListAllOfMigrations() throws Exception { PrintStream oldOutputStream = System.out; @@ -297,7 +298,7 @@ public class MigrationControllerInternalTest extends AAISetup { System.setOut(oldOutputStream); } - @Ignore + @Disabled @Test public void testRunDisabledExcludeAndCommit() throws Exception { assertThat("rebuildAllEdges shouldn't have enabled annotation", !RebuildAllEdges.class.isAnnotationPresent(Enabled.class)); @@ -328,7 +329,7 @@ public class MigrationControllerInternalTest extends AAISetup { migrationControllerInternal.run(args); } - @After + @AfterEach public void tearDown(){ clearGraph(); } diff --git a/src/test/java/org/onap/aai/migration/PropertyMigratorTest.java b/src/test/java/org/onap/aai/migration/PropertyMigratorTest.java index a2db2d0..8eed6ce 100644 --- a/src/test/java/org/onap/aai/migration/PropertyMigratorTest.java +++ b/src/test/java/org/onap/aai/migration/PropertyMigratorTest.java @@ -23,8 +23,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.Cardinality; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.edges.EdgeIngestor; @@ -40,9 +41,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; -import java.util.Optional; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.Optional; public class PropertyMigratorTest extends AAISetup { @@ -71,7 +72,7 @@ public class PropertyMigratorTest extends AAISetup { } } - @Before + @BeforeEach public void setup(){ AAIGraph.getInstance(); JanusGraphTransaction janusgraphTransaction = AAIGraph.getInstance().getGraph().newTransaction(); @@ -111,7 +112,7 @@ public class PropertyMigratorTest extends AAISetup { PropertyMigrator propertyMigrator = new PserverPropMigrator(dbEngine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions, oldPropName, newPropName, String.class, Cardinality.SINGLE); propertyMigrator.run(); - assertEquals("Expecting the property to be success", Status.SUCCESS, propertyMigrator.getStatus()); + assertEquals(Status.SUCCESS, propertyMigrator.getStatus(), "Expecting the property to be success"); dbEngine.commit(); JanusGraphTransaction janusgraphTransaction = AAIGraph.getInstance().getGraph().newTransaction(); @@ -120,8 +121,8 @@ public class PropertyMigratorTest extends AAISetup { List<Vertex> oldVList = g.V().has("aai-node-type", "pserver").has(oldPropName).toList(); List<Vertex> newVList = g.V().has("aai-node-type", "pserver").has(newPropName).toList(); - assertEquals("Expecting the vertex list with old property to be zero", 0, oldVList.size()); - assertEquals("Expecting the vertex list with new property to be 1", 1, newVList.size()); - assertEquals("Expecting the equipment type to be some equipment", "some status", newVList.get(0).property(newPropName).value()); + assertEquals(0, oldVList.size(), "Expecting the vertex list with old property to be zero"); + assertEquals(1, newVList.size(), "Expecting the vertex list with new property to be 1"); + assertEquals("some status", newVList.get(0).property(newPropName).value(), "Expecting the equipment type to be some equipment"); } }
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/RebuildAllEdgesTest.java b/src/test/java/org/onap/aai/migration/RebuildAllEdgesTest.java index 0585a19..af41c80 100644 --- a/src/test/java/org/onap/aai/migration/RebuildAllEdgesTest.java +++ b/src/test/java/org/onap/aai/migration/RebuildAllEdgesTest.java @@ -25,9 +25,9 @@ import org.apache.tinkerpop.gremlin.structure.Graph; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.schema.JanusGraphManagement; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.introspection.Loader; @@ -36,7 +36,7 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; public class RebuildAllEdgesTest extends AAISetup { @@ -48,7 +48,7 @@ public class RebuildAllEdgesTest extends AAISetup { private Graph tx; private RebuildAllEdges spyRebuildAllEdges; - @Before + @BeforeEach public void setUp() { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); JanusGraphManagement janusgraphManagement = graph.openManagement(); @@ -71,7 +71,7 @@ public class RebuildAllEdgesTest extends AAISetup { spyRebuildAllEdges.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/ValueMigratorTest.java b/src/test/java/org/onap/aai/migration/ValueMigratorTest.java index 2b29adb..4e0411b 100644 --- a/src/test/java/org/onap/aai/migration/ValueMigratorTest.java +++ b/src/test/java/org/onap/aai/migration/ValueMigratorTest.java @@ -23,8 +23,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.introspection.Loader; @@ -40,7 +41,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -74,7 +75,7 @@ public class ValueMigratorTest extends AAISetup{ private JanusGraphTransaction tx; private SampleValueMigrator existingValuesMigration; - @Before + @BeforeEach public void setup() throws Exception{ graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); tx = graph.newTransaction(); @@ -121,25 +122,25 @@ public class ValueMigratorTest extends AAISetup{ @Test public void testMissingProperty(){ - assertTrue("Value of pnf should be updated since the property doesn't exist", - g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", true).hasNext()); + assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", true).hasNext(), + "Value of pnf should be updated since the property doesn't exist"); } @Test public void testExistingValue() { - assertTrue("Value of pserver shouldn't be updated since it already exists", - g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", false).hasNext(), + "Value of pserver shouldn't be updated since it already exists"); } @Test public void testEmptyValue() { - assertTrue("Value of pserver should be updated since the value is an empty string", - g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", true).hasNext()); + assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", true).hasNext(), + "Value of pserver should be updated since the value is an empty string"); } @Test public void testUpdateExistingValues() { - assertTrue("Value of pnf should be updated even though it already exists", - g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", true).hasNext()); + assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", true).hasNext(), + "Value of pnf should be updated even though it already exists"); } } diff --git a/src/test/java/org/onap/aai/migration/VertexMergeTest.java b/src/test/java/org/onap/aai/migration/VertexMergeTest.java index 1484eb4..ea7bf86 100644 --- a/src/test/java/org/onap/aai/migration/VertexMergeTest.java +++ b/src/test/java/org/onap/aai/migration/VertexMergeTest.java @@ -26,10 +26,11 @@ import org.janusgraph.core.Cardinality; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.schema.JanusGraphManagement; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; import org.onap.aai.introspection.Loader; @@ -43,13 +44,13 @@ import org.onap.aai.setup.SchemaVersion; import java.io.UnsupportedEncodingException; import java.util.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -@Ignore +@Disabled public class VertexMergeTest extends AAISetup { @@ -63,7 +64,7 @@ public class VertexMergeTest extends AAISetup { private GraphTraversalSource g; private Graph tx; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -150,7 +151,7 @@ public class VertexMergeTest extends AAISetup { merge.performMerge(pserverCanopi, pserverSkeleton, forceCopy, basePath); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -159,18 +160,18 @@ public class VertexMergeTest extends AAISetup { @Test public void run() throws UnsupportedEncodingException { - assertEquals("pserver merged", false, g.V().has("hostname", "TEST1").has("source-of-truth", "AAI-EXTENSIONS").hasNext()); + assertEquals(false, g.V().has("hostname", "TEST1").has("source-of-truth", "AAI-EXTENSIONS").hasNext(), "pserver merged"); assertThat("pserver list merge", Arrays.asList("value1", "value2"), containsInAnyOrder(g.V().has("hostname", "TEST1").values("test-list").toList().toArray())); - assertEquals("canopi pserver has one edge to vserver2", 1, g.V().has("hostname", "TEST1").both().has("vserver-id", "vserver2").toList().size()); - assertEquals("canopi pserver has one edge to vserver1", 1, g.V().has("hostname", "TEST1").both().has("vserver-id", "vserver1").toList().size()); - assertEquals("canopi pserver retained edge to complex2", true, g.V().has("hostname", "TEST1").both().has("physical-location-id", "complex2").hasNext()); - assertEquals("canopi pserver received forced prop", "test1.com", g.V().has("hostname", "TEST1").values("fqdn").next()); - assertEquals("pserver skeleton child copied", true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface1").hasNext()); - assertEquals("pserver skeleton child merged", true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").has("special-prop", "value").hasNext()); - assertEquals("l-interface child merged", true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").both().has("interface-name", "l-interface1").has("special-prop", "value").hasNext()); - assertEquals("l-interface child cousin edge merged", true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").both().has("interface-name", "l-interface1").both().has("link-name", "logical-link1").hasNext()); - assertEquals("one l-interface1 found", new Long(1), g.V().has("interface-name", "l-interface1").count().next()); - assertEquals("one p-interface2 found", new Long(1), g.V().has("interface-name", "p-interface2").count().next()); + assertEquals(1, g.V().has("hostname", "TEST1").both().has("vserver-id", "vserver2").toList().size(), "canopi pserver has one edge to vserver2"); + assertEquals(1, g.V().has("hostname", "TEST1").both().has("vserver-id", "vserver1").toList().size(), "canopi pserver has one edge to vserver1"); + assertEquals(true, g.V().has("hostname", "TEST1").both().has("physical-location-id", "complex2").hasNext(), "canopi pserver retained edge to complex2"); + assertEquals("test1.com", g.V().has("hostname", "TEST1").values("fqdn").next(), "canopi pserver received forced prop"); + assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface1").hasNext(), "pserver skeleton child copied"); + assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").has("special-prop", "value").hasNext(), "pserver skeleton child merged"); + assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").both().has("interface-name", "l-interface1").has("special-prop", "value").hasNext(), "l-interface child merged"); + assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").both().has("interface-name", "l-interface1").both().has("link-name", "logical-link1").hasNext(), "l-interface child cousin edge merged"); + assertEquals(new Long(1), g.V().has("interface-name", "l-interface1").count().next(), "one l-interface1 found"); + assertEquals(new Long(1), g.V().has("interface-name", "p-interface2").count().next(), "one p-interface2 found"); } } diff --git a/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java index e833b90..4fb390f 100644 --- a/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java @@ -19,14 +19,16 @@ */ package org.onap.aai.migration.v12; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import java.io.UnsupportedEncodingException; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; import org.onap.aai.dbmap.DBConnectionType; @@ -53,7 +55,7 @@ public class ALTSLicenseEntitlementMigrationTest extends AAISetup { private GraphTraversalSource g; private JanusGraphTransaction tx; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -116,7 +118,7 @@ public class ALTSLicenseEntitlementMigrationTest extends AAISetup { migration.run(); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); @@ -124,35 +126,42 @@ public class ALTSLicenseEntitlementMigrationTest extends AAISetup { @Test public void testEntitlementsUpdated() throws UnsupportedEncodingException { - assertEquals("Found 1 entitlement", (Long)1L, - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").count().next()); - assertEquals("Entitlement's resource-uuid is updated ", true, - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement").hasNext()); - assertEquals("Entitlement's resource-uuid is updated by migration ", true, + assertEquals((Long)1L, + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").count().next(), + "Found 1 entitlement"); + assertEquals(true, + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement").hasNext(), + "Entitlement's resource-uuid is updated "); + assertEquals(true, g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo") - .has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement").has("last-mod-source-of-truth", "ALTSLicenseEntitlementMigration").hasNext()); + .has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement").has("last-mod-source-of-truth", "ALTSLicenseEntitlementMigration").hasNext(), + "Entitlement's resource-uuid is updated by migration "); } @Test public void testLicensesUpdated() throws UnsupportedEncodingException { - assertEquals("Found 1 License", (Long)1L, - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").count().next()); - assertEquals("License's resource-uuid is updated ", true, - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").has("resource-uuid", "new-ruuid-license").hasNext()); + assertEquals((Long)1L, + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").count().next(), + "Found 1 License"); + assertEquals(true, + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").has("resource-uuid", "new-ruuid-license").hasNext(), + "License's resource-uuid is updated "); } @Test public void verifyUri() { - assertEquals("Uri should be updated", "/network/generic-vnfs/generic-vnf/123456789/entitlements/entitlement/ruuideuuid/new-ruuid-entitlement", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement").next().property(AAIProperties.AAI_URI).value()); - assertEquals("Uri should be updated", "/network/generic-vnfs/generic-vnf/123456789/licenses/license/ruuideuuid/new-ruuid-license", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").has("resource-uuid", "new-ruuid-license").next().property(AAIProperties.AAI_URI).value()); + assertEquals("/network/generic-vnfs/generic-vnf/123456789/entitlements/entitlement/ruuideuuid/new-ruuid-entitlement", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement").next().property(AAIProperties.AAI_URI).value(), + "Uri should be updated"); + assertEquals("/network/generic-vnfs/generic-vnf/123456789/licenses/license/ruuideuuid/new-ruuid-license", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "123456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").has("resource-uuid", "new-ruuid-license").next().property(AAIProperties.AAI_URI).value(), + "Uri should be updated"); } @Test public void duplicateGroupUuid() { Long count = g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "23456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "license").has("resource-uuid", "new-ruuid-license2").count().next() + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "23456789").in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "entitlement").has("resource-uuid", "new-ruuid-entitlement2").count().next(); - assertEquals("Duplicate Entitlement or License Group Uuid should be skipped", (Long)1L, count); + assertEquals((Long)1L, count, "Duplicate Entitlement or License Group Uuid should be skipped"); } diff --git a/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java index 8861d5d..b47e43c 100644 --- a/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java @@ -26,9 +26,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; @@ -42,7 +42,7 @@ import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -58,7 +58,7 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup { private GraphTraversalSource g; private Graph tx; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); JanusGraphManagement janusgraphManagement = graph.openManagement(); @@ -91,7 +91,7 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup { migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -99,12 +99,15 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup { @Test public void run() { - assertEquals("del other now OUT", true, - g.E().hasLabel("hasLInterface").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.OUT.toString()).hasNext()); - assertEquals("contains val still same", true, - g.E().hasLabel("hasLInterface").has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).hasNext()); - assertEquals("non-containment unchanged", true, - g.E().hasLabel("uses").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString()).hasNext()); + assertEquals(true, + g.E().hasLabel("hasLInterface").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.OUT.toString()).hasNext(), + "del other now OUT"); + assertEquals(true, + g.E().hasLabel("hasLInterface").has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).hasNext(), + "contains val still same"); + assertEquals(true, + g.E().hasLabel("uses").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString()).hasNext(), + "non-containment unchanged"); } } diff --git a/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java b/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java index 7788a0a..19eead5 100644 --- a/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java +++ b/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java @@ -24,10 +24,11 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -39,10 +40,11 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.setup.SchemaVersions; import org.onap.aai.setup.SchemaVersion; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -@Ignore + +@Disabled public class DeletePInterfaceTest extends AAISetup { private final static ModelType introspectorFactoryType = ModelType.MOXY; @@ -54,7 +56,7 @@ public class DeletePInterfaceTest extends AAISetup { private GraphTraversalSource g; private JanusGraphTransaction tx; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -118,7 +120,7 @@ public class DeletePInterfaceTest extends AAISetup { migration.run(); } - @After + @AfterEach public void tearDown() throws Exception { tx.rollback(); graph.close(); @@ -126,19 +128,19 @@ public class DeletePInterfaceTest extends AAISetup { @Test public void test() { - assertEquals("pInterface1 deleted", false, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name1") - .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").has("interface-name", "interface-name1").hasNext()); + assertEquals(false, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name1") + .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").has("interface-name", "interface-name1").hasNext(), "pInterface1 deleted"); - assertEquals("pInterface2 skipped", true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name2") - .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").hasNext()); + assertEquals(true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name2") + .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").hasNext(), "pInterface2 skipped"); - assertEquals("pInterface3 skipped", true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name3") - .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").hasNext()); + assertEquals(true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name3") + .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").hasNext(), "pInterface3 skipped"); - assertEquals("pInterface4 should not be deleted", true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name4") - .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").has("interface-name", "interface-name4").hasNext()); + assertEquals(true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name4") + .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").has("interface-name", "interface-name4").hasNext(), "pInterface4 should not be deleted"); - assertEquals("Status should be success", Status.SUCCESS, migration.getStatus()); + assertEquals(Status.SUCCESS, migration.getStatus(), "Status should be success"); } } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java index 545576d..dc5901e 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java @@ -24,9 +24,10 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -37,7 +38,7 @@ import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -64,7 +65,7 @@ public class MigrateDataFromASDCToConfigurationTest extends AAISetup { private final String PARENT_NODE_TYPE = "generic-vnf"; private String VNT = ""; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -149,7 +150,7 @@ public class MigrateDataFromASDCToConfigurationTest extends AAISetup { } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java index 32190b5..188f823 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java @@ -19,9 +19,7 @@ */ package org.onap.aai.migration.v12; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -30,9 +28,10 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -60,7 +59,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { private JanusGraphTransaction tx; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -306,7 +305,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -316,43 +315,49 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { public void testRun_checkFevc1AndFevc2AreUpdated() throws Exception { // check if forwarder-evc nodes get updated - assertEquals("forwarder-evc evc-name-1-1 updated with ivlan", true, + assertEquals(true, g.V().has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id", "evc-name-1-1") .has("ivlan","4054") - .hasNext()); + .hasNext(), + "forwarder-evc evc-name-1-1 updated with ivlan"); - assertEquals("forwarder-evc evc-name-2-2 updated with ivlan", true, + assertEquals(true, g.V().has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id", "evc-name-2-2") .has("ivlan","4084") - .hasNext()); - assertEquals("forwarder-evc evc-name-2-3 updated with ivlan", true, + .hasNext(), + "forwarder-evc evc-name-2-2 updated with ivlan"); + assertEquals(true, g.V().has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id", "evc-name-2-3") .has("ivlan","4054") - .hasNext()); + .hasNext(), + "forwarder-evc evc-name-2-3 updated with ivlan"); - assertEquals("4 forwarder-evcs exist for evc evc-name-2", new Long(4L), + assertEquals(new Long(4L), g.V().has("forwarding-path-id", "evc-name-2") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder-evc") - .count().next()); + .count().next(), + "4 forwarder-evcs exist for evc evc-name-2"); - assertEquals("3 forwarder-evcs updated for evc evc-name-2", new Long(3L), + assertEquals(new Long(3L), g.V().has("forwarding-path-id", "evc-name-2") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id").has("ivlan") - .count().next()); + .count().next(), + "3 forwarder-evcs updated for evc evc-name-2"); - assertEquals("forwarder-evc evc-name-3-1 updated with ivlan", false, + assertEquals(false, g.V().has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id", "evc-name-3-1") .has("ivlan") - .hasNext()); + .hasNext(), + "forwarder-evc evc-name-3-1 updated with ivlan"); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java index 005517a..0454df6 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java @@ -19,9 +19,7 @@ */ package org.onap.aai.migration.v12; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -39,9 +37,10 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; import org.javatuples.Pair; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.introspection.Loader; import org.onap.aai.introspection.ModelType; @@ -61,7 +60,7 @@ public class MigrateINVPhysicalInventoryMethodTest extends AAISetup { private GraphTraversalSource g; private TransactionalGraphEngine spy; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -84,7 +83,7 @@ public class MigrateINVPhysicalInventoryMethodTest extends AAISetup { when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -118,13 +117,13 @@ public class MigrateINVPhysicalInventoryMethodTest extends AAISetup { MigrateINVPhysicalInventory m = new MigrateINVPhysicalInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); String line = "pnf-name-collector-1,06000D.121,5150,AED,,2001:1890:fcfe:7000:7021:0:1:2,64,,,,,\"1.7 \",SFP_1GE/Ethernet_10/100/1000M,ACCESS,N,N,M0651881_ST,SHARED,DOUBLE,SFP-1GE-LX,1000Mbps,,evc-name-1\n"; Pair<String, String> pair = m.processLine(Arrays.asList(line.split(",", -1))).get(); - assertEquals("Test 1","pnf-name-collector-1", pair.getValue0()); - assertEquals("Test 1","1.7", pair.getValue1()); + assertEquals("pnf-name-collector-1", pair.getValue0(), "Test 1"); + assertEquals("1.7", pair.getValue1(), "Test 1"); line = "pnf-name-1,06000D.121,5150,AED,,2001:1890:fcfe:7000:7021:0:1:2,64,,,,,1.2,SFP_1GE/Ethernet_10/100/1000M,ACCESS,N,N,M0651882_ST,SHARED,DOUBLE,SFP-1GE-LX,1000Mbps,,evc-name-3"; pair = m.processLine(Arrays.asList(line.split(",", -1))).get(); - assertEquals("Test 1","pnf-name-1", pair.getValue0()); - assertEquals("Test 1","1.2", pair.getValue1()); + assertEquals("pnf-name-1", pair.getValue0(), "Test 1"); + assertEquals("1.2", pair.getValue1(), "Test 1"); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java index e946a10..b3902de 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java @@ -25,7 +25,9 @@ import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -38,7 +40,7 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.util.Optional; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -54,7 +56,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { private JanusGraphTransaction tx; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -96,7 +98,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -106,17 +108,19 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { @Test public void pnfsExistTest() throws Exception { // check if pnf node gets created - assertEquals("2 PNFs exist", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "pnf") - .count().next()); + .count().next(), + "2 PNFs exist"); } @Test public void pInterfacesExistTest() throws Exception { - assertEquals("4 Pinterfaces exist", new Long(4L), + assertEquals(new Long(4L), g.V().has("aai-node-type", "p-interface") - .count().next()); + .count().next(), + "4 Pinterfaces exist"); } @Test @@ -124,27 +128,31 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { // check if graph nodes exist // check if pnf node gets created - assertEquals("2 PNFs exist", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "pnf") - .count().next()); + .count().next(), + "2 PNFs exist"); System.out.println("cOUNT:" +g.V().has("aai-node-type", "pnf") .has("pnf-name", "pnf-name-collector-1").in("tosca.relationships.network.BindsTo").count().next()); - assertEquals("p-interfaces created for pnfs", new Long(1L), + assertEquals(new Long(1L), g.V().has("aai-node-type", "pnf") - .has("pnf-name", "pnf-name-collector-1").count().next()); + .has("pnf-name", "pnf-name-collector-1").count().next(), + "p-interfaces created for pnfs"); - assertEquals("p-interface 1.7 created for pnf-name-collector-1", true, + assertEquals(true, g.V().has("aai-node-type", "pnf") .has("pnf-name", "pnf-name-collector-1") .in("tosca.relationships.network.BindsTo") .has("interface-name","1.7") - .hasNext()); - assertEquals("p-interfaces created for pnfs", new Long(2L), + .hasNext(), + "p-interface 1.7 created for pnf-name-collector-1"); + assertEquals(new Long(2L), g.V().has("aai-node-type", "pnf") .has("pnf-name", "pnf-name-1") - .in("tosca.relationships.network.BindsTo").count().next()); + .in("tosca.relationships.network.BindsTo").count().next(), + "p-interfaces created for pnfs"); } @Test diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java index 65e1905..8712b20 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java @@ -19,9 +19,7 @@ */ package org.onap.aai.migration.v12; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -30,7 +28,9 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -57,7 +57,7 @@ public class MigrateInvEvcInventoryTest extends AAISetup { private static JanusGraphTransaction tx; private static GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -93,7 +93,7 @@ public class MigrateInvEvcInventoryTest extends AAISetup { migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -102,32 +102,37 @@ public class MigrateInvEvcInventoryTest extends AAISetup { @Test public void testRun_updateEvcNode() throws Exception { // check if graph nodes exist - assertEquals("evc node exists", true, + assertEquals(true, g.V().has("aai-node-type", "evc") .has("evc-id", "evc-name-1") - .hasNext()); + .hasNext(), + "evc node exists"); // check if evc object is updated to set the value for inter-connect-type-ingress - assertEquals("evc is updated", true, + assertEquals(true, g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-1") .has("inter-connect-type-ingress", "SHARED") - .hasNext()); + .hasNext(), + "evc is updated"); } @Test public void testRun_evcNotCreated() throws Exception { - assertEquals("evc node does not exist", false, + assertEquals(false, g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-3") - .hasNext()); + .hasNext(), + "evc node does not exist"); //inter-connect-type-ingress is not present on the evc - assertEquals("evc node exists", true, + assertEquals(true, g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-2") - .hasNext()); - assertEquals("evc node not updated with inter-connect-type-ingress", false, + .hasNext(), + "evc node exists"); + assertEquals(false, g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-2").has("inter-connect-type-ingress") - .hasNext()); + .hasNext(), + "evc node not updated with inter-connect-type-ingress"); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java index e302002..7511f8c 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java @@ -19,9 +19,7 @@ */ package org.onap.aai.migration.v12; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -30,7 +28,10 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -51,7 +52,7 @@ public class MigratePATHEvcInventoryTest extends AAISetup { private MigratePATHEvcInventory migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -239,45 +240,49 @@ public class MigratePATHEvcInventoryTest extends AAISetup { // check if graph nodes exist // check if service-instance node gets created - assertEquals("service subscription node, service-type=SAREA", true, + assertEquals(true, g.V().has("service-instance-id", "evc-name-1") .out("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") - .hasNext()); + .hasNext(), + "service subscription node, service-type=SAREA"); - assertEquals("fowarding-path node exists", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") .in("org.onap.relationships.inventory.AppliesTo") .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-1") - .hasNext()); - assertEquals("fowarding-path node exists", true, + .hasNext(), + "fowarding-path node exists"); + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") .in("org.onap.relationships.inventory.AppliesTo") .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-2") - .hasNext()); - assertEquals("fowarding-path node exists", true, + .hasNext(), + "fowarding-path node exists"); + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") .in("org.onap.relationships.inventory.AppliesTo") .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-3") - .hasNext()); + .hasNext(), + "fowarding-path node exists"); } - @Ignore + @Disabled @Test public void testRun_checkForwardersForEvc1AreCreated() throws Exception { // check if graph nodes exist // check if forwarder node gets created - assertEquals("forwarder node is created for evc-name-1 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") @@ -285,9 +290,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 1) .has("forwarder-role", "ingress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-1 "); - assertEquals("forwarder node is created for evc-name-1 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") @@ -295,42 +301,47 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 2) .has("forwarder-role", "egress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-1 "); } - @Ignore + @Disabled @Test public void testRun_checkForwardersForEvc2AreCreated() throws Exception { // check if forwarder node gets created - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") .in("org.onap.relationships.inventory.AppliesTo").has("aai-node-type", "forwarding-path") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); - assertEquals("4 forwarders are created for evc-name-2 ", (Long)4l, + assertEquals((Long)4l, g.V(). has("aai-node-type", "forwarding-path").has("forwarding-path-id","evc-name-2") .in("org.onap.relationships.inventory.BelongsTo") - .has("aai-node-type", "forwarder").count().next()); //org.onap.relationships.inventory.BelongsTo + .has("aai-node-type", "forwarder").count().next(), + "4 forwarders are created for evc-name-2 "); //org.onap.relationships.inventory.BelongsTo - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("aai-node-type", "forwarding-path").has("forwarding-path-id","evc-name-2") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 1) .has("forwarder-role", "ingress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") @@ -338,9 +349,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 1) .has("forwarder-role", "ingress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") @@ -348,9 +360,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 2) .has("forwarder-role", "intermediate") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") @@ -358,9 +371,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 3) .has("forwarder-role", "intermediate") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); - assertEquals("forwarder node is created for evc-name-2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") @@ -368,16 +382,17 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 4) .has("forwarder-role", "egress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-2 "); } - @Ignore + @Disabled @Test public void testRun_checkForwardersForEvc3AreCreated() throws Exception { // check if forwarder node gets created - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -385,9 +400,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 1) .has("forwarder-role", "ingress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -398,9 +414,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.ForwardsTo") .has("aai-node-type", "p-interface") .has("interface-name","1.7") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder-evc node is created for forwarder with sequence 1 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -415,9 +432,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("circuit-id","M0651881") .has("cvlan","34") .has("svlan","8") - .hasNext()); + .hasNext(), + "forwarder-evc node is created for forwarder with sequence 1 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -425,10 +443,11 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 2) .has("forwarder-role", "intermediate") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); //forwarder to interface check - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -439,9 +458,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.ForwardsTo") .has("aai-node-type", "lag-interface") .has("interface-name","ae101") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder-evc node is created for forwarder with sequence 2 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -455,9 +475,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("forwarder-evc-id","evc-name-3-2") .has("cvlan","34") .has("svlan","740") - .hasNext()); + .hasNext(), + "forwarder-evc node is created for forwarder with sequence 2 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -465,9 +486,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 3) .has("forwarder-role", "intermediate") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -478,9 +500,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.ForwardsTo") .has("aai-node-type", "lag-interface") .has("interface-name","101") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder-evc node is created for forwarder with sequence 3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -494,9 +517,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("forwarder-evc-id","evc-name-3-3") .has("cvlan","35") .has("svlan","740") - .hasNext()); + .hasNext(), + "forwarder-evc node is created for forwarder with sequence 3 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -504,9 +528,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 4) .has("forwarder-role", "intermediate") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -517,9 +542,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.ForwardsTo") .has("aai-node-type", "lag-interface") .has("interface-name","104") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder-evc node is created for forwarder with sequence 4 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -533,9 +559,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("forwarder-evc-id","evc-name-3-4") .has("cvlan","37") .has("svlan","740") - .hasNext()); + .hasNext(), + "forwarder-evc node is created for forwarder with sequence 4 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -543,9 +570,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 5) .has("forwarder-role", "intermediate") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -556,11 +584,12 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.ForwardsTo") .has("aai-node-type", "lag-interface") .has("interface-name","ae104") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("configuration node is created for forwarder with sequence 5 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -570,9 +599,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("forwarder-role", "intermediate") .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .has("configuration-id","evc-name-3-5").has("configuration-type","forwarder").has("configuration-sub-type", "forwarder") - .hasNext()); + .hasNext(), + "configuration node is created for forwarder with sequence 5 "); - assertEquals("forwarder-evc node is created for forwarder with sequence 5 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -586,9 +616,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("forwarder-evc-id","evc-name-3-5") .has("cvlan","36") .has("svlan","740") - .hasNext()); + .hasNext(), + "forwarder-evc node is created for forwarder with sequence 5 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -596,9 +627,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder") .has("sequence", 6) .has("forwarder-role", "egress") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("forwarder node is created for evc-name-3 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -609,9 +641,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.ForwardsTo") .has("aai-node-type", "p-interface") .has("interface-name","1.39") - .hasNext()); + .hasNext(), + "forwarder node is created for evc-name-3 "); - assertEquals("configuration node is created for forwarder with sequence 6 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -621,9 +654,10 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("forwarder-role", "egress") .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .has("configuration-id","evc-name-3-6").has("configuration-type","forwarder").has("configuration-sub-type", "forwarder") - .hasNext()); + .hasNext(), + "configuration node is created for forwarder with sequence 6 "); - assertEquals("configuration node is created for forwarder with sequence 6 ", true, + assertEquals(true, g.V().has("global-customer-id", "customer-id-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") @@ -635,7 +669,8 @@ public class MigratePATHEvcInventoryTest extends AAISetup { .has("configuration-id","evc-name-3-6").has("configuration-type","forwarder").has("configuration-sub-type", "forwarder") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id","evc-name-3-6").has("circuit-id","IZEZ.597112..ATI").has("cvlan","36").has("svlan","3") - .hasNext()); + .hasNext(), + "configuration node is created for forwarder with sequence 6 "); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java index 2951540..74c1aa5 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java @@ -19,9 +19,7 @@ */ package org.onap.aai.migration.v12; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -30,10 +28,11 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -59,7 +58,7 @@ public class MigrateSAREvcInventoryTest extends AAISetup { private JanusGraphTransaction tx; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -151,33 +150,35 @@ public class MigrateSAREvcInventoryTest extends AAISetup { migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); } - @Ignore + @Disabled @Test public void testRun_createServiceInstanceNode() throws Exception { // check if graph nodes exist - assertEquals("service instance node exists", true, + assertEquals(true, g.V().has("service-instance-id", "evc-name-1") - .hasNext()); + .hasNext(), + "service instance node exists"); // check if service-instance node gets created - assertEquals("service subscription node, service-type=SAREA", true, + assertEquals(true, g.V().has("service-instance-id", "evc-name-1") .out("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") - .hasNext()); + .hasNext(), + "service subscription node, service-type=SAREA"); // check if fowarding-path node gets created - assertEquals("fowarding-path is created", true, g.V().has("forwarding-path-id", "evc-name-1") - .has("forwarding-path-name", "evc-name-1").hasNext()); + assertEquals(true, g.V().has("forwarding-path-id", "evc-name-1") + .has("forwarding-path-name", "evc-name-1").hasNext(), "fowarding-path is created"); - assertEquals("fowarding-path node exists", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") @@ -185,10 +186,11 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-1") .has("forwarding-path-name", "evc-name-1") - .hasNext()); + .hasNext(), + "fowarding-path node exists"); // check if configuration node gets created - assertEquals("configuration node, configuration-type= forwarding-path", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") @@ -196,20 +198,22 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .has("configuration-type", "forwarding-path") .has("configuration-sub-type", "evc") - .hasNext()); + .hasNext(), + "configuration node, configuration-type= forwarding-path"); //check if evc node gets created - assertEquals("evc is created", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") .in("org.onap.relationships.inventory.AppliesTo").has("aai-node-type", "forwarding-path") .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "evc") - .hasNext()); + .hasNext(), + "evc is created"); // check if evc node gets created - assertEquals("configuration node, configuration-type= evc", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") @@ -222,75 +226,83 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("cir-units", "Mbps") .has("tagmode-access-ingress", "DOUBLE") .has("tagmode-access-egress", "DOUBLE") - .hasNext()); + .hasNext(), + "configuration node, configuration-type= evc"); } @Test public void testRun_evcNotCreated() throws Exception { // check if graph nodes exist - assertEquals("customer node exists", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") - .hasNext()); + .hasNext(), + "customer node exists"); - assertEquals("service subscription node, service-type=SAREA", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") - .hasNext()); + .hasNext(), + "service subscription node, service-type=SAREA"); //service-instance should not be created - assertEquals("service instance node created", false, + assertEquals(false, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2") - .hasNext()); + .hasNext(), + "service instance node created"); - assertEquals("service instance node already exists", true, + assertEquals(true, g.V().has("global-customer-id", "cust-1") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") - .hasNext()); + .hasNext(), + "service instance node already exists"); // fowarding-path node should not be created - assertEquals("fowarding-path created", false, g.V().has("aai-node-type", "forwarding-path") - .has("forwarding-path-name", "evc-name-2").hasNext()); + assertEquals(false, g.V().has("aai-node-type", "forwarding-path") + .has("forwarding-path-name", "evc-name-2").hasNext(), "fowarding-path created"); // configuration node should not be created - assertEquals("configuration node created", false, g.V().has("aai-node-type", "configuration") - .has("configuration-id", "evc-name-2").hasNext()); + assertEquals(false, g.V().has("aai-node-type", "configuration") + .has("configuration-id", "evc-name-2").hasNext(), "configuration node created"); // evc node should not be created - assertEquals("evc node created", false, g.V().has("aai-node-type", "evc") - .has("evc-id", "evc-name-2").hasNext()); + assertEquals(false, g.V().has("aai-node-type", "evc") + .has("evc-id", "evc-name-2").hasNext(), "evc node created"); // service-instance is not created because pnf exists, but p-interface does not - assertEquals("service instance node created", false, + assertEquals(false, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3") - .hasNext()); + .hasNext(), + "service instance node created"); } - @Ignore + @Disabled @Test public void testRun_createFPConfigurationEvcNode4() throws Exception { // check if graph nodes exist - assertEquals("service instance node exists", true, + assertEquals(true, g.V().has("service-instance-id", "evc-name-4") - .hasNext()); + .hasNext(), + "service instance node exists"); // check if service-instance node gets created - assertEquals("service subscription node, service-type=SAREA", true, + assertEquals(true, g.V().has("service-instance-id", "evc-name-4") .out("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") - .hasNext()); + .hasNext(), + "service subscription node, service-type=SAREA"); // check if fowarding-path node gets created - assertEquals("fowarding-path is created", true, g.V().has("forwarding-path-id", "evc-name-4") - .has("forwarding-path-name", "evc-name-4").hasNext()); + assertEquals(true, g.V().has("forwarding-path-id", "evc-name-4") + .has("forwarding-path-name", "evc-name-4").hasNext(), "fowarding-path is created"); - assertEquals("fowarding-path node exists", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-4") @@ -298,10 +310,11 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-4") .has("forwarding-path-name", "evc-name-4") - .hasNext()); + .hasNext(), + "fowarding-path node exists"); // check if configuration node gets created - assertEquals("configuration node, configuration-type= forwarding-path", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-4") @@ -309,20 +322,22 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .has("configuration-type", "forwarding-path") .has("configuration-sub-type", "evc") - .hasNext()); + .hasNext(), + "configuration node, configuration-type= forwarding-path"); //check if evc node gets created - assertEquals("evc is created", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-4") .in("org.onap.relationships.inventory.AppliesTo").has("aai-node-type", "forwarding-path") .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration") .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "evc") - .hasNext()); + .hasNext(), + "evc is created"); // check if evc node gets created - assertEquals("configuration node, configuration-type= evc", true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA") .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1") @@ -335,7 +350,8 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("cir-units", "Mbps") .has("tagmode-access-ingress", "DOUBLE") .has("tagmode-access-egress", "DOUBLE") - .hasNext()); + .hasNext(), + "configuration node, configuration-type= evc"); } @Test diff --git a/src/test/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigrationTest.java index 079fcf7..ce8f735 100644 --- a/src/test/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigrationTest.java @@ -24,9 +24,10 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -37,7 +38,7 @@ import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -58,7 +59,7 @@ public class SDWANSpeedChangeMigrationTest extends AAISetup { Vertex pLinkWan5; Vertex pLinkWan7; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); tx = graph.newTransaction(); @@ -307,7 +308,7 @@ public class SDWANSpeedChangeMigrationTest extends AAISetup { } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java index 51462fa..d4474b5 100644 --- a/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java @@ -24,9 +24,10 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; import org.onap.aai.dbmap.DBConnectionType; @@ -42,7 +43,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -62,7 +63,7 @@ public class UriMigrationTest extends AAISetup { private Vertex lInterface3; private Vertex plink3; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -103,7 +104,7 @@ public class UriMigrationTest extends AAISetup { } - @After + @AfterEach public void tearDown() throws Exception { graph.close(); } diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java index 02d0e26..355df2a 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -27,9 +27,8 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; @@ -61,7 +60,7 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup { private Vertex modelVer1 = null; private Vertex modelVer3 = null; - @Before + @BeforeEach public void setUp() throws Exception { System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); JanusGraphManagement janusgraphManagement = graph.openManagement(); diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java index 0273e3b..f33c2b2 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -27,9 +27,8 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; @@ -61,7 +60,7 @@ public class MigrateBadWidgetModelsPartTwoTest extends AAISetup { private Vertex modelVer1 = null; private Vertex modelVer3 = null; - @Before + @BeforeEach public void setUp() throws Exception { System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); JanusGraphManagement janusgraphManagement = graph.openManagement(); diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java index f94f595..34f0f83 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java @@ -29,9 +29,10 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
@@ -39,15 +40,14 @@ import org.onap.aai.setup.SchemaVersions; import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.migration.Status;
import org.onap.aai.serialization.engines.QueryStyle;
-import org.onap.aai.serialization.engines.JanusGraphDBEngine;
-
+import org.onap.aai.serialization.engines.JanusGraphDBEngine; + +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import java.util.Optional;
-
-import static org.junit.Assert.assertTrue;
-
+import java.util.Optional; + public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
public static class BooleanDefaultMigrator extends MigrateBooleanDefaultsToFalse {
@@ -75,7 +75,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { private BooleanDefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@@ -246,137 +246,137 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { @Test
public void testMissingProperty(){
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist");
//dhcp-enabled
- assertTrue("Value of subnet should be updated since the property dhcp-enabled doesn't exist",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext(),
+ "Value of subnet should be updated since the property dhcp-enabled doesn't exist");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext());
- assertTrue("Value of l3-network should be updated since the property is-provider-network doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the property is-shared-network doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the property is-external-network doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext(),
+ "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext(),
+ "Value of l3-network should be updated since the property is-provider-network doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext(),
+ "Value of l3-network should be updated since the property is-shared-network doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext(),
+ "Value of l3-network should be updated since the property is-external-network doesn't exist");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored doesn't exist",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext());
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),
+ "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),
+ "Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");
//vf-module: is-base-vf-module
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module doesn't exist",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),
+ "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered doesn't exist",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),
+ "Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");
}
@Test
public void testEmptyValue() {
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string");
//dhcp-enabled
- assertTrue("Value of subnet should be updated since the value for dhcp-enabled is an empty string",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext(),
+ "Value of subnet should be updated since the value for dhcp-enabled is an empty string");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext());
- assertTrue("Value of l3-network should be updated since the value for is-provider-network is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the value for is-shared-network is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the value for is-external-network is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-provider-network is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-shared-network is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-external-network is an empty string");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored is an empty string",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext());
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered is an empty string",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),
+ "Value of l-interface should be updated since the property is-port-mirrored is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),
+ "Value of l-interface should be updated since the property is-ip-unnumbered is an empty string");
//vf-module: is-base-vf-module, is-ip-unnumbered
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module is an empty string",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),
+ "Value of vf-module should be updated since the property is-base-vf-module is an empty string");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered is an empty string",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),
+ "Value of vlan should be updated since the property is-ip-unnumbered is an empty string");
}
@Test
public void testExistingTrueValues() {
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext());
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext());
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext(),
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext(),
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext(),
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");
//dhcp-enabled
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-provider-network", true).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-provider-network", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext());
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
}
@Test
public void testExistingFalseValues() {
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");
//dhcp-enabled
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext(),
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext());
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
}
}
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java index 154b253..481d2ee 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java @@ -19,10 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -31,7 +28,8 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -56,7 +54,7 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup { private MigrateForwarderEvcCircuitId migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -158,20 +156,23 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup { public void testCircuitIdsUpdated() throws Exception { // check if graph nodes are updated - assertEquals("First circuit-id updated", "10", - g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "10").next().value("circuit-id").toString()); + assertEquals("10", + g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "10").next().value("circuit-id").toString(), + "First circuit-id updated"); - assertEquals("Second circuit-id updated", "20", - g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "20").next().value("circuit-id").toString()); + assertEquals("20", + g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "20").next().value("circuit-id").toString(), + "Second circuit-id updated"); - assertFalse("Third circuit-id remains empty", g.V().has("aai-node-type", "forwarder-evc").has("forwarder-evc-id", "evc-3") - .next().property("circuit-id").isPresent()); + assertFalse(g.V().has("aai-node-type", "forwarder-evc").has("forwarder-evc-id", "evc-3") + .next().property("circuit-id").isPresent(), "Third circuit-id remains empty"); - assertEquals("Fourth circuit-id not updated", "3", - g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "3").next().value("circuit-id").toString()); + assertEquals("3", + g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "3").next().value("circuit-id").toString(), + "Fourth circuit-id not updated"); - assertFalse("Fifth circuit-id remains empty", g.V().has("aai-node-type", "forwarder-evc").has("forwarder-evc-id", "evc-5") - .next().property("circuit-id").isPresent()); + assertFalse(g.V().has("aai-node-type", "forwarder-evc").has("forwarder-evc-id", "evc-5") + .next().property("circuit-id").isPresent(), "Fifth circuit-id remains empty"); } @Test diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java index 4e6b127..9dc0dc1 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java @@ -30,9 +30,10 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
import org.janusgraph.core.schema.JanusGraphManagement;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
@@ -45,18 +46,16 @@ import org.onap.aai.migration.v13.MigrateInMaintDefaultToFalse; import org.onap.aai.migration.v13.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
-import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-
+import org.onap.aai.serialization.engines.TransactionalGraphEngine; + +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-
+import java.util.Optional; + public class MigrateInMaintDefaultToFalseTest extends
AAISetup {
protected static final String VNF_NODE_TYPE = "generic-vnf";
@@ -97,7 +96,7 @@ public class MigrateInMaintDefaultToFalseTest extends private InMaintDefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@@ -306,105 +305,105 @@ public class MigrateInMaintDefaultToFalseTest extends @Test
public void testMissingProperty(){
- assertTrue("Value of generic-vnf should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext());
- assertTrue("Value of l-interface should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext());
- assertTrue("Value of lag-interface should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext());
- assertTrue("Value of logical-link should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext());
- assertTrue("Value of p-interface should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext());
- assertTrue("Value of pnf should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext());
- assertTrue("Value of pserver should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext());
- assertTrue("Value of vlan should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext());
- assertTrue("Value of vnfc should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext());
- assertTrue("Value of vserver should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext());
- assertTrue("Value of nos-server should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext(),
+ "Value of generic-vnf should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext(),
+ "Value of l-interface should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext(),
+ "Value of lag-interface should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext(),
+ "Value of logical-link should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext(),
+ "Value of p-interface should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext(),
+ "Value of pnf should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext(),
+ "Value of pserver should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext(),
+ "Value of vlan should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext(),
+ "Value of vnfc should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext(),
+ "Value of vserver should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext(),
+ "Value of nos-server should be updated since the property in-maint doesn't exist");
}
@Test
public void testEmptyValue() {
- assertTrue("Value of generic-vnf should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext());
- assertTrue("Value of l-interface should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext());
- assertTrue("Value of lag-interface should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext());
- assertTrue("Value of logical-link should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext());
- assertTrue("Value of p-interface should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext());
- assertTrue("Value of pnf should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext());
- assertTrue("Value of pserver should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext());
- assertTrue("Value of vlan should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext());
- assertTrue("Value of vnfc should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext());
- assertTrue("Value of vserver should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext());
- assertTrue("Value of nos-server should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext(),
+ "Value of generic-vnf should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext(),
+ "Value of l-interface should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext(),
+ "Value of lag-interface should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext(),
+ "Value of logical-link should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext(),
+ "Value of p-interface should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext(),
+ "Value of pnf should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext(),
+ "Value of pserver should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext(),
+ "Value of vlan should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext(),
+ "Value of vnfc should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext(),
+ "Value of vserver should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext(),
+ "Value of nos-server should be updated since the value for in-maint is an empty string");
}
@Test
public void testExistingTrueValues() {
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext());
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext());
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext());
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext());
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext());
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext());
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext());
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext());
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext());
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext());
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext(),
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext(),
+ "Value of l-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext(),
+ "Value of lag-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext(),
+ "Value of logical-link shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext(),
+ "Value of p-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext(),
+ "Value of pnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext(),
+ "Value of pserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext(),
+ "Value of vlan shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext(),
+ "Value of vnfc shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext(),
+ "Value of vserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext(),
+ "Value of nos-server shouldn't be updated since in-maint already exists");
}
@Test
public void testExistingFalseValues() {
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext());
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext());
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext());
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext());
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext());
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext());
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext());
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext());
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext());
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext());
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext(),
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext(),
+ "Value of l-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext(),
+ "Value of lag-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext(),
+ "Value of logical-link shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext(),
+ "Value of p-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext(),
+ "Value of pnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext(),
+ "Value of pserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext(),
+ "Value of vlan shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext(),
+ "Value of vnfc shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext(),
+ "Value of vserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext(),
+ "Value of nos-server shouldn't be updated since in-maint already exists");
}
}
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantIdTest.java index 8adc9e5..b864d59 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantIdTest.java @@ -25,7 +25,9 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -36,7 +38,7 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -52,7 +54,7 @@ public class MigrateInstanceGroupModelInvariantIdTest extends AAISetup{ private JanusGraphTransaction tx; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -84,7 +86,7 @@ public class MigrateInstanceGroupModelInvariantIdTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -94,13 +96,15 @@ public class MigrateInstanceGroupModelInvariantIdTest extends AAISetup{ public void testIdsUpdated() throws Exception { assertEquals(true, g.V().has("aai-node-type", "instance-group").has("id", "instance-id-1").has("model-invariant-id-local").next().property("model-invariant-id-local").isPresent()); - assertEquals("model-invariant-id renamed to model-invariant-id-local for instance-group", "instance-invariant-id-1", - g.V().has("aai-node-type", "instance-group").has("id", "instance-id-1").next().value("model-invariant-id-local").toString()); + assertEquals("instance-invariant-id-1", + g.V().has("aai-node-type", "instance-group").has("id", "instance-id-1").next().value("model-invariant-id-local").toString(), + "model-invariant-id renamed to model-invariant-id-local for instance-group"); } @Test public void testIdsNotUpdated() throws Exception { - assertEquals("model-invariant-id-local remains the same for instance-group", "instance-invariant-id-2", - g.V().has("aai-node-type", "instance-group").has("id", "instance-id-2").next().value("model-invariant-id-local").toString()); + assertEquals("instance-invariant-id-2", + g.V().has("aai-node-type", "instance-group").has("id", "instance-id-2").next().value("model-invariant-id-local").toString(), + "model-invariant-id-local remains the same for instance-group"); } } diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java index 4350f75..524af90 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java @@ -25,9 +25,10 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -39,7 +40,7 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -55,7 +56,7 @@ public class MigrateInstanceGroupModelVersionIdTest extends AAISetup { private static JanusGraphTransaction tx; private static GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -87,7 +88,7 @@ public class MigrateInstanceGroupModelVersionIdTest extends AAISetup { migration.run(); } - @AfterClass + @AfterAll public static void cleanUp() { tx.tx().rollback(); graph.close(); @@ -97,13 +98,15 @@ public class MigrateInstanceGroupModelVersionIdTest extends AAISetup { public void testIdsUpdated() throws Exception { assertEquals(true, g.V().has("aai-node-type", "instance-group").has("id", "instance-id-1").has("model-version-id-local").next().property("model-version-id-local").isPresent()); - assertEquals("model-version-id renamed to model-version-id-local for instance-group", "instance-version-id-1", - g.V().has("aai-node-type", "instance-group").has("id", "instance-id-1").next().value("model-version-id-local").toString()); + assertEquals("instance-version-id-1", + g.V().has("aai-node-type", "instance-group").has("id", "instance-id-1").next().value("model-version-id-local").toString(), + "model-version-id renamed to model-version-id-local for instance-group"); } @Test public void testIdsNotUpdated() throws Exception { - assertEquals("model-version-id-local remains the same for instance-group", "instance-version-id-2", - g.V().has("aai-node-type", "instance-group").has("id", "instance-id-2").next().value("model-version-id-local").toString()); + assertEquals("instance-version-id-2", + g.V().has("aai-node-type", "instance-group").has("id", "instance-id-2").next().value("model-version-id-local").toString(), + "model-version-id-local remains the same for instance-group"); } } diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java index 7e12349..fb319fc 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java @@ -19,16 +19,17 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -60,7 +61,7 @@ public class MigrateInstanceGroupSubTypeTest extends AAISetup{ Vertex instanceGroupWithoutTSubType; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); tx = graph.newTransaction(); @@ -84,7 +85,7 @@ public class MigrateInstanceGroupSubTypeTest extends AAISetup{ migration = new MigrateInstanceGroupSubType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java index 5e7ee48..281d205 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java @@ -19,16 +19,17 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -60,7 +61,7 @@ public class MigrateInstanceGroupTypeTest extends AAISetup{ Vertex instanceGroupWithoutType; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); tx = graph.newTransaction(); @@ -84,7 +85,7 @@ public class MigrateInstanceGroupTypeTest extends AAISetup{ migration = new MigrateInstanceGroupType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java index 76dda1c..41f524b 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -29,9 +29,9 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; import org.janusgraph.core.schema.JanusGraphManagement; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; @@ -55,7 +55,7 @@ public class MigrateModelVerTest extends AAISetup{ private JanusGraphTransaction tx; private MigrateModelVer migration; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); JanusGraphManagement janusgraphManagement = graph.openManagement(); @@ -271,7 +271,7 @@ public class MigrateModelVerTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); @@ -284,14 +284,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-1").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "connector").has("resource-instance-id", "connector2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-1").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-1").hasNext(), + "Edge not created"); - assertEquals("Edge exists to 2 connectors", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-1") - .in().count().next()); + .in().count().next(), + "Edge exists to 2 connectors"); } @@ -302,14 +304,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-2").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "service-instance").has("service-instance-id", "serviceinstance2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-2").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-2").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 service-instances", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-2") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 service-instances"); } @Test @@ -319,14 +323,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-3").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnfName2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-3").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-3").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 pnfs", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-3") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 pnfs"); } @Test @@ -336,14 +342,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-4").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "logical-link").has("link-name", "linkName2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-4").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-4").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 logical-link", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-4") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 logical-link"); } @Test @@ -353,14 +361,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-5").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-5").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-5").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 logical-link", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-5") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 logical-link"); } @Test @@ -370,14 +380,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-6").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "vnf2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-6").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-6").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 generic-vnfs", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-6") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 generic-vnfs"); } @Test @@ -387,14 +399,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-7").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "configuration").has("configuration-id", "configuration2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-7").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-7").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 configurations", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-7") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 configurations"); } @Test @@ -404,14 +418,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-8").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "l3-network").has("network-id", "l3Network2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-8").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-8").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 l3-networks", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-8") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 l3-networks"); } @Test @@ -421,14 +437,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-9").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "vf-module").has(" vf-module-id", "vfModule2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-9").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-9").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 vf-modules", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-9") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 vf-modules"); } @Test @@ -438,14 +456,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-10").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "collection").has("collection-id", "collection2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-10").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-10").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 collections", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-10") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 collections"); } @Test @@ -455,14 +475,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-11").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "instance-group").has("collection-id", "instanceGroup2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-11").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-11").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 instance-group2", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-11") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 instance-group2"); } @Test @@ -472,14 +494,16 @@ public class MigrateModelVerTest extends AAISetup{ .out() .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-12").hasNext()); - assertEquals( "Edge not created", false, + assertEquals( false, g.V().has("aai-node-type", "allotted-resource").has("id", "allottedResource2") .out() - .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-12").hasNext()); + .has("aai-node-type", "model-ver").has("model-version-id","model-version-id-12").hasNext(), + "Edge not created"); - assertEquals("Edge exists to only 2 allotted-resource", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-12") - .in().count().next()); + .in().count().next(), + "Edge exists to only 2 allotted-resource"); } } diff --git a/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java b/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java index f0eaf33..10a4f20 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java @@ -19,15 +19,16 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -62,7 +63,7 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{ Vertex pnf22; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); tx = graph.newTransaction(); @@ -103,7 +104,7 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantIdTest.java index 04c8ab6..bd642ed 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantIdTest.java @@ -25,7 +25,9 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -36,7 +38,7 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -52,7 +54,7 @@ public class MigrateVnfcModelInvariantIdTest extends AAISetup{ private JanusGraphTransaction tx; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -86,7 +88,7 @@ public class MigrateVnfcModelInvariantIdTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -96,13 +98,15 @@ public class MigrateVnfcModelInvariantIdTest extends AAISetup{ public void testIdsUpdated() throws Exception { assertEquals(true, g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-1").has("model-invariant-id-local").next().property("model-invariant-id-local").isPresent()); - assertEquals("model-invariant-id renamed to model-invariant-id-local for vnfc", "vnfc-invariant-id-1", - g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-1").next().value("model-invariant-id-local").toString()); + assertEquals("vnfc-invariant-id-1", + g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-1").next().value("model-invariant-id-local").toString(), + "model-invariant-id renamed to model-invariant-id-local for vnfc"); } @Test public void testIdsNotUpdated() throws Exception { - assertEquals("model-invariant-id-local should not be renamed for vnfc", "vnfc-invariant-id-2", - g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-2").next().value("model-invariant-id-local").toString()); + assertEquals("vnfc-invariant-id-2", + g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-2").next().value("model-invariant-id-local").toString(), + "model-invariant-id-local should not be renamed for vnfc"); } } diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionIdTest.java index c79b06f..bb25d70 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionIdTest.java @@ -19,14 +19,16 @@ */ package org.onap.aai.migration.v13; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -54,7 +56,7 @@ public class MigrateVnfcModelVersionIdTest extends AAISetup{ private JanusGraphTransaction tx; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -88,7 +90,7 @@ public class MigrateVnfcModelVersionIdTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -98,13 +100,15 @@ public class MigrateVnfcModelVersionIdTest extends AAISetup{ public void testIdsUpdated() throws Exception { assertEquals(true, g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-1").has("model-version-id-local").next().property("model-version-id-local").isPresent()); - assertEquals("model-version-id renamed to model-invariant-id-local for vnfc", "vnfc-version-id-1", - g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-1").next().value("model-version-id-local").toString()); + assertEquals("vnfc-version-id-1", + g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-1").next().value("model-version-id-local").toString(), + "model-version-id renamed to model-invariant-id-local for vnfc"); } @Test public void testIdsNotUpdated() throws Exception { - assertEquals("model-version-id-local should not be renamed for vnfc", "vnfc-version-id-2", - g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-2").next().value("model-version-id-local").toString()); + assertEquals("vnfc-version-id-2", + g.V().has("aai-node-type", "vnfc").has("vnfcName", "vnfc-name-2").next().value("model-version-id-local").toString(), + "model-version-id-local should not be renamed for vnfc"); } } diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java index 30ff201..79f65a0 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java @@ -30,8 +30,9 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; import org.onap.aai.introspection.ModelType; @@ -41,6 +42,7 @@ import org.onap.aai.migration.Status; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -48,8 +50,6 @@ import java.util.Optional; import javax.validation.constraints.AssertFalse; -import static org.junit.Assert.assertTrue; - public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { protected static final String VNF_NODE_TYPE = "generic-vnf"; @@ -79,7 +79,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { private MigrateVnfType migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setup() throws Exception{ g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -174,35 +174,35 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { @Test public void testMissingProperty(){ //management-option - assertTrue("Value of generic-vnf should be updated since the property management-option doesn't exist", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf should be updated since the property management-option doesn't exist", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf10").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf should be updated since the property management-option doesn't exist", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf20").has("management-option", "AT&T Managed-Basic").hasNext()); + assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf should be updated since the property management-option doesn't exist"); + assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf10").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf should be updated since the property management-option doesn't exist"); + assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf20").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf should be updated since the property management-option doesn't exist"); } @Test public void testEmptyValue() { //management-option - assertTrue("Value of generic-vnf should be updated since the value for management-option is an empty string", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf should be updated since the value for management-option is an empty string", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf11").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf should be updated since the value for management-option is an empty string", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf21").has("management-option", "AT&T Managed-Basic").hasNext()); + assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf should be updated since the value for management-option is an empty string"); + assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf11").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf should be updated since the value for management-option is an empty string"); + assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf21").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf should be updated since the value for management-option is an empty string"); } @Test public void testExistingValues() { //management-option - assertTrue("Value of generic-vnf shouldn't be updated since management-option already exists", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf shouldn't be updated since management-option already exists", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf12").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf shouldn't be updated since management-option already exists", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf22").has("management-option", "AT&T Managed-Basic").hasNext()); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since management-option already exists"); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf12").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since management-option already exists"); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf22").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since management-option already exists"); } @@ -210,19 +210,19 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { @Test public void testExistingVnfsNotMigrated() { //management-option - assertTrue("Value of generic-vnf shouldn't be updated since vnf-type is not affected", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf30").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf shouldn't be updated since vnf-type is not affected", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf31").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf shouldn't be updated since vnf-type is not affected and management-option already exists", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf32").has("management-option", "AT&T Managed-Basic").hasNext()); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf30").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since vnf-type is not affected"); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf31").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since vnf-type is not affected"); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf32").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since vnf-type is not affected and management-option already exists"); - assertTrue("Value of generic-vnf shouldn't be updated since vnf-type is not present", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf40").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf shouldn't be updated since vnf-type is not present", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf41").has("management-option", "AT&T Managed-Basic").hasNext()); - assertTrue("Value of generic-vnf shouldn't be updated since vnf-type is not present and management-option already exists", - !g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf42").has("management-option", "AT&T Managed-Basic").hasNext()); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf40").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since vnf-type is not present"); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf41").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since vnf-type is not present"); + assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf42").has("management-option", "AT&T Managed-Basic").hasNext(), + "Value of generic-vnf shouldn't be updated since vnf-type is not present and management-option already exists"); } }
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateMissingFqdnOnPserversTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateMissingFqdnOnPserversTest.java index ba2316e..47ab1e6 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateMissingFqdnOnPserversTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateMissingFqdnOnPserversTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v14; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -28,9 +28,10 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -57,7 +58,7 @@ public class MigrateMissingFqdnOnPserversTest extends AAISetup{ Vertex pserver5; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); @@ -105,7 +106,7 @@ public class MigrateMissingFqdnOnPserversTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java index db9cd42..a3f72dc 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java @@ -19,14 +19,15 @@ */ package org.onap.aai.migration.v14; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -45,7 +46,7 @@ public class MigrateNetworkTechToCloudRegionTest extends AAISetup{ private GraphTraversalSource g; private MigrateNetworkTechToCloudRegion migration; - @Before + @BeforeEach public void setUp() throws Exception { g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -117,20 +118,23 @@ public class MigrateNetworkTechToCloudRegionTest extends AAISetup{ .has("aai-node-type", "network-technology").has("network-technology-id","network-technology-4").hasNext()); - assertEquals("Edge not created", false, + assertEquals(false, g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region-id-1") .out() - .has("aai-node-type", "network-technology").has("network-technology-id","network-technology-3").hasNext()); + .has("aai-node-type", "network-technology").has("network-technology-id","network-technology-3").hasNext(), + "Edge not created"); - assertEquals("Edge not created", false, + assertEquals(false, g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region-id-2") .out() - .has("aai-node-type", "network-technology").has("network-technology-id","network-technology-1").hasNext()); + .has("aai-node-type", "network-technology").has("network-technology-id","network-technology-1").hasNext(), + "Edge not created"); - assertEquals("Edge exists to 2 cloud regions", new Long(2L), + assertEquals(new Long(2L), g.V().has("aai-node-type", "network-technology").has("network-technology-id", "network-technology-1") - .in().count().next()); + .in().count().next(), + "Edge exists to 2 cloud regions"); /* try { diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java index 1a177f7..a652147 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v14; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -29,7 +29,9 @@ import java.util.UUID; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -92,7 +94,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ Vertex zoneScn61; Vertex zoneScn62; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -862,7 +864,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -963,8 +965,8 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ assertEquals(true, g.V().has("aai-node-type", "p-interface").has("aai-uri","/cloud-infrastructure/pservers/pserver/rctP3/p-interfaces/p-interface/pint11").hasNext()); //2. pint12 int-name matches with pint31. So, verify that p-int does not move from rctP1 to rctP3 - assertEquals("rctP3 has only 1 pint with name pint12", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo") - .has("aai-node-type","p-interface").has("interface-name","pint12").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo") + .has("aai-node-type","p-interface").has("interface-name","pint12").count().next(), "rctP3 has only 1 pint with name pint12"); //3. Verify that the p-interface from pserver is not moved to another pserver that has null fqdn assertEquals(false, g.V().has("aai-node-type", "pserver").has("hostname","rctP2").in("tosca.relationships.network.BindsTo") @@ -973,8 +975,8 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ //4. If the fqdn is "" within 2 RCT pservers, ignore that case. Don't move the p-int from old resource-version to new resource-version pserver assertEquals(false, g.V().has("aai-node-type", "pserver").has("hostname","rctP5").in("tosca.relationships.network.BindsTo") .has("aai-node-type","p-interface").has("interface-name","pint41").hasNext()); - assertEquals("rctP5 has only 1 p-interface", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP5").in("tosca.relationships.network.BindsTo") - .has("aai-node-type","p-interface").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP5").in("tosca.relationships.network.BindsTo") + .has("aai-node-type","p-interface").count().next(), "rctP5 has only 1 p-interface"); //5. plink is moved from pint3 on pserver fqdn1 to pint2 on pserver fqdn3. Both p-ints have the same interface-name assertEquals(true, g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo") @@ -1000,16 +1002,16 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ //2. lagint12 int-name matches with lagint31. So, verify that lag-int does not move from rctP1 to rctP3 - assertEquals("rctP3 has only 1 lag-interface with name lagint12", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo") - .has("aai-node-type","lag-interface").has("interface-name","lagint12").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo") + .has("aai-node-type","lag-interface").has("interface-name","lagint12").count().next(), "rctP3 has only 1 lag-interface with name lagint12"); } @Test public void checkRCTPserverHasRelnToOnly1Zone() throws Exception { - assertEquals("Edge to only 1 Zone exists", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").out("org.onap.relationships.inventory.LocatedIn") - .has("aai-node-type","zone").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").out("org.onap.relationships.inventory.LocatedIn") + .has("aai-node-type","zone").count().next(), "Edge to only 1 Zone exists"); assertEquals(true, g.V().has("aai-node-type", "zone").has("zone-id","zone-62").hasNext()); //Verify no edge exists from zone61 to lower resource-version RCT pserver assertEquals(false, g.V().has("aai-node-type", "zone").has("zone-id","zone-61").in().has("aai-node-type", "pserver").hasNext()); @@ -1018,8 +1020,8 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ @Test public void checkRCTPserverHasRelnTo2GenericVnfs() throws Exception { - assertEquals("Edge to 2 generic-vnfs exists", new Long(2L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").in("tosca.relationships.HostedOn") - .has("aai-node-type","generic-vnf").count().next()); + assertEquals(new Long(2L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").in("tosca.relationships.HostedOn") + .has("aai-node-type","generic-vnf").count().next(), "Edge to 2 generic-vnfs exists"); assertEquals(true, g.V().has("aai-node-type", "generic-vnf").has("vnf-id","vnf-1").out().has("aai-node-type", "pserver").has("hostname", "Scn6.pserverRCT1Scn6").hasNext()); //Verify no edge exists from vnf-1 to lower resource-version pserver assertEquals(false, g.V().has("aai-node-type", "generic-vnf").has("vnf-id","vnf-1").out().has("aai-node-type", "pserver").has("hostname", "Scn6.pserverRCTScn6").hasNext()); @@ -1035,7 +1037,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{ assertEquals(true, g.V().has("aai-node-type", "pserver").has("hostname","pserverRo.NewOne.aaaa.ccccccccccc").in("tosca.relationships.network.BindsTo") .has("aai-node-type","p-interface").has("interface-name","pintRo1").out().has("link-name","plinkROonOldRo1").hasNext()); //Verify complex does not get attached to pserverRO5 - assertEquals("Complex is related to only 1 pserver", new Long(1L), g.V().has("physical-location-id", "complexOldRO").in("org.onap.relationships.inventory.LocatedIn").count().next()); + assertEquals(new Long(1L), g.V().has("physical-location-id", "complexOldRO").in("org.onap.relationships.inventory.LocatedIn").count().next(), "Complex is related to only 1 pserver"); } @Test diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java index 7f381f8..03d8464 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v14; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -33,8 +33,9 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; import org.onap.aai.dbmap.DBConnectionType; @@ -64,7 +65,7 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { private MigrateSdnaIvlanData migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -187,8 +188,7 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { @Test public void testSdnaIvlanMigration() { - assertTrue("Value of node-type forwarder-evc, forwarder-evc-id of test/evc/one-1 has ben updated with the ivlan property value of 111 ", - g.V() + assertTrue(g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf1") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, P_INTERFACE_NODE_TYPE).has("interface-name", "11111.1") @@ -196,10 +196,10 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/one")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "111").hasNext()); + .has("ivlan", "111").hasNext(), + "Value of node-type forwarder-evc, forwarder-evc-id of test/evc/one-1 has ben updated with the ivlan property value of 111 "); - assertTrue("Value of node-type forwarder-evc, forwarder-evc-id of test/evc/one-2 has ben updated with the ivlan property value of 222 ", - g.V() + assertTrue(g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf1") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, LAG_INTERFACE_NODE_TYPE).has("interface-name", "lag-interface1") @@ -207,10 +207,10 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/one")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "222").hasNext()); + .has("ivlan", "222").hasNext(), + "Value of node-type forwarder-evc, forwarder-evc-id of test/evc/one-2 has ben updated with the ivlan property value of 222 "); - assertTrue("Value of node-type P-INTERFACE with an interface-name of l11111.2 does not exist in Graph. Ivlan not Updated ", - !g.V() + assertTrue(!g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf1") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, P_INTERFACE_NODE_TYPE).has("interface-name", "11111.2") @@ -218,10 +218,10 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/one")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "333").hasNext()); + .has("ivlan", "333").hasNext(), + "Value of node-type P-INTERFACE with an interface-name of l11111.2 does not exist in Graph. Ivlan not Updated "); - assertTrue("Value of node-type LAG-INTERFACE with an interface-name of lag-interface2 does not exist in Graph. Ivlan not Updated ", - !g.V() + assertTrue(!g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf1") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, LAG_INTERFACE_NODE_TYPE).has("interface-name", "lag-interface2") @@ -229,11 +229,11 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/one")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "444").hasNext()); + .has("ivlan", "444").hasNext(), + "Value of node-type LAG-INTERFACE with an interface-name of lag-interface2 does not exist in Graph. Ivlan not Updated "); - assertTrue("Value of node-type P-INTERFACE with an interface-name of 11111.3 and evc of test/evc/one_2 does not exist in Graph. Ivlan not Updated ", - !g.V() + assertTrue(!g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf1") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, P_INTERFACE_NODE_TYPE).has("interface-name", "11111.3") @@ -241,10 +241,10 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/one_2")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "555").hasNext()); + .has("ivlan", "555").hasNext(), + "Value of node-type P-INTERFACE with an interface-name of 11111.3 and evc of test/evc/one_2 does not exist in Graph. Ivlan not Updated "); - assertTrue("Value of node-type LAG-INTERFACE with an interface-name of lag-interface3 and evc of test/evc/one_2 does not exist in Graph. Ivlan not Updated ", - !g.V() + assertTrue(!g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf1") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, LAG_INTERFACE_NODE_TYPE).has("interface-name", "lag-interface3") @@ -252,10 +252,10 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/one_2")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "666").hasNext()); + .has("ivlan", "666").hasNext(), + "Value of node-type LAG-INTERFACE with an interface-name of lag-interface3 and evc of test/evc/one_2 does not exist in Graph. Ivlan not Updated "); - assertTrue("Value of node-type PNF with an pnf-name of pnf2 does not exist in Graph. Ivlan not Updated ", - !g.V() + assertTrue(!g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf2") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, P_INTERFACE_NODE_TYPE).has("interface-name", "22222.2") @@ -263,10 +263,10 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/two")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "777").hasNext()); + .has("ivlan", "777").hasNext(), + "Value of node-type PNF with an pnf-name of pnf2 does not exist in Graph. Ivlan not Updated "); - assertTrue("Value of node-type PNF with an pnf-name of pnf2 does not exist in Graph. Ivlan not Updated ", - !g.V() + assertTrue(!g.V() .has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).has("pnf-name", "pnf2") .in("tosca.relationships.network.BindsTo") .has(AAIProperties.NODE_TYPE, LAG_INTERFACE_NODE_TYPE).has("interface-name", "lag-interface2") @@ -274,7 +274,8 @@ public class MigrateSdnaIvlanDataTest extends AAISetup { .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", "test/evc/two")) .out("org.onap.relationships.inventory.Uses") .in("org.onap.relationships.inventory.BelongsTo") - .has("ivlan", "888").hasNext()); + .has("ivlan", "888").hasNext(), + "Value of node-type PNF with an pnf-name of pnf2 does not exist in Graph. Ivlan not Updated "); } diff --git a/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java b/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java index e8bebe5..60e6b04 100644 --- a/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java +++ b/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v14; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -28,7 +28,9 @@ import java.util.List; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -84,7 +86,7 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{ Vertex zoneScn61; Vertex zoneScn62; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); tx = graph.newTransaction(); @@ -382,7 +384,7 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); @@ -415,8 +417,8 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{ assertEquals("Scn4.pserverROSPlinkScn4",pserverRCTPlinkScn4.property("fqdn").value().toString()); assertEquals(true, g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTPlinkScn4").in("tosca.relationships.network.BindsTo") .has("aai-node-type","p-interface").has("interface-name","pintPlinkScn4").hasNext()); - assertEquals("only 1 p-int is present on RCT pserver", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTPlinkScn4").in("tosca.relationships.network.BindsTo") - .has("aai-node-type","p-interface").has("interface-name","pintPlinkScn4").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTPlinkScn4").in("tosca.relationships.network.BindsTo") + .has("aai-node-type","p-interface").has("interface-name","pintPlinkScn4").count().next(), "only 1 p-int is present on RCT pserver"); assertEquals("/cloud-infrastructure/pservers/pserver/pserverRCTPlinkScn4/p-interfaces/p-interface/pintPlinkScn4", samePintScn4RCT.property("aai-uri").value().toString()); //plink is not moved from RO to RCT when p-int matches assertEquals(false, g.V().has("aai-node-type", "pserver").has("hostname","pserverRCT").in("tosca.relationships.network.BindsTo") @@ -442,15 +444,15 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{ @Test public void checkRCTPserverHasRelnToOnly1Complex() throws Exception { - assertEquals("Edge to only 1 complex exists", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn3").out("org.onap.relationships.inventory.LocatedIn") - .has("aai-node-type","complex").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn3").out("org.onap.relationships.inventory.LocatedIn") + .has("aai-node-type","complex").count().next(), "Edge to only 1 complex exists"); } @Test public void checkRCTPserverHasRelnToOnly1Zone() throws Exception { - assertEquals("Edge to only 1 Zone exists", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").out("org.onap.relationships.inventory.LocatedIn") - .has("aai-node-type","zone").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").out("org.onap.relationships.inventory.LocatedIn") + .has("aai-node-type","zone").count().next(), "Edge to only 1 Zone exists"); assertEquals(true, g.V().has("aai-node-type", "zone").has("zone-id","zone-62").hasNext()); //Verify no edge exists from zone62 to RO pserver assertEquals(false, g.V().has("aai-node-type", "zone").has("zone-id","zone-62").in().has("aai-node-type", "pserver").hasNext()); @@ -460,8 +462,8 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{ @Test public void checkRCTPserverHasRelnTo2GenericVnfs() throws Exception { - assertEquals("Edge to 2 generic-vnfs exists", new Long(2L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").in("tosca.relationships.HostedOn") - .has("aai-node-type","generic-vnf").count().next()); + assertEquals(new Long(2L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").in("tosca.relationships.HostedOn") + .has("aai-node-type","generic-vnf").count().next(), "Edge to 2 generic-vnfs exists"); assertEquals(true, g.V().has("aai-node-type", "generic-vnf").has("vnf-id","vnf-2").out().has("aai-node-type", "pserver").has("hostname", "pserverRCTScn6").hasNext()); //Verify no edge exists from zone62 to RO pserver assertEquals(false, g.V().has("aai-node-type", "generic-vnf").has("vnf-id","vnf-2").out().has("aai-node-type", "pserver").has("hostname", "pserverROScn6").hasNext()); @@ -486,8 +488,8 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{ //2. lagint12 int-name matches with lagint31. So, verify that lag-int does not move from rctP1 to rctP3 - assertEquals("rctP1 has only 1 lag-interface with name lagint12", new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP1").in("tosca.relationships.network.BindsTo") - .has("aai-node-type","lag-interface").has("interface-name","lagint12").count().next()); + assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP1").in("tosca.relationships.network.BindsTo") + .has("aai-node-type","lag-interface").has("interface-name","lagint12").count().next(), "rctP1 has only 1 lag-interface with name lagint12"); } diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java index 3ab8af5..422930b 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java @@ -29,9 +29,10 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
@@ -40,15 +41,14 @@ import org.onap.aai.setup.SchemaVersion; import org.onap.aai.migration.Status;
import org.onap.aai.migration.v15.MigrateBooleanDefaultsToFalse;
import org.onap.aai.serialization.engines.QueryStyle;
-import org.onap.aai.serialization.engines.JanusGraphDBEngine;
-
+import org.onap.aai.serialization.engines.JanusGraphDBEngine; + +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import java.util.Optional;
-
-import static org.junit.Assert.assertTrue;
-
+import java.util.Optional; + public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
public static class BooleanDefaultMigrator extends MigrateBooleanDefaultsToFalse {
@@ -76,7 +76,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { private BooleanDefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@@ -247,137 +247,137 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { @Test
public void testMissingProperty(){
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist");
//dhcp-enabled
- assertTrue("Value of subnet should be updated since the property dhcp-enabled doesn't exist",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext(),
+ "Value of subnet should be updated since the property dhcp-enabled doesn't exist");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext());
- assertTrue("Value of l3-network should be updated since the property is-provider-network doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the property is-shared-network doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the property is-external-network doesn't exist",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext(),
+ "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext(),
+ "Value of l3-network should be updated since the property is-provider-network doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext(),
+ "Value of l3-network should be updated since the property is-shared-network doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext(),
+ "Value of l3-network should be updated since the property is-external-network doesn't exist");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored doesn't exist",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext());
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),
+ "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),
+ "Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");
//vf-module: is-base-vf-module
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module doesn't exist",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),
+ "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered doesn't exist",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),
+ "Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");
}
@Test
public void testEmptyValue() {
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string");
//dhcp-enabled
- assertTrue("Value of subnet should be updated since the value for dhcp-enabled is an empty string",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext(),
+ "Value of subnet should be updated since the value for dhcp-enabled is an empty string");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext());
- assertTrue("Value of l3-network should be updated since the value for is-provider-network is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the value for is-shared-network is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext());
- assertTrue("Value of l3-network should be updated since the value for is-external-network is an empty string",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-provider-network is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-shared-network is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext(),
+ "Value of l3-network should be updated since the value for is-external-network is an empty string");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored is an empty string",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext());
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered is an empty string",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),
+ "Value of l-interface should be updated since the property is-port-mirrored is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),
+ "Value of l-interface should be updated since the property is-ip-unnumbered is an empty string");
//vf-module: is-base-vf-module, is-ip-unnumbered
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module is an empty string",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),
+ "Value of vf-module should be updated since the property is-base-vf-module is an empty string");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered is an empty string",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),
+ "Value of vlan should be updated since the property is-ip-unnumbered is an empty string");
}
@Test
public void testExistingTrueValues() {
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext());
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext());
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext(),
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext(),
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext(),
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");
//dhcp-enabled
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-provider-network", true).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-provider-network", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext(),
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext());
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
}
@Test
public void testExistingFalseValues() {
//is-closed-loop-disabled
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext());
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext(),
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");
//dhcp-enabled
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext(),
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext());
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",
- g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");
+ assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext(),
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext());
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
}
}
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java index 9e8fe03..449a63f 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java @@ -19,15 +19,16 @@ */ package org.onap.aai.migration.v15; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -59,7 +60,7 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{ Vertex cloudRegion3; - @Before + @BeforeEach public void setUp() throws Exception { graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); @@ -99,7 +100,7 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{ migration.run(); } - @After + @AfterEach public void cleanUp() { tx.rollback(); graph.close(); diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java index d023685..97cc8b6 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java @@ -30,9 +30,10 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
import org.janusgraph.core.schema.JanusGraphManagement;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
@@ -45,18 +46,16 @@ import org.onap.aai.migration.v15.MigrateInMaintDefaultToFalse; import org.onap.aai.migration.v15.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
-import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-
+import org.onap.aai.serialization.engines.TransactionalGraphEngine; + +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-
+import java.util.Optional; + public class MigrateInMaintDefaultToFalseTest extends
AAISetup {
protected static final String VNF_NODE_TYPE = "generic-vnf";
@@ -96,7 +95,7 @@ public class MigrateInMaintDefaultToFalseTest extends private InMaintDefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@@ -305,105 +304,105 @@ public class MigrateInMaintDefaultToFalseTest extends @Test
public void testMissingProperty(){
- assertTrue("Value of generic-vnf should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext());
- assertTrue("Value of l-interface should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext());
- assertTrue("Value of lag-interface should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext());
- assertTrue("Value of logical-link should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext());
- assertTrue("Value of p-interface should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext());
- assertTrue("Value of pnf should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext());
- assertTrue("Value of pserver should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext());
- assertTrue("Value of vlan should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext());
- assertTrue("Value of vnfc should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext());
- assertTrue("Value of vserver should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext());
- assertTrue("Value of nos-server should be updated since the property in-maint doesn't exist",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext(),
+ "Value of generic-vnf should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext(),
+ "Value of l-interface should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext(),
+ "Value of lag-interface should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext(),
+ "Value of logical-link should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext(),
+ "Value of p-interface should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext(),
+ "Value of pnf should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext(),
+ "Value of pserver should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext(),
+ "Value of vlan should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext(),
+ "Value of vnfc should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext(),
+ "Value of vserver should be updated since the property in-maint doesn't exist");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext(),
+ "Value of nos-server should be updated since the property in-maint doesn't exist");
}
@Test
public void testEmptyValue() {
- assertTrue("Value of generic-vnf should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext());
- assertTrue("Value of l-interface should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext());
- assertTrue("Value of lag-interface should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext());
- assertTrue("Value of logical-link should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext());
- assertTrue("Value of p-interface should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext());
- assertTrue("Value of pnf should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext());
- assertTrue("Value of pserver should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext());
- assertTrue("Value of vlan should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext());
- assertTrue("Value of vnfc should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext());
- assertTrue("Value of vserver should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext());
- assertTrue("Value of nos-server should be updated since the value for in-maint is an empty string",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext(),
+ "Value of generic-vnf should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext(),
+ "Value of l-interface should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext(),
+ "Value of lag-interface should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext(),
+ "Value of logical-link should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext(),
+ "Value of p-interface should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext(),
+ "Value of pnf should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext(),
+ "Value of pserver should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext(),
+ "Value of vlan should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext(),
+ "Value of vnfc should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext(),
+ "Value of vserver should be updated since the value for in-maint is an empty string");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext(),
+ "Value of nos-server should be updated since the value for in-maint is an empty string");
}
@Test
public void testExistingTrueValues() {
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext());
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext());
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext());
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext());
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext());
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext());
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext());
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext());
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext());
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext());
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext(),
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext(),
+ "Value of l-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext(),
+ "Value of lag-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext(),
+ "Value of logical-link shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext(),
+ "Value of p-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext(),
+ "Value of pnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext(),
+ "Value of pserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext(),
+ "Value of vlan shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext(),
+ "Value of vnfc shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext(),
+ "Value of vserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext(),
+ "Value of nos-server shouldn't be updated since in-maint already exists");
}
@Test
public void testExistingFalseValues() {
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext());
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext());
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext());
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext());
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext());
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext());
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext());
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext());
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext());
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext());
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext());
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext(),
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext(),
+ "Value of l-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext(),
+ "Value of lag-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext(),
+ "Value of logical-link shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext(),
+ "Value of p-interface shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext(),
+ "Value of pnf shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext(),
+ "Value of pserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext(),
+ "Value of vlan shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext(),
+ "Value of vnfc shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext(),
+ "Value of vserver shouldn't be updated since in-maint already exists");
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext(),
+ "Value of nos-server shouldn't be updated since in-maint already exists");
}
}
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java index a7ac9d8..ccd8c95 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v15; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -28,7 +28,8 @@ import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.AAISetup; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; @@ -52,7 +53,7 @@ public class MigrateRadcomChangesTest extends AAISetup { private MigrateRadcomChanges migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setUp() throws Exception { g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -280,83 +281,116 @@ public class MigrateRadcomChangesTest extends AAISetup { public void testGenericVnfsUpdated() throws Exception { // check if generic-vnf nodes are updated - assertEquals("First generic-vnf updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-1").next().value("model-invariant-id-local")); - assertEquals("First generic-vnf updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-1").next().value("model-version-id-local")); - assertEquals("First generic-vnf updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-1").next().value("model-customization-id")); - - assertEquals("Second generic-vnf updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-2").next().value("model-invariant-id-local")); - assertEquals("Second generic-vnf updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-2").next().value("model-version-id-local")); - assertEquals("Second generic-vnf updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-2").next().value("model-customization-id")); - - assertEquals("Generic-vnf with no service updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-service").next().value("model-invariant-id-local")); - assertEquals("Generic-vnf with no service updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-service").next().value("model-version-id-local")); - assertEquals("Generic-vnf with no service updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-service").next().value("model-customization-id")); - - assertEquals("Generic-vnf with no invariant updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-invariant").next().value("model-invariant-id-local")); - assertEquals("Generic-vnf with no invariant updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-invariant").next().value("model-version-id-local")); - assertEquals("Generic-vnf with no invariant updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-invariant").next().value("model-customization-id")); - - assertEquals("Generic-vnf with no version updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-invariant-id-local")); - assertEquals("Generic-vnf with no version updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-version-id-local")); - assertEquals("Generic-vnf with no version updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-customization-id")); - - assertEquals("Generic-vnf with no customization updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-customization").next().value("model-invariant-id-local")); - assertEquals("Generic-vnf with no customization updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-customization").next().value("model-version-id-local")); - assertEquals("Generic-vnf with no customization updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-customization").next().value("model-customization-id")); - - assertEquals("Generic-vnf with no ids updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no ids").next().value("model-invariant-id-local")); - assertEquals("Generic-vnf with no ids updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no ids").next().value("model-version-id-local")); - assertEquals("Generic-vnf with no version updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-customization-id")); - - assertEquals("First generic-vnf for many-to-service test updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-1").next().value("model-invariant-id-local")); - assertEquals("First generic-vnf for many-to-service test updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-1").next().value("model-version-id-local")); - assertEquals("First generic-vnf for many-to-service test updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-1").next().value("model-customization-id")); - - assertEquals("Second generic-vnf for many-to-service test updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-2").next().value("model-invariant-id-local")); - assertEquals("Second generic-vnf for many-to-service test updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-2").next().value("model-version-id-local")); - assertEquals("Second generic-vnf for many-to-service test updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-2").next().value("model-customization-id")); - - - assertEquals("First generic-vnf for multi-name test updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-10").next().value("model-invariant-id-local")); - assertEquals("First generic-vnf for multi-name test updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-10").next().value("model-version-id-local")); - assertEquals("First generic-vnf for multi-name test updated customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-10").next().value("model-customization-id")); - - assertEquals("Second generic-vnf for multi-name test updated invariant", "new-resource-inv", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-11").next().value("model-invariant-id-local")); - assertEquals("Second generic-vnf for multi-name test updated version", "new-resource-ver", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-11").next().value("model-version-id-local")); - assertEquals("Second generic-vnf for multi-name test customization", "new-resource-cust", - g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-11").next().value("model-customization-id")); + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-1").next().value("model-invariant-id-local"), + "First generic-vnf updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-1").next().value("model-version-id-local"), + "First generic-vnf updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-1").next().value("model-customization-id"), + "First generic-vnf updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-2").next().value("model-invariant-id-local"), + "Second generic-vnf updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-2").next().value("model-version-id-local"), + "Second generic-vnf updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "name-2").next().value("model-customization-id"), + "Second generic-vnf updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-service").next().value("model-invariant-id-local"), + "Generic-vnf with no service updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-service").next().value("model-version-id-local"), + "Generic-vnf with no service updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-service").next().value("model-customization-id"), + "Generic-vnf with no service updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-invariant").next().value("model-invariant-id-local"), + "Generic-vnf with no invariant updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-invariant").next().value("model-version-id-local"), + "Generic-vnf with no invariant updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-invariant").next().value("model-customization-id"), + "Generic-vnf with no invariant updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-invariant-id-local"), + "Generic-vnf with no version updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-version-id-local"), + "Generic-vnf with no version updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-customization-id"), + "Generic-vnf with no version updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-customization").next().value("model-invariant-id-local"), + "Generic-vnf with no customization updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-customization").next().value("model-version-id-local"), + "Generic-vnf with no customization updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-customization").next().value("model-customization-id"), + "Generic-vnf with no customization updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no ids").next().value("model-invariant-id-local"), + "Generic-vnf with no ids updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no ids").next().value("model-version-id-local"), + "Generic-vnf with no ids updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "no-version").next().value("model-customization-id"), + "Generic-vnf with no version updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-1").next().value("model-invariant-id-local"), + "First generic-vnf for many-to-service test updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-1").next().value("model-version-id-local"), + "First generic-vnf for many-to-service test updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-1").next().value("model-customization-id"), + "First generic-vnf for many-to-service test updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-2").next().value("model-invariant-id-local"), + "Second generic-vnf for many-to-service test updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-2").next().value("model-version-id-local"), + "Second generic-vnf for many-to-service test updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "many-service-2").next().value("model-customization-id"), + "Second generic-vnf for many-to-service test updated customization"); + + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-10").next().value("model-invariant-id-local"), + "First generic-vnf for multi-name test updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-10").next().value("model-version-id-local"), + "First generic-vnf for multi-name test updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-10").next().value("model-customization-id"), + "First generic-vnf for multi-name test updated customization"); + + assertEquals("new-resource-inv", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-11").next().value("model-invariant-id-local"), + "Second generic-vnf for multi-name test updated invariant"); + assertEquals("new-resource-ver", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-11").next().value("model-version-id-local"), + "Second generic-vnf for multi-name test updated version"); + assertEquals("new-resource-cust", + g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "test-11").next().value("model-customization-id"), + "Second generic-vnf for multi-name test customization"); } @@ -364,128 +398,155 @@ public class MigrateRadcomChangesTest extends AAISetup { public void testServiceInstancesUpdated() throws Exception { // check if service-instance nodes are updated - assertEquals("First service-instance updated invariant", "new-service-inv", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-1").next().value("model-invariant-id-local")); - assertEquals("First service-instance-updated version", "new-service-ver", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-1").next().value("model-version-id-local")); - - assertEquals("Second service-instance updated invariant", "new-service-inv", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-2").next().value("model-invariant-id-local")); - assertEquals("Second service-instance-updated version", "new-service-ver", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-2").next().value("model-version-id-local")); - - assertEquals("Service-instance with no invariant updated invariant", "new-service-inv", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-invariant").next().value("model-invariant-id-local")); - assertEquals("Service-instance with no invariant updated version", "new-service-ver", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-invariant").next().value("model-version-id-local")); - - assertEquals("Service-instance with no version updated invariant", "new-service-inv", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-version").next().value("model-invariant-id-local")); - assertEquals("Service-instance with no version updated version", "new-service-ver", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-version").next().value("model-version-id-local")); - - assertEquals("Service-instance with no ids updated invariant", "new-service-inv", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no ids").next().value("model-invariant-id-local")); - assertEquals("Service-instance with no ids updated version", "new-service-ver", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no ids").next().value("model-version-id-local")); - - assertEquals("Service-instance for many-to-service test updated invariant", "new-service-inv", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-many").next().value("model-invariant-id-local")); - assertEquals("Service-instance for many-to-service test updated version", "new-service-ver", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-many").next().value("model-version-id-local")); + assertEquals("new-service-inv", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-1").next().value("model-invariant-id-local"), + "First service-instance updated invariant"); + assertEquals("new-service-ver", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-1").next().value("model-version-id-local"), + "First service-instance-updated version"); + + assertEquals("new-service-inv", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-2").next().value("model-invariant-id-local"), + "Second service-instance updated invariant"); + assertEquals("new-service-ver", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-2").next().value("model-version-id-local"), + "Second service-instance-updated version"); + + assertEquals("new-service-inv", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-invariant").next().value("model-invariant-id-local"), + "Service-instance with no invariant updated invariant"); + assertEquals("new-service-ver", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-invariant").next().value("model-version-id-local"), + "Service-instance with no invariant updated version"); + + assertEquals("new-service-inv", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-version").next().value("model-invariant-id-local"), + "Service-instance with no version updated invariant"); + assertEquals("new-service-ver", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no-version").next().value("model-version-id-local"), + "Service-instance with no version updated version"); + + assertEquals("new-service-inv", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no ids").next().value("model-invariant-id-local"), + "Service-instance with no ids updated invariant"); + assertEquals("new-service-ver", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "no ids").next().value("model-version-id-local"), + "Service-instance with no ids updated version"); + + assertEquals("new-service-inv", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-many").next().value("model-invariant-id-local"), + "Service-instance for many-to-service test updated invariant"); + assertEquals("new-service-ver", + g.V().has("aai-node-type", "service-instance").has("service-instance-id", "service-many").next().value("model-version-id-local"), + "Service-instance for many-to-service test updated version"); } @Test public void testVfModulesUpdated() throws Exception { //test if vf-module nodes are updated - assertEquals("First vf-module updated invariant", "new-vf-module-inv-1", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-1").next().value("model-invariant-id-local")); - assertEquals("First vf-module updated version", "new-vf-module-ver-1", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-1").next().value("model-version-id-local")); - - assertEquals("Second vf-module updated invariant", "new-vf-module-inv-2", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-2").next().value("model-invariant-id-local")); - assertEquals("Second vf-module updated version", "new-vf-module-ver-2", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-2").next().value("model-version-id-local")); - - assertEquals("Vf-module with no invariant updated invariant", "new-vf-module-inv-3", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-invariant").next().value("model-invariant-id-local")); - assertEquals("Vf-module with no invariant updated version", "new-vf-module-ver-3", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-invariant").next().value("model-version-id-local")); - - assertEquals("Vf-module with no version updated invariant", "new-vf-module-inv-4", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ver").next().value("model-invariant-id-local")); - assertEquals("Vf-module with no version updated version", "new-vf-module-ver-4", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ver").next().value("model-version-id-local")); - - assertEquals("Vf-module with no ids updated invariant", "new-vf-module-inv-5", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ids").next().value("model-invariant-id-local")); - assertEquals("Vf-module with no ids updated version", "new-vf-module-ver-5", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ids").next().value("model-version-id-local")); + assertEquals("new-vf-module-inv-1", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-1").next().value("model-invariant-id-local"), + "First vf-module updated invariant"); + assertEquals("new-vf-module-ver-1", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-1").next().value("model-version-id-local"), + "First vf-module updated version"); + + assertEquals("new-vf-module-inv-2", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-2").next().value("model-invariant-id-local"), + "Second vf-module updated invariant"); + assertEquals("new-vf-module-ver-2", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module-2").next().value("model-version-id-local"), + "Second vf-module updated version"); + + assertEquals("new-vf-module-inv-3", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-invariant").next().value("model-invariant-id-local"), + "Vf-module with no invariant updated invariant"); + assertEquals("new-vf-module-ver-3", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-invariant").next().value("model-version-id-local"), + "Vf-module with no invariant updated version"); + + assertEquals("new-vf-module-inv-4", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ver").next().value("model-invariant-id-local"), + "Vf-module with no version updated invariant"); + assertEquals("new-vf-module-ver-4", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ver").next().value("model-version-id-local"), + "Vf-module with no version updated version"); + + assertEquals("new-vf-module-inv-5", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ids").next().value("model-invariant-id-local"), + "Vf-module with no ids updated invariant"); + assertEquals("new-vf-module-ver-5", + g.V().has("aai-node-type", "vf-module").has("vf-module-id", "no-ids").next().value("model-version-id-local"), + "Vf-module with no ids updated version"); } @Test public void testVserverAndImageUpdated() throws Exception { //test if vserver-image relationships are updated - assertTrue("Vserver not connected to image is connected to new image", - g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver-1").out("org.onap.relationships.inventory.Uses") - .has("aai-node-type", "image").has("image-id", "image-id-1").hasNext()); - assertTrue("Vserver connected to existing image is connected to new image", - g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver-2").out("org.onap.relationships.inventory.Uses") - .has("aai-node-type", "image").has("image-id", "image-id-2").hasNext()); - assertFalse("Vserver connected to existing image is not connected to that image", - g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver-2").out("org.onap.relationships.inventory.Uses") - .has("aai-node-type", "image").has("image-id", "image-old").hasNext()); - assertTrue("Existing image still exists", - g.V().has("aai-node-type", "image").has("image-id", "image-old").hasNext()); + assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver-1").out("org.onap.relationships.inventory.Uses") + .has("aai-node-type", "image").has("image-id", "image-id-1").hasNext(), + "Vserver not connected to image is connected to new image"); + assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver-2").out("org.onap.relationships.inventory.Uses") + .has("aai-node-type", "image").has("image-id", "image-id-2").hasNext(), + "Vserver connected to existing image is connected to new image"); + assertFalse(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver-2").out("org.onap.relationships.inventory.Uses") + .has("aai-node-type", "image").has("image-id", "image-old").hasNext(), + "Vserver connected to existing image is not connected to that image"); + assertTrue(g.V().has("aai-node-type", "image").has("image-id", "image-old").hasNext(), + "Existing image still exists"); } @Test public void testNodesNotUpdated() throws Exception { // negative tests - assertFalse("Generic-vnf with wrong type has unchanged invariant", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-type").next() - .property("model-invariant-id-local").isPresent()); - assertFalse("Generic-vnf with wrong type has unchanged version", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-type").next() - .property("model-version-id-local").isPresent()); - assertFalse("Generic-vnf with wrong type has unchanged customization", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-type").next() - .property("model-customizaiton-id").isPresent()); - - assertEquals("Generic-vnf with wrong name has unchanged invariant", "test", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-name").next().value("model-invariant-id-local")); - assertEquals("Generic-vnf with wrong name has unchanged version", "test", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-name").next().value("model-version-id-local")); - assertEquals("Generic-vnf with wrong name has unchanged customization", "test", - g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-name").next().value("model-customization-id")); - - assertFalse("Unconnected service-instance has unchanged invariant", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "wrong").next() - .property("model-invariant-id-local").isPresent()); - assertFalse("Unconnected service-instance has unchanged version", - g.V().has("aai-node-type", "service-instance").has("service-instance-id", "wrong").next() - .property("model-version-id-local").isPresent()); - - assertEquals("Service-instance connected to unctouched generic-vnf has unchanged invariant", "test", + assertFalse(g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-type").next() + .property("model-invariant-id-local").isPresent(), + "Generic-vnf with wrong type has unchanged invariant"); + assertFalse(g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-type").next() + .property("model-version-id-local").isPresent(), + "Generic-vnf with wrong type has unchanged version"); + assertFalse(g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-type").next() + .property("model-customizaiton-id").isPresent(), + "Generic-vnf with wrong type has unchanged customization"); + + assertEquals("test", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-name").next().value("model-invariant-id-local"), + "Generic-vnf with wrong name has unchanged invariant"); + assertEquals("test", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-name").next().value("model-version-id-local"), + "Generic-vnf with wrong name has unchanged version"); + assertEquals("test", + g.V().has("aai-node-type", "generic-vnf").has("vnf-name", "wrong-name").next().value("model-customization-id"), + "Generic-vnf with wrong name has unchanged customization"); + + assertFalse(g.V().has("aai-node-type", "service-instance").has("service-instance-id", "wrong").next() + .property("model-invariant-id-local").isPresent(), + "Unconnected service-instance has unchanged invariant"); + assertFalse(g.V().has("aai-node-type", "service-instance").has("service-instance-id", "wrong").next() + .property("model-version-id-local").isPresent(), + "Unconnected service-instance has unchanged version"); + + assertEquals("test", g.V().has("aai-node-type", "service-instance").has("service-instance-id", "connected-wrong") - .next().value("model-invariant-id-local")); - assertEquals("Service-instance connected to untouched generic-vnf has unchanged version", "test", + .next().value("model-invariant-id-local"), + "Service-instance connected to unctouched generic-vnf has unchanged invariant"); + assertEquals("test", g.V().has("aai-node-type", "service-instance").has("service-instance-id", "connected-wrong") - .next().value("model-version-id-local")); - - assertFalse("Vf-module connected to untouched generic-vnf has unchanged invariant", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "bad") - .next().property("model-invariant-id-local").isPresent()); - assertFalse("Vf-module connected to untouched generic-vnf has unchanged version", - g.V().has("aai-node-type", "vf-module").has("vf-module-id", "bad") - .next().property("model-version-id-local").isPresent()); + .next().value("model-version-id-local"), + "Service-instance connected to untouched generic-vnf has unchanged version"); + + assertFalse(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "bad") + .next().property("model-invariant-id-local").isPresent(), + "Vf-module connected to untouched generic-vnf has unchanged invariant"); + assertFalse(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "bad") + .next().property("model-version-id-local").isPresent(), + "Vf-module connected to untouched generic-vnf has unchanged version"); - assertTrue("Untouched vserver still connected to image", - g.V().has("aai-node-type", "vserver").has("vserver-id", "unchanged").out("org.onap.relationships.inventory.Uses") - .has("aai-node-type", "image").has("image-id", "image-bad").hasNext()); + assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "unchanged").out("org.onap.relationships.inventory.Uses") + .has("aai-node-type", "image").has("image-id", "image-bad").hasNext(), + "Untouched vserver still connected to image"); } @Test diff --git a/src/test/java/org/onap/aai/migration/v16/MigrateBooleanDefaultsToFalseTest.java b/src/test/java/org/onap/aai/migration/v16/MigrateBooleanDefaultsToFalseTest.java index 96dfe19..b05401e 100644 --- a/src/test/java/org/onap/aai/migration/v16/MigrateBooleanDefaultsToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v16/MigrateBooleanDefaultsToFalseTest.java @@ -20,8 +20,9 @@ package org.onap.aai.migration.v16; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.introspection.Loader; @@ -36,7 +37,7 @@ import org.onap.aai.setup.SchemaVersions; import java.util.Optional; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -67,7 +68,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { private BooleanDefaultMigrator migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setup() throws Exception{ g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -105,29 +106,29 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { @Test public void testMissingProperty(){ //orchestration-disabled - assertTrue("Value of cloud-region should be updated since the property orchestration-disabled doesn't exist", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region0").has("orchestration-disabled", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region0").has("orchestration-disabled", false).hasNext(), + "Value of cloud-region should be updated since the property orchestration-disabled doesn't exist"); } @Test public void testEmptyValue() { //orchestration-disabled - assertTrue("Value of cloud-region should be updated since the value for orchestration-disabled is an empty string", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region1").has("orchestration-disabled", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region1").has("orchestration-disabled", false).hasNext(), + "Value of cloud-region should be updated since the value for orchestration-disabled is an empty string"); } @Test public void testExistingTrueValues() { //orchestration-disabled - assertTrue("Value of cloud-region shouldn't be update since orchestration-disabled already exists", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region2").has("orchestration-disabled", true).hasNext()); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region2").has("orchestration-disabled", true).hasNext(), + "Value of cloud-region shouldn't be update since orchestration-disabled already exists"); } @Test public void testExistingFalseValues() { //orchestration-disabled - assertTrue("Value of cloud-region shouldn't be update since orchestration-disabled already exists", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region3").has("orchestration-disabled", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region3").has("orchestration-disabled", false).hasNext(), + "Value of cloud-region shouldn't be update since orchestration-disabled already exists"); } }
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v16/MigrateInMaintDefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v16/MigrateInMaintDefaultToFalseTest.java index 4adc146..88ce7ec 100644 --- a/src/test/java/org/onap/aai/migration/v16/MigrateInMaintDefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v16/MigrateInMaintDefaultToFalseTest.java @@ -20,8 +20,9 @@ package org.onap.aai.migration.v16; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.introspection.Loader; @@ -36,7 +37,7 @@ import org.onap.aai.setup.SchemaVersions; import java.util.Optional; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -71,7 +72,7 @@ public class MigrateInMaintDefaultToFalseTest extends private InMaintDefaultMigrator migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setup() throws Exception{ g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -124,37 +125,37 @@ public class MigrateInMaintDefaultToFalseTest extends @Test public void testMissingProperty(){ - assertTrue("Value of zone should be updated since the property in-maint doesn't exist", - g.V().has("aai-node-type", "zone").has("zone-id", "zone0").has("in-maint", false).hasNext()); - assertTrue("Value of cloud-region should be updated since the property in-maint doesn't exist", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region0").has("in-maint", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "zone").has("zone-id", "zone0").has("in-maint", false).hasNext(), + "Value of zone should be updated since the property in-maint doesn't exist"); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region0").has("in-maint", false).hasNext(), + "Value of cloud-region should be updated since the property in-maint doesn't exist"); } @Test public void testEmptyValue() { - assertTrue("Value of zone should be updated since the value for in-maint is an empty string", - g.V().has("aai-node-type", "zone").has("zone-id", "zone1").has("in-maint", false).hasNext()); - assertTrue("Value of cloud-region should be updated since the value for in-maint is an empty string", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region1").has("in-maint", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "zone").has("zone-id", "zone1").has("in-maint", false).hasNext(), + "Value of zone should be updated since the value for in-maint is an empty string"); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region1").has("in-maint", false).hasNext(), + "Value of cloud-region should be updated since the value for in-maint is an empty string"); } @Test public void testExistingTrueValues() { - assertTrue("Value of zone shouldn't be updated since in-maint already exists", - g.V().has("aai-node-type", "zone").has("zone-id", "zone2").has("in-maint", true).hasNext()); - assertTrue("Value of cloud-region shouldn't be updated since in-maint already exists", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region2").has("in-maint", true).hasNext()); + assertTrue(g.V().has("aai-node-type", "zone").has("zone-id", "zone2").has("in-maint", true).hasNext(), + "Value of zone shouldn't be updated since in-maint already exists"); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region2").has("in-maint", true).hasNext(), + "Value of cloud-region shouldn't be updated since in-maint already exists"); } @Test public void testExistingFalseValues() { - assertTrue("Value of zone shouldn't be updated since in-maint already exists", - g.V().has("aai-node-type", "zone").has("zone-id", "zone3").has("in-maint", false).hasNext()); - assertTrue("Value of cloud-region shouldn't be updated since in-maint already exists", - g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region3").has("in-maint", false).hasNext()); + assertTrue(g.V().has("aai-node-type", "zone").has("zone-id", "zone3").has("in-maint", false).hasNext(), + "Value of zone shouldn't be updated since in-maint already exists"); + assertTrue(g.V().has("aai-node-type", "cloud-region").has("cloud-region-id", "cloud-region3").has("in-maint", false).hasNext(), + "Value of cloud-region shouldn't be updated since in-maint already exists"); } }
\ No newline at end of file diff --git a/src/test/java/org/onap/aai/migration/v20/MigrateL2DefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v20/MigrateL2DefaultToFalseTest.java index 94413f8..720efb8 100644 --- a/src/test/java/org/onap/aai/migration/v20/MigrateL2DefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v20/MigrateL2DefaultToFalseTest.java @@ -20,8 +20,9 @@ package org.onap.aai.migration.v20; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.introspection.Loader; @@ -35,7 +36,7 @@ import org.onap.aai.setup.SchemaVersions; import java.util.Arrays; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -58,7 +59,7 @@ public class MigrateL2DefaultToFalseTest extends private L2DefaultMigrator migration; private GraphTraversalSource g; - @Before + @BeforeEach public void setup() throws Exception{ g = tx.traversal(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion()); @@ -101,35 +102,35 @@ public class MigrateL2DefaultToFalseTest extends @Test public void testAllValuesSet() { - assertTrue("Value of node 1 \"no-value\" should have " + L2_MULTI_PROPERTY + " of false ", - g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "no-value") - .has(L2_MULTI_PROPERTY,false).hasNext()); + assertTrue(g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "no-value") + .has(L2_MULTI_PROPERTY,false).hasNext(), + "Value of node 1 \"no-value\" should have " + L2_MULTI_PROPERTY + " of false "); - assertTrue("Value of node 2 \"empty-value\" should have " + L2_MULTI_PROPERTY + " of false ", - g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "empty-value") - .has(L2_MULTI_PROPERTY,false).hasNext()); + assertTrue(g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "empty-value") + .has(L2_MULTI_PROPERTY,false).hasNext(), + "Value of node 2 \"empty-value\" should have " + L2_MULTI_PROPERTY + " of false "); - assertTrue("Value of node 3 \"true-value\" should have " + L2_MULTI_PROPERTY + " of true ", - g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "true-value") - .has(L2_MULTI_PROPERTY,true).hasNext()); + assertTrue(g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "true-value") + .has(L2_MULTI_PROPERTY,true).hasNext(), + "Value of node 3 \"true-value\" should have " + L2_MULTI_PROPERTY + " of true "); - assertTrue("Value of node 4 \"false-value\" should have " + L2_MULTI_PROPERTY + " of false ", - g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "false-value") - .has(L2_MULTI_PROPERTY,false).hasNext()); + assertTrue(g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "false-value") + .has(L2_MULTI_PROPERTY,false).hasNext(), + "Value of node 4 \"false-value\" should have " + L2_MULTI_PROPERTY + " of false "); - assertTrue("Value of node 5 \"extra\" should have " + L2_MULTI_PROPERTY + " of false ", - g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "extra") - .has(L2_MULTI_PROPERTY,false).hasNext()); + assertTrue(g.V().has("aai-node-type", L_INTERFACE_NODE_TYPE).has("interface-name", "extra") + .has(L2_MULTI_PROPERTY,false).hasNext(), + "Value of node 5 \"extra\" should have " + L2_MULTI_PROPERTY + " of false "); } @Test public void testOtherMethods() { - assertTrue("getStatus function works", migration.getStatus().toString().contains("SUCCESS")); + assertTrue(migration.getStatus().toString().contains("SUCCESS"), "getStatus function works"); - assertTrue("getAffectedNodeTypes returns " + L_INTERFACE_NODE_TYPE, - Arrays.asList(migration.getAffectedNodeTypes().get()).contains(L_INTERFACE_NODE_TYPE)); + assertTrue(Arrays.asList(migration.getAffectedNodeTypes().get()).contains(L_INTERFACE_NODE_TYPE), + "getAffectedNodeTypes returns " + L_INTERFACE_NODE_TYPE); - assertTrue("getMigrationName returns MigrateL2DefaultToFalse", - migration.getMigrationName().equals("MigrateL2DefaultToFalse")); + assertTrue(migration.getMigrationName().equals("MigrateL2DefaultToFalse"), + "getMigrationName returns MigrateL2DefaultToFalse"); } }
\ No newline at end of file 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 6d62098..55af4f9 100644 --- a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java +++ b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java @@ -25,9 +25,10 @@ import org.codehaus.jackson.map.ObjectMapper; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.schema.JanusGraphManagement; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import org.onap.aai.AAISetup; import org.onap.aai.db.schema.DBIndex; import org.onap.aai.db.schema.ManageJanusGraphSchema; @@ -35,12 +36,12 @@ import org.onap.aai.db.schema.ManageJanusGraphSchema; import java.io.IOException; import java.util.Set; -@Ignore("not ready yet") +@Disabled("not ready yet") public class ManageSchemaTest extends AAISetup { private JanusGraph graph = null; - @Before + @BeforeEach public void beforeTest() { graph = JanusGraphFactory.open("bundleconfig-local/etc/appprops/aaiconfig.properties"); } diff --git a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java index fc7e55f..fa9980a 100644 --- a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java +++ b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java @@ -23,8 +23,12 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.*; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; @@ -38,10 +42,10 @@ import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.concurrent.atomic.AtomicBoolean; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class SendDeleteMigrationNotificationsTest extends AAISetup { private final static String FILE = "./test.txt"; @@ -54,7 +58,7 @@ public class SendDeleteMigrationNotificationsTest extends AAISetup { private static final String REALTIME_CONFIG = "./src/main/resources/etc/appprops/janusgraph-realtime.properties"; - @Before + @BeforeEach public void setUp() throws Exception { System.setProperty("realtime.db.config", REALTIME_CONFIG); AAIGraph.getInstance(); @@ -115,12 +119,12 @@ public class SendDeleteMigrationNotificationsTest extends AAISetup { graphCreated.compareAndSet(false, true); } } - @AfterClass + @AfterAll public static void cleanUp() throws IOException { Files.delete(Paths.get(FILE)); } - @After + @AfterEach public void tearDown() throws IOException { if (tx.isOpen()) { tx.tx().rollback(); @@ -134,7 +138,7 @@ public class SendDeleteMigrationNotificationsTest extends AAISetup { doNothing().when(s).trigger(); doNothing().when(s).cleanup(); s.process("/aai/"); - assertEquals("1 events are created ", 4, s.notificationHelper.getNotifications().getEvents().size()); + assertEquals(4, s.notificationHelper.getNotifications().getEvents().size(), "1 events are created "); } diff --git a/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java index c7ca3d3..2f6a4e0 100644 --- a/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java +++ b/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java @@ -24,8 +24,12 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; -import org.junit.*; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer.MethodName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.mockito.Mockito; import org.onap.aai.AAISetup; import org.onap.aai.db.props.AAIProperties; @@ -39,10 +43,10 @@ import java.nio.file.Paths; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodName.class) public class SendMigrationNotificationsTest extends AAISetup { private final static String FILE = "./test.txt"; @@ -55,7 +59,7 @@ public class SendMigrationNotificationsTest extends AAISetup { private static final String REALTIME_CONFIG = "./src/main/resources/etc/appprops/janusgraph-realtime.properties"; - @Before + @BeforeEach public void setUp() throws Exception { System.setProperty("realtime.db.config", REALTIME_CONFIG); AAIGraph.getInstance(); @@ -119,12 +123,12 @@ public class SendMigrationNotificationsTest extends AAISetup { graphCreated.compareAndSet(false, true); } } - @AfterClass + @AfterAll public static void cleanUp() throws IOException { Files.delete(Paths.get(FILE)); } - @After + @AfterEach public void tearDown() throws IOException { if (tx.isOpen()) { tx.tx().rollback(); @@ -138,7 +142,7 @@ public class SendMigrationNotificationsTest extends AAISetup { doNothing().when(s).trigger(); doNothing().when(s).cleanup(); s.process("/aai/"); - assertEquals("4 events are created ", 4, s.notificationHelper.getNotifications().getEvents().size()); + assertEquals(4, s.notificationHelper.getNotifications().getEvents().size(), "4 events are created "); } @@ -149,7 +153,7 @@ public class SendMigrationNotificationsTest extends AAISetup { doNothing().when(s).trigger(); doNothing().when(s).cleanup(); s.process("/aai/"); - assertEquals("2 events are created ", 2, s.notificationHelper.getNotifications().getEvents().size()); + assertEquals(2, s.notificationHelper.getNotifications().getEvents().size(), "2 events are created "); } @@ -160,7 +164,7 @@ public class SendMigrationNotificationsTest extends AAISetup { doNothing().when(s).trigger(); doNothing().when(s).cleanup(); s.process("/aai/"); - assertEquals("3 events are created ", 3, s.notificationHelper.getNotifications().getEvents().size()); + assertEquals(3, s.notificationHelper.getNotifications().getEvents().size(), "3 events are created "); } |