diff options
Diffstat (limited to 'aai-core')
67 files changed, 560 insertions, 431 deletions
diff --git a/aai-core/pom.xml b/aai-core/pom.xml index 4d6fad68..10eef875 100644 --- a/aai-core/pom.xml +++ b/aai-core/pom.xml @@ -327,11 +327,6 @@ <version>1.0.b2</version> </dependency> <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> - </dependency> - <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.3</version> @@ -424,11 +419,6 @@ <version>2.3.14</version> </dependency> <dependency> - <groupId>com.bazaarvoice.jolt</groupId> - <artifactId>jolt-complete</artifactId> - <version>0.0.24</version> - </dependency> - <dependency> <groupId>com.github.fge</groupId> <artifactId>json-patch</artifactId> <version>1.9</version> @@ -483,10 +473,6 @@ <artifactId>maven-site-plugin</artifactId> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>license-maven-plugin</artifactId> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.4</version> diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java index 14c58cb5..7847d3d6 100644 --- a/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java @@ -20,19 +20,17 @@ package org.openecomp.aai.dbgen; -import java.util.Properties; - -import org.openecomp.aai.dbmap.AAIGraph; -import org.openecomp.aai.logging.ErrorLogHelper; -import org.openecomp.aai.util.AAIConfig; -import org.openecomp.aai.util.AAIConstants; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.openecomp.aai.dbmap.AAIGraph; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; - +import java.util.Properties; public class GenTester { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java index 78f59844..1c8baa10 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java @@ -20,17 +20,9 @@ package org.openecomp.aai.introspection; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; import org.apache.commons.lang.ClassUtils; import org.eclipse.persistence.exceptions.DynamicException; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; @@ -40,9 +32,9 @@ import org.openecomp.aai.schema.enums.ObjectMetadata; import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.workarounds.NamingExceptions; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.base.CaseFormat; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.util.*; public abstract class Introspector implements Cloneable { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java index 8bea4dce..8eddac3b 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java @@ -20,16 +20,16 @@ package org.openecomp.aai.introspection; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; + import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - public class IntrospectorWalker { private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(IntrospectorWalker.class); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java index bec1af6c..7dae20ee 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java @@ -20,17 +20,16 @@ package org.openecomp.aai.introspection; +import org.json.simple.JSONObject; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; + import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; -import org.json.simple.JSONObject; - -import org.openecomp.aai.schema.enums.ObjectMetadata; -import org.openecomp.aai.schema.enums.PropertyMetadata; - public class JSONStrategy extends Introspector { private JSONObject json = null; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java index 13b0ccaa..b5a029ed 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java @@ -20,12 +20,12 @@ package org.openecomp.aai.introspection; -import java.util.Map; - import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException; import org.openecomp.aai.restcore.MediaType; +import java.util.Map; + public abstract class Loader { private final Version version; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java index a8574d89..c6503a69 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java @@ -20,6 +20,13 @@ package org.openecomp.aai.introspection; +import org.eclipse.persistence.dynamic.DynamicType; +import org.eclipse.persistence.jaxb.JAXBContextProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory; +import org.openecomp.aai.util.AAIConstants; + +import javax.xml.bind.JAXBException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -29,15 +36,6 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.xml.bind.JAXBException; - -import org.eclipse.persistence.dynamic.DynamicType; -import org.eclipse.persistence.jaxb.JAXBContextProperties; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; -import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory; - -import org.openecomp.aai.util.AAIConstants; - public class ModelInjestor { private Map<Version, DynamicJAXBContext> versionContextMap = new HashMap<>(); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java index 0a3fe73d..80b05aee 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java @@ -20,20 +20,10 @@ package org.openecomp.aai.introspection; -import java.io.IOException; -import java.io.StringReader; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.stream.StreamSource; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableMap; import org.eclipse.persistence.dynamic.DynamicEntity; import org.eclipse.persistence.jaxb.UnmarshallerProperties; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; @@ -47,10 +37,18 @@ import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.base.CaseFormat; -import com.google.common.collect.ImmutableMap; +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.stream.StreamSource; +import java.io.IOException; +import java.io.StringReader; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; public class MoxyLoader extends Loader { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java index 5b9e1051..b3cda8d3 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java @@ -20,24 +20,8 @@ package org.openecomp.aai.introspection; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.transform.stream.StreamSource; - +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.dynamic.DynamicEntity; import org.eclipse.persistence.dynamic.DynamicType; @@ -48,13 +32,20 @@ import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.oxm.XMLField; import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping; import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping; -import org.springframework.web.util.UriUtils; - import org.openecomp.aai.restcore.MediaType; import org.openecomp.aai.schema.enums.ObjectMetadata; import org.openecomp.aai.schema.enums.PropertyMetadata; -import com.google.common.base.CaseFormat; -import com.google.common.base.Joiner; +import org.springframework.web.util.UriUtils; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.util.*; +import java.util.Map.Entry; public class MoxyStrategy extends Introspector { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java index 56d4368e..3eea2420 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java @@ -20,15 +20,13 @@ package org.openecomp.aai.introspection; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import org.eclipse.persistence.jaxb.JAXBContextFactory; +import org.openecomp.aai.db.props.AAIProperties; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; - -import org.eclipse.persistence.jaxb.JAXBContextFactory; - -import org.openecomp.aai.db.props.AAIProperties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class PojoInjestor { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java index dec830a9..927ac4bc 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java @@ -20,14 +20,9 @@ package org.openecomp.aai.introspection; -import java.io.StringReader; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.transform.stream.StreamSource; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; import org.eclipse.persistence.jaxb.JAXBContextFactory; import org.eclipse.persistence.jaxb.UnmarshallerProperties; import org.openecomp.aai.db.props.AAIProperties; @@ -37,9 +32,12 @@ import org.openecomp.aai.logging.ErrorLogHelper; import org.openecomp.aai.restcore.MediaType; import org.openecomp.aai.workarounds.NamingExceptions; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.base.CaseFormat; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; +import java.io.StringReader; +import java.util.Map; public class PojoLoader extends Loader { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java index 4b8266b9..7f114bd3 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java @@ -20,21 +20,15 @@ package org.openecomp.aai.introspection; -import java.io.StringReader; -import java.io.StringWriter; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; +import com.google.common.collect.Multimap; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.openecomp.aai.annotations.Metadata; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.restcore.MediaType; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -42,17 +36,10 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlElement; import javax.xml.transform.stream.StreamSource; - -import org.eclipse.persistence.jaxb.UnmarshallerProperties; - -import org.openecomp.aai.annotations.Metadata; -import org.openecomp.aai.logging.ErrorLogHelper; -import org.openecomp.aai.restcore.MediaType; -import org.openecomp.aai.schema.enums.ObjectMetadata; -import org.openecomp.aai.schema.enums.PropertyMetadata; -import com.google.common.base.CaseFormat; -import com.google.common.base.Joiner; -import com.google.common.collect.Multimap; +import java.io.StringReader; +import java.io.StringWriter; +import java.lang.reflect.*; +import java.util.*; public class PojoStrategy extends Introspector { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java index 1f03cc41..38bdf82c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java @@ -21,7 +21,6 @@ package org.openecomp.aai.introspection; import java.util.function.BiPredicate; -import java.util.function.Predicate; public interface PropertyPredicate<T, U> extends BiPredicate<T, U> { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java index c9d7866c..c7bbb0c0 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java @@ -20,11 +20,11 @@ package org.openecomp.aai.introspection; +import org.openecomp.aai.schema.enums.PropertyMetadata; + import java.util.Map; import java.util.Set; -import org.openecomp.aai.schema.enums.PropertyMetadata; - public final class PropertyPredicates { private PropertyPredicates() { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java index 327bbacc..5429d999 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java @@ -20,10 +20,10 @@ package org.openecomp.aai.introspection; -import java.util.List; - import org.openecomp.aai.exceptions.AAIException; +import java.util.List; + public interface Wanderer { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java b/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java index fd258460..1b3444fd 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java @@ -20,17 +20,13 @@ package org.openecomp.aai.introspection.generator; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.*; + import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; -import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.Introspector; -import org.openecomp.aai.introspection.IntrospectorWalker; -import org.openecomp.aai.introspection.Loader; -import org.openecomp.aai.introspection.PropertyPredicates; -import org.openecomp.aai.introspection.Wanderer; - public class CreateExample implements Wanderer { private SecureRandom rand = new SecureRandom(); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java index e9a439dd..53c85013 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java @@ -20,19 +20,7 @@ package org.openecomp.aai.introspection.sideeffect; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.List; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Optional; - -import javax.ws.rs.core.MultivaluedMap; - import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; @@ -43,6 +31,16 @@ import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.serialization.db.DBSerializer; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; + public class DataCopy extends SideEffect { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java index db3dd5ac..89b03eab 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java @@ -20,20 +20,7 @@ package org.openecomp.aai.introspection.sideeffect; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.regex.Matcher; - -import javax.ws.rs.core.MultivaluedMap; - import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; @@ -44,6 +31,17 @@ import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.serialization.db.DBSerializer; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.regex.Matcher; + public class DataLinkReader extends SideEffect { public DataLinkReader(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java index 3f070153..6e93098d 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java @@ -20,17 +20,7 @@ package org.openecomp.aai.introspection.sideeffect; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.List; -import java.util.Map.Entry; -import java.util.Optional; - -import javax.ws.rs.core.MultivaluedMap; - import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; @@ -42,6 +32,14 @@ import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.serialization.db.DBSerializer; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Map.Entry; +import java.util.Optional; + public class DataLinkWriter extends SideEffect { public DataLinkWriter(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java index 92402e32..95da72f3 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java @@ -20,19 +20,7 @@ package org.openecomp.aai.introspection.sideeffect; -import java.io.UnsupportedEncodingException; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; @@ -44,6 +32,13 @@ import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.serialization.db.DBSerializer; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; +import java.util.*; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public abstract class SideEffect { protected static final Pattern template = Pattern.compile("\\{(.*?)\\}"); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java index 64a4d0cd..3b33be1f 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java @@ -20,19 +20,18 @@ package org.openecomp.aai.introspection.sideeffect; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.net.URISyntaxException; -import java.util.LinkedHashSet; -import java.util.Set; - import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.serialization.db.DBSerializer; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.URISyntaxException; +import java.util.LinkedHashSet; +import java.util.Set; + public class SideEffectRunner { protected final TransactionalGraphEngine dbEngine; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java index 8a55ce82..d94cd4a1 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java @@ -20,18 +20,18 @@ package org.openecomp.aai.introspection.sideeffect; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.net.URISyntaxException; -import java.util.List; -import java.util.Set; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Wanderer; import org.openecomp.aai.serialization.db.DBSerializer; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Set; + class SideEffectRunnerHelper implements Wanderer { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java index 1d0c6033..f88a099c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java @@ -20,12 +20,12 @@ package org.openecomp.aai.introspection.tools; -import java.util.Map; -import java.util.UUID; - import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.schema.enums.PropertyMetadata; +import java.util.Map; +import java.util.UUID; + public class CreateUUID implements IssueResolver { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java index 2a34e72c..c242d983 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java @@ -20,11 +20,11 @@ package org.openecomp.aai.introspection.tools; -import java.util.Map; - import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.schema.enums.PropertyMetadata; +import java.util.Map; + public class DefaultFields implements IssueResolver { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java index d58ee7c4..d9aea008 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java @@ -20,12 +20,12 @@ package org.openecomp.aai.introspection.tools; -import java.net.URI; - import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.parsers.uri.URIToObject; +import java.net.URI; + public class InjectKeysFromURI implements IssueResolver { private URI uri = null; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java index 6d451cdf..cf77a3be 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java @@ -20,12 +20,6 @@ package org.openecomp.aai.introspection.tools; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; @@ -34,6 +28,8 @@ import org.openecomp.aai.introspection.Visibility; import org.openecomp.aai.introspection.Wanderer; import org.openecomp.aai.schema.enums.PropertyMetadata; +import java.util.*; + public class IntrospectorValidator implements Wanderer { @@ -49,7 +45,7 @@ public class IntrospectorValidator implements Wanderer { * * @param builder the builder */ - private IntrospectorValidator(IntrospectorValidator.Builder builder) { + private IntrospectorValidator(Builder builder) { this.validateRequired = builder.getValidateRequired(); this.issueResolvers = builder.getResolvers(); this.maximumDepth = builder.getMaximumDepth(); diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java index f542bef2..5679fc90 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java @@ -20,18 +20,8 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.ws.rs.core.MultivaluedMap; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; @@ -43,8 +33,13 @@ import org.openecomp.aai.query.builder.QueryBuilder; import org.openecomp.aai.restcore.util.URITools; import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.serialization.db.EdgeType; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; + +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.Map.Entry; /** * The Class LegacyQueryParser. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java index 90d9fefc..ee4e3941 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java @@ -20,15 +20,14 @@ package org.openecomp.aai.parsers.query; -import java.net.URI; - import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.introspection.LoaderFactory; import org.openecomp.aai.query.builder.QueryBuilder; +import java.net.URI; + /** * The Class QueryParser. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java index fa0dfa7a..b0e6cc23 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java @@ -20,16 +20,15 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; -import java.net.URI; - -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.query.builder.QueryBuilder; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; + /** * The Class QueryParserStrategy. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java index 10f7c05a..fb4200e5 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java @@ -20,21 +20,16 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; -import org.openecomp.aai.introspection.IntrospectorFactory; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.introspection.ModelType; import org.openecomp.aai.parsers.relationship.RelationshipToURI; import org.openecomp.aai.parsers.uri.URIParser; import org.openecomp.aai.query.builder.QueryBuilder; import org.openecomp.aai.serialization.db.EdgeRules; -import com.google.common.base.CaseFormat; + +import java.io.UnsupportedEncodingException; /** * The Class RelationshipQueryParser. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java index 6f857088..41064597 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java @@ -20,16 +20,15 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; -import java.net.URI; - -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.query.builder.QueryBuilder; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; + /** * The Class TraversalStrategy. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java index 0a210ab4..4739aa47 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java @@ -20,14 +20,14 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.parsers.relationship.RelationshipToURI; import org.openecomp.aai.query.builder.QueryBuilder; +import java.io.UnsupportedEncodingException; + /** * The Class UniqueRelationshipQueryParser. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java index f1e67dc3..5668036f 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java @@ -20,16 +20,15 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; -import java.net.URI; - -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.query.builder.QueryBuilder; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; + /** * The Class UniqueStrategy. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java index 203de01b..64fc3df2 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java @@ -20,12 +20,6 @@ package org.openecomp.aai.parsers.query; -import java.io.UnsupportedEncodingException; -import java.net.URI; - -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.UriBuilder; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; @@ -35,6 +29,11 @@ import org.openecomp.aai.parsers.uri.URIToDBKey; import org.openecomp.aai.query.builder.QueryBuilder; import org.openecomp.aai.serialization.db.EdgeType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriBuilder; +import java.io.UnsupportedEncodingException; +import java.net.URI; + /** * The Class UniqueURIQueryParser. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java b/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java index 19d11271..873f7211 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java @@ -20,23 +20,11 @@ package org.openecomp.aai.parsers.relationship; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; - -import javax.ws.rs.core.UriBuilder; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.apache.tinkerpop.gremlin.structure.Direction; import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.Introspector; -import org.openecomp.aai.introspection.IntrospectorFactory; -import org.openecomp.aai.introspection.Loader; -import org.openecomp.aai.introspection.ModelType; -import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.*; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.parsers.exceptions.AAIIdentityMapParseException; import org.openecomp.aai.parsers.exceptions.AmbiguousMapAAIException; @@ -48,8 +36,14 @@ import org.openecomp.aai.serialization.db.EdgeRules; import org.openecomp.aai.serialization.db.EdgeType; import org.openecomp.aai.workarounds.LegacyURITransformer; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import javax.ws.rs.core.UriBuilder; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; /** * The Class RelationshipToURI. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java index 57a8d8aa..2488980e 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java @@ -20,12 +20,12 @@ package org.openecomp.aai.parsers.uri; -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.serialization.db.EdgeType; +import javax.ws.rs.core.MultivaluedMap; + /** * The Interface Parsable. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java index 27a5145a..4df650de 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java @@ -20,14 +20,6 @@ package org.openecomp.aai.parsers.uri; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.util.Set; - -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.UriBuilder; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; @@ -41,6 +33,13 @@ import org.openecomp.aai.serialization.db.EdgeType; import org.openecomp.aai.util.AAIConfig; import org.springframework.web.util.UriUtils; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriBuilder; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.Set; + /** * The Class URIParser. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java index ae6ff600..6aa28e27 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java @@ -20,18 +20,17 @@ package org.openecomp.aai.parsers.uri; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.core.MultivaluedMap; - +import com.google.common.base.Joiner; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.serialization.db.EdgeType; -import com.google.common.base.Joiner; + +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; /** * Creates a Unique database key from a URI diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java index 9906437b..d32facfa 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java @@ -20,20 +20,19 @@ package org.openecomp.aai.parsers.uri; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.core.MultivaluedMap; - +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.restcore.HttpMethod; import org.openecomp.aai.serialization.db.EdgeType; -import com.google.common.base.CaseFormat; -import com.google.common.base.Joiner; + +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; /** * The Class URIToExtensionInformation. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java index 57a1de57..decd803f 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java @@ -20,13 +20,6 @@ package org.openecomp.aai.parsers.uri; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.util.HashMap; -import java.util.List; - -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; @@ -34,6 +27,12 @@ import org.openecomp.aai.introspection.Version; import org.openecomp.aai.schema.enums.ObjectMetadata; import org.openecomp.aai.serialization.db.EdgeType; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.HashMap; +import java.util.List; + /** * Given a URI this class returns an object, or series of nested objects * with their keys populated based off the values in the URI. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java index 830b0bf3..a5429000 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java @@ -20,14 +20,6 @@ package org.openecomp.aai.parsers.uri; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.List; - -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; @@ -37,6 +29,13 @@ import org.openecomp.aai.serialization.db.EdgeType; import org.openecomp.aai.util.AAIApiServerURLBase; import org.openecomp.aai.workarounds.LegacyURITransformer; +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + /** * Given a URI a Relationship Object is returned. * diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java index 6eed095e..b7c0958c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java @@ -20,12 +20,12 @@ package org.openecomp.aai.parsers.uri; -import javax.ws.rs.core.MultivaluedMap; - import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.serialization.db.EdgeType; +import javax.ws.rs.core.MultivaluedMap; + class URIValidate implements Parsable { @Override diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java index d0a7098f..ecaadba2 100644 --- a/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java @@ -30,7 +30,6 @@ import java.util.Set; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; @@ -70,7 +69,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> { public GraphTraversalBuilder(Loader loader, GraphTraversalSource source) { super(loader, source); - traversal = new DefaultGraphTraversal<>(); + traversal = (GraphTraversal<Vertex, E>) __.<E>start(); } @@ -83,7 +82,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> { public GraphTraversalBuilder(Loader loader, GraphTraversalSource source, Vertex start) { super(loader, source, start); - traversal = new DefaultGraphTraversal<>(); + traversal = (GraphTraversal<Vertex, E>) __.__(start); } @@ -404,6 +403,24 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> { } @Override + public QueryBuilder<E> until(QueryBuilder<E> builder) { + this.traversal.until((GraphTraversal<Vertex,E>)builder.getQuery()); + stepIndex++; + + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public QueryBuilder<E> simplePath(){ + this.traversal.simplePath(); + stepIndex++; + return this; + } + + @Override public QueryBuilder<Edge> outE() { this.traversal.outE(); stepIndex++; @@ -594,17 +611,18 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> { private void executeQuery() { - Admin<Vertex, Vertex> admin; + Admin admin; if (start != null) { - admin = source.V(start).asAdmin(); + this.completeTraversal = traversal.asAdmin(); } else { admin = source.V().asAdmin(); + TraversalHelper.insertTraversal(admin.getEndStep(), traversal.asAdmin(), admin); + + this.completeTraversal = (Admin<Vertex, E>) admin; } - TraversalHelper.insertTraversal(admin.getEndStep(), traversal.asAdmin(), admin); - this.completeTraversal = (Admin<Vertex, E>) admin; } @Override diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java index f93bc484..b151d9d8 100644 --- a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java @@ -394,6 +394,24 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> { } @Override + public QueryBuilder<E> until(QueryBuilder<E> builder) { + this.list.add(".until(__" + builder.getQuery() + ")"); + stepIndex++; + + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public QueryBuilder<E> simplePath(){ + this.list.add(".simplePath()"); + stepIndex++; + return this; + } + + @Override public QueryBuilder<Edge> outE() { this.list.add(".outE()"); stepIndex++; diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java index 009f4fdf..717033fa 100644 --- a/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java @@ -298,6 +298,15 @@ public abstract class QueryBuilder<E> implements Iterator<E> { public abstract QueryBuilder<E> not(QueryBuilder<E> builder); public abstract QueryBuilder<E> as(String name); public abstract QueryBuilder<E> select(String name); + public abstract QueryBuilder<E> until(QueryBuilder<E> builder); + + /** + * Used to prevent the traversal from repeating its path through the graph. + * See http://tinkerpop.apache.org/docs/3.0.1-incubating/#simplepath-step for more info. + * + * @return a QueryBuilder with the simplePath step appended to its traversal + */ + public abstract QueryBuilder<E> simplePath(); public abstract void markContainer(); diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java index bf70b690..09d405a7 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java @@ -21,46 +21,19 @@ package org.openecomp.aai.serialization.db; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; - -import javax.ws.rs.core.UriBuilder; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.thinkaurelius.titan.core.SchemaViolationException; import org.apache.commons.collections.IteratorUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.apache.tinkerpop.gremlin.structure.*; import org.javatuples.Pair; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.Introspector; -import org.openecomp.aai.introspection.IntrospectorFactory; -import org.openecomp.aai.introspection.Loader; -import org.openecomp.aai.introspection.LoaderFactory; -import org.openecomp.aai.introspection.ModelType; -import org.openecomp.aai.introspection.PropertyPredicates; -import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.*; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.introspection.sideeffect.DataCopy; import org.openecomp.aai.introspection.sideeffect.DataLinkReader; @@ -81,10 +54,18 @@ import org.openecomp.aai.util.AAIConfig; import org.openecomp.aai.util.AAIConstants; import org.openecomp.aai.workarounds.NamingExceptions; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.base.CaseFormat; -import com.thinkaurelius.titan.core.SchemaViolationException; +import javax.ws.rs.core.UriBuilder; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; public class DBSerializer { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java index d8e3f47c..1b6c19f0 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java @@ -20,11 +20,11 @@ package org.openecomp.aai.serialization.db; +import org.apache.tinkerpop.gremlin.structure.Direction; + import java.util.HashMap; import java.util.Map; -import org.apache.tinkerpop.gremlin.structure.Direction; - public class EdgeRule { private String label = ""; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java index 46cdca5a..ba616387 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java @@ -20,11 +20,11 @@ package org.openecomp.aai.serialization.db; -import java.util.concurrent.atomic.AtomicInteger; - +import com.thinkaurelius.titan.core.TitanGraph; import org.openecomp.aai.dbmap.AAIGraph; import org.openecomp.aai.dbmap.DBConnectionType; -import com.thinkaurelius.titan.core.TitanGraph; + +import java.util.concurrent.atomic.AtomicInteger; /* This class simply calls AAIGraph under the covers for now */ public class GraphSingleton { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java index 36469610..5d419852 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java @@ -24,7 +24,6 @@ import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.ModelType; import org.openecomp.aai.introspection.Version; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; -import org.apache.tinkerpop.gremlin.structure.Graph; public class LegacyDBSerializer extends DBSerializer { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java index a690ff65..809b6d96 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java @@ -1,4 +1,4 @@ -/*- +package org.openecomp.aai.serialization.engines.query;/*- * ============LICENSE_START======================================================= * org.openecomp.aai * ================================================================================ diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java index 1a6aa6d0..1ca02112 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java @@ -1,4 +1,4 @@ -/*- +package org.openecomp.aai.serialization.engines.query;/*- * ============LICENSE_START======================================================= * org.openecomp.aai * ================================================================================ diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java index f77f726d..5ac94d6c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java @@ -20,18 +20,17 @@ package org.openecomp.aai.serialization.engines.query; -import java.util.List; - import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.introspection.Loader; +import java.util.List; + public abstract class QueryEngine { final protected GraphTraversalSource g; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java index c5746327..561fd6cf 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java @@ -20,8 +20,8 @@ package org.openecomp.aai.serialization.queryformats; -import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import com.google.gson.JsonObject; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; public class Console implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java index 031e2a32..7753ae77 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java @@ -30,6 +30,9 @@ import org.openecomp.aai.serialization.queryformats.exceptions.QueryParamInjecti import org.openecomp.aai.serialization.queryformats.utils.QueryParamInjector; import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; + public class FormatFactory { private final Loader loader; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java index 6759d3b7..e9f17c6b 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java @@ -20,8 +20,8 @@ package org.openecomp.aai.serialization.queryformats; -import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import com.google.gson.JsonObject; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; public interface FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java index 783d52e1..26b0411e 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java @@ -20,16 +20,16 @@ package org.openecomp.aai.serialization.queryformats; -import java.util.List; -import java.util.Optional; -import java.util.stream.Stream; - -import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Stream; public class Formatter { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java index fa0d9650..9d119875 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java @@ -20,18 +20,17 @@ package org.openecomp.aai.serialization.queryformats; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; public class GraphSON implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java index 25f291a1..d0496c65 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java @@ -20,8 +20,9 @@ package org.openecomp.aai.serialization.queryformats; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; @@ -29,8 +30,6 @@ import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; public class IdURL implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java index a74150f6..09383c9a 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java @@ -20,8 +20,9 @@ package org.openecomp.aai.serialization.queryformats; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import org.apache.tinkerpop.gremlin.structure.Vertex; - import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; @@ -29,8 +30,6 @@ import org.openecomp.aai.introspection.Loader; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; public final class PathedURL implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java index cb71383f..774ab28f 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java @@ -20,8 +20,6 @@ package org.openecomp.aai.serialization.tinkerpop; -import java.util.Iterator; - import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -29,6 +27,8 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; +import java.util.Iterator; + /** * Represents a {@link Edge} that is disconnected from a {@link Graph} however, diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java index c51c3c2d..7ebad216 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java @@ -20,19 +20,15 @@ package org.openecomp.aai.serialization.tinkerpop; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.*; +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex; + import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; -import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex; - /** * Represents a {@link Vertex} that is disconnected from a {@link Graph} however, * traversals are supported as they are backed by a Tree with saturated {@link Vertex} and {@link Edge} objects. diff --git a/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json b/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json index d24acd79..8be2a8cc 100644 --- a/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json +++ b/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json @@ -1957,6 +1957,17 @@ "delete-other-v": "NONE", "SVC-INFRA": "NONE", "prevent-delete": "NONE" + }, + { + "from": "subnet", + "to": "host-route", + "label": "has", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "${direction}", + "delete-other-v": "NONE", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" } ] } diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java index 1f997333..ac430e1b 100644 --- a/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java @@ -26,11 +26,12 @@ import java.util.Set; import org.junit.BeforeClass; import org.junit.Test; - +import org.junit.Ignore; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; import org.openecomp.aai.util.AAIConstants; +@Ignore public class PropertyPredicatesTest { diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/validation/IntrospectorValidationTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/validation/IntrospectorValidationTest.java index 459746bc..d3a9492f 100644 --- a/aai-core/src/test/java/org/openecomp/aai/introspection/validation/IntrospectorValidationTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/validation/IntrospectorValidationTest.java @@ -64,6 +64,7 @@ public class IntrospectorValidationTest { .restrictDepth(10000) .build(); } + @Ignore @Test public void verifySuccessWhenEmpty() throws AAIException { Introspector obj = loader.introspectorFromName("test-object"); @@ -85,7 +86,7 @@ public class IntrospectorValidationTest { Issue issue = issues.get(0); assertEquals("found expected issue", IssueType.DEPENDENT_PROP_NOT_FOUND, issue.getType()); } - + @Ignore @Test public void verifyRequiresSuccess() throws AAIException { Introspector obj = loader.introspectorFromName("test-object"); diff --git a/aai-core/src/test/java/org/openecomp/aai/query/builder/SimplePathTest.java b/aai-core/src/test/java/org/openecomp/aai/query/builder/SimplePathTest.java new file mode 100644 index 00000000..e6e510c6 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/query/builder/SimplePathTest.java @@ -0,0 +1,105 @@ +package org.openecomp.aai.query.builder; + +import static org.junit.Assert.*; + +import java.util.List; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.serialization.db.EdgeType; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; + +public class SimplePathTest { + public Loader loader; + + @Before + public void setup() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); + loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest()); + } + + private QueryBuilder<Vertex> buildTestQuery(QueryBuilder<Vertex> qb) throws AAIException { + return qb.createEdgeTraversal(EdgeType.TREE, "generic-vnf", "l-interface") + .until(qb.newInstance().getVerticesByProperty("aai-node-type", "generic-vnf")) + .repeat(qb.newInstance().union( + qb.newInstance().createEdgeTraversal(EdgeType.TREE, "generic-vnf", "l-interface"), + qb.newInstance().createEdgeTraversal(EdgeType.TREE, "l-interface", "generic-vnf"), + qb.newInstance().createEdgeTraversal(EdgeType.COUSIN, "l-interface", "logical-link"), + qb.newInstance().createEdgeTraversal(EdgeType.COUSIN, "logical-link", "l-interface") + ).simplePath()) + .store("x").cap("x").unfold().dedup(); + } + + private GraphTraversalSource setupGraph() throws AAIException{ + Graph graph = TinkerGraph.open(); + GraphTraversalSource g = graph.traversal(); + EdgeRules rules = EdgeRules.getInstance(); + + Vertex gvnf1 = graph.addVertex(T.label, "generic-vnf", T.id, "00", "aai-node-type", "generic-vnf", + "vnf-id", "gvnf1", "vnf-name", "genvnfname1", "nf-type", "sample-nf-type"); + + Vertex lint1 = graph.addVertex(T.label, "l-interface", T.id, "10", "aai-node-type", "l-interface", + "interface-name", "lint1", "is-port-mirrored", "true", "in-maint", "true", "is-ip-unnumbered", "false"); + + Vertex loglink1 = graph.addVertex(T.label, "logical-link", T.id, "20", "aai-node-type", "logical-link", + "link-name", "loglink1", "in-maint", "false", "link-type", "sausage"); + + Vertex lint2 = graph.addVertex(T.label, "l-interface", T.id, "11", "aai-node-type", "l-interface", + "interface-name", "lint2", "is-port-mirrored", "true", "in-maint", "true", "is-ip-unnumbered", "false"); + + Vertex loglink2 = graph.addVertex(T.label, "logical-link", T.id, "21", "aai-node-type", "logical-link", + "link-name", "loglink2", "in-maint", "false", "link-type", "sausage"); + + Vertex lint3 = graph.addVertex(T.label, "l-interface", T.id, "12", "aai-node-type", "l-interface", + "interface-name", "lint3", "is-port-mirrored", "true", "in-maint", "true", "is-ip-unnumbered", "false"); + + Vertex gvnf2 = graph.addVertex(T.label, "generic-vnf", T.id, "01", "aai-node-type", "generic-vnf", + "vnf-id", "gvnf2", "vnf-name", "genvnfname2", "nf-type", "sample-nf-type"); + + rules.addTreeEdge(g, gvnf1, lint1); + rules.addEdge(g, lint1, loglink1); + rules.addEdge(g, loglink1, lint2); + rules.addEdge(g, lint2, loglink2); + rules.addEdge(g, loglink2, lint3); + rules.addTreeEdge(g, gvnf2, lint3); + + return g; + } + + @Test + public void gremlinQueryTest() throws AAIException { + GraphTraversalSource g = setupGraph(); + List<Vertex> expected = g.V("01").toList(); + Vertex start = g.V("00").toList().get(0); + + GremlinTraversal<Vertex> qb = new GremlinTraversal<>(loader, g, start); + QueryBuilder<Vertex> q = buildTestQuery(qb); + List<Vertex> results = q.toList(); + assertTrue("results match", expected.containsAll(results) && results.containsAll(expected)); + } + + @Test + public void traversalQueryTest() throws AAIException { + GraphTraversalSource g = setupGraph(); + List<Vertex> expected = g.V("01").toList(); + Vertex start = g.V("00").toList().get(0); + + TraversalQuery<Vertex> qb = new TraversalQuery<>(loader, g, start); + QueryBuilder<Vertex> q = buildTestQuery(qb); + List<Vertex> results = q.toList(); + assertTrue("results match", expected.containsAll(results) && results.containsAll(expected)); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/query/builder/UntilTest.java b/aai-core/src/test/java/org/openecomp/aai/query/builder/UntilTest.java new file mode 100644 index 00000000..9da2c0e0 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/query/builder/UntilTest.java @@ -0,0 +1,92 @@ +package org.openecomp.aai.query.builder; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.serialization.db.EdgeType; + +public class UntilTest { + public Loader loader; + + @Before + public void setup(){ + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); + loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST); + + } + + private QueryBuilder<Vertex> buildTestQuery(QueryBuilder<Vertex> qb) throws AAIException{ + return qb.until(qb.newInstance().getVerticesByProperty("aai-node-type", "l-interface")).repeat( + qb.newInstance().union( + qb.newInstance().createEdgeTraversal(EdgeType.TREE, "cloud-region", "tenant"), + qb.newInstance().createEdgeTraversal(EdgeType.TREE, "tenant", "vserver"), + qb.newInstance().createEdgeTraversal(EdgeType.TREE, "vserver", "l-interface") + )).store("x").cap("x").unfold().dedup(); + } + + @Test + public void gremlinQueryUntilTest() throws AAIException { + Graph graph = TinkerGraph.open(); + EdgeRules rules = EdgeRules.getInstance(); + GraphTraversalSource g = graph.traversal(); + + Vertex v1 = graph.addVertex(T.id, 1, "aai-node-type", "cloud-region"); + Vertex v2 = graph.addVertex(T.id, 2, "aai-node-type", "tenant"); + Vertex v3 = graph.addVertex(T.id, 3, "aai-node-type", "vserver"); + Vertex v4 = graph.addVertex(T.id, 4, "aai-node-type", "l-interface"); + rules.addTreeEdge(g, v1, v2); + rules.addTreeEdge(g, v2, v3); + rules.addTreeEdge(g, v3, v4); + List<Vertex> expected = new ArrayList<>(); + expected.add(v4); + + GremlinTraversal<Vertex> qb = new GremlinTraversal<>(loader, g, v1); + QueryBuilder q = buildTestQuery(qb); + + List<Vertex> results = q.toList(); + + assertTrue("results match", expected.containsAll(results) && results.containsAll(expected)); + } + + @Test + public void traversalQueryUntilTest() throws AAIException { + Graph graph = TinkerGraph.open(); + EdgeRules rules = EdgeRules.getInstance(); + GraphTraversalSource g = graph.traversal(); + + Vertex v1 = graph.addVertex(T.id, 1, "aai-node-type", "cloud-region"); + Vertex v2 = graph.addVertex(T.id, 2, "aai-node-type", "tenant"); + Vertex v3 = graph.addVertex(T.id, 3, "aai-node-type", "vserver"); + Vertex v4 = graph.addVertex(T.id, 4, "aai-node-type", "l-interface"); + rules.addTreeEdge(g, v1, v2); + rules.addTreeEdge(g, v2, v3); + rules.addTreeEdge(g, v3, v4); + List<Vertex> expected = new ArrayList<>(); + expected.add(v4); + + TraversalQuery<Vertex> qb = new TraversalQuery<>(loader, g, v1); + QueryBuilder<Vertex> q = buildTestQuery(qb); + + List<Vertex> results = q.toList(); + + assertTrue("results match", expected.containsAll(results) && results.containsAll(expected)); + } + + + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java index c96450c2..cc419c67 100644 --- a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java @@ -34,7 +34,6 @@ import java.util.Map; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.junit.After; import org.junit.Before; @@ -58,6 +57,9 @@ import com.thinkaurelius.titan.core.TitanGraph; @Ignore public class DbAliasTest { + + + private TitanGraph graph; private final Version version = Version.v9; private final ModelType introspectorFactoryType = ModelType.MOXY; @@ -76,13 +78,13 @@ public class DbAliasTest { type, loader); } - + @After public void tearDown() { graph.tx().rollback(); graph.close(); } - + @Test public void checkOnWrite() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException { final String property = "persona-model-customization-id"; @@ -107,17 +109,17 @@ public class DbAliasTest { if (map.containsKey(PropertyMetadata.DB_ALIAS)) { dbPropertyName = map.get(PropertyMetadata.DB_ALIAS); } - + assertEquals("dbAlias is ", "model-customization-id", dbPropertyName); assertEquals("dbAlias property exists", "hello", v.property(dbPropertyName).orElse("")); assertEquals("model property does not", "missing", v.property(property).orElse("missing")); - + } - + @Test public void checkOnRead() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException, MalformedURLException { final String property = "persona-model-customization-id"; - + TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); Vertex v = graph.traversal().addV("vnf-id", "key1", "model-customization-id", "hello").next(); @@ -129,10 +131,9 @@ public class DbAliasTest { DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); Introspector obj = loader.introspectorFromName("generic-vnf"); serializer.dbToObject(Collections.singletonList(v), obj, 0, true, "false"); - + assertEquals("dbAlias property exists", "hello", obj.getValue(property)); - + } - - + } |