diff options
8 files changed, 28 insertions, 27 deletions
diff --git a/aai-core/pom.xml b/aai-core/pom.xml index a7225531..83cca34f 100644 --- a/aai-core/pom.xml +++ b/aai-core/pom.xml @@ -172,6 +172,11 @@ limitations under the License. <artifactId>guava</artifactId> </dependency> <dependency> + <groupId>org.glassfish</groupId> + <artifactId>javax.json</artifactId> + <version>1.1.4</version> + </dependency> + <dependency> <groupId>org.janusgraph</groupId> <artifactId>janusgraph-core</artifactId> <exclusions> diff --git a/aai-core/src/main/java/org/onap/aai/concurrent/AaiCallable.java b/aai-core/src/main/java/org/onap/aai/concurrent/AaiCallable.java index 2703bdc4..9451e32e 100644 --- a/aai-core/src/main/java/org/onap/aai/concurrent/AaiCallable.java +++ b/aai-core/src/main/java/org/onap/aai/concurrent/AaiCallable.java @@ -35,7 +35,6 @@ public abstract class AaiCallable<T> implements Callable<T> { /** * The constructor. */ - @SuppressWarnings("unchecked") public AaiCallable() { mdcCopy = MDC.getCopyOfContextMap(); } diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java index 6430df50..055a70e3 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java @@ -26,12 +26,10 @@ import com.google.common.collect.Multimap; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; @@ -49,10 +47,10 @@ import org.janusgraph.core.PropertyKey; import org.janusgraph.core.schema.ConsistencyModifier; import org.janusgraph.core.schema.JanusGraphIndex; import org.janusgraph.core.schema.JanusGraphManagement; -import org.janusgraph.core.schema.JanusGraphManagement.IndexJobFuture; import org.janusgraph.core.schema.RelationTypeIndex; import org.janusgraph.core.schema.SchemaAction; import org.janusgraph.core.schema.SchemaStatus; +import org.janusgraph.diskstorage.keycolumnvalue.scan.ScanJobFuture; import org.janusgraph.graphdb.database.StandardJanusGraph; import org.janusgraph.graphdb.database.management.ManagementSystem; import org.janusgraph.graphdb.database.management.RelationIndexStatusReport; @@ -109,7 +107,7 @@ public class SchemaGenerator { final Map<String, Introspector> objs = LoaderUtil.getLatestVersion().getAllObjects(); final Map<String, PropertyKey> seenProps = new HashMap<>(); - + for (Introspector obj : objs.values()) { createSchemaForObject(graphMgmt, seenProps, obj); } @@ -340,7 +338,7 @@ public class SchemaGenerator { private static void awaitRelationIndexStatus(JanusGraph graph, Collection<String> labels, SchemaStatus newStatus) { LOGGER.info("Awaiting index status [{}]", newStatus);; CompletableFuture<RelationIndexStatusReport>[] awaits = labels.stream() - .map(label -> + .map(label -> CompletableFuture.supplyAsync(() -> { try { return ManagementSystem @@ -365,8 +363,8 @@ public class SchemaGenerator { private static void updateRelationIndexes(JanusGraph graph, Collection<String> labels, SchemaAction updateAction) { JanusGraphManagement graphMgmt = graph.openManagement(); - CompletableFuture<IndexJobFuture>[] awaits = labels.stream() - .map(label -> + CompletableFuture<ScanJobFuture>[] awaits = labels.stream() + .map(label -> CompletableFuture.supplyAsync(() -> { EdgeLabel relation = graphMgmt.getEdgeLabel(label); RelationTypeIndex index = graphMgmt.getRelationIndex(relation, label); @@ -398,7 +396,7 @@ public class SchemaGenerator { LOGGER.debug("Closing open transaction [{}] before schema generation", transaction.toString()); transaction.rollback(); }); - + final JanusGraphManagement graphMgtForClosing = graph.openManagement(); Set<String> instances = graphMgtForClosing.getOpenInstances(); diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java index 10f5cbaf..4ea0c074 100644 --- a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java +++ b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java @@ -30,10 +30,11 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; -import org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator; +import org.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslator; import org.apache.tinkerpop.gremlin.process.traversal.Order; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Path; @@ -519,7 +520,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> { @Override public QueryBuilder<E> store(String name) { - this.traversal.store(name); + this.traversal.aggregate(Scope.local , name); stepIndex++; return this; @@ -1028,7 +1029,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> { try { return mapPaginationResult((Map<String,Object>) completeTraversal.next()); // .next() will throw an IllegalArguementException if there are no vertices of the given type - } catch (IllegalArgumentException e) { + } catch (NoSuchElementException | IllegalArgumentException e) { return new PaginationResult<>(Collections.emptyList(), 0L); } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java index 89970e24..9c7c4a44 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java @@ -54,7 +54,7 @@ public class GraphSON implements FormatMapper { private static final GraphSONVersion version = GraphSONVersion.V1_0; private final GraphSONMapper mapper = - GraphSONMapper.build().version(version).addRegistry(JanusGraphIoRegistry.getInstance()).create(); + GraphSONMapper.build().version(version).addRegistry(JanusGraphIoRegistry.instance()).create(); private final GraphSONWriter writer = GraphSONWriter.build().mapper(mapper).create(); @Override diff --git a/aai-core/src/test/java/org/onap/aai/util/StoreNotificationEventTest.java b/aai-core/src/test/java/org/onap/aai/util/StoreNotificationEventTest.java index a0c3f639..7d3a19d4 100644 --- a/aai-core/src/test/java/org/onap/aai/util/StoreNotificationEventTest.java +++ b/aai-core/src/test/java/org/onap/aai/util/StoreNotificationEventTest.java @@ -25,12 +25,11 @@ import static org.junit.Assert.assertTrue; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; -import javax.json.Json; -import javax.json.JsonObject; - import org.eclipse.persistence.dynamic.DynamicEntity; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; import org.junit.Before; @@ -51,6 +50,8 @@ public class StoreNotificationEventTest extends AAISetup { private static AAIKafkaEventJMSProducer producer; private static StoreNotificationEvent sne; + private final ObjectMapper mapper = new ObjectMapper(); + @BeforeClass public static void setUp() { producer = Mockito.mock(AAIKafkaEventJMSProducer.class); @@ -77,7 +78,8 @@ public class StoreNotificationEventTest extends AAISetup { @Test public void testStoreEventEmptyEventHeader() throws AAIException, JsonGenerationException, JsonMappingException, IOException { - JsonObject object = Json.createObjectBuilder().add("hello", "world").build(); + + ObjectNode object = mapper.createObjectNode().put("hello", "world"); String res = sne.storeEventAndSendToJms(new EventHeader(), object); assertNotNull(res); @@ -98,14 +100,12 @@ public class StoreNotificationEventTest extends AAISetup { assertTrue(res.contains("\"entity-link\" : \"UNK\"")); assertTrue(res.contains("\"entity\"")); assertTrue(res.contains("\"hello\"")); - assertTrue(res.contains("\"chars\" : \"world\"")); - assertTrue(res.contains("\"string\" : \"world\"")); - assertTrue(res.contains("\"valueType\" : \"STRING\"")); + assertTrue(res.contains("\"world\"")); } @Test public void testStoreEvent() throws AAIException, JsonGenerationException, JsonMappingException, IOException { - JsonObject object = Json.createObjectBuilder().add("hello", "world").build(); + ObjectNode object = mapper.createObjectNode().put("hello", "world"); EventHeader eh = new EventHeader(); eh.setId("123"); eh.setTimestamp("current-time"); @@ -135,9 +135,7 @@ public class StoreNotificationEventTest extends AAISetup { assertTrue(res.contains("\"entity-link\" : \"entity-link\"")); assertTrue(res.contains("\"entity\"")); assertTrue(res.contains("\"hello\"")); - assertTrue(res.contains("\"chars\" : \"world\"")); - assertTrue(res.contains("\"string\" : \"world\"")); - assertTrue(res.contains("\"valueType\" : \"STRING\"")); + assertTrue(res.contains("\"world\"")); } @Test(expected = AAIException.class) diff --git a/aai-parent/pom.xml b/aai-parent/pom.xml index c4b96c2d..99fe0aaf 100644 --- a/aai-parent/pom.xml +++ b/aai-parent/pom.xml @@ -61,8 +61,8 @@ limitations under the License. <eelf.core.version>2.0.0-oss</eelf.core.version> <freemarker.version>2.3.31</freemarker.version> <google.guava.version>31.1-jre</google.guava.version> - <gremlin.version>3.5.8</gremlin.version> - <janusgraph.version>0.6.4</janusgraph.version> + <gremlin.version>3.7.1</gremlin.version> + <janusgraph.version>1.0.0</janusgraph.version> <groovy.version>2.5.15</groovy.version> <gson.version>2.9.1</gson.version> <hamcrest.junit.version>2.0.0.0</hamcrest.junit.version> diff --git a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java index e7055a3f..08cf880e 100644 --- a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java +++ b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java @@ -31,7 +31,7 @@ import org.junit.Before; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.setup.AAIConfigTranslator; |