aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/aai/AAIGremlinQueryTest.java2
-rw-r--r--src/test/java/org/onap/aai/AAISetup.java2
-rw-r--r--src/test/java/org/onap/aai/GraphAdminTestConfiguration.java32
-rw-r--r--src/test/java/org/onap/aai/MetricsConfigurationTest.java4
-rw-r--r--src/test/java/org/onap/aai/PayloadUtil.java8
-rw-r--r--src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java5
-rw-r--r--src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java9
-rw-r--r--src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java5
-rw-r--r--src/test/java/org/onap/aai/migration/VertexMergeTest.java4
-rw-r--r--src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java6
-rw-r--r--src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java24
-rw-r--r--src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java2
-rw-r--r--src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java12
-rw-r--r--src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java10
-rw-r--r--src/test/java/org/onap/aai/rest/util/EchoResponseTest.java16
-rw-r--r--src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java20
-rw-r--r--src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java14
-rw-r--r--src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java6
-rw-r--r--src/test/resources/application-test.properties8
19 files changed, 97 insertions, 92 deletions
diff --git a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
index 307dfaa..d71c94f 100644
--- a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
+++ b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
@@ -31,11 +31,11 @@ import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.util.AAIConfig;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
import org.springframework.http.*;
import org.springframework.test.context.TestPropertySource;
diff --git a/src/test/java/org/onap/aai/AAISetup.java b/src/test/java/org/onap/aai/AAISetup.java
index f0b78f2..4368875 100644
--- a/src/test/java/org/onap/aai/AAISetup.java
+++ b/src/test/java/org/onap/aai/AAISetup.java
@@ -128,7 +128,7 @@ public abstract class AAISetup {
.getClassLoader()
.getResourceAsStream(filename);
- String message = String.format("Unable to find the %s in src/test/resources", filename);
+ String message = "Unable to find the %s in src/test/resources".formatted(filename);
assertNotNull(inputStream, message);
String resource = IOUtils.toString(inputStream);
diff --git a/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java b/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java
index bdd2c36..24b6d1c 100644
--- a/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java
+++ b/src/test/java/org/onap/aai/GraphAdminTestConfiguration.java
@@ -21,14 +21,14 @@ package org.onap.aai;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import org.apache.http.client.HttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.hc.client5.http.classic.HttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClients;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
+import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
-import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -51,15 +51,19 @@ public class GraphAdminTestConfiguration {
RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception {
SSLContext sslContext = SSLContext.getDefault();
-
- HttpClient client = HttpClients.custom()
- .setSSLContext(sslContext)
- .setSSLHostnameVerifier((s, sslSession) -> true)
- .build();
-
- RestTemplate restTemplate = builder
- .requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client))
- .build();
+ PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
+ .setSSLSocketFactory(
+ SSLConnectionSocketFactoryBuilder.create()
+ .setSslContext(sslContext)
+ .build()
+ )
+ .build();
+ HttpClient client = HttpClients
+ .custom()
+ .setConnectionManager(connectionManager)
+ .build();
+
+ RestTemplate restTemplate = builder.requestFactory(() -> new HttpComponentsClientHttpRequestFactory(client)).build();
restTemplate.setErrorHandler(new ResponseErrorHandler() {
@Override
diff --git a/src/test/java/org/onap/aai/MetricsConfigurationTest.java b/src/test/java/org/onap/aai/MetricsConfigurationTest.java
index d0b833b..902c45a 100644
--- a/src/test/java/org/onap/aai/MetricsConfigurationTest.java
+++ b/src/test/java/org/onap/aai/MetricsConfigurationTest.java
@@ -34,13 +34,13 @@ import org.junit.jupiter.api.Test;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.exceptions.AAIException;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.web.server.LocalManagementPort;
+import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
import org.springframework.http.*;
import org.springframework.test.context.ContextConfiguration;
diff --git a/src/test/java/org/onap/aai/PayloadUtil.java b/src/test/java/org/onap/aai/PayloadUtil.java
index 65f5d9f..b859c1e 100644
--- a/src/test/java/org/onap/aai/PayloadUtil.java
+++ b/src/test/java/org/onap/aai/PayloadUtil.java
@@ -39,7 +39,7 @@ public class PayloadUtil {
InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/expected/" + fileName);
- String message = String.format("Unable to find the %s in src/test/resources", fileName);
+ String message = "Unable to find the %s in src/test/resources".formatted(fileName);
assertNotNull(inputStream, message);
String resource = IOUtils.toString(inputStream);
@@ -52,7 +52,7 @@ public class PayloadUtil {
InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/resource/" + fileName);
- String message = String.format("Unable to find the %s in src/test/resources", fileName);
+ String message = "Unable to find the %s in src/test/resources".formatted(fileName);
assertNotNull(inputStream, message);
String resource = IOUtils.toString(inputStream);
@@ -65,7 +65,7 @@ public class PayloadUtil {
InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/templates/" + fileName);
- String message = String.format("Unable to find the %s in src/test/resources", fileName);
+ String message = "Unable to find the %s in src/test/resources".formatted(fileName);
assertNotNull(inputStream, message);
String resource;
@@ -100,7 +100,7 @@ public class PayloadUtil {
InputStream inputStream = PayloadUtil.class.getClassLoader().getResourceAsStream("payloads/named-queries/" + fileName);
- String message = String.format("Unable to find the %s in src/test/resources/payloads/named-queries", fileName);
+ String message = "Unable to find the %s in src/test/resources/payloads/named-queries".formatted(fileName);
assertNotNull(inputStream, message);
String resource = IOUtils.toString(inputStream);
diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java
index b976fa8..e9f07e2 100644
--- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java
+++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshot4HistInitTest.java
@@ -51,7 +51,6 @@ import java.util.Map;
import java.util.Set;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
@@ -144,7 +143,7 @@ public class DataSnapshot4HistInitTest extends AAISetup {
String logsFolder = System.getProperty("AJSC_HOME") + "/logs/data/dataSnapshots/";
- Set<Path> preSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> preSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
// Run the clear dataSnapshot and this time it should fail
//String [] args = {"JUST_TAKE_SNAPSHOT"}; >> default behavior is now to use 15 threads
@@ -155,7 +154,7 @@ public class DataSnapshot4HistInitTest extends AAISetup {
// Add sleep so the file actually gets created with the data
- Set<Path> postSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> postSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
assertThat(postSnapshotFiles.size(), is(preSnapshotFiles.size()+1));
postSnapshotFiles.removeAll(preSnapshotFiles);
diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
index c6c7b4b..cb5f114 100644
--- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
+++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest.java
@@ -42,7 +42,6 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -137,7 +136,7 @@ public class DataSnapshotTest extends AAISetup {
String logsFolder = System.getProperty("AJSC_HOME") + "/logs/data/dataSnapshots/";
- Set<Path> preSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> preSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
// Run the clear dataSnapshot and this time it should fail
//String [] args = {"JUST_TAKE_SNAPSHOT"}; >> default behavior is now to use 15 threads
@@ -148,7 +147,7 @@ public class DataSnapshotTest extends AAISetup {
// Add sleep so the file actually gets created with the data
- Set<Path> postSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> postSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
assertThat(postSnapshotFiles.size(), is(preSnapshotFiles.size() +1));
postSnapshotFiles.removeAll(preSnapshotFiles);
@@ -165,7 +164,7 @@ public class DataSnapshotTest extends AAISetup {
String logsFolder = System.getProperty("AJSC_HOME") + "/logs/data/dataSnapshots/";
- Set<Path> preSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> preSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
// previous test may have the same generated file name, this wait will ensure a new name is used for this test
System.out.println("delay generation, seconds " + DELAYSINGLETHREADTEST);
@@ -179,7 +178,7 @@ public class DataSnapshotTest extends AAISetup {
// Add sleep so the file actually gets created with the data
- Set<Path> postSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> postSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
assertThat(postSnapshotFiles.size(), is(preSnapshotFiles.size() +1));
boolean gryoSnapshotExists = postSnapshotFiles.stream()
diff --git a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java
index 7682cdb..5086861 100644
--- a/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java
+++ b/src/test/java/org/onap/aai/datasnapshot/DataSnapshotTest4HistInit.java
@@ -45,7 +45,6 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -144,7 +143,7 @@ public class DataSnapshotTest4HistInit extends AAISetup {
String logsFolder = System.getProperty("AJSC_HOME") + "/logs/data/dataSnapshots/";
- Set<Path> preSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> preSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
// Run the clear dataSnapshot and this time it should fail
//String [] args = {"JUST_TAKE_SNAPSHOT"}; >> default behavior is now to use 15 threads
@@ -155,7 +154,7 @@ public class DataSnapshotTest4HistInit extends AAISetup {
// Add sleep so the file actually gets created with the data
- Set<Path> postSnapshotFiles = Files.walk(Paths.get(logsFolder)).collect(Collectors.toSet());
+ Set<Path> postSnapshotFiles = Files.walk(Path.of(logsFolder)).collect(Collectors.toSet());
assertThat(postSnapshotFiles.size(), is(preSnapshotFiles.size()+1));
postSnapshotFiles.removeAll(preSnapshotFiles);
diff --git a/src/test/java/org/onap/aai/migration/VertexMergeTest.java b/src/test/java/org/onap/aai/migration/VertexMergeTest.java
index ea7bf86..30e14d6 100644
--- a/src/test/java/org/onap/aai/migration/VertexMergeTest.java
+++ b/src/test/java/org/onap/aai/migration/VertexMergeTest.java
@@ -170,8 +170,8 @@ public class VertexMergeTest extends AAISetup {
assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").has("special-prop", "value").hasNext(), "pserver skeleton child merged");
assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").both().has("interface-name", "l-interface1").has("special-prop", "value").hasNext(), "l-interface child merged");
assertEquals(true, g.V().has("hostname", "TEST1").both().has("interface-name", "p-interface2").both().has("interface-name", "l-interface1").both().has("link-name", "logical-link1").hasNext(), "l-interface child cousin edge merged");
- assertEquals(new Long(1), g.V().has("interface-name", "l-interface1").count().next(), "one l-interface1 found");
- assertEquals(new Long(1), g.V().has("interface-name", "p-interface2").count().next(), "one p-interface2 found");
+ assertEquals(Long.valueOf(1), g.V().has("interface-name", "l-interface1").count().next(), "one l-interface1 found");
+ assertEquals(Long.valueOf(1), g.V().has("interface-name", "p-interface2").count().next(), "one p-interface2 found");
}
}
diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java
index 028cc22..4b8dd77 100644
--- a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java
+++ b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java
@@ -105,7 +105,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
@Test
public void pnfsExistTest() throws Exception {
// check if pnf node gets created
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "pnf")
.count().next(),
"2 PNFs exist");
@@ -114,7 +114,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
@Test
public void pInterfacesExistTest() throws Exception {
- assertEquals(new Long(4L),
+ assertEquals(Long.valueOf(4L),
g.V().has("aai-node-type", "p-interface")
.count().next(),
"4 Pinterfaces exist");
@@ -145,7 +145,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
.has("interface-name","1.7")
.hasNext(),
"p-interface 1.7 created for pnf-name-collector-1");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "pnf")
.has("pnf-name", "pnf-name-1")
.in("tosca.relationships.network.BindsTo").count().next(),
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 74b9e0f..9765ce5 100644
--- a/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java
+++ b/src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java
@@ -288,7 +288,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-1").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-1")
.in().count().next(),
"Edge exists to 2 connectors");
@@ -308,7 +308,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-2").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-2")
.in().count().next(),
"Edge exists to only 2 service-instances");
@@ -327,7 +327,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-3").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-3")
.in().count().next(),
"Edge exists to only 2 pnfs");
@@ -346,7 +346,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-4").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-4")
.in().count().next(),
"Edge exists to only 2 logical-link");
@@ -365,7 +365,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-5").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-5")
.in().count().next(),
"Edge exists to only 2 logical-link");
@@ -384,7 +384,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-6").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-6")
.in().count().next(),
"Edge exists to only 2 generic-vnfs");
@@ -403,7 +403,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-7").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-7")
.in().count().next(),
"Edge exists to only 2 configurations");
@@ -422,7 +422,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-8").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-8")
.in().count().next(),
"Edge exists to only 2 l3-networks");
@@ -441,7 +441,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-9").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-9")
.in().count().next(),
"Edge exists to only 2 vf-modules");
@@ -460,7 +460,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-10").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-10")
.in().count().next(),
"Edge exists to only 2 collections");
@@ -479,7 +479,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-11").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-11")
.in().count().next(),
"Edge exists to only 2 instance-group2");
@@ -498,7 +498,7 @@ public class MigrateModelVerTest extends AAISetup{
.has("aai-node-type", "model-ver").has("model-version-id","model-version-id-12").hasNext(),
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-12")
.in().count().next(),
"Edge exists to only 2 allotted-resource");
diff --git a/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java b/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java
index 72ed591..fd9eb15 100644
--- a/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java
+++ b/src/test/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegionTest.java
@@ -130,7 +130,7 @@ public class MigrateNetworkTechToCloudRegionTest extends AAISetup{
"Edge not created");
- assertEquals(new Long(2L),
+ assertEquals(Long.valueOf(2L),
g.V().has("aai-node-type", "network-technology").has("network-technology-id", "network-technology-1")
.in().count().next(),
"Edge exists to 2 cloud regions");
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 99f2509..4638b84 100644
--- a/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java
+++ b/src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java
@@ -964,7 +964,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{
assertEquals(true, g.V().has("aai-node-type", "p-interface").has("aai-uri","/cloud-infrastructure/pservers/pserver/rctP3/p-interfaces/p-interface/pint11").hasNext());
//2. pint12 int-name matches with pint31. So, verify that p-int does not move from rctP1 to rctP3
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","p-interface").has("interface-name","pint12").count().next(), "rctP3 has only 1 pint with name pint12");
//3. Verify that the p-interface from pserver is not moved to another pserver that has null fqdn
@@ -974,7 +974,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{
//4. If the fqdn is "" within 2 RCT pservers, ignore that case. Don't move the p-int from old resource-version to new resource-version pserver
assertEquals(false, g.V().has("aai-node-type", "pserver").has("hostname","rctP5").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","p-interface").has("interface-name","pint41").hasNext());
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP5").in("tosca.relationships.network.BindsTo")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP5").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","p-interface").count().next(), "rctP5 has only 1 p-interface");
//5. plink is moved from pint3 on pserver fqdn1 to pint2 on pserver fqdn3. Both p-ints have the same interface-name
@@ -1001,7 +1001,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{
//2. lagint12 int-name matches with lagint31. So, verify that lag-int does not move from rctP1 to rctP3
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP3").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","lag-interface").has("interface-name","lagint12").count().next(), "rctP3 has only 1 lag-interface with name lagint12");
}
@@ -1009,7 +1009,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{
@Test
public void checkRCTPserverHasRelnToOnly1Zone() throws Exception {
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").out("org.onap.relationships.inventory.LocatedIn")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").out("org.onap.relationships.inventory.LocatedIn")
.has("aai-node-type","zone").count().next(), "Edge to only 1 Zone exists");
assertEquals(true, g.V().has("aai-node-type", "zone").has("zone-id","zone-62").hasNext());
//Verify no edge exists from zone61 to lower resource-version RCT pserver
@@ -1019,7 +1019,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{
@Test
public void checkRCTPserverHasRelnTo2GenericVnfs() throws Exception {
- assertEquals(new Long(2L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").in("tosca.relationships.HostedOn")
+ assertEquals(Long.valueOf(2L), g.V().has("aai-node-type", "pserver").has("hostname","Scn6.pserverRCT1Scn6").in("tosca.relationships.HostedOn")
.has("aai-node-type","generic-vnf").count().next(), "Edge to 2 generic-vnfs exists");
assertEquals(true, g.V().has("aai-node-type", "generic-vnf").has("vnf-id","vnf-1").out().has("aai-node-type", "pserver").has("hostname", "Scn6.pserverRCT1Scn6").hasNext());
//Verify no edge exists from vnf-1 to lower resource-version pserver
@@ -1036,7 +1036,7 @@ public class MigrateSameSourcedRCTROPServerDataTest extends AAISetup{
assertEquals(true, g.V().has("aai-node-type", "pserver").has("hostname","pserverRo.NewOne.aaaa.ccccccccccc").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","p-interface").has("interface-name","pintRo1").out().has("link-name","plinkROonOldRo1").hasNext());
//Verify complex does not get attached to pserverRO5
- assertEquals(new Long(1L), g.V().has("physical-location-id", "complexOldRO").in("org.onap.relationships.inventory.LocatedIn").count().next(), "Complex is related to only 1 pserver");
+ assertEquals(Long.valueOf(1L), g.V().has("physical-location-id", "complexOldRO").in("org.onap.relationships.inventory.LocatedIn").count().next(), "Complex is related to only 1 pserver");
}
@Test
diff --git a/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java b/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java
index 27d8ff2..40052b8 100644
--- a/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java
+++ b/src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java
@@ -414,7 +414,7 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{
assertEquals("Scn4.pserverROSPlinkScn4",pserverRCTPlinkScn4.property("fqdn").value().toString());
assertEquals(true, g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTPlinkScn4").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","p-interface").has("interface-name","pintPlinkScn4").hasNext());
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTPlinkScn4").in("tosca.relationships.network.BindsTo")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTPlinkScn4").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","p-interface").has("interface-name","pintPlinkScn4").count().next(), "only 1 p-int is present on RCT pserver");
assertEquals("/cloud-infrastructure/pservers/pserver/pserverRCTPlinkScn4/p-interfaces/p-interface/pintPlinkScn4", samePintScn4RCT.property("aai-uri").value().toString());
//plink is not moved from RO to RCT when p-int matches
@@ -441,14 +441,14 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{
@Test
public void checkRCTPserverHasRelnToOnly1Complex() throws Exception {
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn3").out("org.onap.relationships.inventory.LocatedIn")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn3").out("org.onap.relationships.inventory.LocatedIn")
.has("aai-node-type","complex").count().next(), "Edge to only 1 complex exists");
}
@Test
public void checkRCTPserverHasRelnToOnly1Zone() throws Exception {
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").out("org.onap.relationships.inventory.LocatedIn")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").out("org.onap.relationships.inventory.LocatedIn")
.has("aai-node-type","zone").count().next(), "Edge to only 1 Zone exists");
assertEquals(true, g.V().has("aai-node-type", "zone").has("zone-id","zone-62").hasNext());
//Verify no edge exists from zone62 to RO pserver
@@ -459,7 +459,7 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{
@Test
public void checkRCTPserverHasRelnTo2GenericVnfs() throws Exception {
- assertEquals(new Long(2L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").in("tosca.relationships.HostedOn")
+ assertEquals(Long.valueOf(2L), g.V().has("aai-node-type", "pserver").has("hostname","pserverRCTScn6").in("tosca.relationships.HostedOn")
.has("aai-node-type","generic-vnf").count().next(), "Edge to 2 generic-vnfs exists");
assertEquals(true, g.V().has("aai-node-type", "generic-vnf").has("vnf-id","vnf-2").out().has("aai-node-type", "pserver").has("hostname", "pserverRCTScn6").hasNext());
//Verify no edge exists from zone62 to RO pserver
@@ -485,7 +485,7 @@ public class PserverDedupWithDifferentSourcesOfTruthTest extends AAISetup{
//2. lagint12 int-name matches with lagint31. So, verify that lag-int does not move from rctP1 to rctP3
- assertEquals(new Long(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP1").in("tosca.relationships.network.BindsTo")
+ assertEquals(Long.valueOf(1L), g.V().has("aai-node-type", "pserver").has("hostname","rctP1").in("tosca.relationships.network.BindsTo")
.has("aai-node-type","lag-interface").has("interface-name","lagint12").count().next(), "rctP1 has only 1 lag-interface with name lagint12");
}
diff --git a/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
index af6ba46..2d98d37 100644
--- a/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
+++ b/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
@@ -21,7 +21,7 @@ package org.onap.aai.rest.util;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -32,12 +32,12 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedHashMap;
+import jakarta.ws.rs.core.MultivaluedMap;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.UriInfo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -112,7 +112,7 @@ public class EchoResponseTest extends AAISetup {
when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters);
// TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable
- Mockito.doReturn(null).when(queryParameters).remove(anyObject());
+ Mockito.doReturn(null).when(queryParameters).remove(any());
when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
}
diff --git a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java
index b7bb9c4..deed477 100644
--- a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java
+++ b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java
@@ -90,15 +90,17 @@ public class ManageSchemaTest extends AAISetup {
@Test
public void addNewIndex() throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
- String content = " {\r\n" +
- " \"name\" : \"equipment-name\",\r\n" +
- " \"unique\" : false,\r\n" +
- " \"properties\" : [ {\r\n" +
- " \"name\" : \"equipment-name\",\r\n" +
- " \"cardinality\" : \"SINGLE\",\r\n" +
- " \"typeClass\" : \"java.lang.String\"\r\n" +
- " } ]\r\n" +
- " }";
+ String content = """
+ {
+ "name" : "equipment-name",
+ "unique" : false,
+ "properties" : [ {
+ "name" : "equipment-name",
+ "cardinality" : "SINGLE",
+ "typeClass" : "java.lang.String"
+ } ]
+ }\
+ """;
DBIndex index = mapper.readValue(content, DBIndex.class);
ManageJanusGraphSchema schema = new ManageJanusGraphSchema(graph, auditorFactory, schemaVersions, edgeIngestor);
JanusGraphManagement mgmt = graph.openManagement();
diff --git a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java
index fa9980a..526e4a3 100644
--- a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java
+++ b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java
@@ -38,7 +38,7 @@ import org.onap.aai.migration.EventAction;
import java.io.IOException;
import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -103,25 +103,25 @@ public class SendDeleteMigrationNotificationsTest extends AAISetup {
tx.commit();
try{
- Files.createFile(Paths.get(FILE));
+ Files.createFile(Path.of(FILE));
}catch(Exception e) {
System.out.println("Create File error : " + e.getMessage());
}
String finalStr = "";
finalStr = "pserver" + "#@#" + "/cloud-infrastructure/pservers/pserver/"+SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-1" + "#@#" + "{\"hostname\":\""+ SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-1\",\"resource-version\":\"333\"}" + "\n";
- Files.write(Paths.get(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
+ Files.write(Path.of(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
finalStr = "pserver" + "#@#" + "/cloud-infrastructure/pservers/pserver/"+SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-2" + "#@#" + "{\"hostname\":\""+ SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-2\",\"resource-version\":\"334\"}" + "\n";
- Files.write(Paths.get(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
+ Files.write(Path.of(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
finalStr = "pserver" + "#@#" + "/cloud-infrastructure/pservers/pserver/"+SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-3" + "#@#" + "{\"hostname\":\""+ SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-3\",\"resource-version\":\"335\"}" + "\n";
- Files.write(Paths.get(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
+ Files.write(Path.of(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
finalStr = "pserver" + "#@#" + "/cloud-infrastructure/pservers/pserver/"+SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-4" + "#@#" + "{\"hostname\":\""+ SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-4\",\"resource-version\":\"336\"}" + "\n";
- Files.write(Paths.get(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
+ Files.write(Path.of(FILE), finalStr.getBytes(),StandardOpenOption.APPEND);
graphCreated.compareAndSet(false, true);
}
}
@AfterAll
public static void cleanUp() throws IOException {
- Files.delete(Paths.get(FILE));
+ Files.delete(Path.of(FILE));
}
@AfterEach
diff --git a/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java
index dd22e91..4503c0f 100644
--- a/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java
+++ b/src/test/java/org/onap/aai/util/SendMigrationNotificationsTest.java
@@ -38,7 +38,7 @@ import org.onap.aai.migration.EventAction;
import java.io.IOException;
import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -118,13 +118,13 @@ public class SendMigrationNotificationsTest extends AAISetup {
list.add(pnf3.id().toString() + "_222"); // invalid: wrong resource version
list.add("345_345"); // invalid
list.add(pserver1.id().toString() + "_333"); // valid
- Files.write(Paths.get(FILE), (Iterable<String>)list.stream()::iterator);
+ Files.write(Path.of(FILE), (Iterable<String>)list.stream()::iterator);
graphCreated.compareAndSet(false, true);
}
}
@AfterAll
public static void cleanUp() throws IOException {
- Files.delete(Paths.get(FILE));
+ Files.delete(Path.of(FILE));
}
@AfterEach
diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties
index f85c97a..40a4156 100644
--- a/src/test/resources/application-test.properties
+++ b/src/test/resources/application-test.properties
@@ -1,7 +1,7 @@
spring.application.name=GraphAdmin
-server.contextPath=/
+server.servlet.context-path=/
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
# These two properties represent whether it should use component scan
@@ -31,7 +31,8 @@ server.local.startpath=src/main/resources
server.basic.auth.location=${server.local.startpath}/etc/auth/realm.properties
server.port=8449
-security.require-ssl=false
+# This property is deprecated: The security auto-configuration is no longer customizable. Provide your own WebSecurityConfigurer bean instead.
+# security.require-ssl=false
server.ssl.enabled=false
# Schema related attributes for the oxm and edges
@@ -75,7 +76,8 @@ aaf.cadi.file=${server.local.startpath}/cadi.properties
management.server.port=0
management.endpoints.enabled-by-default=true
management.endpoints.web.exposure.include=info, health, loggers, prometheus
-management.metrics.web.server.auto-time-requests=false
+# This property is deprecated: Should be applied at the ObservationRegistry level.
+# management.metrics.web.server.request.autotime.enabled=false
aai.notifications.enabled=false