summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src
diff options
context:
space:
mode:
Diffstat (limited to 'aai-traversal/src')
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java10
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java2
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java5
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java5
5 files changed, 12 insertions, 14 deletions
diff --git a/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java b/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java
index 005d3dc..f262ac4 100644
--- a/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java
+++ b/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java
@@ -269,7 +269,7 @@ public class ModelBasedProcessing {
try {
Optional<Vertex> result = dbMethHelper.searchVertexByIdentityMap(modTopNodeType,
startNodeFilterArrayOfHashes.get(i));
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + modTopNodeType + " found for properties");
}
@@ -710,7 +710,7 @@ public class ModelBasedProcessing {
Optional<Vertex> result =
dbMethHelper.searchVertexByIdentityMap(topNodeTypeVal, startNodeFilterHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + topNodeTypeVal + " found for properties");
}
@@ -741,7 +741,7 @@ public class ModelBasedProcessing {
}
Optional<Vertex> result =
dbMethHelper.locateUniqueVertex(widgModNodeType, startNodeFilterHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + topNType + " found for properties");
}
@@ -794,7 +794,7 @@ public class ModelBasedProcessing {
// Locate the starting node that we'll use to start looking for instance data
Optional<Vertex> result =
dbMethHelper.searchVertexByIdentityMap(topNType, startNodeFilterHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + topNType + " found for properties");
}
@@ -2093,7 +2093,7 @@ public class ModelBasedProcessing {
propHash.put(targetProp, valFromInstance);
Optional<Vertex> result = dbMethHelper.locateUniqueVertex(targetNodeType, propHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
// If it can't find the lookup node, don't fail, just log that it couldn't be found
// ---
logger.debug("WARNING - Could not find lookup node that corresponds to nodeType ["
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java
index bade2cd..76da9d8 100644
--- a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java
@@ -204,7 +204,7 @@ public class CQ2GremlinTest extends RESTAPI {
protected void addStartNode(GraphTraversal<Vertex, Vertex> g, CustomQueryTestDTO content) {
Optional<LinkedHashMap<String, String>> startNodeVertex = content.getVerticesDtos().stream()
.filter(map -> map.containsKey("start-node")).findFirst();
- if (!startNodeVertex.isPresent()) {
+ if (startNodeVertex.isEmpty()) {
throw new IllegalArgumentException("start-node was not specified");
}
startNodeVertex.get().forEach((k, v) -> {
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java
index ebf49d7..ad5eb4e 100644
--- a/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java
@@ -25,7 +25,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.Date;
import java.util.Timer;
import java.util.TimerTask;
@@ -56,7 +55,7 @@ public class LocalCQConfig extends CQConfig {
String filepath =
storedQueriesLocation + AAIConstants.AAI_FILESEP + "stored-queries.json";
logger.info("Using the Local stored queries");
- Path path = Paths.get(filepath);
+ Path path = Path.of(filepath);
String customQueryConfigJson = new String(Files.readAllBytes(path));
queryConfig = new GetCustomQueryConfig(customQueryConfigJson);
@@ -72,7 +71,7 @@ public class LocalCQConfig extends CQConfig {
protected void onChange(File file) {
try {
String filepath = storedQueriesLocation;
- Path path = Paths.get(filepath);
+ Path path = Path.of(filepath);
String customQueryConfigJson = new String(Files.readAllBytes(path));
queryConfig = new GetCustomQueryConfig(customQueryConfigJson);
diff --git a/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java b/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java
index 10bee2b..c291551 100644
--- a/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java
+++ b/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java
@@ -22,7 +22,7 @@ package org.onap.aai.service;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
@@ -53,7 +53,7 @@ public class AuthorizationService {
String basicAuthFile = getBasicAuthFilePath();
- try (Stream<String> stream = Files.lines(Paths.get(basicAuthFile))) {
+ try (Stream<String> stream = Files.lines(Path.of(basicAuthFile))) {
stream.filter(line -> !line.startsWith("#")).forEach(str -> {
byte[] bytes = null;
diff --git a/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
index e3351ae..9b88c38 100644
--- a/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
@@ -29,7 +29,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.Collections;
import java.util.HashSet;
@@ -101,7 +100,7 @@ public class SearchGraphNamedQueryTest extends AAISetup {
assert files != null;
for (File file : files) {
try {
- Path path = Paths.get(widgetPath + AAIConstants.AAI_FILESEP + file.getName());
+ Path path = Path.of(widgetPath + AAIConstants.AAI_FILESEP + file.getName());
String widgetPayload = new String(Files.readAllBytes(path));
String modelInvariantId = getJsonValue(widgetPayload, "model-invariant-id");
String widgetUri =
@@ -126,7 +125,7 @@ public class SearchGraphNamedQueryTest extends AAISetup {
assert files != null;
for (File file : files) {
try {
- Path path = Paths.get(namedQueryPath + AAIConstants.AAI_FILESEP + file.getName());
+ Path path = Path.of(namedQueryPath + AAIConstants.AAI_FILESEP + file.getName());
String namedQueryPayload = new String(Files.readAllBytes(path));
String namedQueryUuid = getJsonValue(namedQueryPayload, "named-query-uuid");
String namedQueryUri =