<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guava</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
<exclusions>
<exclusion>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.0.0</version>
+ <version>3.1.2</version>
<configuration>
<!-- <argLine>-noverify ${argLine}</argLine> -->
<argLine>-Xmx4096m</argLine>
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;
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;
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
)
public class AAIGremlinQueryTest {
- @ClassRule
- public static final SpringClassRule springClassRule = new SpringClassRule();
-
- @Rule
- public final SpringMethodRule springMethodRule = new SpringMethodRule();
-
@Autowired
RestTemplate restTemplate;
private String baseUrl;
- @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 Exception {
AAIConfig.init();
assertThat(result, containsString("v["));
}
- @After
+ @AfterEach
public void tearDown() {
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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;
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,
@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/");
tx = graph.newTransaction();
}
- @AfterClass
+ @AfterAll
public static void cleanUpGraph() {
tx.tx().rollback();
graph.close();
.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;
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;
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;
/**
@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;
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();
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<>();
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);
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);
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;
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);
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;
import java.io.IOException;
import java.util.HashMap;
-import static org.junit.Assert.*;
-
public class AuditGraphson2SqlTest extends AAISetup {
@Mock
private ApertureService apertureServiceMock;
- @Before
+ @BeforeEach
public void setUp() {
auditG2S = new AuditGraphson2Sql(ei, schemaVersions, loaderFactory, apertureServiceMock);
assertTrue(resultOk);
}
- @Ignore
+ @Disabled
@Test
public void testGetDateTimeStamp() {
long dts = 0;
}
- @Ignore
+ @Disabled
@Test
public void testGetCounts() throws IOException, EdgeRuleNotFoundException {
Boolean resultOk = true;
}
- @Ignore
+ @Disabled
@Test
public void testGoodRun() throws IOException, EdgeRuleNotFoundException {
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;
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);
private Vertex cloudRegionVertex;
- @Before
+ @BeforeEach
public void setup() {
dataGrooming = new DataGrooming(loaderFactory, schemaVersions);
// deleteTool.SHOULD_EXIT_VM = false;
}
- @After
+ @AfterEach
public void tearDown() {
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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;
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();
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";
@Test
- public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase() throws IOException {
+ public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase(CapturedOutput outputCapture) throws IOException {
// Create a empty file called empty.graphson in src/test/resources/
assertThat(outputCapture.toString(), containsString("graphson had no data."));
}
-
+
@Test
public void testTakeSnapshotAndItShouldCreateASnapshotFileWithOneVertex() throws IOException, InterruptedException {
List<String> fileContents = Files.readAllLines(snapshotPathList.get(0));
assertThat(fileContents.get(0), containsString("id"));
}
-
+
@Test
public void testTakeSnapshotMultiAndItShouldCreateMultipleSnapshotFiles() throws IOException {
// 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
dataSnapshot4HistInit.executeCommand(args);
}
-
+
@Test
public void testReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException {
dataSnapshot4HistInit.executeCommand(args);
}
-
+
@Test
public void testMultiReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException, AAIException {
// 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 {
dataSnapshot4HistInit.executeCommand(args);
}
-
+
@Test
public void testCanRetrieveNamesOfKeyProps() throws IOException {
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
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")
.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
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")
FileUtils.copyFile(inputFile, outputFile);
}
-}
\ No newline at end of file
+}
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;
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;
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();
currentTransaction.commit();
}
- @After
+ @AfterEach
public void tearDown(){
JanusGraph graph = AAIGraph.getInstance().getGraph();
}
@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";
@Test
- public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase() throws IOException {
+ public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase(CapturedOutput outputCapture) throws IOException {
// Create a empty file called empty.graphson in src/test/resources/
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;
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();
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";
@Test
- public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase() throws IOException {
+ public void testClearEntireDatabaseWithEmptyGraphSONFileAndItShouldNotClearDatabase(CapturedOutput outputCapture) throws IOException {
// Create a empty file called empty.graphson in src/test/resources/
assertThat(outputCapture.toString(), containsString("graphson had no data."));
}
-
+
@Test
public void testTakeSnapshotAndItShouldCreateASnapshotFileWithOneVertex() throws IOException, InterruptedException {
List<String> fileContents = Files.readAllLines(snapshotPathList.get(0));
assertThat(fileContents.get(0), containsString("id"));
}
-
+
@Test
public void testTakeSnapshotMultiAndItShouldCreateMultipleSnapshotFiles() throws IOException {
// 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
dataSnapshot4HistInit.executeCommand(args);
}
-
+
@Test
public void testReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException {
dataSnapshot4HistInit.executeCommand(args);
}
-
+
@Test
public void testMultiReloadDataAndVerifyDataInGraphMatchesGraphson() throws IOException, AAIException {
// 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 {
dataSnapshot4HistInit.executeCommand(args);
}
-
+
@Test
public void testCanRetrieveNamesOfKeyProps() throws IOException {
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
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")
.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
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")
FileUtils.copyFile(inputFile, outputFile);
}
-}
\ No newline at end of file
+}
*/
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() {
}
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 {
private DupeTool dupeTool;
- @Before
+ @BeforeEach
public void setup(){
dupeTool = new DupeTool(loaderFactory, schemaVersions, false);
createGraph();
}
- @After
+ @AfterEach
public void tearDown(){
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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;
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);
private Vertex cloudRegionVertex;
- @Before
+ @BeforeEach
public void setup(){
deleteTool = new ForceDeleteTool();
deleteTool.SHOULD_EXIT_VM = false;
deleteTool.main(args);
System.setIn(systemInputStream);
}
- @After
+ @AfterEach
public void tearDown(){
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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);
JanusGraphTransaction transaction;
GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup(){
updatePropertyTool = new UpdatePropertyTool();
updatePropertyToolInternal = new UpdatePropertyToolInternal();
assertFalse(updatePropertyToolInternal.run(null, args));
}
- @After
+ @AfterEach
public void tearDown(){
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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);
private SchemaMod4Hist schemaMod4H;
- @Before
+ @BeforeEach
public void setup() {
schemaMod4H = new SchemaMod4Hist(loaderFactory, schemaVersions);
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();
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);
private boolean setUp = false;
- @Before
+ @BeforeEach
public void setup() {
schemaMod = new SchemaMod(loaderFactory, schemaVersions);
// deleteTool.SHOULD_EXIT_VM = false;
- @After
+ @AfterEach
public void tearDown() {
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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;
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);
private long todayMinusTwoMonthsTs;
private long todayMinus55DaysTs;
- @Before
+ @BeforeEach
public void setup() {
historyTruncate = new HistoryTruncate();
- @After
+ @AfterEach
public void tearDown() {
JanusGraphTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
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;
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;
private Graph tx;
private EdgeMigratorImpl edgeMigrator;
- @Before
+ @BeforeEach
public void setUp() {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
JanusGraphManagement janusgraphManagement = graph.openManagement();
edgeMigrator = new EdgeMigratorImpl(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
@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
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;
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;
private Vertex modelVer3 = null;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
JanusGraphManagement janusgraphManagement = graph.openManagement();
g = graph.traversal();
}
}
- 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 " );
}
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;
private MigrationControllerInternal migrationControllerInternal;
- @Before
+ @BeforeEach
public void setup() {
migrationControllerInternal = new MigrationControllerInternal(loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
clearGraph();
}
}
- @Ignore
+ @Disabled
@Test
public void testListAllOfMigrations() throws Exception {
PrintStream oldOutputStream = System.out;
System.setOut(oldOutputStream);
}
- @Ignore
+ @Disabled
@Test
public void testRunDisabledExcludeAndCommit() throws Exception {
assertThat("rebuildAllEdges shouldn't have enabled annotation", !RebuildAllEdges.class.isAnnotationPresent(Enabled.class));
migrationControllerInternal.run(args);
}
- @After
+ @AfterEach
public void tearDown(){
clearGraph();
}
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;
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 {
}
}
- @Before
+ @BeforeEach
public void setup(){
AAIGraph.getInstance();
JanusGraphTransaction janusgraphTransaction = AAIGraph.getInstance().getGraph().newTransaction();
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();
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
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;
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 {
private Graph tx;
private RebuildAllEdges spyRebuildAllEdges;
- @Before
+ @BeforeEach
public void setUp() {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
JanusGraphManagement janusgraphManagement = graph.openManagement();
spyRebuildAllEdges.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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;
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;
private JanusGraphTransaction tx;
private SampleValueMigrator existingValuesMigration;
- @Before
+ @BeforeEach
public void setup() throws Exception{
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
tx = graph.newTransaction();
@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");
}
}
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;
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 {
private GraphTraversalSource g;
private Graph tx;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
merge.performMerge(pserverCanopi, pserverSkeleton, forceCopy, basePath);
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
@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");
}
}
*/
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;
private GraphTraversalSource g;
private JanusGraphTransaction tx;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
@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");
}
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;
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;
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();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
@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");
}
}
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;
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;
private GraphTraversalSource g;
private JanusGraphTransaction tx;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
tx.rollback();
graph.close();
@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");
}
}
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;
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;
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();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
*/
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;
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;
private JanusGraphTransaction tx;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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");
}
*/
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;
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;
private GraphTraversalSource g;
private TransactionalGraphEngine spy;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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");
}
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;
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;
private JanusGraphTransaction tx;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
@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
// 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
*/
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;
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;
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();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
@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");
}
*/
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;
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;
private MigratePATHEvcInventory migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
// 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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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 ");
}
*/
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;
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;
private JanusGraphTransaction tx;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
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")
.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")
.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")
.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")
.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")
.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")
.has("cir-units", "Mbps")
.has("tagmode-access-ingress", "DOUBLE")
.has("tagmode-access-egress", "DOUBLE")
- .hasNext());
+ .hasNext(),
+ "configuration node, configuration-type= evc");
}
@Test
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;
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;
Vertex pLinkWan5;
Vertex pLinkWan7;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
tx = graph.newTransaction();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
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;
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;
private Vertex lInterface3;
private Vertex plink3;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
graph.close();
}
*/
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;
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;
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();
*/
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;
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;
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();
import org.janusgraph.core.JanusGraph;\r
import org.janusgraph.core.JanusGraphFactory;\r
import org.janusgraph.core.JanusGraphTransaction;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
+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;\r
import org.onap.aai.introspection.Loader;\r
import org.onap.aai.introspection.ModelType;\r
import org.onap.aai.setup.SchemaVersion;\r
import org.onap.aai.migration.Status;\r
import org.onap.aai.serialization.engines.QueryStyle;\r
-import org.onap.aai.serialization.engines.JanusGraphDBEngine;\r
-\r
+import org.onap.aai.serialization.engines.JanusGraphDBEngine;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;\r
import static org.mockito.Mockito.when;\r
\r
-import java.util.Optional;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
+import java.util.Optional;
+
public class MigrateBooleanDefaultsToFalseTest extends AAISetup {\r
\r
public static class BooleanDefaultMigrator extends MigrateBooleanDefaultsToFalse {\r
private BooleanDefaultMigrator migration;\r
private GraphTraversalSource g;\r
\r
- @Before\r
+ @BeforeEach\r
public void setup() throws Exception{\r
g = tx.traversal();\r
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());\r
@Test\r
public void testMissingProperty(){\r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist");\r
//dhcp-enabled\r
- assertTrue("Value of subnet should be updated since the property dhcp-enabled doesn't exist",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext(),\r
+ "Value of subnet should be updated since the property dhcp-enabled doesn't exist");\r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the property is-provider-network doesn't exist",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the property is-shared-network doesn't exist",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the property is-external-network doesn't exist",\r
- 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()); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-provider-network doesn't exist"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-shared-network doesn't exist"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-external-network doesn't exist"); \r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored doesn't exist",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext()); \r
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-port-mirrored doesn't exist"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");\r
//vf-module: is-base-vf-module\r
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module doesn't exist",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),\r
+ "Value of vf-module should be updated since the property is-base-vf-module doesn't exist"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered doesn't exist",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");\r
}\r
\r
@Test\r
public void testEmptyValue() { \r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string");\r
//dhcp-enabled\r
- assertTrue("Value of subnet should be updated since the value for dhcp-enabled is an empty string",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext(),\r
+ "Value of subnet should be updated since the value for dhcp-enabled is an empty string");\r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the value for is-provider-network is an empty string",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the value for is-shared-network is an empty string",\r
- 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());\r
- assertTrue("Value of l3-network should be updated since the value for is-external-network is an empty string",\r
- 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());\r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-provider-network is an empty string"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-shared-network is an empty string");\r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-external-network is an empty string");\r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored is an empty string",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext()); \r
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered is an empty string",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-port-mirrored is an empty string"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-ip-unnumbered is an empty string");\r
//vf-module: is-base-vf-module, is-ip-unnumbered\r
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module is an empty string",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),\r
+ "Value of vf-module should be updated since the property is-base-vf-module is an empty string"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered is an empty string",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of vlan should be updated since the property is-ip-unnumbered is an empty string");\r
}\r
\r
@Test\r
public void testExistingTrueValues() {\r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext());\r
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext());\r
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext(),\r
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext(),\r
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext(),\r
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");\r
//dhcp-enabled\r
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),\r
+ "Value of subnet shouldn't be update since dhcp-enabled already exists"); \r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",\r
- 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()); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-external-network already exists"); \r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext()); \r
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),\r
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),\r
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists"); \r
//vf-module: is-base-vf-module\r
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),\r
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),\r
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
\r
}\r
\r
@Test\r
public void testExistingFalseValues() {\r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");\r
//dhcp-enabled\r
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext(),\r
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");\r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",\r
- 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()); \r
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",\r
- 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()); \r
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",\r
- 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()); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists"); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-provider-network already exists"); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-external-network already exists"); \r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext()); \r
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),\r
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists"); \r
//vf-module: is-base-vf-module\r
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),\r
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
} \r
}
\ No newline at end of file
*/
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;
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;
private MigrateForwarderEvcCircuitId migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
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
import org.janusgraph.core.JanusGraphFactory;\r
import org.janusgraph.core.JanusGraphTransaction;\r
import org.janusgraph.core.schema.JanusGraphManagement;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
+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;\r
import org.onap.aai.dbmap.DBConnectionType;\r
import org.onap.aai.introspection.Loader;\r
import org.onap.aai.migration.v13.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator;\r
import org.onap.aai.serialization.engines.QueryStyle;\r
import org.onap.aai.serialization.engines.JanusGraphDBEngine;\r
-import org.onap.aai.serialization.engines.TransactionalGraphEngine;\r
-\r
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;\r
import static org.mockito.Mockito.when;\r
\r
import java.util.HashMap;\r
import java.util.Map;\r
-import java.util.Optional;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-import static org.junit.Assert.assertEquals;\r
-\r
+import java.util.Optional;
+
public class MigrateInMaintDefaultToFalseTest extends\r
AAISetup {\r
protected static final String VNF_NODE_TYPE = "generic-vnf";\r
private InMaintDefaultMigrator migration;\r
private GraphTraversalSource g;\r
\r
- @Before\r
+ @BeforeEach\r
public void setup() throws Exception{\r
g = tx.traversal();\r
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());\r
\r
@Test\r
public void testMissingProperty(){\r
- assertTrue("Value of generic-vnf should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext());\r
- assertTrue("Value of l-interface should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext());\r
- assertTrue("Value of lag-interface should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext());\r
- assertTrue("Value of logical-link should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext());\r
- assertTrue("Value of p-interface should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext());\r
- assertTrue("Value of pnf should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext());\r
- assertTrue("Value of pserver should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext());\r
- assertTrue("Value of vlan should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext()); \r
- assertTrue("Value of nos-server should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext(),\r
+ "Value of l-interface should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext(),\r
+ "Value of lag-interface should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext(),\r
+ "Value of logical-link should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext(),\r
+ "Value of p-interface should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext(),\r
+ "Value of pnf should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext(),\r
+ "Value of pserver should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext(),\r
+ "Value of vlan should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext(),\r
+ "Value of vnfc should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext(),\r
+ "Value of vserver should be updated since the property in-maint doesn't exist"); \r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext(),\r
+ "Value of nos-server should be updated since the property in-maint doesn't exist"); \r
}\r
\r
@Test\r
public void testEmptyValue() { \r
- assertTrue("Value of generic-vnf should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext());\r
- assertTrue("Value of l-interface should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext());\r
- assertTrue("Value of lag-interface should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext());\r
- assertTrue("Value of logical-link should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext());\r
- assertTrue("Value of p-interface should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext());\r
- assertTrue("Value of pnf should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext());\r
- assertTrue("Value of pserver should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext());\r
- assertTrue("Value of vlan should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext());\r
- assertTrue("Value of nos-server should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext(),\r
+ "Value of l-interface should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext(),\r
+ "Value of lag-interface should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext(),\r
+ "Value of logical-link should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext(),\r
+ "Value of p-interface should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext(),\r
+ "Value of pnf should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext(),\r
+ "Value of pserver should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext(),\r
+ "Value of vlan should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext(),\r
+ "Value of vnfc should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext(),\r
+ "Value of vserver should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext(),\r
+ "Value of nos-server should be updated since the value for in-maint is an empty string");\r
}\r
\r
@Test\r
public void testExistingTrueValues() {\r
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext());\r
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext());\r
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext());\r
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext());\r
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext());\r
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext());\r
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext());\r
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext());\r
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext());\r
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext());\r
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext(),\r
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext(),\r
+ "Value of l-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext(),\r
+ "Value of lag-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext(),\r
+ "Value of logical-link shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext(),\r
+ "Value of p-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext(),\r
+ "Value of pnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext(),\r
+ "Value of pserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext(),\r
+ "Value of vlan shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext(),\r
+ "Value of vnfc shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext(),\r
+ "Value of vserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext(),\r
+ "Value of nos-server shouldn't be updated since in-maint already exists");\r
}\r
\r
@Test\r
public void testExistingFalseValues() {\r
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext());\r
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext());\r
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext());\r
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext());\r
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext());\r
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext());\r
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext());\r
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext());\r
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext());\r
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext());\r
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext(),\r
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext(),\r
+ "Value of l-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext(),\r
+ "Value of lag-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext(),\r
+ "Value of logical-link shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext(),\r
+ "Value of p-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext(),\r
+ "Value of pnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext(),\r
+ "Value of pserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext(),\r
+ "Value of vlan shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext(),\r
+ "Value of vnfc shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext(),\r
+ "Value of vserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext(),\r
+ "Value of nos-server shouldn't be updated since in-maint already exists");\r
}\r
}
\ No newline at end of file
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;
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;
private JanusGraphTransaction tx;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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");
}
}
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;
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;
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();
migration.run();
}
- @AfterClass
+ @AfterAll
public static void cleanUp() {
tx.tx().rollback();
graph.close();
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");
}
}
*/
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;
Vertex instanceGroupWithoutTSubType;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
tx = graph.newTransaction();
migration = new MigrateInstanceGroupSubType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
*/
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;
Vertex instanceGroupWithoutType;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
tx = graph.newTransaction();
migration = new MigrateInstanceGroupType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
*/
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;
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;
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();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
.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");
}
.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
.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
.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
.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
.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
.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
.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
.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
.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
.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
.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");
}
}
*/
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;
Vertex pnf22;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
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;
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;
private JanusGraphTransaction tx;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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");
}
}
*/
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;
private JanusGraphTransaction tx;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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");
}
}
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;
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;
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";
private MigrateVnfType migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@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");
}
@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
*/
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.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;
Vertex pserver5;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
*/
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;
private GraphTraversalSource g;
private MigrateNetworkTechToCloudRegion migration;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
.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 {
*/
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;
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;
Vertex zoneScn61;
Vertex zoneScn62;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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")
//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")
//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());
@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());
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
*/
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;
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;
private MigrateSdnaIvlanData migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@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")
.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")
.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")
.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")
.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")
.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")
.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")
.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")
.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 ");
}
*/
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;
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;
Vertex zoneScn61;
Vertex zoneScn62;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend","inmemory").open();
tx = graph.newTransaction();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.tx().rollback();
graph.close();
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")
@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());
@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());
//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");
}
import org.janusgraph.core.JanusGraph;\r
import org.janusgraph.core.JanusGraphFactory;\r
import org.janusgraph.core.JanusGraphTransaction;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
+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;\r
import org.onap.aai.introspection.Loader;\r
import org.onap.aai.introspection.ModelType;\r
import org.onap.aai.migration.Status;\r
import org.onap.aai.migration.v15.MigrateBooleanDefaultsToFalse;\r
import org.onap.aai.serialization.engines.QueryStyle;\r
-import org.onap.aai.serialization.engines.JanusGraphDBEngine;\r
-\r
+import org.onap.aai.serialization.engines.JanusGraphDBEngine;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;\r
import static org.mockito.Mockito.when;\r
\r
-import java.util.Optional;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-\r
+import java.util.Optional;
+
public class MigrateBooleanDefaultsToFalseTest extends AAISetup {\r
\r
public static class BooleanDefaultMigrator extends MigrateBooleanDefaultsToFalse {\r
private BooleanDefaultMigrator migration;\r
private GraphTraversalSource g;\r
\r
- @Before\r
+ @BeforeEach\r
public void setup() throws Exception{\r
g = tx.traversal();\r
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());\r
@Test\r
public void testMissingProperty(){\r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the property is-closed-loop-disabled doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vnfc should be updated since the property is-closed-loop-disabled doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vserver should be updated since the property is-closed-loop-disabled doesn't exist");\r
//dhcp-enabled\r
- assertTrue("Value of subnet should be updated since the property dhcp-enabled doesn't exist",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet0").has("dhcp-enabled", false).hasNext(),\r
+ "Value of subnet should be updated since the property dhcp-enabled doesn't exist");\r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the property is-provider-network doesn't exist",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the property is-shared-network doesn't exist",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the property is-external-network doesn't exist",\r
- 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()); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-provider-network doesn't exist"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-shared-network doesn't exist"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the property is-external-network doesn't exist"); \r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored doesn't exist",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext()); \r
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-port-mirrored doesn't exist"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");\r
//vf-module: is-base-vf-module\r
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module doesn't exist",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),\r
+ "Value of vf-module should be updated since the property is-base-vf-module doesn't exist"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered doesn't exist",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");\r
}\r
\r
@Test\r
public void testEmptyValue() { \r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vnfc should be updated since the value for is-closed-loop-disabled is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vserver should be updated since the value for is-closed-loop-disabled is an empty string");\r
//dhcp-enabled\r
- assertTrue("Value of subnet should be updated since the value for dhcp-enabled is an empty string",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet1").has("dhcp-enabled", false).hasNext(),\r
+ "Value of subnet should be updated since the value for dhcp-enabled is an empty string");\r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the value for is-provider-network is an empty string",\r
- 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()); \r
- assertTrue("Value of l3-network should be updated since the value for is-shared-network is an empty string",\r
- 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());\r
- assertTrue("Value of l3-network should be updated since the value for is-external-network is an empty string",\r
- 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());\r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-provider-network is an empty string"); \r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-shared-network is an empty string");\r
+ 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(),\r
+ "Value of l3-network should be updated since the value for is-external-network is an empty string");\r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface should be updated since the property is-port-mirrored is an empty string",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext()); \r
- assertTrue("Value of l-interface should be updated since the property is-ip-unnumbered is an empty string",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-port-mirrored is an empty string"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of l-interface should be updated since the property is-ip-unnumbered is an empty string");\r
//vf-module: is-base-vf-module, is-ip-unnumbered\r
- assertTrue("Value of vf-module should be updated since the property is-base-vf-module is an empty string",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),\r
+ "Value of vf-module should be updated since the property is-base-vf-module is an empty string"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan should be updated since the property is-ip-unnumbered is an empty string",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of vlan should be updated since the property is-ip-unnumbered is an empty string");\r
}\r
\r
@Test\r
public void testExistingTrueValues() {\r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext());\r
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext());\r
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("is-closed-loop-disabled", true).hasNext(),\r
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("is-closed-loop-disabled", true).hasNext(),\r
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("is-closed-loop-disabled", true).hasNext(),\r
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");\r
//dhcp-enabled\r
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),\r
+ "Value of subnet shouldn't be update since dhcp-enabled already exists"); \r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",\r
- 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()); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-external-network already exists"); \r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext()); \r
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),\r
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),\r
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists"); \r
//vf-module: is-base-vf-module\r
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),\r
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),\r
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
\r
}\r
\r
@Test\r
public void testExistingFalseValues() {\r
//is-closed-loop-disabled\r
- assertTrue("Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vnfc shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext());\r
- assertTrue("Value of vserver shouldn't be update since is-closed-loop-disabled already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of generic-vnf shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vnfc shouldn't be update since is-closed-loop-disabled already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("is-closed-loop-disabled", false).hasNext(),\r
+ "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");\r
//dhcp-enabled\r
- assertTrue("Value of subnet shouldn't be update since dhcp-enabled already exists",\r
- g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet3").has("dhcp-enabled", false).hasNext(),\r
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");\r
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
- assertTrue("Value of l3-network shouldn't be updated since is-bound-to-vpn already exists",\r
- 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()); \r
- assertTrue("Value of l3-network shouldn't be updated since is-provider-network already exists",\r
- 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()); \r
- assertTrue("Value of l3-network shouldn't be updated since is-shared-network already exists",\r
- 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());\r
- assertTrue("Value of l3-network shouldn't be updated since is-external-network already exists",\r
- 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()); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists"); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-provider-network already exists"); \r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
+ 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(),\r
+ "Value of l3-network shouldn't be updated since is-external-network already exists"); \r
//l-interface: is-port-mirrored, is-ip-unnumbered\r
- assertTrue("Value of l-interface shouldn't be updated since is-port-mirrored already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext()); \r
- assertTrue("Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),\r
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists"); \r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists"); \r
//vf-module: is-base-vf-module\r
- assertTrue("Value of vf-module shouldn't be updated since is-base-vf-module already exists",\r
- g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),\r
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists"); \r
//vlan: is-ip-unnumbered\r
- assertTrue("Value of vlan shouldn't be updated since is-ip-unnumbered already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),\r
+ "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
} \r
}
\ No newline at end of file
*/
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;
Vertex cloudRegion3;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
migration.run();
}
- @After
+ @AfterEach
public void cleanUp() {
tx.rollback();
graph.close();
import org.janusgraph.core.JanusGraphFactory;\r
import org.janusgraph.core.JanusGraphTransaction;\r
import org.janusgraph.core.schema.JanusGraphManagement;\r
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
+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;\r
import org.onap.aai.dbmap.DBConnectionType;\r
import org.onap.aai.introspection.Loader;\r
import org.onap.aai.migration.v15.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator;\r
import org.onap.aai.serialization.engines.QueryStyle;\r
import org.onap.aai.serialization.engines.JanusGraphDBEngine;\r
-import org.onap.aai.serialization.engines.TransactionalGraphEngine;\r
-\r
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;\r
import static org.mockito.Mockito.when;\r
\r
import java.util.HashMap;\r
import java.util.Map;\r
-import java.util.Optional;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-import static org.junit.Assert.assertEquals;\r
-\r
+import java.util.Optional;
+
public class MigrateInMaintDefaultToFalseTest extends\r
AAISetup {\r
protected static final String VNF_NODE_TYPE = "generic-vnf";\r
private InMaintDefaultMigrator migration;\r
private GraphTraversalSource g;\r
\r
- @Before\r
+ @BeforeEach\r
public void setup() throws Exception{\r
g = tx.traversal();\r
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());\r
\r
@Test\r
public void testMissingProperty(){\r
- assertTrue("Value of generic-vnf should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext());\r
- assertTrue("Value of l-interface should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext());\r
- assertTrue("Value of lag-interface should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext());\r
- assertTrue("Value of logical-link should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext());\r
- assertTrue("Value of p-interface should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext());\r
- assertTrue("Value of pnf should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext());\r
- assertTrue("Value of pserver should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext());\r
- assertTrue("Value of vlan should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext()); \r
- assertTrue("Value of nos-server should be updated since the property in-maint doesn't exist",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext()); \r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("in-maint", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("in-maint", false).hasNext(),\r
+ "Value of l-interface should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface0").has("in-maint", false).hasNext(),\r
+ "Value of lag-interface should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link0").has("in-maint", false).hasNext(),\r
+ "Value of logical-link should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface0").has("in-maint", false).hasNext(),\r
+ "Value of p-interface should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf0").has("in-maint", false).hasNext(),\r
+ "Value of pnf should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver0").has("in-maint", false).hasNext(),\r
+ "Value of pserver should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("in-maint", false).hasNext(),\r
+ "Value of vlan should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext(),\r
+ "Value of vnfc should be updated since the property in-maint doesn't exist");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext(),\r
+ "Value of vserver should be updated since the property in-maint doesn't exist"); \r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext(),\r
+ "Value of nos-server should be updated since the property in-maint doesn't exist"); \r
}\r
\r
@Test\r
public void testEmptyValue() { \r
- assertTrue("Value of generic-vnf should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext());\r
- assertTrue("Value of l-interface should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext());\r
- assertTrue("Value of lag-interface should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext());\r
- assertTrue("Value of logical-link should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext());\r
- assertTrue("Value of p-interface should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext());\r
- assertTrue("Value of pnf should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext());\r
- assertTrue("Value of pserver should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext());\r
- assertTrue("Value of vlan should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext());\r
- assertTrue("Value of vnfc should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext());\r
- assertTrue("Value of vserver should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext());\r
- assertTrue("Value of nos-server should be updated since the value for in-maint is an empty string",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext(),\r
+ "Value of generic-vnf should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext(),\r
+ "Value of l-interface should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface1").has("in-maint", false).hasNext(),\r
+ "Value of lag-interface should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link1").has("in-maint", false).hasNext(),\r
+ "Value of logical-link should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface1").has("in-maint", false).hasNext(),\r
+ "Value of p-interface should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf1").has("in-maint", false).hasNext(),\r
+ "Value of pnf should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver1").has("in-maint", false).hasNext(),\r
+ "Value of pserver should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("in-maint", false).hasNext(),\r
+ "Value of vlan should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc1").has("in-maint", false).hasNext(),\r
+ "Value of vnfc should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver1").has("in-maint", false).hasNext(),\r
+ "Value of vserver should be updated since the value for in-maint is an empty string");\r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext(),\r
+ "Value of nos-server should be updated since the value for in-maint is an empty string");\r
}\r
\r
@Test\r
public void testExistingTrueValues() {\r
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext());\r
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext());\r
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext());\r
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext());\r
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext());\r
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext());\r
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext());\r
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext());\r
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext());\r
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext());\r
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext(),\r
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("in-maint", true).hasNext(),\r
+ "Value of l-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface2").has("in-maint", true).hasNext(),\r
+ "Value of lag-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link2").has("in-maint", true).hasNext(),\r
+ "Value of logical-link shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface2").has("in-maint", true).hasNext(),\r
+ "Value of p-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf2").has("in-maint", true).hasNext(),\r
+ "Value of pnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver2").has("in-maint", true).hasNext(),\r
+ "Value of pserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("in-maint", true).hasNext(),\r
+ "Value of vlan shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc2").has("in-maint", true).hasNext(),\r
+ "Value of vnfc shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver2").has("in-maint", true).hasNext(),\r
+ "Value of vserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext(),\r
+ "Value of nos-server shouldn't be updated since in-maint already exists");\r
}\r
\r
@Test\r
public void testExistingFalseValues() {\r
- assertTrue("Value of generic-vnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext());\r
- assertTrue("Value of l-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext());\r
- assertTrue("Value of lag-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext());\r
- assertTrue("Value of logical-link shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext());\r
- assertTrue("Value of p-interface shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext());\r
- assertTrue("Value of pnf shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext());\r
- assertTrue("Value of pserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext());\r
- assertTrue("Value of vlan shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext());\r
- assertTrue("Value of vnfc shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext());\r
- assertTrue("Value of vserver shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext());\r
- assertTrue("Value of nos-server shouldn't be updated since in-maint already exists",\r
- g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext());\r
+ assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext(),\r
+ "Value of generic-vnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("in-maint", false).hasNext(),\r
+ "Value of l-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "lag-interface").has("interface-name", "lag-interface3").has("in-maint", false).hasNext(),\r
+ "Value of lag-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "logical-link").has("link-name", "logical-link3").has("in-maint", false).hasNext(),\r
+ "Value of logical-link shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "p-interface").has("interface-name", "p-interface3").has("in-maint", false).hasNext(),\r
+ "Value of p-interface shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf3").has("in-maint", false).hasNext(),\r
+ "Value of pnf shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "pserver").has("pserver-id", "pserver3").has("in-maint", false).hasNext(),\r
+ "Value of pserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("in-maint", false).hasNext(),\r
+ "Value of vlan shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc3").has("in-maint", false).hasNext(),\r
+ "Value of vnfc shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver3").has("in-maint", false).hasNext(),\r
+ "Value of vserver shouldn't be updated since in-maint already exists");\r
+ assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext(),\r
+ "Value of nos-server shouldn't be updated since in-maint already exists");\r
}\r
}
\ No newline at end of file
*/
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;
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;
private MigrateRadcomChanges migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
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");
}
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
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;
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;
private BooleanDefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@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
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;
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;
private InMaintDefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@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
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;
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;
private L2DefaultMigrator migration;
private GraphTraversalSource g;
- @Before
+ @BeforeEach
public void setup() throws Exception{
g = tx.traversal();
loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
@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
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;
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");
}
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;
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";
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();
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();
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 ");
}
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;
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";
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();
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();
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 ");
}
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 ");
}
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 ");
}