diff options
author | 2025-02-04 08:07:50 +0100 | |
---|---|---|
committer | 2025-02-04 11:00:36 +0100 | |
commit | f0aaa98a50edbc8b44a8b14c8c21287e623b6ff0 (patch) | |
tree | a90c93578138797bc3f59fb1f08b9ed5d6d3a77d /src/test/java/org | |
parent | 8b002a9cf36de2e65f82d5c9999200246d48af33 (diff) |
Use 1.15.5 aai-common release
Issue-ID: AAI-4119
Change-Id: I392037529a8e377cf319981772255d417addac6f
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'src/test/java/org')
36 files changed, 329 insertions, 386 deletions
diff --git a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java index 2c99751..307dfaa 100644 --- a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java +++ b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java @@ -27,7 +27,6 @@ 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.onap.aai.util.AAIConfig; @@ -39,7 +38,6 @@ import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoCo import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Import; import org.springframework.http.*; -import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.web.client.RestTemplate; @@ -66,7 +64,6 @@ import static org.junit.jupiter.api.Assertions.fail; */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = GraphAdminApp.class) @EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test -@ContextConfiguration(initializers = PropertyPasswordConfiguration.class) @Import(GraphAdminTestConfiguration.class) @TestPropertySource( properties = { diff --git a/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java b/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java index c53a0d4..bdd2c36 100644 --- a/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java +++ b/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java @@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; -import org.apache.http.ssl.SSLContextBuilder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.web.client.RestTemplateBuilder; @@ -33,25 +32,17 @@ import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.util.ResourceUtils; import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestTemplate; import javax.net.ssl.SSLContext; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; -import java.security.KeyStore; @TestConfiguration public class GraphAdminTestConfiguration { private static final Logger logger = LoggerFactory.getLogger(GraphAdminTestConfiguration.class); - @Autowired - private Environment env; - /** * Create a RestTemplate bean, using the RestTemplateBuilder provided * by the auto-configuration. @@ -59,21 +50,7 @@ public class GraphAdminTestConfiguration { @Bean RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception { - char[] trustStorePassword = env.getProperty("server.ssl.trust-store-password").toCharArray(); - char[] keyStorePassword = env.getProperty("server.ssl.key-store-password").toCharArray(); - - String keyStore = env.getProperty("server.ssl.key-store"); - String trustStore = env.getProperty("server.ssl.trust-store"); - - SSLContextBuilder sslContextBuilder = SSLContextBuilder.create(); - - if(env.acceptsProfiles("two-way-ssl")){ - sslContextBuilder = sslContextBuilder.loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword); - } - - SSLContext sslContext = sslContextBuilder - .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword) - .build(); + SSLContext sslContext = SSLContext.getDefault(); HttpClient client = HttpClients.custom() .setSSLContext(sslContext) @@ -112,13 +89,4 @@ public class GraphAdminTestConfiguration { return restTemplate; } - - private KeyStore loadPfx(String file, char[] password) throws Exception { - KeyStore keyStore = KeyStore.getInstance("PKCS12"); - File key = ResourceUtils.getFile(file); - try (InputStream in = new FileInputStream(key)) { - keyStore.load(in, password); - } - return keyStore; - } } diff --git a/src/test/java/org/onap/aai/MetricsConfigurationTest.java b/src/test/java/org/onap/aai/MetricsConfigurationTest.java index 481ff0a..d0b833b 100644 --- a/src/test/java/org/onap/aai/MetricsConfigurationTest.java +++ b/src/test/java/org/onap/aai/MetricsConfigurationTest.java @@ -33,7 +33,6 @@ 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.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -54,7 +53,7 @@ import org.springframework.web.client.RestTemplate; @AutoConfigureMetrics @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {SpringContextAware.class, GraphAdminApp.class}) -@ContextConfiguration(initializers = PropertyPasswordConfiguration.class, classes = {SpringContextAware.class}) +@ContextConfiguration(classes = {SpringContextAware.class}) @EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test @Import(GraphAdminTestConfiguration.class) @TestPropertySource(locations = "classpath:application-test.properties") diff --git a/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java b/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java index c709fa0..8de2398 100644 --- a/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java +++ b/src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java @@ -41,7 +41,7 @@ import java.util.HashSet; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.fail; @TestMethodOrder(MethodName.class) public class DataGroomingTest extends AAISetup { diff --git a/src/test/java/org/onap/aai/dbgen/DupeToolTest.java b/src/test/java/org/onap/aai/dbgen/DupeToolTest.java index 5ba0f9e..fdf2fec 100644 --- a/src/test/java/org/onap/aai/dbgen/DupeToolTest.java +++ b/src/test/java/org/onap/aai/dbgen/DupeToolTest.java @@ -34,7 +34,7 @@ import org.onap.aai.dbmap.AAIGraph; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.fail; public class DupeToolTest extends AAISetup { diff --git a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java index 8c3d669..3f2a525 100644 --- a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java +++ b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java @@ -32,7 +32,8 @@ import org.onap.aai.AAISetup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.exceptions.AAIException; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; @TestMethodOrder(MethodName.class) public class SchemaMod4HistTest extends AAISetup { diff --git a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java index 0b71fc0..4056954 100644 --- a/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java +++ b/src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java @@ -32,7 +32,7 @@ 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.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.fail; @TestMethodOrder(MethodName.class) public class SchemaModTest extends AAISetup { diff --git a/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java index d284981..c40b1f9 100644 --- a/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v12; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java index 9f39e86..eae4964 100644 --- a/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java @@ -71,11 +71,11 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup { Vertex v2 = g.addV().property("aai-node-type", "l-interface") .property("interface-name", "delcontains-test-lint") .next(); - Edge e = v.addEdge("hasLInterface", v2, EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString(), + Edge e = v.addEdge("hasLInterface", v2, EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString(), EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString()); - + Vertex v3 = g.addV().property("aai-node-type", "allotted-resource").next(); - + Edge e2 = v2.addEdge("uses", v3, EdgeProperty.CONTAINS.toString(), AAIDirection.NONE.toString(), EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString()); TransactionalGraphEngine spy = spy(dbEngine); @@ -87,20 +87,20 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup { migration = new ContainmentDeleteOtherVPropertyMigration(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions, "/edgeMigrationTestRules.json"); migration.run(); } - + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); } - + @Test public void run() { - assertEquals(true, - g.E().hasLabel("hasLInterface").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.OUT.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(), + 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(), diff --git a/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java b/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java index cd38450..6fa8a0b 100644 --- a/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java +++ b/src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java @@ -73,7 +73,7 @@ public class DeletePInterfaceTest extends AAISetup { .property("source-of-truth", "AAI-CSVP-INSTARAMS") .next(); edgeSerializer.addTreeEdge(g, pnf1, pInterface1); - + Vertex pnf2 = g.addV().property("aai-node-type", "pnf") .property("pnf-name", "pnf-name2") .next(); @@ -86,7 +86,7 @@ public class DeletePInterfaceTest extends AAISetup { .next(); edgeSerializer.addTreeEdge(g, pnf2, pInterface2); edgeSerializer.addEdge(g, pInterface2, pLink); - + Vertex pnf3 = g.addV().property("aai-node-type", "pnf") .property("pnf-name", "pnf-name3") .next(); @@ -99,7 +99,7 @@ public class DeletePInterfaceTest extends AAISetup { .next(); edgeSerializer.addTreeEdge(g, pnf3, pInterface3); edgeSerializer.addTreeEdge(g, pInterface3, lInterface); - + Vertex pnf4 = g.addV().property("aai-node-type", "pnf") .property("pnf-name", "pnf-name4") .next(); @@ -107,7 +107,7 @@ public class DeletePInterfaceTest extends AAISetup { .property("interface-name", "interface-name4") .next(); edgeSerializer.addTreeEdge(g, pnf4, pInterface4); - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); GraphTraversalSource traversal = g; @@ -127,16 +127,16 @@ public class DeletePInterfaceTest extends AAISetup { public void test() { 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(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(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(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.SUCCESS, migration.getStatus(), "Status should be success"); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java index 328ede6..c22c5f9 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java @@ -71,7 +71,7 @@ public class MigrateDataFromASDCToConfigurationTest extends AAISetup { dbEngine = new JanusGraphDBEngine( queryStyle, loader); - + System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); Vertex genericvnf1 = g.addV().property("aai-node-type", "generic-vnf") .property("vnf-id", "vnfId1") diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java index 0dfd821..31f7e36 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java @@ -66,18 +66,18 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { loader); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); - + Vertex customer1 = g.addV() .property("aai-node-type", "customer") .property("global-customer-id", "customer-id-1") .property("subscriber-type", "CUST") .next(); - + Vertex servSub1 = g.addV() .property("aai-node-type", "service-subscription") .property("service-type", "SAREA") .next(); - + Vertex servInstance1 = g.addV() .property("aai-node-type", "service-instance") .property("service-type", "SAREA") @@ -93,7 +93,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { .property("service-type", "SAREA") .property("service-instance-id", "evc-name-2") .next(); - + Vertex evc1 = g.addV().property("aai-node-type", "evc") .property("evc-id", "evc-name-1") .next(); @@ -132,9 +132,9 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { .property("forwarder-evc-id", "evc-name-1-2") .property("svlan", "16") .next(); - - - + + + Vertex evc2 = g.addV().property("aai-node-type", "evc") .property("evc-id", "evc-name-2") .next(); @@ -242,24 +242,24 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { .property("forwarder-evc-id", "evc-name-3-2") // .property("svlan", "16") .next(); - + // graph 1 edgeSerializer.addTreeEdge(g, customer1, servSub1); edgeSerializer.addTreeEdge(g, servSub1, servInstance1); edgeSerializer.addTreeEdge(g, servSub1, servInstance2); edgeSerializer.addTreeEdge(g, servSub1, servInstance3); - + edgeSerializer.addEdge(g, servInstance1, fp1); edgeSerializer.addEdge(g, servInstance2, fp2); - + edgeSerializer.addEdge(g, fp1, config1); edgeSerializer.addEdge(g, fp2, config2); edgeSerializer.addEdge(g, fp3, config3); - + edgeSerializer.addTreeEdge(g, evc1, config1); edgeSerializer.addTreeEdge(g, evc2, config2); edgeSerializer.addTreeEdge(g, evc3, config3); - + edgeSerializer.addTreeEdge(g, fp1, for11); edgeSerializer.addTreeEdge(g, fp1, for12); edgeSerializer.addTreeEdge(g, fp2, for21); @@ -268,7 +268,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { edgeSerializer.addTreeEdge(g, fp2, for24); edgeSerializer.addTreeEdge(g, fp3, for31); edgeSerializer.addTreeEdge(g, fp3, for32); - + edgeSerializer.addEdge(g, for11, config11); edgeSerializer.addEdge(g, for12, config12); edgeSerializer.addEdge(g, for21, config21); @@ -277,7 +277,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { edgeSerializer.addEdge(g, for24, config24); edgeSerializer.addEdge(g, for31, config31); edgeSerializer.addEdge(g, for32, config32); - + edgeSerializer.addTreeEdge(g, config11, fevc11); edgeSerializer.addTreeEdge(g, config12, fevc12); edgeSerializer.addTreeEdge(g, config21, fevc21); @@ -286,7 +286,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { edgeSerializer.addTreeEdge(g, config24, fevc24); edgeSerializer.addTreeEdge(g, config31, fevc31); edgeSerializer.addTreeEdge(g, config32, fevc32); - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); @@ -296,72 +296,72 @@ public class MigrateHUBEvcInventoryTest extends AAISetup { when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly); - + migration = new MigrateHUBEvcInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); migration.run(); } - + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); } - + @Test public void testRun_checkFevc1AndFevc2AreUpdated() throws Exception { - + // check if forwarder-evc nodes get updated - assertEquals(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(true, + + assertEquals(true, g.V().has("aai-node-type", "forwarder-evc") .has("forwarder-evc-id", "evc-name-2-2") .has("ivlan","4084") - .hasNext(), + .hasNext(), "forwarder-evc evc-name-2-2 updated with ivlan"); - assertEquals(true, + 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(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(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(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"); } - + @Test public void testGetAffectedNodeTypes() { Optional<String[]> types = migration.getAffectedNodeTypes(); Optional<String[]> expected = Optional.of(new String[]{"forwarder-evc"}); - + assertNotNull(types); assertArrayEquals(expected.get(), types.get()); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java index f54dae0..028cc22 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java @@ -64,8 +64,8 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { loader); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); - - + + Vertex pnf1 = g.addV() .property("aai-node-type", "pnf") .property("pnf-name", "pnf-name-1") @@ -77,7 +77,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { .property("aai-uri", "/network/pnfs/pnf/pnf-name-1/p-interfaces/pinterface/1.1") .next(); // graph 1 - + edgeSerializer.addTreeEdge(g, pnf1, port11); @@ -90,11 +90,11 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly); - + migration = new MigrateINVPhysicalInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); migration.run(); } - + @AfterEach public void cleanUp() { tx.tx().rollback(); @@ -123,21 +123,21 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { @Test public void testRun_checkPnfsAndPInterfacesExist() throws Exception { // check if graph nodes exist - + // check if pnf node gets created - assertEquals(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(new Long(1L), g.V().has("aai-node-type", "pnf") .has("pnf-name", "pnf-name-collector-1").count().next(), "p-interfaces created for pnfs"); - + assertEquals(true, g.V().has("aai-node-type", "pnf") .has("pnf-name", "pnf-name-collector-1") @@ -151,12 +151,12 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup { .in("tosca.relationships.network.BindsTo").count().next(), "p-interfaces created for pnfs"); } - + @Test public void testGetAffectedNodeTypes() { Optional<String[]> types = migration.getAffectedNodeTypes(); Optional<String[]> expected = Optional.of(new String[]{"pnf"}); - + assertNotNull(types); assertArrayEquals(expected.get(), types.get()); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java index dcc49c0..0a0bfcc 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java @@ -65,17 +65,17 @@ public class MigrateInvEvcInventoryTest extends AAISetup { loader); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); - + Vertex evc = g.addV() .property("aai-node-type", "evc") .property("evc-id", "evc-name-1") .next(); - + Vertex evc2 = g.addV() .property("aai-node-type", "evc") .property("evc-id", "evc-name-2") .next(); - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); @@ -85,59 +85,59 @@ public class MigrateInvEvcInventoryTest extends AAISetup { when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly); - + migration = new MigrateINVEvcInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); migration.run(); } - + @AfterEach public void cleanUp() { tx.tx().rollback(); graph.close(); } - + @Test public void testRun_updateEvcNode() throws Exception { // check if graph nodes exist - assertEquals(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(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(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(true, + assertEquals(true, g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-2") - .hasNext(), + .hasNext(), "evc node exists"); - assertEquals(false, + 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"); - + } @Test public void testGetAffectedNodeTypes() { Optional<String[]> types = migration.getAffectedNodeTypes(); Optional<String[]> expected = Optional.of(new String[]{"evc"}); - + assertNotNull(types); assertArrayEquals(expected.get(), types.get()); } diff --git a/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java index 7511f8c..03f7f8f 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java @@ -33,11 +33,9 @@ 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.introspection.ModelType; import org.onap.aai.setup.SchemaVersions; -import org.onap.aai.setup.SchemaVersion; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java index 2b46026..ecf45f7 100644 --- a/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java +++ b/src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java @@ -66,59 +66,59 @@ public class MigrateSAREvcInventoryTest extends AAISetup { loader); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); - + Vertex customer1 = g.addV() .property("aai-node-type", "customer") .property("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") .property("subscriber-type", "CUST") .next(); - + Vertex servSub1 = g.addV() .property("aai-node-type", "service-subscription") .property("service-type", "SAREA") .next(); - + Vertex servInst1 = g.addV() .property("aai-node-type", "service-instance") .property("service-instance-id", "evc-name-1") .next(); - + Vertex customer2 = g.addV() .property("aai-node-type", "customer") .property("global-customer-id", "cust-1") .property("subscriber-type", "CUST") .next(); - + Vertex servSub2 = g.addV() .property("aai-node-type", "service-subscription") .property("service-type", "SAREA") .next(); - + Vertex servInst2 = g.addV() .property("aai-node-type", "service-instance") .property("service-instance-id", "evc-name-1") .next(); - + Vertex collectorPnf = g.addV() .property("aai-node-type", "pnf") .property("pnf-name", "pnf-name-collector-1") .next(); - + Vertex bearerPnf = g.addV() .property("aai-node-type", "pnf") .property("pnf-name", "pnf-name-bearer-1") .next(); - + Vertex collectorPort = g.addV() .property("aai-node-type", "p-interface") .property("interface-name", "p-int-collector-1") .next(); - + Vertex bearerPort = g.addV() .property("aai-node-type", "p-interface") .property("interface-name", "p-int-bearer-1") .next(); - + Vertex servInst4 = g.addV() .property("aai-node-type", "service-instance") .property("service-instance-id", "evc-name-4") @@ -142,11 +142,11 @@ public class MigrateSAREvcInventoryTest extends AAISetup { when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly); - + migration = new MigrateSAREvcInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); migration.run(); } - + @AfterEach public void cleanUp() { tx.tx().rollback(); @@ -157,25 +157,25 @@ public class MigrateSAREvcInventoryTest extends AAISetup { @Test public void testRun_createServiceInstanceNode() throws Exception { // check if graph nodes exist - assertEquals(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(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(true, g.V().has("forwarding-path-id", "evc-name-1") .has("forwarding-path-name", "evc-name-1").hasNext(), "fowarding-path is created"); - - assertEquals(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") @@ -183,9 +183,9 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-1") .has("forwarding-path-name", "evc-name-1") - .hasNext(), + .hasNext(), "fowarding-path node exists"); - + // check if configuration node gets created assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") @@ -197,20 +197,20 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("configuration-sub-type", "evc") .hasNext(), "configuration node, configuration-type= forwarding-path"); - + //check if evc node gets created - assertEquals(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(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") @@ -223,57 +223,57 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("cir-units", "Mbps") .has("tagmode-access-ingress", "DOUBLE") .has("tagmode-access-egress", "DOUBLE") - .hasNext(), + .hasNext(), "configuration node, configuration-type= evc"); } @Test public void testRun_evcNotCreated() throws Exception { // check if graph nodes exist - assertEquals(true, + assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") - .hasNext(), + .hasNext(), "customer node exists"); - - assertEquals(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(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(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(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(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(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(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"); } @@ -281,25 +281,25 @@ public class MigrateSAREvcInventoryTest extends AAISetup { @Test public void testRun_createFPConfigurationEvcNode4() throws Exception { // check if graph nodes exist - assertEquals(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(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(true, g.V().has("forwarding-path-id", "evc-name-4") .has("forwarding-path-name", "evc-name-4").hasNext(), "fowarding-path is created"); - - assertEquals(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") @@ -307,9 +307,9 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("aai-node-type", "forwarding-path") .has("forwarding-path-id", "evc-name-4") .has("forwarding-path-name", "evc-name-4") - .hasNext(), + .hasNext(), "fowarding-path node exists"); - + // check if configuration node gets created assertEquals(true, g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd") @@ -321,20 +321,20 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("configuration-sub-type", "evc") .hasNext(), "configuration node, configuration-type= forwarding-path"); - + //check if evc node gets created - assertEquals(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(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") @@ -347,15 +347,15 @@ public class MigrateSAREvcInventoryTest extends AAISetup { .has("cir-units", "Mbps") .has("tagmode-access-ingress", "DOUBLE") .has("tagmode-access-egress", "DOUBLE") - .hasNext(), + .hasNext(), "configuration node, configuration-type= evc"); } - + @Test public void testGetAffectedNodeTypes() { Optional<String[]> types = migration.getAffectedNodeTypes(); Optional<String[]> expected = Optional.of(new String[]{"service-instance"}); - + assertNotNull(types); assertArrayEquals(expected.get(), types.get()); } diff --git a/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java b/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java index e8f7cda..b6894b5 100644 --- a/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java +++ b/src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java @@ -162,4 +162,4 @@ public class UriMigrationTest extends AAISetup { migration.seen.add(pInterface3.id()); assertEquals(Collections.EMPTY_SET, migration.getChildren(lInterface3)); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java index cf96574..e0ff99e 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -74,14 +74,14 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup { } private void createFirstVertexAndRelatedVertexes() throws AAIException { - + // Add model1/model-ver1 -- invalid model/model-ver Vertex model1 = g.addV().property("aai-node-type", "model") .property("model-invariant-id", "model-invariant-id-1").property("model-type", "widget").next(); modelVer1 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-1") .property("model-name", "connector").property("model-version", "v1.0").next(); edgeSerializer.addTreeEdge(g, model1, modelVer1); - + // Add named-query and named-query-element nodes. Point the named-query-element at model1 Vertex namedQ1 = g.addV().property("aai-node-type", "named-query") .property("named-query-uuid", "named-query-uuid-1").property("named-query-name", "test-NQ-1").next(); @@ -123,9 +123,9 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup { assertEquals(true, g.V().has("aai-node-type", "named-query-element").has("named-query-element-uuid", "named-query-element-uuid-1") .out("org.onap.relationships.inventory.BelongsTo") - .has("named-query-uuid", "named-query-uuid-1").hasNext()); + .has("named-query-uuid", "named-query-uuid-1").hasNext()); } - + @Test public void testBadNodesAreNotGone() { assertEquals(true, @@ -133,16 +133,16 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup { assertEquals(true, g.V().has("aai-node-type", "model").has("model-invariant-id", "model-invariant-id-1").hasNext()); } - + @Test public void testNQNodesaAreStillThere() { assertEquals(true, g.V().has("aai-node-type", "named-query").has("named-query-uuid", "named-query-uuid-1").hasNext()); assertEquals(true, g.V().has("aai-node-type", "named-query-element").has("named-query-element-uuid", "named-query-element-uuid-1").hasNext()); - + } - + @Test public void testThatNewEdgeAdded() { @@ -159,7 +159,7 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup { .in("org.onap.relationships.inventory.IsA").has("named-query-element-uuid", "named-query-element-uuid-1") .hasNext()); } - - -}
\ No newline at end of file + + +} diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java index f50e037..9602f4b 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -132,13 +132,13 @@ public class MigrateBadWidgetModelsPartTwoTest extends AAISetup { .out("org.onap.relationships.inventory.BelongsTo").has("model-version-id", "model-version-id-2") .hasNext()); } - + @Test public void testBadVerNodeIsGoneX() { assertEquals(false, g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-1").hasNext()); } - + @Test public void testBadModelNodeIsGoneX() { assertEquals(false, @@ -161,4 +161,4 @@ public class MigrateBadWidgetModelsPartTwoTest extends AAISetup { .hasNext()); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java index f4c3a28..eb679c4 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java @@ -122,7 +122,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { g.addV().property("aai-node-type", "vserver")
.property("vserver-id", "vserver3")
.property("is-closed-loop-disabled", false)
- .next();
+ .next();
//l3-network
g.addV().property("aai-node-type", "l3-network")
.property("network-id", "l3-network0")
@@ -151,7 +151,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .property("is-provider-network", false)
.property("is-shared-network", false)
.property("is-external-network", false)
- .next();
+ .next();
//subnet
g.addV().property("aai-node-type", "subnet")
.property("subnet-id", "subnet0")
@@ -190,7 +190,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .property("in-maint", false)
.property("is-port-mirrored", false)
.property("is-ip-unnumbered", false)
- .next();
+ .next();
//vf-module
g.addV().property("aai-node-type", "vf-module")
.property("vf-module-id", "vf-module0")
@@ -205,9 +205,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .next();
g.addV().property("aai-node-type", "vf-module")
.property("vf-module-id", "vf-module3")
- .property("is-base-vf-module", false)
- .next();
-
+ .property("is-base-vf-module", false)
+ .next();
+
//vlan
g.addV().property("aai-node-type", "vlan")
.property("vlan-interface", "vlan0")
@@ -222,9 +222,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .next();
g.addV().property("aai-node-type", "vlan")
.property("vlan-interface", "vlan3")
- .property("is-ip-unnumbered", false)
+ .property("is-ip-unnumbered", false)
.next();
-
+
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
GraphTraversalSource traversal = g;
@@ -232,7 +232,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { when(adminSpy.getTraversalSource()).thenReturn(traversal);
migration = new BooleanDefaultMigrator(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
migration.run();
-
+
}
@Test
@@ -249,28 +249,28 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of subnet should be updated since the property dhcp-enabled doesn't exist");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext(),
- "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");
+ "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext(),
- "Value of l3-network should be updated since the property is-provider-network doesn't exist");
+ "Value of l3-network should be updated since the property is-provider-network doesn't exist");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext(),
- "Value of l3-network should be updated since the property is-shared-network doesn't exist");
+ "Value of l3-network should be updated since the property is-shared-network doesn't exist");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext(),
- "Value of l3-network should be updated since the property is-external-network doesn't exist");
+ "Value of l3-network should be updated since the property is-external-network doesn't exist");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),
- "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");
+ "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),
"Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");
//vf-module: is-base-vf-module
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),
- "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");
+ "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),
"Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");
}
@Test
- public void testEmptyValue() {
+ public void testEmptyValue() {
//is-closed-loop-disabled
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),
"Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");
@@ -283,26 +283,26 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of subnet should be updated since the value for dhcp-enabled is an empty string");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext(),
- "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");
+ "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext(),
- "Value of l3-network should be updated since the value for is-provider-network is an empty string");
+ "Value of l3-network should be updated since the value for is-provider-network is an empty string");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext(),
"Value of l3-network should be updated since the value for is-shared-network is an empty string");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext(),
"Value of l3-network should be updated since the value for is-external-network is an empty string");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),
- "Value of l-interface should be updated since the property is-port-mirrored is an empty string");
+ "Value of l-interface should be updated since the property is-port-mirrored is an empty string");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),
"Value of l-interface should be updated since the property is-ip-unnumbered is an empty string");
//vf-module: is-base-vf-module, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),
- "Value of vf-module should be updated since the property is-base-vf-module is an empty string");
+ "Value of vf-module should be updated since the property is-base-vf-module is an empty string");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),
"Value of vlan should be updated since the property is-ip-unnumbered is an empty string");
}
-
+
@Test
public void testExistingTrueValues() {
//is-closed-loop-disabled
@@ -314,7 +314,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");
//dhcp-enabled
assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),
- "Value of subnet shouldn't be update since dhcp-enabled already exists");
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext(),
"Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
@@ -323,21 +323,21 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext(),
"Value of l3-network shouldn't be updated since is-shared-network already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext(),
- "Value of l3-network shouldn't be updated since is-external-network already exists");
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),
- "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),
- "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),
- "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),
"Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
-
+
}
-
+
@Test
public void testExistingFalseValues() {
//is-closed-loop-disabled
@@ -352,23 +352,23 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext(),
- "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext(),
- "Value of l3-network shouldn't be updated since is-provider-network already exists");
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext(),
"Value of l3-network shouldn't be updated since is-shared-network already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext(),
- "Value of l3-network shouldn't be updated since is-external-network already exists");
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),
- "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),
- "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),
- "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),
"Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
- }
-}
\ No newline at end of file + }
+}
diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java index 9bb413b..0952bd7 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java @@ -54,7 +54,7 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup { dbEngine = new JanusGraphDBEngine( queryStyle, loader); - + System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); Vertex pnf1 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-1").next(); @@ -79,8 +79,8 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup { .property("forwarder-role", "ingress").next(); Vertex forwarder5 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1) .property("forwarder-role", "ingress").next(); - - + + Vertex configuration1 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-1") .property("configuration-type", "test").property("configuration-subt-type", "test").next(); Vertex configuration2 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-2") @@ -102,30 +102,30 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup { Vertex forwarderEvc4 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-4") .property("circuit-id", "3").property("resource-version", "v13").next(); Vertex forwarderEvc5 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-5") - .property("resource-version", "v13").next(); - + .property("resource-version", "v13").next(); + + - edgeSerializer.addTreeEdge(g, pnf1, pInterface1); edgeSerializer.addEdge(g, pInterface1, forwarder1); edgeSerializer.addEdge(g, forwarder1, configuration1); edgeSerializer.addTreeEdge(g, configuration1, forwarderEvc1); - + edgeSerializer.addTreeEdge(g, pnf2, pInterface2); edgeSerializer.addEdge(g, pInterface2, forwarder2); edgeSerializer.addEdge(g, forwarder2, configuration2); edgeSerializer.addTreeEdge(g, configuration2, forwarderEvc2); - + edgeSerializer.addTreeEdge(g, pnf3, pInterface3); edgeSerializer.addEdge(g, pInterface3, forwarder3); edgeSerializer.addEdge(g, forwarder3, configuration3); edgeSerializer.addTreeEdge(g, configuration3, forwarderEvc3); - + edgeSerializer.addTreeEdge(g, pnf4, pInterface4); edgeSerializer.addEdge(g, pInterface4, forwarder4); edgeSerializer.addEdge(g, forwarder4, configuration4); edgeSerializer.addTreeEdge(g, configuration4, forwarderEvc4); - + edgeSerializer.addTreeEdge(g, pnf5, pInterface5); edgeSerializer.addEdge(g, pInterface5, forwarder5); edgeSerializer.addEdge(g, forwarder5, configuration5); @@ -140,39 +140,39 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup { when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly); - + migration = new MigrateForwarderEvcCircuitId(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); migration.run(); } - + @Test public void testCircuitIdsUpdated() throws Exception { // check if graph nodes are updated - - assertEquals("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("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(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("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(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 public void testGetAffectedNodeTypes() { Optional<String[]> types = migration.getAffectedNodeTypes(); Optional<String[]> expected = Optional.of(new String[]{"forwarder-evc"}); - + assertNotNull(types); assertArrayEquals(expected.get(), types.get()); } diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java index 6e906ca..28e993e 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java @@ -23,10 +23,7 @@ import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
-import org.janusgraph.core.schema.JanusGraphManagement;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java index dab9077..2a0981f 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java @@ -36,7 +36,7 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java index eef65ac..776bb45 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java @@ -104,4 +104,4 @@ public class MigrateInstanceGroupSubTypeTest extends AAISetup{ assertFalse(instanceGroupWithoutTSubType.property(MigrateInstanceGroupSubType.INSTANCE_GROUP_ROLE_PROPERTY).isPresent()); assertFalse(instanceGroupWithoutTSubType.property(MigrateInstanceGroupSubType.SUB_TYPE_PROPERTY).isPresent()); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java index d0b93d6..b4106fb 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java @@ -67,12 +67,12 @@ public class MigrateInstanceGroupTypeTest extends AAISetup{ queryStyle, loader); instanceGroup = g.addV().property("aai-node-type", MigrateInstanceGroupType.INSTANCE_GROUP_NODE_TYPE) - .property( MigrateInstanceGroupType.TYPE_PROPERTY, TYPE_VALUE) + .property( MigrateInstanceGroupType.TYPE_PROPERTY, TYPE_VALUE) .next(); - + instanceGroupWithoutType = g.addV().property("aai-node-type", MigrateInstanceGroupType.INSTANCE_GROUP_NODE_TYPE) .next(); - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); GraphTraversalSource traversal = g; @@ -104,4 +104,4 @@ public class MigrateInstanceGroupTypeTest extends AAISetup{ assertFalse(instanceGroupWithoutType.property(MigrateInstanceGroupType.INSTANCE_GROUP_TYPE_PROPERTY).isPresent()); assertFalse(instanceGroupWithoutType.property(MigrateInstanceGroupType.TYPE_PROPERTY).isPresent()); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java index 41f524b..74b9e0f 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.migration.v13; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -34,12 +34,10 @@ 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.introspection.Loader; import org.onap.aai.introspection.LoaderFactory; import org.onap.aai.introspection.ModelType; import org.onap.aai.setup.SchemaVersions; -import org.onap.aai.setup.SchemaVersion; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.TransactionalGraphEngine; diff --git a/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java b/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java index 7272176..25b46ad 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java @@ -71,11 +71,11 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{ pserver1 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PSERVER_NODE_TYPE) .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "Server") .next(); - + pserver2 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PSERVER_NODE_TYPE) .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "server") .next(); - + pnf1 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PNF_NODE_TYPE) .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "Switch") .next(); @@ -86,7 +86,7 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{ pserver3 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PSERVER_NODE_TYPE) .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "server1") .next(); - + pnf2 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PNF_NODE_TYPE) .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "Switch1") .next(); @@ -119,15 +119,15 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{ assertEquals("SWITCH",pnf1.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value()); assertEquals("SWITCH",pnf22.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value()); } - + @Test public void verifyEquipTypeIsNotChanged() { assertEquals("server1",pserver3.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value()); assertEquals("Switch1",pnf2.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value()); } - - - -}
\ No newline at end of file + + + +} diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java index 066b2c8..d6bbad2 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.when; import java.util.Optional; public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { - + protected static final String VNF_NODE_TYPE = "generic-vnf"; public static class MigrateVnfType extends MigrateGenericVnfMgmtOptions { @@ -92,7 +92,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { .property("vnf-type", "HN") .property("management-option", "existingOption") .next(); - + g.addV().property("aai-node-type", "generic-vnf") .property("vnf-id", "generic-vnf10") .property("vnf-type", "HP") @@ -107,7 +107,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { .property("vnf-type", "HP") .property("management-option", "existingOption") .next(); - + g.addV().property("aai-node-type", "generic-vnf") .property("vnf-id", "generic-vnf20") .property("vnf-type", "HG") @@ -121,8 +121,8 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { .property("vnf-id", "generic-vnf22") .property("vnf-type", "HG") .property("management-option", "existingOption") - .next(); - + .next(); + // Non-eligible migration conditions - vnf-type = XX g.addV().property("aai-node-type", "generic-vnf") .property("vnf-id", "generic-vnf30") @@ -137,7 +137,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { .property("vnf-id", "generic-vnf32") .property("vnf-type", "XX") .property("management-option", "existingOption") - .next(); + .next(); // Non-eligible migration conditions - vnf-type = missing g.addV().property("aai-node-type", "generic-vnf") .property("vnf-id", "generic-vnf40") @@ -149,8 +149,8 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { g.addV().property("aai-node-type", "generic-vnf") .property("vnf-id", "generic-vnf42") .property("management-option", "existingOption") - .next(); - + .next(); + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); GraphTraversalSource traversal = g; @@ -158,22 +158,22 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { when(adminSpy.getTraversalSource()).thenReturn(traversal); migration = new MigrateVnfType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions); migration.run(); - + } @Test public void testMissingProperty(){ //management-option 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"); + "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"); + "Value of generic-vnf should be updated since the property management-option doesn't exist"); } @Test - public void testEmptyValue() { + public void testEmptyValue() { //management-option 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"); @@ -181,9 +181,9 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { "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 @@ -193,10 +193,10 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { "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 @@ -206,13 +206,13 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup { "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(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf40").has("management-option", "AT&T Managed-Basic").hasNext(), "Value of generic-vnf shouldn't be updated since vnf-type is not present"); assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf41").has("management-option", "AT&T Managed-Basic").hasNext(), "Value of generic-vnf shouldn't be updated since vnf-type is not present"); assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf42").has("management-option", "AT&T Managed-Basic").hasNext(), "Value of generic-vnf shouldn't be updated since vnf-type is not present and management-option already exists"); - - } -}
\ No newline at end of file + + } +} diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java index a652147..99f2509 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java @@ -19,7 +19,8 @@ */ package org.onap.aai.migration.v14; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -33,10 +34,8 @@ 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.introspection.ModelType; -import org.onap.aai.migration.v14.MigrateSameSourcedRCTROPserverData; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java index 03d8464..512d9f2 100644 --- a/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java +++ b/src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java @@ -19,26 +19,21 @@ */ package org.onap.aai.migration.v14; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.List; - import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.janusgraph.core.JanusGraph; -import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraphTransaction; import org.junit.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 org.onap.aai.introspection.Loader; import org.onap.aai.introspection.ModelType; import org.onap.aai.serialization.engines.JanusGraphDBEngine; diff --git a/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java b/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java index 60e6b04..27d8ff2 100644 --- a/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java +++ b/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java @@ -19,12 +19,10 @@ */ package org.onap.aai.migration.v14; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -import java.util.List; - import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -32,7 +30,6 @@ 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.introspection.ModelType; import org.onap.aai.serialization.engines.QueryStyle; diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java index 116e773..a465fed 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java @@ -122,7 +122,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { g.addV().property("aai-node-type", "vserver")
.property("vserver-id", "vserver3")
.property("is-closed-loop-disabled", false)
- .next();
+ .next();
//l3-network
g.addV().property("aai-node-type", "l3-network")
.property("network-id", "l3-network0")
@@ -151,7 +151,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .property("is-provider-network", false)
.property("is-shared-network", false)
.property("is-external-network", false)
- .next();
+ .next();
//subnet
g.addV().property("aai-node-type", "subnet")
.property("subnet-id", "subnet0")
@@ -190,7 +190,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .property("in-maint", false)
.property("is-port-mirrored", false)
.property("is-ip-unnumbered", false)
- .next();
+ .next();
//vf-module
g.addV().property("aai-node-type", "vf-module")
.property("vf-module-id", "vf-module0")
@@ -205,9 +205,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .next();
g.addV().property("aai-node-type", "vf-module")
.property("vf-module-id", "vf-module3")
- .property("is-base-vf-module", false)
- .next();
-
+ .property("is-base-vf-module", false)
+ .next();
+
//vlan
g.addV().property("aai-node-type", "vlan")
.property("vlan-interface", "vlan0")
@@ -222,9 +222,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { .next();
g.addV().property("aai-node-type", "vlan")
.property("vlan-interface", "vlan3")
- .property("is-ip-unnumbered", false)
+ .property("is-ip-unnumbered", false)
.next();
-
+
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
GraphTraversalSource traversal = g;
@@ -232,7 +232,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { when(adminSpy.getTraversalSource()).thenReturn(traversal);
migration = new BooleanDefaultMigrator(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
migration.run();
-
+
}
@Test
@@ -249,28 +249,28 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of subnet should be updated since the property dhcp-enabled doesn't exist");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext(),
- "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");
+ "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext(),
- "Value of l3-network should be updated since the property is-provider-network doesn't exist");
+ "Value of l3-network should be updated since the property is-provider-network doesn't exist");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext(),
- "Value of l3-network should be updated since the property is-shared-network doesn't exist");
+ "Value of l3-network should be updated since the property is-shared-network doesn't exist");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext(),
- "Value of l3-network should be updated since the property is-external-network doesn't exist");
+ "Value of l3-network should be updated since the property is-external-network doesn't exist");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),
- "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");
+ "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),
"Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");
//vf-module: is-base-vf-module
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),
- "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");
+ "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),
"Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");
}
@Test
- public void testEmptyValue() {
+ public void testEmptyValue() {
//is-closed-loop-disabled
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),
"Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");
@@ -283,26 +283,26 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of subnet should be updated since the value for dhcp-enabled is an empty string");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext(),
- "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");
+ "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext(),
- "Value of l3-network should be updated since the value for is-provider-network is an empty string");
+ "Value of l3-network should be updated since the value for is-provider-network is an empty string");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext(),
"Value of l3-network should be updated since the value for is-shared-network is an empty string");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext(),
"Value of l3-network should be updated since the value for is-external-network is an empty string");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),
- "Value of l-interface should be updated since the property is-port-mirrored is an empty string");
+ "Value of l-interface should be updated since the property is-port-mirrored is an empty string");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),
"Value of l-interface should be updated since the property is-ip-unnumbered is an empty string");
//vf-module: is-base-vf-module, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),
- "Value of vf-module should be updated since the property is-base-vf-module is an empty string");
+ "Value of vf-module should be updated since the property is-base-vf-module is an empty string");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),
"Value of vlan should be updated since the property is-ip-unnumbered is an empty string");
}
-
+
@Test
public void testExistingTrueValues() {
//is-closed-loop-disabled
@@ -314,7 +314,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");
//dhcp-enabled
assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),
- "Value of subnet shouldn't be update since dhcp-enabled already exists");
+ "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext(),
"Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
@@ -323,21 +323,21 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext(),
"Value of l3-network shouldn't be updated since is-shared-network already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext(),
- "Value of l3-network shouldn't be updated since is-external-network already exists");
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),
- "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),
- "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),
- "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),
"Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
-
+
}
-
+
@Test
public void testExistingFalseValues() {
//is-closed-loop-disabled
@@ -352,23 +352,23 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup { "Value of subnet shouldn't be update since dhcp-enabled already exists");
//l3-network: is-bound-to-vpn, is-shared-network, is-external-network
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext(),
- "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
+ "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext(),
- "Value of l3-network shouldn't be updated since is-provider-network already exists");
+ "Value of l3-network shouldn't be updated since is-provider-network already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext(),
"Value of l3-network shouldn't be updated since is-shared-network already exists");
assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext(),
- "Value of l3-network shouldn't be updated since is-external-network already exists");
+ "Value of l3-network shouldn't be updated since is-external-network already exists");
//l-interface: is-port-mirrored, is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),
- "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
+ "Value of l-interface shouldn't be updated since is-port-mirrored already exists");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),
- "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
+ "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");
//vf-module: is-base-vf-module
assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),
- "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
+ "Value of vf-module shouldn't be updated since is-base-vf-module already exists");
//vlan: is-ip-unnumbered
assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),
"Value of vlan shouldn't be updated since is-ip-unnumbered already exists");
- }
-}
\ No newline at end of file + }
+}
diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java index 0ecbcfa..8f33f4c 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java @@ -54,11 +54,11 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{ Vertex cloudRegion1; Vertex cloudRegion2; Vertex cloudRegion3; - + @BeforeEach public void setUp() throws Exception { - + graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); tx = graph.newTransaction(); g = tx.traversal(); @@ -66,27 +66,27 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{ dbEngine = new JanusGraphDBEngine( queryStyle, loader); - + System.setProperty("BUNDLECONFIG_DIR", "src/test/resources"); - + cloudRegion1 = g.addV().property("aai-node-type", MigrateCloudRegionUpgradeCycle.CLOUD_REGION_NODE_TYPE) .property(MigrateCloudRegionUpgradeCycle.CLOUD_REGION_ID, "akr1") .property(MigrateCloudRegionUpgradeCycle.CLOUD_OWNER, "att-aic") .property( MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE, "Test") .next(); - + cloudRegion2 = g.addV().property("aai-node-type", MigrateCloudRegionUpgradeCycle.CLOUD_REGION_NODE_TYPE) .property(MigrateCloudRegionUpgradeCycle.CLOUD_REGION_ID, "amsnl1b") .property(MigrateCloudRegionUpgradeCycle.CLOUD_OWNER, "att-aic") //.property( MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE, "server") .next(); - + cloudRegion3 = g.addV().property("aai-node-type", MigrateCloudRegionUpgradeCycle.CLOUD_REGION_NODE_TYPE) .property(MigrateCloudRegionUpgradeCycle.CLOUD_REGION_ID, "alp1") .property(MigrateCloudRegionUpgradeCycle.CLOUD_OWNER, "Test") .property( MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE, "server1") .next(); - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); GraphTraversalSource traversal = g; @@ -114,4 +114,4 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{ assertEquals("B",cloudRegion2.property(MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE).value()); assertEquals("server1",cloudRegion3.property(MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE).value());//Not changed } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java index ccd8c95..b657ef6 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java @@ -31,15 +31,12 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; 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.introspection.ModelType; import org.onap.aai.setup.SchemaVersions; -import org.onap.aai.setup.SchemaVersion; import org.onap.aai.serialization.engines.QueryStyle; import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import org.janusgraph.core.JanusGraphFactory; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphTransaction; diff --git a/src/test/java/org/onap/aai/rest/SchemaJobStatusControllerTest.java b/src/test/java/org/onap/aai/rest/SchemaJobStatusControllerTest.java index 971a174..e115b97 100644 --- a/src/test/java/org/onap/aai/rest/SchemaJobStatusControllerTest.java +++ b/src/test/java/org/onap/aai/rest/SchemaJobStatusControllerTest.java @@ -24,23 +24,20 @@ import static org.mockito.Mockito.when; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.onap.aai.config.WebClientConfiguration; -import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.service.SchemaJobStatusService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import org.springframework.test.context.ContextConfiguration; import org.springframework.test.web.reactive.server.WebTestClient; @Import(WebClientConfiguration.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@ContextConfiguration(initializers = PropertyPasswordConfiguration.class) public class SchemaJobStatusControllerTest { - @MockBean + @MockBean private SchemaJobStatusService schemaJobStatusService; @Autowired @@ -58,7 +55,7 @@ public class SchemaJobStatusControllerTest { @Test void testIsSchemaInitializedTrue() throws Exception { when(schemaJobStatusService.isSchemaInitialized()).thenReturn(true); - + webClient.get() .uri("/isSchemaInitialized") .exchange() @@ -70,7 +67,7 @@ public class SchemaJobStatusControllerTest { @Test void testIsSchemaInitializedFalse() throws Exception { when(schemaJobStatusService.isSchemaInitialized()).thenReturn(false); - + webClient.get() .uri("/isSchemaInitialized") .exchange() @@ -87,4 +84,4 @@ public class SchemaJobStatusControllerTest { .expectStatus() .isNotFound(); } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java index fb310c7..af6ba46 100644 --- a/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java +++ b/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java @@ -154,7 +154,7 @@ public class EchoResponseTest extends AAISetup { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus()); } - + @Test public void testCheckDbNowAction_Unknown() { when(aaiGraphCheckerMock.isAaiGraphDbAvailable()).thenReturn(null); @@ -163,4 +163,4 @@ public class EchoResponseTest extends AAISetup { assertNotNull(response); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); } -}
\ No newline at end of file +} |