aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java3
-rw-r--r--aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java8
-rw-r--r--aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java1
-rw-r--r--aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java1
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java2
-rw-r--r--aai-core/src/main/java/org/onap/aai/kafka/AAIKafkaEventJMSProducer.java1
-rw-r--r--aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java5
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/GremlinUnique.java1
-rw-r--r--aai-core/src/main/java/org/onap/aai/serialization/db/EdgeSerializer.java3
-rw-r--r--aai-core/src/main/java/org/onap/aai/util/delta/DeltaEvents.java2
-rw-r--r--aai-core/src/test/java/org/onap/aai/db/DbMethHelperTest.java1
-rw-r--r--aai-core/src/test/java/org/onap/aai/domain/model/AAIResourceTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/introspection/tools/CreateUUIDTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/introspection/tools/DefaultFieldsTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/introspection/tools/InjectKeysFromURITest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/introspection/tools/RemoveNonVisiblePropertyTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/introspection/validation/IntrospectorValidationTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/kafka/AAIKafkaEventIntegrationTest.java10
-rw-r--r--aai-core/src/test/java/org/onap/aai/kafka/KafkaTestConfiguration.java1
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java9
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/uri/URIToDBKeyTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/uri/URIToObjectTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/parsers/uri/URIToRelationshipObjectTest.java5
-rw-r--r--aai-core/src/test/java/org/onap/aai/rest/RestHandlerTest.java3
-rw-r--r--aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTest.java8
-rw-r--r--aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTransactionTest.java126
-rw-r--r--aai-core/src/test/java/org/onap/aai/rest/notification/NotificationServiceTest.java1
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java4
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java2
-rw-r--r--aai-core/src/test/java/org/onap/aai/serialization/queryformats/FormatTest.java2
33 files changed, 189 insertions, 63 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
index a9fcb880..a3411076 100644
--- a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
+++ b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
@@ -22,10 +22,9 @@
package org.onap.aai.config;
-import java.util.*;
+import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.MoxyLoader;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
diff --git a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
index 9247bc77..7547f4f7 100644
--- a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
+++ b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
@@ -25,10 +25,7 @@ package org.onap.aai.config;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.setup.AAIConfigTranslator;
import org.onap.aai.setup.ConfigTranslator;
-import org.onap.aai.setup.SchemaConfigVersions;
-import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.validation.CheckEverythingStrategy;
import org.onap.aai.validation.SchemaErrorStrategy;
import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
@@ -36,7 +33,10 @@ import org.onap.aai.validation.nodes.DuplicateNodeDefinitionValidationModule;
import org.onap.aai.validation.nodes.NodeValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.*;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.PropertySource;
@Import({NodesConfiguration.class, EdgesConfiguration.class})
@Configuration
diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
index 73bbf7c1..0db67860 100644
--- a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
+++ b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
@@ -25,7 +25,6 @@ package org.onap.aai.dbmap;
import java.io.FileNotFoundException;
import java.util.Properties;
-import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.tinkerpop.gremlin.structure.Graph;
diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java b/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java
index cca11c6d..6e4ce147 100644
--- a/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java
+++ b/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java
@@ -29,7 +29,6 @@ import org.apache.tinkerpop.gremlin.structure.io.IoCore;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
-import org.janusgraph.core.schema.JanusGraphManagement;
import org.onap.aai.dbgen.GraphSONPartialIO;
import org.onap.aai.dbgen.SchemaGenerator;
import org.onap.aai.logging.LogFormatTools;
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java b/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
index 6099e1b4..ec3151b5 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
@@ -23,7 +23,7 @@ package org.onap.aai.introspection;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableMap;
-import java.io.*;
+import java.io.StringReader;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
diff --git a/aai-core/src/main/java/org/onap/aai/kafka/AAIKafkaEventJMSProducer.java b/aai-core/src/main/java/org/onap/aai/kafka/AAIKafkaEventJMSProducer.java
index a46f2e99..4e948772 100644
--- a/aai-core/src/main/java/org/onap/aai/kafka/AAIKafkaEventJMSProducer.java
+++ b/aai-core/src/main/java/org/onap/aai/kafka/AAIKafkaEventJMSProducer.java
@@ -23,7 +23,6 @@
package org.onap.aai.kafka;
import org.json.JSONObject;
-import org.onap.aai.util.AAIConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;
diff --git a/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java b/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
index 8ed0fcb6..95b1517d 100644
--- a/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
+++ b/aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
@@ -40,7 +40,10 @@ import org.onap.aai.edges.enums.EdgeType;
import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.IntrospectorFactory;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.parsers.exceptions.AAIIdentityMapParseException;
import org.onap.aai.parsers.exceptions.AmbiguousMapAAIException;
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinUnique.java b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinUnique.java
index 58495201..2b117c49 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinUnique.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinUnique.java
@@ -35,7 +35,6 @@ import org.onap.aai.introspection.Loader;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.parsers.query.TraversalStrategy;
import org.onap.aai.parsers.query.UniqueStrategy;
-import org.onap.aai.query.entities.PaginationResult;
/**
* The Class GremlinUnique.
diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/EdgeSerializer.java b/aai-core/src/main/java/org/onap/aai/serialization/db/EdgeSerializer.java
index 0c58717e..0d491c9d 100644
--- a/aai-core/src/main/java/org/onap/aai/serialization/db/EdgeSerializer.java
+++ b/aai-core/src/main/java/org/onap/aai/serialization/db/EdgeSerializer.java
@@ -20,9 +20,6 @@
package org.onap.aai.serialization.db;
-import java.util.EnumMap;
-import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
import java.util.UUID;
diff --git a/aai-core/src/main/java/org/onap/aai/util/delta/DeltaEvents.java b/aai-core/src/main/java/org/onap/aai/util/delta/DeltaEvents.java
index b2821b04..39a03777 100644
--- a/aai-core/src/main/java/org/onap/aai/util/delta/DeltaEvents.java
+++ b/aai-core/src/main/java/org/onap/aai/util/delta/DeltaEvents.java
@@ -29,8 +29,6 @@ import java.util.Map;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.kafka.MessageProducer;
import org.onap.aai.util.AAIConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.google.gson.FieldNamingPolicy;
diff --git a/aai-core/src/test/java/org/onap/aai/db/DbMethHelperTest.java b/aai-core/src/test/java/org/onap/aai/db/DbMethHelperTest.java
index c79b9148..7bea305e 100644
--- a/aai-core/src/test/java/org/onap/aai/db/DbMethHelperTest.java
+++ b/aai-core/src/test/java/org/onap/aai/db/DbMethHelperTest.java
@@ -36,7 +36,6 @@ import org.apache.commons.io.IOUtils;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.janusgraph.core.JanusGraphFactory;
import org.junit.After;
import org.junit.AfterClass;
diff --git a/aai-core/src/test/java/org/onap/aai/domain/model/AAIResourceTest.java b/aai-core/src/test/java/org/onap/aai/domain/model/AAIResourceTest.java
index 3ef1befa..5eb0d99c 100644
--- a/aai-core/src/test/java/org/onap/aai/domain/model/AAIResourceTest.java
+++ b/aai-core/src/test/java/org/onap/aai/domain/model/AAIResourceTest.java
@@ -23,7 +23,9 @@ package org.onap.aai.domain.model;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
import org.junit.Assert;
import org.junit.Before;
diff --git a/aai-core/src/test/java/org/onap/aai/introspection/tools/CreateUUIDTest.java b/aai-core/src/test/java/org/onap/aai/introspection/tools/CreateUUIDTest.java
index 6d8508ce..49baf789 100644
--- a/aai-core/src/test/java/org/onap/aai/introspection/tools/CreateUUIDTest.java
+++ b/aai-core/src/test/java/org/onap/aai/introspection/tools/CreateUUIDTest.java
@@ -26,7 +26,10 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.AAISetup;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.springframework.test.annotation.DirtiesContext;
diff --git a/aai-core/src/test/java/org/onap/aai/introspection/tools/DefaultFieldsTest.java b/aai-core/src/test/java/org/onap/aai/introspection/tools/DefaultFieldsTest.java
index 664a69c5..704f02a1 100644
--- a/aai-core/src/test/java/org/onap/aai/introspection/tools/DefaultFieldsTest.java
+++ b/aai-core/src/test/java/org/onap/aai/introspection/tools/DefaultFieldsTest.java
@@ -28,7 +28,10 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.AAISetup;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.springframework.test.annotation.DirtiesContext;
diff --git a/aai-core/src/test/java/org/onap/aai/introspection/tools/InjectKeysFromURITest.java b/aai-core/src/test/java/org/onap/aai/introspection/tools/InjectKeysFromURITest.java
index cd5bdb93..15ba9a5e 100644
--- a/aai-core/src/test/java/org/onap/aai/introspection/tools/InjectKeysFromURITest.java
+++ b/aai-core/src/test/java/org/onap/aai/introspection/tools/InjectKeysFromURITest.java
@@ -31,7 +31,10 @@ import java.net.URI;
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.AAISetup;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.springframework.test.annotation.DirtiesContext;
diff --git a/aai-core/src/test/java/org/onap/aai/introspection/tools/RemoveNonVisiblePropertyTest.java b/aai-core/src/test/java/org/onap/aai/introspection/tools/RemoveNonVisiblePropertyTest.java
index a3380ee2..2ca97007 100644
--- a/aai-core/src/test/java/org/onap/aai/introspection/tools/RemoveNonVisiblePropertyTest.java
+++ b/aai-core/src/test/java/org/onap/aai/introspection/tools/RemoveNonVisiblePropertyTest.java
@@ -27,7 +27,10 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.AAISetup;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.springframework.test.annotation.DirtiesContext;
diff --git a/aai-core/src/test/java/org/onap/aai/introspection/validation/IntrospectorValidationTest.java b/aai-core/src/test/java/org/onap/aai/introspection/validation/IntrospectorValidationTest.java
index 88e148f1..374ee558 100644
--- a/aai-core/src/test/java/org/onap/aai/introspection/validation/IntrospectorValidationTest.java
+++ b/aai-core/src/test/java/org/onap/aai/introspection/validation/IntrospectorValidationTest.java
@@ -29,7 +29,10 @@ import org.junit.Ignore;
import org.junit.Test;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.tools.IntrospectorValidator;
import org.onap.aai.introspection.tools.Issue;
import org.onap.aai.introspection.tools.IssueType;
diff --git a/aai-core/src/test/java/org/onap/aai/kafka/AAIKafkaEventIntegrationTest.java b/aai-core/src/test/java/org/onap/aai/kafka/AAIKafkaEventIntegrationTest.java
index c10260da..0f5f47ad 100644
--- a/aai-core/src/test/java/org/onap/aai/kafka/AAIKafkaEventIntegrationTest.java
+++ b/aai-core/src/test/java/org/onap/aai/kafka/AAIKafkaEventIntegrationTest.java
@@ -19,27 +19,17 @@
*/
package org.onap.aai.kafka;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import java.time.Duration;
import java.util.Collections;
-import java.util.List;
-
-import javax.ws.rs.core.Response;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
-import org.apache.kafka.common.TopicPartition;
-import org.json.JSONObject;
import org.junit.Test;
import org.mockito.Mock;
import org.onap.aai.AAISetup;
import org.onap.aai.PayloadUtil;
-import org.onap.aai.restcore.HttpMethod;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/aai-core/src/test/java/org/onap/aai/kafka/KafkaTestConfiguration.java b/aai-core/src/test/java/org/onap/aai/kafka/KafkaTestConfiguration.java
index 730699e6..e77f21af 100644
--- a/aai-core/src/test/java/org/onap/aai/kafka/KafkaTestConfiguration.java
+++ b/aai-core/src/test/java/org/onap/aai/kafka/KafkaTestConfiguration.java
@@ -32,7 +32,6 @@ import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.core.KafkaAdmin;
-import org.springframework.test.context.TestPropertySource;
@TestConfiguration
public class KafkaTestConfiguration {
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java
index 96a22d4e..2675045c 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java
@@ -40,7 +40,10 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.IntrospectorFactory;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
import org.onap.aai.serialization.engines.QueryStyle;
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java
index b0f6b240..accb471c 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java
@@ -37,7 +37,10 @@ import org.junit.Ignore;
import org.junit.Test;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.IntrospectorFactory;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java
index 68fc4376..a2f04c76 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java
@@ -40,7 +40,10 @@ import org.junit.Ignore;
import org.junit.Test;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.IntrospectorFactory;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
import org.onap.aai.serialization.engines.QueryStyle;
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java
index 74914cce..ebef3cc3 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIParserTest.java
@@ -23,20 +23,13 @@ package org.onap.aai.parsers.uri;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import java.io.UnsupportedEncodingException;
import java.net.URI;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
import javax.annotation.PostConstruct;
import javax.ws.rs.core.MultivaluedHashMap;
@@ -47,14 +40,12 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
-import org.mockito.InOrder;
import org.onap.aai.AAISetup;
import org.onap.aai.edges.enums.EdgeType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
-import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.setup.SchemaVersion;
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToDBKeyTest.java b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToDBKeyTest.java
index f9055b1d..4bac547d 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToDBKeyTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToDBKeyTest.java
@@ -36,7 +36,9 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.parsers.exceptions.DoesNotStartWithValidNamespaceException;
public class URIToDBKeyTest extends AAISetup {
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToObjectTest.java b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToObjectTest.java
index 52aa470d..2aad37a0 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToObjectTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToObjectTest.java
@@ -38,7 +38,10 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.setup.SchemaVersion;
import org.springframework.test.annotation.DirtiesContext;
diff --git a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToRelationshipObjectTest.java b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToRelationshipObjectTest.java
index ee8cce21..f94d9241 100644
--- a/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToRelationshipObjectTest.java
+++ b/aai-core/src/test/java/org/onap/aai/parsers/uri/URIToRelationshipObjectTest.java
@@ -38,7 +38,10 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.aai.AAISetup;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.setup.SchemaVersion;
import org.springframework.test.annotation.DirtiesContext;
diff --git a/aai-core/src/test/java/org/onap/aai/rest/RestHandlerTest.java b/aai-core/src/test/java/org/onap/aai/rest/RestHandlerTest.java
index 494d7e4e..b408940e 100644
--- a/aai-core/src/test/java/org/onap/aai/rest/RestHandlerTest.java
+++ b/aai-core/src/test/java/org/onap/aai/rest/RestHandlerTest.java
@@ -22,7 +22,8 @@
package org.onap.aai.rest;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
import org.junit.Test;
diff --git a/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTest.java b/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTest.java
index 5ecffbc0..2578eef4 100644
--- a/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTest.java
+++ b/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTest.java
@@ -24,15 +24,12 @@
import static org.onap.aai.edges.enums.AAIDirection.NONE;
import static org.hamcrest.Matchers.containsString;
- import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -42,8 +39,6 @@ import static org.mockito.Mockito.times;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
import java.io.UnsupportedEncodingException;
import java.net.URI;
@@ -71,7 +66,6 @@ import static org.mockito.Mockito.times;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.After;
- import org.junit.Assert;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
@@ -86,7 +80,6 @@ import static org.mockito.Mockito.times;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
- import org.onap.aai.introspection.ModelType;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.prevalidation.ValidationService;
import org.onap.aai.query.builder.Pageable;
@@ -98,7 +91,6 @@ import static org.mockito.Mockito.times;
import org.onap.aai.rest.db.responses.RelationshipWrapper;
import org.onap.aai.rest.db.responses.ServiceException;
import org.onap.aai.rest.notification.NotificationService;
-import org.onap.aai.rest.notification.UEBNotification;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
diff --git a/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTransactionTest.java b/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTransactionTest.java
new file mode 100644
index 00000000..0c2b22ea
--- /dev/null
+++ b/aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTransactionTest.java
@@ -0,0 +1,126 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2024 Deutsche Telekom. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.aai.rest.db;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.janusgraph.core.JanusGraphException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aai.AAISetup;
+import org.onap.aai.config.SpringContextAware;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.parsers.query.QueryParser;
+import org.onap.aai.restcore.HttpMethod;
+import org.onap.aai.restcore.MediaType;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+
+import lombok.SneakyThrows;
+
+public class HttpEntryTransactionTest extends AAISetup {
+
+ @Mock UriInfo uriInfoMock;
+ @Mock MultivaluedMap<String, String> queryParamsMock;
+ @Mock HttpHeaders headersMock;
+
+ @Before
+ public void setup() {
+ when(uriInfoMock.getQueryParameters(anyBoolean())).thenReturn(queryParamsMock);
+ when(queryParamsMock.getFirst("depth")).thenReturn("0");
+ when(headersMock.getRequestHeader("aai-request-context")).thenReturn(null);
+ }
+
+ @Test
+ public void thatDBRequestsAreWritten() throws AAIException, UnsupportedEncodingException {
+ HttpEntry httpEntry = SpringContextAware.getBean("requestScopedTraversalUriHttpEntry", HttpEntry.class);
+ httpEntry.setHttpEntryProperties(schemaVersions.getDefaultVersion());
+ TransactionalGraphEngine dbEngine = httpEntry.getDbEngine();
+ Loader loader = httpEntry.getLoader();
+
+ List<String> hostnames = Arrays.asList("test1", "test2", "test3");
+ List<DBRequest> dbRequests = createDbRequests(dbEngine, loader, hostnames);
+
+ httpEntry.process(dbRequests, SERVICE_NAME);
+
+ GraphTraversalSource source = dbEngine.startTransaction().traversal();
+ Long pserverCount = source.V().has("aai-node-type","pserver").count().next();
+ assertEquals(3, pserverCount.intValue());
+ }
+
+ @Test
+ // same test, only that JanusgraphException is thrown
+ public void thatDBRequestsAreRolledBack() throws AAIException, UnsupportedEncodingException {
+ HttpEntry httpEntry = SpringContextAware.getBean("requestScopedTraversalUriHttpEntry", HttpEntry.class);
+ httpEntry.setHttpEntryProperties(schemaVersions.getDefaultVersion());
+ TransactionalGraphEngine dbEngine = httpEntry.getDbEngine();
+ Loader loader = httpEntry.getLoader();
+
+ List<String> hostnames = Arrays.asList("test1", "test2", "test3");
+ List<DBRequest> dbRequests = createDbRequests(dbEngine, loader, hostnames);
+
+ DBRequest request2Spy = spy(dbRequests.get(1));
+ QueryParser uriQuerySpy = spy(dbRequests.get(1).getParser());
+ when(request2Spy.getParser()).thenReturn(uriQuerySpy);
+ dbRequests.set(1, request2Spy);
+ when(uriQuerySpy.getQueryBuilder()).thenThrow(new JanusGraphException(""));
+
+ httpEntry.process(dbRequests, SERVICE_NAME);
+
+ GraphTraversalSource source = dbEngine.startTransaction().traversal();
+ Long pserverCount = source.V().has("aai-node-type","pserver").count().next();
+ assertEquals(0, pserverCount.intValue());
+ }
+
+ @SneakyThrows
+ private List<DBRequest> createDbRequests(TransactionalGraphEngine dbEngine, Loader loader, List<String> hostnames) {
+ List<DBRequest> dbRequests = new ArrayList<>();
+
+ for(String hostname: hostnames) {
+ URI uriObject = UriBuilder.fromPath("/cloud-infrastructure/pservers/pserver/" + hostname).build();
+ QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(uriObject);
+ String content = "{\"hostname\":\"" + hostname + "\"}";
+ Introspector obj = loader.unmarshal(uriQuery.getResultType(), content,MediaType.APPLICATION_JSON_TYPE);
+ DBRequest request = new DBRequest.Builder(HttpMethod.PUT, uriObject, uriQuery, obj, headersMock, uriInfoMock, "someTransaction")
+ .rawRequestContent(content).build();
+ dbRequests.add(request);
+ }
+
+ return dbRequests;
+ }
+}
diff --git a/aai-core/src/test/java/org/onap/aai/rest/notification/NotificationServiceTest.java b/aai-core/src/test/java/org/onap/aai/rest/notification/NotificationServiceTest.java
index b3556bbe..95301c6f 100644
--- a/aai-core/src/test/java/org/onap/aai/rest/notification/NotificationServiceTest.java
+++ b/aai-core/src/test/java/org/onap/aai/rest/notification/NotificationServiceTest.java
@@ -24,7 +24,6 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java
index 5dfa12b7..517a43a7 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java
@@ -27,7 +27,9 @@ import static org.junit.Assert.assertEquals;
import com.google.common.collect.Multimap;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.junit.Rule;
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java b/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
index 6ae32f39..6a22aee1 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.serialization.engines.query;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/FormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/FormatTest.java
index 965e7157..78b8a5aa 100644
--- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/FormatTest.java
+++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/FormatTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.serialization.queryformats;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import org.junit.Rule;
import org.junit.Test;