summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/pom.xml2852
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java12
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java51
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java72
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java37
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java68
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathRenameNodeTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java210
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java98
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java196
-rw-r--r--catalog-be/src/test/resources/paths/path-context.xml112
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java1087
-rw-r--r--catalog-fe/pom.xml1372
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java99
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java80
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java41
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java87
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java148
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java54
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java71
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java41
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java55
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java76
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java66
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java77
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java138
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java169
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java331
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java85
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java74
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java270
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java117
-rw-r--r--onboarding/pom.xml633
-rw-r--r--openecomp-be/backend/openecomp-sdc-security-util/pom.xml116
-rw-r--r--pom.xml854
-rw-r--r--utils/webseal-simulator/pom.xml235
38 files changed, 5079 insertions, 5015 deletions
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml
index e3988433a5..97cd8b6df0 100644
--- a/catalog-be/pom.xml
+++ b/catalog-be/pom.xml
@@ -1,1431 +1,1439 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>catalog-be</artifactId>
- <packaging>war</packaging>
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>sdc-main</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- </parent>
-
- <properties>
- <java-hamcrest.version>2.0.0.0</java-hamcrest.version>
- <swagger.version>${swagger-core-mvn-plugin.version}</swagger.version>
- <swagger-ui.version>3.25.0</swagger-ui.version>
- <maven-dependency-plugin.version>3.2.0</maven-dependency-plugin.version>
- <replacer.plugin.version>1.5.3</replacer.plugin.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>togglz-rest-services</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.woodstox</groupId>
- <artifactId>woodstox-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!--JSON and YAML Parsing-->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-yaml</artifactId>
- <version>${jackson.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.onap.sdc.common</groupId>
- <artifactId>onap-generic-artifact-browser-service</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Swagger Dependencies Start -->
- <dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-jaxrs2</artifactId>
- <version>${swagger.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>${swagger.version}</version>
- </dependency>
- <!-- Swagger Dependencies End -->
-
- <dependency>
- <groupId>org.hibernate.validator</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate.validator.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>common-app-api</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${ws.rs.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.openecomp.sdc.be</groupId>
- <artifactId>common-be</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.be</groupId>
- <artifactId>common-be</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.be</groupId>
- <artifactId>catalog-dao</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.openecomp.sdc.be</groupId>
- <artifactId>catalog-model</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Snake Yaml -->
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>${snakeyaml.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- File changes listener -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Gson -->
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- jersey -->
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jackson</artifactId>
- <version>${jersey-bom.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet-core</artifactId>
- <version>${jersey-bom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-multipart</artifactId>
- <version>${jersey-bom.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-spring4</artifactId>
- <version>${jersey-bom.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </exclusion>
- <!-- Transitive dependency of spring-bridge -->
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- </exclusion>
- </exclusions>
-
- </dependency>
-
- <!--asm-all-repackaged is a jersey dependency. in current version jersey depends on a version that was compiled using java 9 compiler
- currently our jetty (v9.3.6) does not support java 9. as soon as jetty gets upgraded we will remove this dependency-->
- <dependency>
- <groupId>org.glassfish.hk2.external</groupId>
- <artifactId>asm-all-repackaged</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-bean-validation</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- http client -->
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>${httpcore.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons-logging}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec}</version>
- <scope>compile</scope>
- </dependency>
- <!-- http client END -->
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${servlet-api.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jgit</groupId>
- <artifactId>org.eclipse.jgit</artifactId>
- <version>3.4.1.201406201815-r</version>
- </dependency>
-
- <!-- spring - used by A4C -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- <version>${spring.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Spring integration (optional) -->
- <dependency>
- <groupId>org.togglz</groupId>
- <artifactId>togglz-spring-web</artifactId>
- <version>${togglz.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.janino</groupId>
- <artifactId>janino</artifactId>
- <version>${janino.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.janino</groupId>
- <artifactId>commons-compiler</artifactId>
- <version>${janino.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.janusgraph</groupId>
- <artifactId>janusgraph-core</artifactId>
- <version>${janusgraph.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <artifactId>gremlin-groovy</artifactId>
- <groupId>org.apache.tinkerpop</groupId>
- </exclusion>
- <exclusion>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>commons-collections</artifactId>
- <groupId>commons-collections</groupId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.janusgraph</groupId>
- <artifactId>janusgraph-cql</artifactId>
- <version>${janusgraph.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>commons-collections</artifactId>
- <groupId>commons-collections</groupId>
- </exclusion>
- <exclusion>
- <artifactId>groovy</artifactId>
- <groupId>org.codehaus.groovy</groupId>
- </exclusion>
- <exclusion>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${lang3.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>${json-simple.version}</version>
- <scope>compile</scope>
-
- </dependency>
-
- <!-- functional java -->
- <dependency>
- <groupId>org.functionaljava</groupId>
- <artifactId>functionaljava</artifactId>
- <version>${functionaljava.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Aspects -->
- <dependency>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-aspects</artifactId>
- <version>${jcabi.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectjrt.version}</version>
- <scope>compile</scope>
- </dependency>
-
-
- <!-- CAMBRIA CLIENT for U-EB -->
- <dependency>
- <groupId>com.att.nsa</groupId>
- <artifactId>cambriaClient</artifactId>
- <version>1.2.1-oss</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>com.att.nsa</groupId>
- <artifactId>saClientLibrary</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20131018</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- CASSANDRA -->
- <dependency>
- <groupId>com.datastax.cassandra</groupId>
- <artifactId>cassandra-driver-core</artifactId>
- <version>${cassandra.driver.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.datastax.cassandra</groupId>
- <artifactId>cassandra-driver-mapping</artifactId>
- <version>${cassandra.driver.version}</version>
- <scope>compile</scope>
- </dependency>
- <!-- CASSANDRA END -->
-
- <!-- Inserted for ECOMP Portal Integration -->
- <dependency>
- <groupId>org.owasp.esapi</groupId>
- <artifactId>esapi</artifactId>
- <version>${org.owasp.esapi.version}</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.xmlgraphics</groupId>
- <artifactId>xmlgraphics-commons</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-fw</artifactId>
- <version>${ecomp.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>com.att.nsa</groupId>
- <artifactId>cambriaClient</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <groupId>org.onap.aaf.authz</groupId>
- <artifactId>aaf-cadi-aaf</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>aaf-cadi-core</artifactId>
- <groupId>org.onap.aaf.authz</groupId>
- </exclusion>
- <exclusion>
- <artifactId>commons-codec</artifactId>
- <groupId>commons-codec</groupId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!--Jetty Proxy-->
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-proxy</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-continuation</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- System metrics -->
- <dependency>
- <groupId>org.fusesource</groupId>
- <artifactId>sigar</artifactId>
- <version>${sigar.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
- <artifactId>dmaapClient</artifactId>
- <version>1.1.3</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>com.att.aft</groupId>
- <artifactId>dme2</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>apache-log4j-extras</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.att.aft</groupId>
- <artifactId>dme2</artifactId>
- <version>3.1.200-oss</version>
- <exclusions>
- <exclusion>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- CADI -->
- <dependency>
- <groupId>org.onap.aaf.authz</groupId>
- <artifactId>aaf-cadi-aaf</artifactId>
- <version>${cadi.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.datastax.cassandra</groupId>
- <artifactId>cassandra-driver-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- TEST -->
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.test-framework.providers</groupId>
- <artifactId>jersey-test-framework-provider-bundle</artifactId>
- <version>${jersey-bom.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-continuation</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey-bom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <version>${hamcrest.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>${hamcrest.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junitJupiter.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junitJupiter.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-commons</artifactId>
- <version>${junit.platform.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-engine</artifactId>
- <version>${junit.platform.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-junit-jupiter</artifactId>
- <version>${mockitoJupiter.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.cucumber</groupId>
- <artifactId>cucumber-java</artifactId>
- <version>${cucumber.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>io.cucumber</groupId>
- <artifactId>cucumber-junit</artifactId>
- <version>${cucumber.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jmockit</groupId>
- <artifactId>jmockit</artifactId>
- <version>${jmockit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.code.bean-matchers</groupId>
- <artifactId>bean-matchers</artifactId>
- <version>0.11</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.common</groupId>
- <artifactId>onap-tosca-datatype</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>${commons.collections.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.sdc-be-common</groupId>
- <artifactId>security-util-lib</artifactId>
- <version>${security.util.lib.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-tosca-lib</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.vnfsdk.validation</groupId>
- <artifactId>validation-pmdictionary</artifactId>
- <version>${onap.vnfsdk.validation.pmdictionary.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>com.googlecode.jmapper-framework</groupId>
- <artifactId>jmapper-core</artifactId>
- <version>${jMapper.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>catalog-be</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkCount>1C</forkCount>
- <reuseForks>false</reuseForks>
- </configuration>
- </plugin>
- <plugin>
- <!-- Download Swagger UI webjar. -->
- <artifactId>maven-dependency-plugin</artifactId>
- <version>${maven-dependency-plugin.version}</version>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.webjars</groupId>
- <artifactId>swagger-ui</artifactId>
- <version>${swagger-ui.version}</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- Replace the OpenAPI specification example URL with the local one. -->
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>replacer</artifactId>
- <version>${replacer.plugin.version}</version>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>replace</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <file>
- ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/index.html
- </file>
- <replacements>
- <replacement>
- <token>https://petstore.swagger.io/v2/swagger.json</token>
- <value>/sdc/openapi.json</value>
- </replacement>
- </replacements>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <packagingExcludes>WEB-INF\lib\slf4j-log4j*.jar,
- WEB-INF/classes/elasticsearch.yml,
- WEB-INF/classes/portal.properties
- </packagingExcludes>
- <archive>
- <manifestEntries>
- <SDC-Version>${project.version}</SDC-Version>
- </manifestEntries>
- <manifest>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
- </manifest>
- </archive>
- <attachClasses>true</attachClasses>
- <webResources combine.children="append">
- <resource>
- <directory>
- ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}
- </directory>
- <includes>
- <include>**/*.*</include>
- </includes>
- <targetPath>swagger-ui</targetPath>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.github.sylvainlaurent.maven</groupId>
- <artifactId>yaml-json-validator-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>validate</id>
- <phase>validate</phase>
- <goals>
- <goal>validate</goal>
- </goals>
- <configuration>
- <validationSets>
- <validationSet>
- <includes>
- <include>src/main/resources/**/*.y*ml</include>
- <include>src/test/resources/**/*.y*ml</include>
- </includes>
- <excludes>
- <exclude>
- src/test/resources/artifacts/pnfSoftwareInformation/**
- </exclude>
- </excludes>
- </validationSet>
- <validationSet>
- <includes>
- <include>src/main/resources/**/*.json</include>
- <include>src/test/resources/**/*.json</include>
- </includes>
- </validationSet>
- </validationSets>
- <skip>${skipYamlJsonValidator}</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-maven-plugin</artifactId>
- <version>${jcabi.maven.plugin.version}</version>
- <dependencies>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjtools</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <goals>
- <goal>ajc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>normatives</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>normatives</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>src/main/assembly/normatives.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <executions>
- <execution>
- <id>clean.sdc.backend.folder</id>
- <phase>clean</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <filesets>
- <fileset>
- <directory>
- sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default
- </directory>
- <followSymlinks>false</followSymlinks>
- <includes>
- <include>normatives.tar.gz</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-maven-plugin</artifactId>
- <version>${swagger-core-mvn-plugin.version}</version>
- <executions>
- <execution>
- <id>sdce-2-sdce-5</id>
- <phase>compile</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <contextId>sdce-2-sdce-5</contextId>
- <outputPath>${project.build.directory}/generated/swagger</outputPath>
- <outputFileName>swagger-sdce-2-sdce-5</outputFileName>
- <outputFormat>JSON</outputFormat>
- <configurationFilePath>
- ${project.basedir}/src/main/resources/swagger-config/sdce-2-sdce-5.yaml
- </configurationFilePath>
- <skip>${swagger.skip}</skip>
- </configuration>
- </execution>
- <execution>
- <id>sdce-4</id>
- <phase>compile</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <contextId>sdce-4</contextId>
- <outputPath>${project.build.directory}/generated/swagger</outputPath>
- <outputFileName>swagger-sdce-4</outputFileName>
- <outputFormat>JSON</outputFormat>
- <configurationFilePath>
- ${project.basedir}/src/main/resources/swagger-config/sdce-4.yaml
- </configurationFilePath>
- <skip>${swagger.skip}</skip>
- </configuration>
- </execution>
- <execution>
- <id>sdce-6</id>
- <phase>compile</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <contextId>sdce-6</contextId>
- <outputPath>${project.build.directory}/generated/swagger</outputPath>
- <outputFileName>swagger-sdce-6</outputFileName>
- <outputFormat>JSON</outputFormat>
- <configurationFilePath>
- ${project.basedir}/src/main/resources/swagger-config/sdce-6.yaml
- </configurationFilePath>
- <skip>${swagger.skip}</skip>
- </configuration>
- </execution>
- <execution>
- <id>sdce-7</id>
- <phase>compile</phase>
- <goals>
- <goal>resolve</goal>
- </goals>
- <configuration>
- <contextId>sdce-7</contextId>
- <outputPath>${project.build.directory}/generated/swagger</outputPath>
- <outputFileName>swagger-sdce-7</outputFileName>
- <outputFormat>JSON</outputFormat>
- <configurationFilePath>
- ${project.basedir}/src/main/resources/swagger-config/sdce-7.yaml
- </configurationFilePath>
- <skip>${swagger.skip}</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>com.googlecode.maven-download-plugin</groupId>
- <artifactId>download-maven-plugin</artifactId>
- <versionRange>[1.2.1,)</versionRange>
- <goals>
- <goal>wget</goal>
- </goals>
- </pluginExecutionFilter>
- </pluginExecution>
-
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-maven-plugin</artifactId>
- <versionRange>[0.0,)</versionRange>
- <goals>
- <goal>ajc</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute/>
- </action>
- </pluginExecution>
-
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <!-- Swagger Plugins End -->
- </build>
-
- <profiles>
- <profile>
- <id>docker</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <artifactId>catalog-be</artifactId>
+
+ <build>
+ <finalName>catalog-be</finalName>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <artifactId>lifecycle-mapping</artifactId>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <artifactId>download-maven-plugin</artifactId>
+ <goals>
+ <goal>wget</goal>
+ </goals>
+ <groupId>com.googlecode.maven-download-plugin</groupId>
+ <versionRange>[1.2.1,)</versionRange>
+ </pluginExecutionFilter>
+ </pluginExecution>
+
+ <pluginExecution>
+ <action>
+ <execute/>
+ </action>
+ <pluginExecutionFilter>
+ <artifactId>jcabi-maven-plugin</artifactId>
+ <goals>
+ <goal>ajc</goal>
+ </goals>
+ <groupId>com.jcabi</groupId>
+ <versionRange>[0.0,)</versionRange>
+ </pluginExecutionFilter>
+ </pluginExecution>
+
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ <groupId>org.eclipse.m2e</groupId>
+ <version>1.0.0</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-normatives</id>
- <phase>package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <outputDirectory>
- sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default
- </outputDirectory>
- <resources>
- <resource>
- <directory>${project.build.directory}</directory>
- <includes>
- <include>normatives.tar.gz</include>
- </includes>
- </resource>
- </resources>
+ <forkCount>1C</forkCount>
+ <reuseForks>false</reuseForks>
</configuration>
- </execution>
- <execution>
- <id>copy-sdc-be-py</id>
- <phase>verify</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <!-- Download Swagger UI webjar. -->
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <artifactId>swagger-ui</artifactId>
+ <groupId>org.webjars</groupId>
+ <version>${swagger-ui.version}</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
+ </configuration>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ </execution>
+ </executions>
+ <version>${maven-dependency-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <!-- Replace the OpenAPI specification example URL with the local one. -->
+ <artifactId>replacer</artifactId>
<configuration>
- <outputDirectory>
- sdc-backend-init/
- </outputDirectory>
- <resources>
- <resource>
- <directory>
- ${project.parent.basedir}/catalog-be/src/main/resources/
- </directory>
- <includes>
- <include>scripts/sdcBePy/**</include>
- <inculde>scripts/setup.py</inculde>
- </includes>
- </resource>
- </resources>
+ <file>
+ ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/index.html
+ </file>
+ <replacements>
+ <replacement>
+ <token>https://petstore.swagger.io/v2/swagger.json</token>
+ <value>/sdc/openapi.json</value>
+ </replacement>
+ </replacements>
</configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <configuration>
- <verbose>${verbose}</verbose>
- <apiVersion>${docker.api.version}</apiVersion>
- <registry>nexus3.onap.org:10001</registry>
- <authConfig>
- <pull>
- <username>docker</username>
- <password>docker</password>
- </pull>
- </authConfig>
- <images>
-
- <!-- Build backend image -->
- <image>
- <name>onap/sdc-backend</name>
- <alias>sdc-backend</alias>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>backend</dockerFileDir>
- <tags>
- <tag>latest</tag>
- <tag>
- ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
- </tag>
- <tag>
- ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
- </tag>
- </tags>
- <assembly>
- <descriptor>backend/backend-files.xml</descriptor>
- <name>onap-sdc-backend</name>
- </assembly>
- </build>
- </image>
- <!-- Build backend-init image -->
- <image>
- <name>onap/sdc-backend-init</name>
- <alias>sdc-backend-init</alias>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${project.basedir}/sdc-backend-init
- </dockerFileDir>
- <tags>
- <tag>latest</tag>
- <tag>
- ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
- </tag>
- <tag>
- ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
- </tag>
- </tags>
- </build>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>clean-images</id>
- <phase>pre-clean</phase>
- <goals>
- <goal>remove</goal>
- </goals>
+ <executions>
+ <execution>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ </execution>
+ </executions>
+ <groupId>com.google.code.maven-replacer-plugin</groupId>
+ <version>${replacer.plugin.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
<configuration>
- <removeAll>true</removeAll>
- <image>onap/sdc-backend,onap/sdc-backend-init</image>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ </manifest>
+ <manifestEntries>
+ <SDC-Version>${project.version}</SDC-Version>
+ </manifestEntries>
+ </archive>
+ <attachClasses>true</attachClasses>
+ <packagingExcludes>WEB-INF\lib\slf4j-log4j*.jar,
+ WEB-INF/classes/elasticsearch.yml,
+ WEB-INF/classes/portal.properties
+ </packagingExcludes>
+ <webResources combine.children="append">
+ <resource>
+ <directory>
+ ${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}
+ </directory>
+ <includes>
+ <include>**/*.*</include>
+ </includes>
+ <targetPath>swagger-ui</targetPath>
+ </resource>
+ </webResources>
</configuration>
- </execution>
-
- <execution>
- <id>generate-images</id>
- <phase>install</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
-
- <execution>
- <id>push-images</id>
- <phase>deploy</phase>
- <goals>
- <goal>push</goal>
- </goals>
- <configuration>
- <image>onap/sdc-backend,onap/sdc-backend-init</image>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>yaml-json-validator-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <skip>${skipYamlJsonValidator}</skip>
+ <validationSets>
+ <validationSet>
+ <excludes>
+ <exclude>
+ src/test/resources/artifacts/pnfSoftwareInformation/**
+ </exclude>
+ </excludes>
+ <includes>
+ <include>src/main/resources/**/*.y*ml</include>
+ <include>src/test/resources/**/*.y*ml</include>
+ </includes>
+ </validationSet>
+ <validationSet>
+ <includes>
+ <include>src/main/resources/**/*.json</include>
+ <include>src/test/resources/**/*.json</include>
+ </includes>
+ </validationSet>
+ </validationSets>
+ </configuration>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <id>validate</id>
+ <phase>validate</phase>
+ </execution>
+ </executions>
+ <groupId>com.github.sylvainlaurent.maven</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>jcabi-maven-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <artifactId>aspectjtools</artifactId>
+ <groupId>org.aspectj</groupId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>aspectjweaver</artifactId>
+ <groupId>org.aspectj</groupId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ajc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <groupId>com.jcabi</groupId>
+ <version>${jcabi.maven.plugin.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/main/assembly/normatives.xml</descriptor>
+ </descriptors>
+ <finalName>normatives</finalName>
+ </configuration>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <id>normatives</id>
+ <phase>prepare-package</phase>
+ </execution>
+ </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>
+ sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default
+ </directory>
+ <followSymlinks>false</followSymlinks>
+ <includes>
+ <include>normatives.tar.gz</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <id>clean.sdc.backend.folder</id>
+ <phase>clean</phase>
+ </execution>
+ </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <configurationFilePath>
+ ${project.basedir}/src/main/resources/swagger-config/sdce-2-sdce-5.yaml
+ </configurationFilePath>
+ <contextId>sdce-2-sdce-5</contextId>
+ <outputFileName>swagger-sdce-2-sdce-5</outputFileName>
+ <outputFormat>JSON</outputFormat>
+ <outputPath>${project.build.directory}/generated/swagger</outputPath>
+ <skip>${swagger.skip}</skip>
+ </configuration>
+ <goals>
+ <goal>resolve</goal>
+ </goals>
+ <id>sdce-2-sdce-5</id>
+ <phase>compile</phase>
+ </execution>
+ <execution>
+ <configuration>
+ <configurationFilePath>
+ ${project.basedir}/src/main/resources/swagger-config/sdce-4.yaml
+ </configurationFilePath>
+ <contextId>sdce-4</contextId>
+ <outputFileName>swagger-sdce-4</outputFileName>
+ <outputFormat>JSON</outputFormat>
+ <outputPath>${project.build.directory}/generated/swagger</outputPath>
+ <skip>${swagger.skip}</skip>
+ </configuration>
+ <goals>
+ <goal>resolve</goal>
+ </goals>
+ <id>sdce-4</id>
+ <phase>compile</phase>
+ </execution>
+ <execution>
+ <configuration>
+ <configurationFilePath>
+ ${project.basedir}/src/main/resources/swagger-config/sdce-6.yaml
+ </configurationFilePath>
+ <contextId>sdce-6</contextId>
+ <outputFileName>swagger-sdce-6</outputFileName>
+ <outputFormat>JSON</outputFormat>
+ <outputPath>${project.build.directory}/generated/swagger</outputPath>
+ <skip>${swagger.skip}</skip>
+ </configuration>
+ <goals>
+ <goal>resolve</goal>
+ </goals>
+ <id>sdce-6</id>
+ <phase>compile</phase>
+ </execution>
+ <execution>
+ <configuration>
+ <configurationFilePath>
+ ${project.basedir}/src/main/resources/swagger-config/sdce-7.yaml
+ </configurationFilePath>
+ <contextId>sdce-7</contextId>
+ <outputFileName>swagger-sdce-7</outputFileName>
+ <outputFormat>JSON</outputFormat>
+ <outputPath>${project.build.directory}/generated/swagger</outputPath>
+ <skip>${swagger.skip}</skip>
+ </configuration>
+ <goals>
+ <goal>resolve</goal>
+ </goals>
+ <id>sdce-7</id>
+ <phase>compile</phase>
+ </execution>
+ </executions>
+ <groupId>io.swagger.core.v3</groupId>
+ <version>${swagger-core-mvn-plugin.version}</version>
+ </plugin>
</plugins>
- </build>
- </profile>
- </profiles>
+ <!-- Swagger Plugins End -->
+ </build>
+ <dependencies>
+ <dependency>
+ <artifactId>togglz-rest-services</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>woodstox-core</artifactId>
+ <groupId>com.fasterxml.woodstox</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!--JSON and YAML Parsing-->
+ <dependency>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jackson-databind</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>onap-generic-artifact-browser-service</artifactId>
+ <groupId>org.onap.sdc.common</groupId>
+ <scope>compile</scope>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Swagger Dependencies Start -->
+ <dependency>
+ <artifactId>swagger-jaxrs2</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>io.swagger.core.v3</groupId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>swagger-annotations</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <!-- Swagger Dependencies End -->
+
+ <dependency>
+ <artifactId>hibernate-validator</artifactId>
+ <groupId>org.hibernate.validator</groupId>
+ <version>${hibernate.validator.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>common-app-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <groupId>javax.ws.rs</groupId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>common-be</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <scope>compile</scope>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>common-be</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>catalog-dao</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>catalog-model</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>logback-classic</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <scope>compile</scope>
+ <version>${logback.version}</version>
+ </dependency>
+
+ <!-- Snake Yaml -->
+ <dependency>
+ <artifactId>snakeyaml</artifactId>
+ <groupId>org.yaml</groupId>
+ <scope>compile</scope>
+ <version>${snakeyaml.version}</version>
+ </dependency>
+
+ <!-- File changes listener -->
+ <dependency>
+ <artifactId>commons-jci-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>commons-io</artifactId>
+ <groupId>commons-io</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.apache.commons</groupId>
+ <scope>compile</scope>
+ <version>${commons-jci-core.version}</version>
+ </dependency>
+
+ <!-- Gson -->
+ <dependency>
+ <artifactId>gson</artifactId>
+ <groupId>com.google.code.gson</groupId>
+ <scope>compile</scope>
+ <version>${gson.version}</version>
+ </dependency>
+
+ <!-- jersey -->
+ <dependency>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <scope>compile</scope>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-media-multipart</artifactId>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <scope>compile</scope>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jersey-spring4</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-web</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-beans</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-aop</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <!-- Transitive dependency of spring-bridge -->
+ <exclusion>
+ <artifactId>spring-context</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>hibernate-validator</artifactId>
+ <groupId>org.hibernate</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.glassfish.jersey.ext</groupId>
+ <version>${jersey-bom.version}</version>
+
+ </dependency>
+
+ <!--asm-all-repackaged is a jersey dependency. in current version jersey depends on a version that was compiled using java 9 compiler
+ currently our jetty (v9.3.6) does not support java 9. as soon as jetty gets upgraded we will remove this dependency-->
+ <dependency>
+ <artifactId>asm-all-repackaged</artifactId>
+ <groupId>org.glassfish.hk2.external</groupId>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-bean-validation</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>hibernate-validator</artifactId>
+ <groupId>org.hibernate</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.glassfish.jersey.ext</groupId>
+ </dependency>
+
+ <!-- http client -->
+ <dependency>
+ <artifactId>httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <scope>compile</scope>
+ <version>${httpclient.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>httpcore</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <scope>compile</scope>
+ <version>${httpcore.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-logging</artifactId>
+ <groupId>commons-logging</groupId>
+ <scope>compile</scope>
+ <version>${commons-logging}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-codec</artifactId>
+ <groupId>commons-codec</groupId>
+ <scope>compile</scope>
+ <version>${commons-codec}</version>
+ </dependency>
+ <!-- http client END -->
+
+ <dependency>
+ <artifactId>javax.servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ <scope>provided</scope>
+ <version>${servlet-api.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>org.eclipse.jgit</artifactId>
+ <groupId>org.eclipse.jgit</groupId>
+ <version>3.4.1.201406201815-r</version>
+ </dependency>
+
+ <!-- spring - used by A4C -->
+ <dependency>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-context</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-expression</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-webmvc</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-expression</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-web</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-aop</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-beans</artifactId>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-expression</artifactId>
+ <groupId>org.springframework</groupId>
+ <scope>compile</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <!-- Spring integration (optional) -->
+ <dependency>
+ <artifactId>togglz-spring-web</artifactId>
+ <groupId>org.togglz</groupId>
+ <version>${togglz.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>janino</artifactId>
+ <groupId>org.codehaus.janino</groupId>
+ <scope>compile</scope>
+ <version>${janino.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-compiler</artifactId>
+ <groupId>org.codehaus.janino</groupId>
+ <scope>compile</scope>
+ <version>${janino.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ <scope>compile</scope>
+ <version>${guava.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>janusgraph-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>gremlin-groovy</artifactId>
+ <groupId>org.apache.tinkerpop</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>json</artifactId>
+ <groupId>org.json</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-collections</artifactId>
+ <groupId>commons-collections</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>libthrift</artifactId>
+ <groupId>org.apache.thrift</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-io</artifactId>
+ <groupId>commons-io</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-codec</artifactId>
+ <groupId>commons-codec</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>dom4j</artifactId>
+ <groupId>dom4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.janusgraph</groupId>
+ <scope>compile</scope>
+ <version>${janusgraph.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>janusgraph-cql</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>json</artifactId>
+ <groupId>org.json</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-collections</artifactId>
+ <groupId>commons-collections</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>groovy</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>netty-all</artifactId>
+ <groupId>io.netty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.janusgraph</groupId>
+ <scope>compile</scope>
+ <version>${janusgraph.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-lang3</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <scope>compile</scope>
+ <version>${lang3.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>json-simple</artifactId>
+ <groupId>com.googlecode.json-simple</groupId>
+ <scope>compile</scope>
+ <version>${json-simple.version}</version>
+
+ </dependency>
+
+ <!-- functional java -->
+ <dependency>
+ <artifactId>functionaljava</artifactId>
+ <groupId>org.functionaljava</groupId>
+ <scope>compile</scope>
+ <version>${functionaljava.version}</version>
+ </dependency>
+
+ <!-- Aspects -->
+ <dependency>
+ <artifactId>jcabi-aspects</artifactId>
+ <groupId>com.jcabi</groupId>
+ <scope>compile</scope>
+ <version>${jcabi.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>aspectjrt</artifactId>
+ <groupId>org.aspectj</groupId>
+ <scope>compile</scope>
+ <version>${aspectjrt.version}</version>
+ </dependency>
+
+
+ <!-- CAMBRIA CLIENT for U-EB -->
+ <dependency>
+ <artifactId>cambriaClient</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>saClientLibrary</artifactId>
+ <groupId>com.att.nsa</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.att.nsa</groupId>
+ <scope>compile</scope>
+ <version>1.2.1-oss</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>json</artifactId>
+ <groupId>org.json</groupId>
+ <scope>compile</scope>
+ <version>20131018</version>
+ </dependency>
+
+ <!-- CASSANDRA -->
+ <dependency>
+ <artifactId>cassandra-driver-core</artifactId>
+ <groupId>com.datastax.cassandra</groupId>
+ <scope>compile</scope>
+ <version>${cassandra.driver.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>cassandra-driver-mapping</artifactId>
+ <groupId>com.datastax.cassandra</groupId>
+ <scope>compile</scope>
+ <version>${cassandra.driver.version}</version>
+ </dependency>
+ <!-- CASSANDRA END -->
+
+ <!-- Inserted for ECOMP Portal Integration -->
+ <dependency>
+ <artifactId>esapi</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>xercesImpl</artifactId>
+ <groupId>xerces</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-fileupload</artifactId>
+ <groupId>commons-fileupload</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xmlgraphics-commons</artifactId>
+ <groupId>org.apache.xmlgraphics</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis-ext</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.owasp.esapi</groupId>
+ <version>${org.owasp.esapi.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>epsdk-fw</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>cambriaClient</artifactId>
+ <groupId>com.att.nsa</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>aaf-cadi-aaf</artifactId>
+ <groupId>org.onap.aaf.authz</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>aaf-cadi-core</artifactId>
+ <groupId>org.onap.aaf.authz</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-codec</artifactId>
+ <groupId>commons-codec</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.portal.sdk</groupId>
+ <scope>compile</scope>
+ <version>${ecomp.version}</version>
+ </dependency>
+
+ <!--Jetty Proxy-->
+ <dependency>
+ <artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jetty-proxy</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jetty-servlets</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-continuation</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+ <!-- System metrics -->
+ <dependency>
+ <artifactId>sigar</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.fusesource</groupId>
+ <scope>compile</scope>
+ <version>${sigar.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>dmaapClient</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>dme2</artifactId>
+ <groupId>com.att.aft</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>apache-log4j-extras</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
+ <scope>compile</scope>
+ <version>1.1.3</version>
+ </dependency>
+ <dependency>
+ <artifactId>dme2</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jms</artifactId>
+ <groupId>javax.jms</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.att.aft</groupId>
+ <version>3.1.200-oss</version>
+ </dependency>
+
+ <!-- CADI -->
+ <dependency>
+ <artifactId>aaf-cadi-aaf</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>cassandra-driver-core</artifactId>
+ <groupId>com.datastax.cassandra</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.aaf.authz</groupId>
+ <version>${cadi.version}</version>
+ </dependency>
+
+ <!-- TEST -->
+ <dependency>
+ <artifactId>assertj-core</artifactId>
+ <groupId>org.assertj</groupId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-test-framework-provider-bundle</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-server</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-continuation</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+ <scope>test</scope>
+ <type>pom</type>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-client</artifactId>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jetty-webapp</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-servlet</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>test</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>hamcrest</artifactId>
+ <groupId>org.hamcrest</groupId>
+ <scope>test</scope>
+ <version>${hamcrest.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>hamcrest-library</artifactId>
+ <groupId>org.hamcrest</groupId>
+ <scope>test</scope>
+ <version>${hamcrest.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>junit-jupiter-api</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <scope>test</scope>
+ <version>${junitJupiter.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>junit-jupiter</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <scope>test</scope>
+ <version>${junitJupiter.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>junit-platform-commons</artifactId>
+ <groupId>org.junit.platform</groupId>
+ <scope>test</scope>
+ <version>${junit.platform.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>junit-platform-engine</artifactId>
+ <groupId>org.junit.platform</groupId>
+ <scope>test</scope>
+ <version>${junit.platform.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <groupId>org.mockito</groupId>
+ <scope>test</scope>
+ <version>${mockitoJupiter.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-test</artifactId>
+ <groupId>org.springframework</groupId>
+ <scope>test</scope>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>spring-tx</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <version>${spring.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>cucumber-java</artifactId>
+ <groupId>io.cucumber</groupId>
+ <scope>test</scope>
+ <version>${cucumber.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>cucumber-junit</artifactId>
+ <groupId>io.cucumber</groupId>
+ <scope>test</scope>
+ <version>${cucumber.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jmockit</artifactId>
+ <groupId>org.jmockit</groupId>
+ <scope>test</scope>
+ <version>${jmockit.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>bean-matchers</artifactId>
+ <groupId>com.google.code.bean-matchers</groupId>
+ <scope>test</scope>
+ <version>0.11</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>groovy</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ <version>${groovy.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>netty-handler</artifactId>
+ <groupId>io.netty</groupId>
+ </dependency>
+ <dependency>
+ <artifactId>onap-tosca-datatype</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.sdc.common</groupId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-collections4</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <version>${commons.collections.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>security-util-lib</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ <groupId>org.springframework.boot</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.sdc.sdc-be-common</groupId>
+ <version>${security.util.lib.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>validation-pmdictionary</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.vnfsdk.validation</groupId>
+ <version>${onap.vnfsdk.validation.pmdictionary.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jmapper-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>xstream</artifactId>
+ <groupId>com.thoughtworks.xstream</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.googlecode.jmapper-framework</groupId>
+ <version>${jMapper.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>war</packaging>
+
+ <parent>
+ <artifactId>sdc-main</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.10.0-SNAPSHOT</version>
+ </parent>
+
+ <profiles>
+ <profile>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>
+ sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default
+ </outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.build.directory}</directory>
+ <includes>
+ <include>normatives.tar.gz</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <id>copy-normatives</id>
+ <phase>package</phase>
+ </execution>
+ <execution>
+ <configuration>
+ <outputDirectory>
+ sdc-backend-init/
+ </outputDirectory>
+ <resources>
+ <resource>
+ <directory>
+ ${project.parent.basedir}/catalog-be/src/main/resources/
+ </directory>
+ <includes>
+ <include>scripts/sdcBePy/**</include>
+ <inculde>scripts/setup.py</inculde>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <id>copy-sdc-be-py</id>
+ <phase>verify</phase>
+ </execution>
+ </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <apiVersion>${docker.api.version}</apiVersion>
+ <authConfig>
+ <pull>
+ <password>docker</password>
+ <username>docker</username>
+ </pull>
+ </authConfig>
+ <images>
+
+ <!-- Build backend image -->
+ <image>
+ <alias>sdc-backend</alias>
+ <build>
+ <assembly>
+ <descriptor>backend/backend-files.xml</descriptor>
+ <name>onap-sdc-backend</name>
+ </assembly>
+ <cleanup>try</cleanup>
+ <dockerFileDir>backend</dockerFileDir>
+ <tags>
+ <tag>latest</tag>
+ <tag>
+ ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
+ </tag>
+ <tag>
+ ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
+ </tag>
+ </tags>
+ </build>
+ <name>onap/sdc-backend</name>
+ </image>
+ <!-- Build backend-init image -->
+ <image>
+ <alias>sdc-backend-init</alias>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${project.basedir}/sdc-backend-init
+ </dockerFileDir>
+ <tags>
+ <tag>latest</tag>
+ <tag>
+ ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
+ </tag>
+ <tag>
+ ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
+ </tag>
+ </tags>
+ </build>
+ <name>onap/sdc-backend-init</name>
+ </image>
+ </images>
+ <registry>nexus3.onap.org:10001</registry>
+ <verbose>${verbose}</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <configuration>
+ <image>onap/sdc-backend,onap/sdc-backend-init</image>
+ <removeAll>true</removeAll>
+ </configuration>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ </execution>
+
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ <id>generate-images</id>
+ <phase>install</phase>
+ </execution>
+
+ <execution>
+ <configuration>
+ <image>onap/sdc-backend,onap/sdc-backend-init</image>
+ </configuration>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ </execution>
+ </executions>
+ <groupId>io.fabric8</groupId>
+ </plugin>
+ </plugins>
+ </build>
+ <id>docker</id>
+ </profile>
+ </profiles>
+
+ <properties>
+ <java-hamcrest.version>2.0.0.0</java-hamcrest.version>
+ <maven-dependency-plugin.version>3.2.0</maven-dependency-plugin.version>
+ <replacer.plugin.version>1.5.3</replacer.plugin.version>
+ <swagger-ui.version>3.25.0</swagger-ui.version>
+ <swagger.version>${swagger-core-mvn-plugin.version}</swagger.version>
+ </properties>
</project>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java
index b668ae7efc..3531fe786b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java
@@ -28,6 +28,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
@@ -40,10 +42,7 @@ import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter;
import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
-/**
- * @author KATYR
- * @since November 19, 2017
- */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ForwardingPathToscaUtil {
public static final String FORWARDS_TO_TOSCA_NAME = "org.openecomp.relationships.ForwardsTo";
@@ -97,8 +96,9 @@ public class ForwardingPathToscaUtil {
}
private static String fetchNodeName(Service service, String nodeId) {
- if (service.getComponentInstanceByName(nodeId).isPresent()) {
- return service.getComponentInstanceByName(nodeId).get().getName();
+ final Optional<ComponentInstance> componentInstanceByName = service.getComponentInstanceByName(nodeId);
+ if (componentInstanceByName.isPresent()) {
+ return componentInstanceByName.get().getName();
} else {
return "";
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java
index 8a575629af..50eaea9ad2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,16 @@
package org.openecomp.sdc.be.components.merge.path;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
-import org.junit.Before;
-import org.junit.Test;
+import java.util.Set;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -36,15 +43,6 @@ import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.common.api.UserRoleEnum;
-import java.util.Set;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.Mockito.when;
-
public class ComponentInstanceForwardingPathMergeTest extends BaseForwardingPathVersionChangeTest {
@InjectMocks
@@ -57,7 +55,7 @@ public class ComponentInstanceForwardingPathMergeTest extends BaseForwardingPath
private ToscaOperationFacade toscaOperationFacade;
private User user;
- @Before
+ @BeforeEach
public void setUpData() {
MockitoAnnotations.initMocks(this);
user = new User();
@@ -73,7 +71,6 @@ public class ComponentInstanceForwardingPathMergeTest extends BaseForwardingPath
Component componentResponseFormatEither = testInstance
.mergeDataAfterCreate(user, dataHolder, newNodeAC, "3344");
assertNotNull(componentResponseFormatEither);
- assertTrue(componentResponseFormatEither != null);
assertEquals(newNodeAC, componentResponseFormatEither);
}
@@ -102,18 +99,18 @@ public class ComponentInstanceForwardingPathMergeTest extends BaseForwardingPath
@Test
public void mergeShouldUpdate() {
- when(serviceBusinessLogic.updateForwardingPath(any(), any(), any(), anyBoolean()))
- .then(invocationOnMock -> service);
- when(toscaOperationFacade.getToscaFullElement(any())).thenReturn(Either.left(newNodeAC));
- testInstance.saveDataBeforeMerge(dataHolder, service, nodeACI, newNodeAC);
- assertEquals(nodeACI.getName(), dataHolder.getOrigComponentInstId());
-
- // Change internal ci, just like change version do
- service.getComponentInstances().remove(nodeACI);
- service.getComponentInstances().add(newNodeACI);
-
- Component component = testInstance.mergeDataAfterCreate(user, dataHolder, service, newNodeA);
- assertNotNull(component);
+ when(serviceBusinessLogic.updateForwardingPath(any(), any(), any(), anyBoolean()))
+ .then(invocationOnMock -> service);
+ when(toscaOperationFacade.getToscaFullElement(any())).thenReturn(Either.left(newNodeAC));
+ testInstance.saveDataBeforeMerge(dataHolder, service, nodeACI, newNodeAC);
+ assertEquals(nodeACI.getName(), dataHolder.getOrigComponentInstId());
+
+ // Change internal ci, just like change version do
+ service.getComponentInstances().remove(nodeACI);
+ service.getComponentInstances().add(newNodeACI);
+
+ Component component = testInstance.mergeDataAfterCreate(user, dataHolder, service, newNodeA);
+ assertNotNull(component);
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
index 0fa7ca8cb6..e9c1d40121 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.components.path;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -33,13 +33,15 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
import org.openecomp.sdc.be.components.path.beans.JanusGraphTestSetup;
import org.openecomp.sdc.be.components.path.utils.GraphTestUtils;
import org.openecomp.sdc.be.components.validation.service.ServiceValidator;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
@@ -63,6 +65,8 @@ import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.common.datastructure.UserContext;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.common.util.ThreadLocalsHolder;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -70,42 +74,44 @@ import org.springframework.beans.factory.annotation.Autowired;
public abstract class BaseForwardingPathTest extends BeConfDependentTest implements ForwardingPathTestUtils {
-
+ static final String FORWARDING_PATH_ID = "forwarding_pathId";
+ static final String HTTP_PROTOCOL = "http";
+ private static final String CATEGORY_NAME = "cat_name";
+ private static final String INSTANTIATION_TYPE = "A-la-carte";
+ private static final String CAPABILITY_NAME_1 = "CP1";
+ private static final String CAPABILITY_NAME_2 = "CP2";
+ private static final String CAPABILITY_NAME_3 = "CP3";
+ private static final String CI_NAME_1 = "CI1";
+ private static final String CI_NAME_2 = "CI2";
+ private static final String CI_NAME_3 = "CI3";
protected User user;
- private ForwardingPathDataDefinition forwardingPathDataDefinition;
-
@Autowired
protected JanusGraphClient janusGraphClient;
-
@Autowired
protected CapabilityRequirementConverter capabiltyRequirementConvertor;
-
@Autowired
protected ToscaOperationFacade toscaOperationFacade;
-
@Autowired
protected ServiceBusinessLogic bl;
-
- private CatalogOperation catalogOperation = mock(CatalogOperation.class);
-
- private ServiceValidator serviceValidator = mock(ServiceValidator.class);
@Autowired
protected IElementOperation elementDao;
-
@Autowired
protected ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
-
@javax.annotation.Resource
protected JanusGraphDao janusGraphDao;
+ private ForwardingPathDataDefinition forwardingPathDataDefinition;
+ private CatalogOperation catalogOperation = mock(CatalogOperation.class);
+ private ServiceValidator serviceValidator = mock(ServiceValidator.class);
+ private CategoryDefinition categoryDefinition;
- @Before
+ @BeforeEach
public void initJanusGraph() {
JanusGraphTestSetup.createGraph(janusGraphClient.getGraph().left().value());
categoryDefinition = new CategoryDefinition();
categoryDefinition.setName(CATEGORY_NAME);
}
- @Before
+ @BeforeEach
public void initUser() {
// User data and management
user = new User();
@@ -115,25 +121,11 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme
user.setRole(Role.ADMIN.name());
Set<String> userRole = new HashSet<>();
userRole.add(user.getRole());
- UserContext userContext = new UserContext(user.getUserId(), userRole, user.getFirstName() ,user.getLastName());
+ UserContext userContext = new UserContext(user.getUserId(), userRole, user.getFirstName(), user.getLastName());
ThreadLocalsHolder.setUserContext(userContext);
bl.setServiceValidator(serviceValidator);
}
-
- private CategoryDefinition categoryDefinition;
- private static final String CATEGORY_NAME = "cat_name";
- static final String FORWARDING_PATH_ID = "forwarding_pathId";
- static final String HTTP_PROTOCOL = "http";
- private static final String INSTANTIATION_TYPE = "A-la-carte";
- private static final String CAPABILITY_NAME_1 = "CP1";
- private static final String CAPABILITY_NAME_2 = "CP2";
- private static final String CAPABILITY_NAME_3 = "CP3";
- private static final String CI_NAME_1 = "CI1";
- private static final String CI_NAME_2 = "CI2";
- private static final String CI_NAME_3 = "CI3";
-
-
private void initGraph() {
Map<GraphPropertyEnum, Object> props = new HashMap<>();
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
@@ -176,7 +168,7 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme
private void createCategory() {
Either<CategoryDefinition, ActionStatus> category = elementDao.createCategory(categoryDefinition, NodeTypeEnum.ServiceNewCategory);
- assertTrue("Failed to create category", category.isLeft());
+ assertTrue(category.isLeft(), "Failed to create category");
}
private void createServiceCategory(String categoryName) {
@@ -196,7 +188,7 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme
assertTrue(catRes.isLeft());
}
- Service initForwardPath() {
+ public Service initForwardPath() {
ForwardingPathDataDefinition forwardingPathDataDefinition = createMockPath();
Service service = new Service();
service.setUniqueId(FORWARDING_PATH_ID);
@@ -213,8 +205,10 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme
forwardingPathDataDefinition.setDestinationPortNumber("414155");
forwardingPathDataDefinition.setProtocol(HTTP_PROTOCOL);
org.openecomp.sdc.be.datatypes.elements.ListDataDefinition<org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition> forwardingPathElementDataDefinitionListDataDefinition = new org.openecomp.sdc.be.datatypes.elements.ListDataDefinition<>();
- forwardingPathElementDataDefinitionListDataDefinition.add(new ForwardingPathElementDataDefinition(CI_NAME_1, CI_NAME_2, CAPABILITY_NAME_1, CAPABILITY_NAME_2, "2222", "5555"));
- forwardingPathElementDataDefinitionListDataDefinition.add(new ForwardingPathElementDataDefinition(CI_NAME_2, CI_NAME_3, CAPABILITY_NAME_2, CAPABILITY_NAME_3, "4", "44"));
+ forwardingPathElementDataDefinitionListDataDefinition.add(
+ new ForwardingPathElementDataDefinition(CI_NAME_1, CI_NAME_2, CAPABILITY_NAME_1, CAPABILITY_NAME_2, "2222", "5555"));
+ forwardingPathElementDataDefinitionListDataDefinition.add(
+ new ForwardingPathElementDataDefinition(CI_NAME_2, CI_NAME_3, CAPABILITY_NAME_2, CAPABILITY_NAME_3, "4", "44"));
forwardingPathDataDefinition.setPathElements(forwardingPathElementDataDefinitionListDataDefinition);
return forwardingPathDataDefinition;
}
@@ -222,7 +216,7 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme
Service createService() {
Either<Service, ResponseFormat> serviceCreateResult;
serviceCreateResult = bl.createService(createTestService(), user);
- assertTrue("Failed to create service", serviceCreateResult.isLeft());
+ assertTrue(serviceCreateResult.isLeft(), "Failed to create service");
return serviceCreateResult.left().value();
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java
index 5eca2b35a4..d4d0b9150c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,11 @@
package org.openecomp.sdc.be.components.path;
import com.google.common.collect.Lists;
-import org.junit.Before;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.BeforeEach;
import org.openecomp.sdc.be.components.merge.instance.DataForMergeHolder;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
@@ -33,27 +37,22 @@ import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
public abstract class BaseForwardingPathVersionChangeTest {
- protected Service service;
- protected ComponentInstance nodeACI;
- protected ComponentInstance newNodeACI;
- protected Component newNodeAC;
- protected Component newNodeWithoutCapability;
- protected DataForMergeHolder dataHolder;
+
protected static final String nodeA = "nodeA";
protected static final String NODE_A_FORWARDER_CAPABILITY = "nodeA_FORWARDER_CAPABILITY";
protected static final String nodeB = "nodeB";
protected static final String newNodeA = "newNodeA";
protected static final String fpName = "fpName";
protected static final String FPId = "1122";
+ protected Service service;
+ protected ComponentInstance nodeACI;
+ protected ComponentInstance newNodeACI;
+ protected Component newNodeAC;
+ protected Component newNodeWithoutCapability;
+ protected DataForMergeHolder dataHolder;
-
- @Before
+ @BeforeEach
public void initService() {
service = new Service();
ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition(fpName);
@@ -64,7 +63,7 @@ public abstract class BaseForwardingPathVersionChangeTest {
= new ListDataDefinition<>();
forwardingPathElementListDataDefinition.add(
- new ForwardingPathElementDataDefinition(nodeA, nodeB, NODE_A_FORWARDER_CAPABILITY, "nodeBcpType" , "nodeDcpName",
+ new ForwardingPathElementDataDefinition(nodeA, nodeB, NODE_A_FORWARDER_CAPABILITY, "nodeBcpType", "nodeDcpName",
"nodeBcpName"));
forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>();
@@ -75,10 +74,10 @@ public abstract class BaseForwardingPathVersionChangeTest {
newNodeACI = new ComponentInstance();
initComponentInstance(newNodeACI, newNodeA);
newNodeAC = new Resource();
- newNodeWithoutCapability=new Resource();
+ newNodeWithoutCapability = new Resource();
initComponent(newNodeAC, newNodeA);
service.setComponentInstances(Lists.newArrayList(newNodeACI));
- initComponentWithoutForwarder(newNodeWithoutCapability,"newNodeC");
+ initComponentWithoutForwarder(newNodeWithoutCapability, "newNodeC");
service.setComponentInstances(Lists.newArrayList(nodeACI));
dataHolder = new DataForMergeHolder();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java
index 49c25832cc..5f0282b7d6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java
@@ -16,49 +16,58 @@
package org.openecomp.sdc.be.components.path;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import fj.data.Either;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer;
import org.openecomp.sdc.be.ui.model.UiServiceDataTransfer;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "/paths/path-context.xml")
-@Ignore
+@SpringJUnitConfig(locations = "classpath:paths/path-context.xml")
public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest {
- @Test(expected = ComponentException.class)
+ @BeforeAll
+ private static void setup() {
+ configurationManager =
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
+ }
+
+ @Test
public void shouldFailToUpdateForwardingPathSincePathDoesNotExist() {
- Service service = initForwardPath();
- bl.updateForwardingPath(FORWARDING_PATH_ID, service, user, true);
+ Assertions.assertThrows(ComponentException.class, () -> {
+ Service service = initForwardPath();
+ bl.updateForwardingPath(FORWARDING_PATH_ID, service, user, true);
+ });
}
- @Test(expected = ComponentException.class)
+ @Test
public void shouldFailToDeleteForwardingPathSincePathDoesNotExist() {
- initForwardPath();
- bl.deleteForwardingPaths("delete_forward_test", Sets.newHashSet(FORWARDING_PATH_ID), user, true);
+ Assertions.assertThrows(ComponentException.class, () -> {
+ initForwardPath();
+ bl.deleteForwardingPaths("delete_forward_test", Sets.newHashSet(FORWARDING_PATH_ID), user, true);
+ });
}
- @Test
+ @Test
public void shouldSucceedCreateAndDeleteForwardingPath() {
Service createdService = createService();
Service service = initForwardPath();
@@ -71,7 +80,8 @@ public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest {
String toscaResourceName = forwardingPathsMap.values().iterator().next().getToscaResourceName();
// should return the created path
- Either<UiComponentDataTransfer, ResponseFormat> uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user, Lists.newArrayList(ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
+ Either<UiComponentDataTransfer, ResponseFormat> uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user,
+ Lists.newArrayList(ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
assertTrue(uiResaponse.isLeft());
UiServiceDataTransfer uiServiceDataTransfer = (UiServiceDataTransfer) uiResaponse.left().value();
Map<String, ForwardingPathDataDefinition> forwardingPaths = uiServiceDataTransfer.getForwardingPaths();
@@ -93,7 +103,8 @@ public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest {
assertTrue(serviceResponseFormatEither != null);
// make sure changes were applied
- uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user, Lists.newArrayList(ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
+ uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user,
+ Lists.newArrayList(ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
assertTrue(uiResaponse.isLeft());
uiServiceDataTransfer = (UiServiceDataTransfer) uiResaponse.left().value();
Map<String, ForwardingPathDataDefinition> forwardingPathsUpdated = uiServiceDataTransfer.getForwardingPaths();
@@ -107,7 +118,8 @@ public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest {
assertTrue(setResponseFormatEither != null);
// nothing to return now
- uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user, Lists.newArrayList(ComponentFieldsEnum.COMPONENT_INSTANCES.getValue(),ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
+ uiResaponse = bl.getComponentDataFilteredByParams(createdService.getUniqueId(), user,
+ Lists.newArrayList(ComponentFieldsEnum.COMPONENT_INSTANCES.getValue(), ComponentFieldsEnum.FORWARDING_PATHS.getValue()));
assertTrue(uiResaponse.isLeft());
uiServiceDataTransfer = (UiServiceDataTransfer) uiResaponse.left().value();
forwardingPaths = uiServiceDataTransfer.getForwardingPaths();
@@ -115,8 +127,4 @@ public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest {
}
-
-
-
}
-
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java
index fd305b5f22..deab6ee161 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java
@@ -21,7 +21,7 @@
package org.openecomp.sdc.be.components.path;
import org.javatuples.Pair;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.impl.ForwardingPathUtils;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java
index efef9bd799..55c123f9aa 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java
@@ -20,8 +20,8 @@
package org.openecomp.sdc.be.components.path;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
@@ -44,7 +44,7 @@ public class ForwardingPathDeleteCITest {
private static final String nodeB = "nodeB";
private static final String fpName = "fpName";
- @Before
+ @BeforeEach
public void initService() {
service = new Service();
ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition(fpName);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathRenameNodeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathRenameNodeTest.java
index 886cda05da..1af5c80cd2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathRenameNodeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathRenameNodeTest.java
@@ -17,7 +17,7 @@
package org.openecomp.sdc.be.components.path;
import com.google.common.collect.Sets;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.impl.ForwardingPathUtils;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java
deleted file mode 100644
index 1b680fae50..0000000000
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.be.components.path;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
-import org.openecomp.sdc.be.model.CapabilityDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
-import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
-import org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDER;
-import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDS_TO_TOSCA_NAME;
-import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PORTS_RANGE;
-import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PROTOCOL;
-import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.addForwardingPaths;
-
-/**
- * @author KATYR, ORENK
- * @since November 19, 2017
- */
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "/paths/path-context.xml")
-@Ignore
-public class ForwardingPathToscaUtilTest extends BaseForwardingPathTest {
-
- private static final String NODE_NAME_1 = "nodeA-name";
- private static final String NODE_NAME_2 = "nodeB-name";
- private static final String PATH_1_PROTOCOL = "protocol-path1";
- private static final String PATH_1_DESC = "path1-desc";
- private static final String PATH_1_PORTS = "8585";
- private static final String PATH_1_NAME = "pathName1";
- private Service service;
- private Map<String, Component> originComponents = new HashMap<>();
- private static final String NODE_ID_1 = "nodeA-id";
- private static final String NODE_ID_2 = "nodeB-id";
- private static final String FORWARDING_PATH_TOSCA_TYPE = "org.openecomp.nodes.ForwardingPath";
-
-
- @Before
- public void setUpForwardingPath() {
- service = initForwardPath();
- List<ComponentInstance> componentInstances = new ArrayList<>();
- componentInstances.add(generateComponentInstance(NODE_NAME_1, NODE_ID_1));
- componentInstances.add(generateComponentInstance(NODE_NAME_2, NODE_ID_2));
- service.setComponentInstances(componentInstances);
- }
-
- private ComponentInstance generateComponentInstance(String name, String uuid) {
- ComponentInstance componentInstance = new ComponentInstance();
- componentInstance.setName(name);
- componentInstance.setUniqueId(uuid);
- componentInstance.setComponentUid(uuid);
- Map<String, List<CapabilityDefinition>> capabiltiesMap = new HashMap<>();
- CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
- capabilityDefinition.setMinOccurrences(Integer.toString(1));
- capabilityDefinition.setMaxOccurrences(Integer.toString(100));
- capabilityDefinition.setType(ForwardingPathToscaUtil.FORWARDS_TO_TOSCA_NAME);
- capabilityDefinition.setName(name);
- capabilityDefinition.setUniqueId(name);
- capabilityDefinition.setPath(Arrays.asList("Just", "something", "to", "read"));
- capabiltiesMap.put(capabilityDefinition.getName(),
- Collections.singletonList(capabilityDefinition));
- componentInstance.setCapabilities(capabiltiesMap);
- Resource resource = new Resource();
- resource.setToscaResourceName("test");
- originComponents.put(uuid, resource);
- return componentInstance;
- }
-
-
- @Test
- public void singleElementPath() {
- try {
- createPathSingleElement();
- Map<String, ToscaNodeTemplate> nodeTemplatesRes = new HashMap<>();
-
- Map<String, ToscaNodeTemplate> expectedNodeTemplatesRes = new HashMap<>();
- ToscaNodeTemplate pathEntry = new ToscaNodeTemplate();
- pathEntry.setType(FORWARDING_PATH_TOSCA_TYPE);
- Map<String, Object> expectedProps = new HashMap<>();
- expectedProps.put(PORTS_RANGE, Collections.singletonList(PATH_1_PORTS));
- expectedProps.put(PROTOCOL, PATH_1_PROTOCOL);
- pathEntry.setProperties(expectedProps);
- List<Map<String, ToscaTemplateRequirement>> requirements = new ArrayList<>();
- ToscaTemplateRequirement firstEntryReq = new ToscaTemplateRequirement();
- ToscaTemplateRequirement secondEntryReq = new ToscaTemplateRequirement();
-
- firstEntryReq.setCapability("null." + NODE_NAME_1);
- secondEntryReq.setCapability("null." + NODE_NAME_2);
-
- firstEntryReq.setNode(NODE_NAME_1);
- secondEntryReq.setNode(NODE_NAME_2);
-
- firstEntryReq.setRelationship(FORWARDS_TO_TOSCA_NAME);
- secondEntryReq.setRelationship(FORWARDS_TO_TOSCA_NAME);
-
- Map<String, ToscaTemplateRequirement> entryMap1 = new HashMap<>();
- Map<String, ToscaTemplateRequirement> entryMap2 = new HashMap<>();
-
- entryMap1.put(FORWARDER, firstEntryReq);
- entryMap2.put(FORWARDER, secondEntryReq);
-
- requirements.add(entryMap1);
- requirements.add(entryMap2);
-
- pathEntry.setRequirements(requirements);
- expectedNodeTemplatesRes.put(PATH_1_NAME, pathEntry);
- addForwardingPaths(service, nodeTemplatesRes, capabiltyRequirementConvertor, originComponents,
- toscaOperationFacade);
-
- assertEquals(2, nodeTemplatesRes.get(PATH_1_NAME).getRequirements().size());
- compareToscaPathEntry(expectedNodeTemplatesRes, nodeTemplatesRes);
- } catch (Exception e){
- e.printStackTrace();
- Assert.fail(e.getMessage());
- }
- }
-
- private void compareToscaPathEntry(Map<String, ToscaNodeTemplate> expectedNodeTemplatesRes,
- Map<String, ToscaNodeTemplate> nodeTemplatesRes) {
- final ToscaNodeTemplate expectedTemplate = expectedNodeTemplatesRes.get(PATH_1_NAME);
- final ToscaNodeTemplate actualTemplate = nodeTemplatesRes.get(PATH_1_NAME);
- assertEquals(expectedTemplate.getProperties(), actualTemplate.getProperties());
- final int size = expectedTemplate.getRequirements().size();
- assertEquals(size,
- actualTemplate.getRequirements().size());
- for (int i = 0; i < size; i++) {
- compareToscaRequirement(expectedTemplate, actualTemplate, i);
- }
- }
-
- private void compareToscaRequirement(ToscaNodeTemplate expectedTemplate,
- ToscaNodeTemplate actualTemplate,
- int i) {
- final ToscaTemplateRequirement actualRequirement =
- actualTemplate.getRequirements().get(i).get(FORWARDER);
- final ToscaTemplateRequirement expectedToscaRequirement = expectedTemplate
- .getRequirements()
- .get(i).get(FORWARDER);
- assertEquals(actualRequirement.getCapability(), expectedToscaRequirement.getCapability());
- assertEquals(actualRequirement.getNode(), expectedToscaRequirement.getNode());
- }
-
- private void createPathSingleElement() {
- ForwardingPathElementDataDefinition element1 = initElement(NODE_NAME_1, NODE_NAME_2, NODE_NAME_1,
- NODE_NAME_2);
-
- ListDataDefinition<ForwardingPathElementDataDefinition> list = new ListDataDefinition<>();
- list.add(element1);
-
-
- ForwardingPathDataDefinition path = new ForwardingPathDataDefinition();
- path.setDescription(PATH_1_DESC);
- path.setProtocol(PATH_1_PROTOCOL);
- path.setDestinationPortNumber(PATH_1_PORTS);
- path.setToscaResourceName(FORWARDING_PATH_TOSCA_TYPE);
- path.setPathElements(list);
- path.setName(PATH_1_NAME);
-
- Map<String, ForwardingPathDataDefinition> paths = new HashMap<>();
- paths.put(PATH_1_NAME, path);
-
- service.setForwardingPaths(paths);
- }
-
- private ForwardingPathElementDataDefinition initElement(String fromId, String toId, String
- fromCP, String toCP) {
- ForwardingPathElementDataDefinition element = new ForwardingPathElementDataDefinition();
- element.setFromCP(fromCP);
- element.setFromNode(fromId);
- element.setToCP(toCP);
- element.setToNode(toId);
- return element;
- }
-} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
index 6123561d45..ae44ceac90 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,10 +21,16 @@
package org.openecomp.sdc.be.components.path;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
import com.google.common.collect.Sets;
import fj.data.Either;
-import org.junit.Before;
-import org.junit.Test;
+import java.util.Collection;
+import java.util.Set;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -42,30 +48,17 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.util.Collection;
-import java.util.Set;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
public class ForwardingPathValidatorTest implements ForwardingPathTestUtils {
+ private static final String SERVICE_ID = "serviceid1";
ResponseFormatManager mock;
-
- private Service service = (Service) getToscaFullElement().left().value();
-
-
@Mock
ToscaOperationFacade toscaOperationFacade;
@InjectMocks
ForwardingPathValidationUtilTest test = new ForwardingPathValidationUtilTest();
+ private Service service = (Service) getToscaFullElement().left().value();
- private static final String SERVICE_ID = "serviceid1";
-
-
-
-
- @Before
+ @BeforeEach
public void init() {
MockitoAnnotations.initMocks(this);
mock = Mockito.mock(ResponseFormatManager.class);
@@ -78,60 +71,65 @@ public class ForwardingPathValidatorTest implements ForwardingPathTestUtils {
}
@Test
- public void testValidForwardingPathName(){
+ public void testValidForwardingPathName() {
Collection<ForwardingPathDataDefinition> paths = createData("pathName", "http", "8285", "pathName");
test.validateForwardingPaths(paths, SERVICE_ID, false);
}
- @Test(expected = ComponentException.class)
- public void testEmptyForwardingPathName(){
- Collection<ForwardingPathDataDefinition> paths = createData("", "protocol", "8285", "name1");
- test.validateForwardingPaths(paths, SERVICE_ID, false);
+ @Test
+ public void testEmptyForwardingPathName() {
+ Assertions.assertThrows(ComponentException.class, () -> {
+ Collection<ForwardingPathDataDefinition> paths = createData("", "protocol", "8285", "name1");
+ test.validateForwardingPaths(paths, SERVICE_ID, false);
+ });
}
- @Test(expected = ComponentException.class)
- public void testLongForwardingPathName(){
- String pathName = "Failed to execute goal on project catalog-be: Could not resolve dependencies for project \n" +
+ @Test
+ public void testLongForwardingPathName() {
+ Assertions.assertThrows(ComponentException.class, () -> {
+ String pathName = "Failed to execute goal on project catalog-be: Could not resolve dependencies for project \n" +
"org.openecomp.sdc:catalog-be:war:1.1.0-SNAPSHOT: Failed to collect dependencies at \n" +
"org.openecomp.sdc.common:openecomp-sdc-artifact-generator-api:jar:1802.0.1.167: ";
- Collection<ForwardingPathDataDefinition> paths = createData(pathName,
+ Collection<ForwardingPathDataDefinition> paths = createData(pathName,
"http", "port", "name1");
- test.validateForwardingPaths(paths, SERVICE_ID, false);
-
+ test.validateForwardingPaths(paths, SERVICE_ID, false);
+ });
}
@Test
- public void testUniqueForwardingPathNameUpdateName(){
+ public void testUniqueForwardingPathNameUpdateName() {
Collection<ForwardingPathDataDefinition> paths = createData("pathName4", "httpfd", "82df85", "name1");
test.validateForwardingPaths(paths, SERVICE_ID, true);
}
@Test
- public void testUniqueForwardingPathNameUpdatePort(){
+ public void testUniqueForwardingPathNameUpdatePort() {
Collection<ForwardingPathDataDefinition> paths = createData("pathName3", "httpfd", "82df85", "name1");
test.validateForwardingPaths(paths, SERVICE_ID, true);
}
- @Test(expected = ComponentException.class)
- public void testLongForwardingPathPortNumber(){
- String port = "Failed to execute goal on project catalog-be: Could not resolve dependencies for project \n" +
+ @Test
+ public void testLongForwardingPathPortNumber() {
+ Assertions.assertThrows(ComponentException.class, () -> {
+ String port = "Failed to execute goal on project catalog-be: Could not resolve dependencies for project \n" +
"org.openecomp.sdc:catalog-be:war:1.1.0-SNAPSHOT: Failed to collect dependencies at \n" +
"org.openecomp.sdc.common:openecomp-sdc-artifact-generator-api:jar:1802.0.1.167: ";
- Collection<ForwardingPathDataDefinition> paths = createData("pathName",
+ Collection<ForwardingPathDataDefinition> paths = createData("pathName",
"http", port, "name1");
- test.validateForwardingPaths(paths, SERVICE_ID, false);
-
+ test.validateForwardingPaths(paths, SERVICE_ID, false);
+ });
}
- @Test(expected = ComponentException.class)
- public void testLongForwardingPathProtocol(){
- String protocol = "Failed to execute goal on project catalog-be: Could not resolve dependencies for project \n" +
+ @Test
+ public void testLongForwardingPathProtocol() {
+ Assertions.assertThrows(ComponentException.class, () -> {
+ String protocol = "Failed to execute goal on project catalog-be: Could not resolve dependencies for project \n" +
"org.openecomp.sdc:catalog-be:war:1.1.0-SNAPSHOT: Failed to collect dependencies at \n" +
"org.openecomp.sdc.common:openecomp-sdc-artifact-generator-api:jar:1802.0.1.167: ";
- Collection<ForwardingPathDataDefinition> paths = createData("pathName",
+ Collection<ForwardingPathDataDefinition> paths = createData("pathName",
protocol, "port", "name1");
- test.validateForwardingPaths(paths, SERVICE_ID, false);
-
+ test.validateForwardingPaths(paths, SERVICE_ID, false);
+ });
}
private Set<ForwardingPathDataDefinition> createData(String pathName, String protocol, String ports, String uniqueId) {
@@ -140,15 +138,15 @@ public class ForwardingPathValidatorTest implements ForwardingPathTestUtils {
}
- private <T extends Component> Either<T, StorageOperationStatus> getToscaFullElement() {
+ private <T extends Component> Either<T, StorageOperationStatus> getToscaFullElement() {
return Either.left((T) setUpServiceMcok());
}
- private Service setUpServiceMcok(){
- Service service = new Service();
- service.addForwardingPath(createPath("pathName3", "http", "8285", "name1"));
- return service;
+ private Service setUpServiceMcok() {
+ Service service = new Service();
+ service.addForwardingPath(createPath("pathName3", "http", "8285", "name1"));
+ return service;
}
private class ForwardingPathValidationUtilTest extends ForwardingPathValidator {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java
new file mode 100644
index 0000000000..3b8089e858
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.be.tosca.utils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDER;
+import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDS_TO_TOSCA_NAME;
+import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PORTS_RANGE;
+import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PROTOCOL;
+import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.addForwardingPaths;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.components.path.BaseForwardingPathTest;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
+import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
+
+@SpringJUnitConfig(locations = "classpath:paths/path-context.xml")
+public class ForwardingPathToscaUtilTest extends BaseForwardingPathTest {
+
+ private static final String NODE_NAME_1 = "nodeA-name";
+ private static final String NODE_NAME_2 = "nodeB-name";
+ private static final String PATH_1_PROTOCOL = "protocol-path1";
+ private static final String PATH_1_DESC = "path1-desc";
+ private static final String PATH_1_PORTS = "8585";
+ private static final String PATH_1_NAME = "pathName1";
+ private static final String NODE_ID_1 = "nodeA-id";
+ private static final String NODE_ID_2 = "nodeB-id";
+ private static final String FORWARDING_PATH_TOSCA_TYPE = "org.openecomp.nodes.ForwardingPath";
+ private Service service;
+ private Map<String, Component> originComponents = new HashMap<>();
+
+ @BeforeAll
+ private static void setup() {
+ configurationManager =
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
+ }
+
+ @BeforeEach
+ public void setUpForwardingPath() {
+ service = initForwardPath();
+ List<ComponentInstance> componentInstances = new ArrayList<>();
+ componentInstances.add(generateComponentInstance(NODE_NAME_1, NODE_ID_1));
+ componentInstances.add(generateComponentInstance(NODE_NAME_2, NODE_ID_2));
+ service.setComponentInstances(componentInstances);
+ }
+
+ private ComponentInstance generateComponentInstance(String name, String uuid) {
+ ComponentInstance componentInstance = new ComponentInstance();
+ componentInstance.setName(name);
+ componentInstance.setUniqueId(uuid);
+ componentInstance.setComponentUid(uuid);
+ Map<String, List<CapabilityDefinition>> capabiltiesMap = new HashMap<>();
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition.setMinOccurrences(Integer.toString(1));
+ capabilityDefinition.setMaxOccurrences(Integer.toString(100));
+ capabilityDefinition.setType(ForwardingPathToscaUtil.FORWARDS_TO_TOSCA_NAME);
+ capabilityDefinition.setName(name);
+ capabilityDefinition.setUniqueId(name);
+ capabilityDefinition.setPath(Arrays.asList("Just", "something", "to", "read"));
+ capabiltiesMap.put(capabilityDefinition.getName(), Collections.singletonList(capabilityDefinition));
+ componentInstance.setCapabilities(capabiltiesMap);
+ Resource resource = new Resource();
+ resource.setToscaResourceName("test");
+ originComponents.put(uuid, resource);
+ return componentInstance;
+ }
+
+ @Test
+ public void singleElementPath() {
+ Assertions.assertDoesNotThrow(() -> {
+ createPathSingleElement();
+ Map<String, ToscaNodeTemplate> nodeTemplatesRes = new HashMap<>();
+
+ Map<String, ToscaNodeTemplate> expectedNodeTemplatesRes = new HashMap<>();
+ ToscaNodeTemplate pathEntry = new ToscaNodeTemplate();
+ pathEntry.setType(FORWARDING_PATH_TOSCA_TYPE);
+ Map<String, Object> expectedProps = new HashMap<>();
+ expectedProps.put(PORTS_RANGE, Collections.singletonList(PATH_1_PORTS));
+ expectedProps.put(PROTOCOL, PATH_1_PROTOCOL);
+ pathEntry.setProperties(expectedProps);
+ List<Map<String, ToscaTemplateRequirement>> requirements = new ArrayList<>();
+ ToscaTemplateRequirement firstEntryReq = new ToscaTemplateRequirement();
+ ToscaTemplateRequirement secondEntryReq = new ToscaTemplateRequirement();
+
+ firstEntryReq.setCapability("null." + NODE_NAME_1);
+ secondEntryReq.setCapability("null." + NODE_NAME_2);
+
+ firstEntryReq.setNode(NODE_NAME_1);
+ secondEntryReq.setNode(NODE_NAME_2);
+
+ firstEntryReq.setRelationship(FORWARDS_TO_TOSCA_NAME);
+ secondEntryReq.setRelationship(FORWARDS_TO_TOSCA_NAME);
+
+ Map<String, ToscaTemplateRequirement> entryMap1 = new HashMap<>();
+ Map<String, ToscaTemplateRequirement> entryMap2 = new HashMap<>();
+
+ entryMap1.put(FORWARDER, firstEntryReq);
+ entryMap2.put(FORWARDER, secondEntryReq);
+
+ requirements.add(entryMap1);
+ requirements.add(entryMap2);
+
+ pathEntry.setRequirements(requirements);
+ expectedNodeTemplatesRes.put(PATH_1_NAME, pathEntry);
+ addForwardingPaths(service, nodeTemplatesRes, capabiltyRequirementConvertor, originComponents, toscaOperationFacade);
+
+ assertEquals(2, nodeTemplatesRes.get(PATH_1_NAME).getRequirements().size());
+ compareToscaPathEntry(expectedNodeTemplatesRes, nodeTemplatesRes);
+ });
+ }
+
+ private void compareToscaPathEntry(Map<String, ToscaNodeTemplate> expectedNodeTemplatesRes,
+ Map<String, ToscaNodeTemplate> nodeTemplatesRes) {
+ final ToscaNodeTemplate expectedTemplate = expectedNodeTemplatesRes.get(PATH_1_NAME);
+ final ToscaNodeTemplate actualTemplate = nodeTemplatesRes.get(PATH_1_NAME);
+ assertEquals(expectedTemplate.getProperties(), actualTemplate.getProperties());
+ final int size = expectedTemplate.getRequirements().size();
+ assertEquals(size, actualTemplate.getRequirements().size());
+ for (int i = 0; i < size; i++) {
+ compareToscaRequirement(expectedTemplate, actualTemplate, i);
+ }
+ }
+
+ private void compareToscaRequirement(ToscaNodeTemplate expectedTemplate,
+ ToscaNodeTemplate actualTemplate,
+ int i) {
+ final ToscaTemplateRequirement actualRequirement = actualTemplate.getRequirements().get(i).get(FORWARDER);
+ final ToscaTemplateRequirement expectedToscaRequirement = expectedTemplate.getRequirements().get(i).get(FORWARDER);
+ assertEquals(actualRequirement.getCapability(), expectedToscaRequirement.getCapability());
+ assertEquals(actualRequirement.getNode(), expectedToscaRequirement.getNode());
+ }
+
+ private void createPathSingleElement() {
+ ForwardingPathElementDataDefinition element1 = initElement(NODE_NAME_1, NODE_NAME_2, NODE_NAME_1, NODE_NAME_2);
+
+ ListDataDefinition<ForwardingPathElementDataDefinition> list = new ListDataDefinition<>();
+ list.add(element1);
+
+ ForwardingPathDataDefinition path = new ForwardingPathDataDefinition();
+ path.setDescription(PATH_1_DESC);
+ path.setProtocol(PATH_1_PROTOCOL);
+ path.setDestinationPortNumber(PATH_1_PORTS);
+ path.setToscaResourceName(FORWARDING_PATH_TOSCA_TYPE);
+ path.setPathElements(list);
+ path.setName(PATH_1_NAME);
+
+ Map<String, ForwardingPathDataDefinition> paths = new HashMap<>();
+ paths.put(PATH_1_NAME, path);
+
+ service.setForwardingPaths(paths);
+ }
+
+ private ForwardingPathElementDataDefinition initElement(String fromId, String toId, String fromCP, String toCP) {
+ ForwardingPathElementDataDefinition element = new ForwardingPathElementDataDefinition();
+ element.setFromCP(fromCP);
+ element.setFromNode(fromId);
+ element.setToCP(toCP);
+ element.setToNode(toId);
+ return element;
+ }
+}
diff --git a/catalog-be/src/test/resources/paths/path-context.xml b/catalog-be/src/test/resources/paths/path-context.xml
index 752e4ecf13..53e8b8c74b 100644
--- a/catalog-be/src/test/resources/paths/path-context.xml
+++ b/catalog-be/src/test/resources/paths/path-context.xml
@@ -20,87 +20,67 @@ limitations under the License.
Modifications copyright (c) 2018 Nokia
================================================================================
-->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<beans xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
- xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
- <context:annotation-config/>
<aop:aspectj-autoproxy proxy-target-class="true"/>
-
+ <bean class="org.openecomp.sdc.be.dao.config.DAOSpringConfig"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.ForwardingPathToscaOperationFacade"
+ id="tosca-operation-facade"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.InMemoryJanusGraphClient"
+ id="janusgraph-client"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.ArtifactCassandraDaoMock"
+ id="artifact-cassandra-dao"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.AuditCassandraDaoMock"
+ id="audit-cassandra-dao"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.FeatureToggleDaoMock"
+ id="feature_toggle_dao"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.EnvironmentCassandraDaoMock"
+ id="operational-environment-dao"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.SdcSchemaFilesCassandraDaoMock"
+ id="sdc-schema-files-cassandra-dao"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.ToscaModelImportCassandraDaoMock"
+ id="tosca-model-import-cassandra-dao"/>
+ <bean class="org.openecomp.sdc.be.client.onboarding.impl.OnboardingClientImpl"
+ id="onboarding-client"/>
+ <bean class="org.openecomp.sdc.be.catalog.impl.DmaapProducer" id="dmaapProducer"/>
+ <bean class="org.openecomp.sdc.be.catalog.impl.DmaapProducerHealth" id="dmaapProducerHealth"/>
+ <bean class="org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic"
+ id="lifecycleBusinessLogic"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.DistributionEngineMock"
+ id="distributionEngine"/>
+ <bean class="org.openecomp.sdc.be.components.path.beans.ForwardingPathValidatorMock"
+ id="forwardingPathValidator"/>
+ <bean class="org.openecomp.sdc.be.components.attribute.AttributeDeclarationOrchestrator"
+ id="attributeDeclarationOrchestrator"/>
+ <bean
+ class="org.openecomp.sdc.be.components.attribute.ComponentInstanceOutputAttributeDeclarator"/>
+ <bean class="org.openecomp.sdc.be.components.attribute.ComponentInstanceAttributeDeclarator"/>
+ <context:annotation-config/>
<context:component-scan
- base-package="org.openecomp.sdc.be.dao.impl,
- org.openecomp.sdc.be.dao.neo4j,
- org.openecomp.sdc.be.model.operations.impl,
+ base-package="
+ org.openecomp.sdc.be.dao.janusgraph,
+ org.openecomp.sdc.be.model.jsonjanusgraph,
+ org.openecomp.sdc.be.model.operations.impl,
org.openecomp.sdc.be.model.cache,
- org.openecomp.sdc.be.dao.janusgraph,
org.openecomp.sdc.be.user,
- org.openecomp.sdc.be.impl,
- org.openecomp.sdc.be.auditing.impl,
org.openecomp.sdc.be.components.impl,
- org.openecomp.sdc.be.components.attribute,
org.openecomp.sdc.be.components.merge,
+ org.openecomp.sdc.be.datamodel.utils,
+ org.openecomp.sdc.be.components.distribution.engine,
org.openecomp.sdc.be.components.property,
- org.openecomp.sdc.be.components.distribution.engine,
org.openecomp.sdc.be.facade.operations,
- org.openecomp.sdc.be.distribution,
org.openecomp.sdc.be.components.validation,
- org.openecomp.sdc.be.switchover.detector,
- org.openecomp.sdc.be.tosca,
- org.openecomp.sdc.be.client,
- org.openecomp.sdc.be.model.operations.impl,
- org.openecomp.sdc.be.model.jsonjanusgraph.operations,
- org.openecomp.sdc.be.model.jsonjanusgraph.utils,
- org.openecomp.sdc.be.model.jsonjanusgraph.config,
+ org.openecomp.sdc.be.auditing.impl,
org.openecomp.sdc.be.components.csar,
- org.openecomp.sdc.be.datamodel.utils,
- org.openecomp.sdc.be.model.utils,
- org.openecomp.sdc.be.dao.jsongraph">
-
+ org.openecomp.sdc.be.impl,
+ org.openecomp.sdc.be.tosca,
+ org.openecomp.sdc.be.dao.impl">
</context:component-scan>
- <bean id="tosca-operation-facade"
- class="org.openecomp.sdc.be.components.path.beans.ForwardingPathToscaOperationFacade"/>
- <bean id="janusgraph-client"
- class="org.openecomp.sdc.be.components.path.beans.InMemoryJanusGraphClient"/>
- <bean id="lifecycleBusinessLogic"
- class="org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic"/>
- <bean id="userBusinessLogicExt" class="org.openecomp.sdc.be.user.UserBusinessLogicExt"/>
- <bean id="asset-metadata-utils"
- class="org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter"/>
- <bean class="org.openecomp.sdc.be.dao.config.DAOSpringConfig"/>
- <bean id="cassandra-client"
- class="org.openecomp.sdc.be.components.path.beans.CassandraClientMock"/>
- <bean id="audit-cassandra-dao"
- class="org.openecomp.sdc.be.components.path.beans.AuditCassandraDaoMock"/>
- <bean id="artifact-cassandra-dao"
- class="org.openecomp.sdc.be.components.path.beans.ArtifactCassandraDaoMock"/>
- <bean id="operational-environment-dao"
- class="org.openecomp.sdc.be.components.path.beans.EnvironmentCassandraDaoMock"/>
- <bean id="sdc-schema-files-cassandra-dao"
- class="org.openecomp.sdc.be.components.path.beans.SdcSchemaFilesCassandraDaoMock"/>
- <bean id="distributionEngine"
- class="org.openecomp.sdc.be.components.path.beans.DistributionEngineMock"/>
- <bean id="forwardingPathValidator"
- class="org.openecomp.sdc.be.components.path.beans.ForwardingPathValidatorMock"/>
- <bean id="dataTypeValidatorConverter"
- class="org.openecomp.sdc.be.model.tosca.validators.DataTypeValidatorConverter"/>
- <bean id="sdcSchemaUtils" class="org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils"/>
- <bean id="dmaapProducer" class="org.openecomp.sdc.be.catalog.impl.DmaapProducer"/>
- <bean id="catalogOperation" class="org.openecomp.sdc.be.facade.operations.CatalogOperation"/>
- <bean id="userOperation" class="org.openecomp.sdc.be.facade.operations.UserOperation"/>
- <bean id="dmaapProducerHealth" class="org.openecomp.sdc.be.catalog.impl.DmaapProducerHealth"/>
- <bean id="feature_toggle_dao"
- class="org.openecomp.sdc.be.components.path.beans.FeatureToggleDaoMock"/>
- <bean id="tosca-model-import-cassandra-dao"
- class="org.openecomp.sdc.be.components.path.beans.ToscaModelImportCassandraDaoMock"/>
- <bean name="httpClient" class="org.apache.http.impl.client.HttpClients"
- factory-method="createDefault"/>
- <bean class="org.openecomp.sdc.be.components.attribute.AttributeDeclarationOrchestrator"/>
- <bean
- class="org.openecomp.sdc.be.components.attribute.ComponentInstanceOutputAttributeDeclarator"/>
- <bean class="org.openecomp.sdc.be.components.attribute.ComponentInstanceAttributeDeclarator"/>
</beans>
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java
index 09ab6a1745..549841c6cb 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JanusGraphGenericDaoTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,23 +20,30 @@
package org.openecomp.sdc.be.resources;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import com.google.gson.Gson;
-import org.janusgraph.core.PropertyKey;
-import org.janusgraph.core.JanusGraphEdge;
-import org.janusgraph.core.JanusGraphFactory;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
-import org.janusgraph.core.attribute.Text;
-import org.janusgraph.core.schema.JanusGraphManagement;
import fj.data.Either;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraphVertex;
+import org.janusgraph.core.PropertyKey;
+import org.janusgraph.core.attribute.Text;
+import org.janusgraph.core.schema.JanusGraphManagement;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
@@ -45,586 +52,580 @@ import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import org.openecomp.sdc.be.resources.data.*;
+import org.openecomp.sdc.be.resources.data.AdditionalInfoParameterData;
+import org.openecomp.sdc.be.resources.data.ArtifactData;
+import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
+import org.openecomp.sdc.be.resources.data.GraphNodeLock;
+import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
+import org.openecomp.sdc.be.resources.data.UserData;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.UserRoleEnum;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
-@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class,
- DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class })
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
+@TestExecutionListeners(listeners = {DependencyInjectionTestExecutionListener.class,
+ DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class})
public class JanusGraphGenericDaoTest {
- private static Logger log = LoggerFactory.getLogger(JanusGraphGenericDaoTest.class.getName());
- private static ConfigurationManager configurationManager;
-
- @Resource(name = "janusgraph-generic-dao")
- private JanusGraphGenericDao janusGraphDao;
-
- @BeforeClass
- public static void setupBeforeClass() {
- ExternalConfiguration.setAppName("catalog-dao");
- String appConfigDir = "src/test/resources/config/catalog-dao";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
- appConfigDir);
- configurationManager = new ConfigurationManager(configurationSource);
- configurationManager.getConfiguration().setJanusGraphCfgFile("../catalog-be/src/main/resources/config/janusgraph.properties");
- configurationManager.getConfiguration().setJanusGraphInMemoryGraph(true);
- }
-
- // @Test
- public void testcheckEdgeProps() {
- JanusGraph graph = janusGraphDao.getGraph().left().value();
- JanusGraphVertex v1 = graph.addVertex();
- v1.property("prop1", 123);
- JanusGraphVertex v2 = graph.addVertex();
- v2.property("prop1", 456);
- JanusGraphEdge addEdge = v1.addEdge("label11", v2);
- addEdge.property("edgeProp", "my prop edge");
- graph.tx().commit();
-
- Either<JanusGraphVertex, JanusGraphOperationStatus> v11 = janusGraphDao.getVertexByProperty("prop1", 123);
- Iterator<Edge> edges = v11.left().value().edges(Direction.OUT, "label11");
- Edge edge = edges.next();
- // String value = (String)edge.value("edgeProp");
- String value = (String) janusGraphDao.getProperty(edge, "edgeProp");
- log.debug(value);
-
- }
-
- @Test
- public void testCrudNode() {
-
- String id = "userId12345abc";
- UserData userData = new UserData("Myname123", "Mylastname", id, "email123", "Tester",
- UserStatusEnum.ACTIVE.name(), null);
-
- Either<UserData, JanusGraphOperationStatus> newNode = janusGraphDao.createNode(userData, UserData.class);
-
- assertTrue(newNode.isLeft());
-
- log.debug("{}", newNode.left().value());
-
- janusGraphDao.commit();
-
- ImmutablePair<String, Object> keyValueId = userData.getKeyValueId();
- Either<UserData, JanusGraphOperationStatus> node = janusGraphDao.getNode(keyValueId.getKey(), keyValueId.getValue(),
- UserData.class);
- janusGraphDao.commit();
- assertTrue(node.isLeft());
- log.debug("{}", node.left().value());
-
- userData.setRole("Designer");
- node = janusGraphDao.updateNode(userData, UserData.class);
- assertTrue(node.isLeft());
- log.debug("{}", node.left().value());
- assertEquals(null, "Designer", node.left().value().getRole());
- janusGraphDao.commit();
-
- node = janusGraphDao.deleteNode(userData, UserData.class);
- assertTrue(node.isLeft());
- log.debug("{}", node.left().value());
- janusGraphDao.commit();
-
- node = janusGraphDao.getNode(keyValueId.getKey(), keyValueId.getValue(), UserData.class);
- assertTrue(node.isRight());
- log.debug("{}", node.right().value());
-
- }
-
- @Test
- public void testGetByCategoryAndAll() {
-
- // create 2 nodes
- String id = "userId12345abc";
- UserData userData1 = new UserData("Myname123", "Mylastname", id, "email123", "Tester",
- UserStatusEnum.ACTIVE.name(), null);
-
- Either<UserData, JanusGraphOperationStatus> node1 = janusGraphDao.createNode(userData1, UserData.class);
- assertTrue(node1.isLeft());
- log.debug("{}", node1.left().value());
-
- id = "userIddfkoer45abc";
- UserData userData2 = new UserData("Mynadyhme123", "Mylasghtname", id, "emaighdl123", "Designer",
- UserStatusEnum.ACTIVE.name(), null);
- Either<UserData, JanusGraphOperationStatus> node2 = janusGraphDao.createNode(userData2, UserData.class);
- assertTrue(node2.isLeft());
- log.debug("{}", node2.left().value());
-
- janusGraphDao.commit();
-
- ImmutablePair<String, Object> keyValueId1 = userData1.getKeyValueId();
- // get first node
- Either<UserData, JanusGraphOperationStatus> node = janusGraphDao.getNode(keyValueId1.getKey(), keyValueId1.getValue(),
- UserData.class);
- assertTrue(node.isLeft());
- log.debug("{}", node.left().value());
- janusGraphDao.commit();
-
- // get all must be 2 + 1 default user = 3
- Either<List<UserData>, JanusGraphOperationStatus> all = janusGraphDao.getAll(NodeTypeEnum.User, UserData.class);
- assertTrue(all.isLeft());
- assertTrue(all.left().value().size() > 0);
-
- log.debug("{}", all.left().value());
-
- Map<String, Object> props = new HashMap<>();
-
- props.put(keyValueId1.getKey(), keyValueId1.getValue());
-
- // get by criteria. must be 1
- Either<List<UserData>, JanusGraphOperationStatus> byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.User, props,
- UserData.class);
- assertTrue(byCriteria.isLeft());
- assertEquals(1, byCriteria.left().value().size());
-
- log.debug("{}", byCriteria.left().value());
-
- // delete all nodes
- node = janusGraphDao.deleteNode(userData1, UserData.class);
- assertTrue(node.isLeft());
- node = janusGraphDao.deleteNode(userData2, UserData.class);
- assertTrue(node.isLeft());
- }
-
- @Test
- public void testGetEdgesForNode() {
- String id = "userId12345abc";
- UserData userData = new UserData("Myname123", "Mylastname", id, "email123", UserRoleEnum.ADMIN.name(),
- UserStatusEnum.ACTIVE.name(), null);
- janusGraphDao.createNode(userData, UserData.class);
- ResourceMetadataData resourceData = new ResourceMetadataData();
- resourceData.getMetadataDataDefinition().setName("resourceForLock");
- resourceData.getMetadataDataDefinition().setVersion("0.1");
- resourceData.getMetadataDataDefinition().setState("newState");
- resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
- + resourceData.getMetadataDataDefinition().getVersion());
-
- janusGraphDao.createNode(resourceData, ResourceMetadataData.class);
- janusGraphDao.createRelation(userData, resourceData, GraphEdgeLabels.LAST_MODIFIER, null);
- janusGraphDao.commit();
-
- Either<List<Edge>, JanusGraphOperationStatus> eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.OUT);
- assertTrue(eitherEdges.isLeft());
+
+ private static Logger log = LoggerFactory.getLogger(JanusGraphGenericDaoTest.class.getName());
+ private static ConfigurationManager configurationManager;
+
+ @Resource(name = "janusgraph-generic-dao")
+ private JanusGraphGenericDao janusGraphDao;
+
+ @BeforeAll
+ public static void setupBeforeClass() {
+ ExternalConfiguration.setAppName("catalog-dao");
+ String appConfigDir = "src/test/resources/config/catalog-dao";
+ ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+ appConfigDir);
+ configurationManager = new ConfigurationManager(configurationSource);
+ configurationManager.getConfiguration().setJanusGraphCfgFile("../catalog-be/src/main/resources/config/janusgraph.properties");
+ configurationManager.getConfiguration().setJanusGraphInMemoryGraph(true);
+ }
+
+ @Test
+ public void testcheckEdgeProps() {
+ JanusGraph graph = janusGraphDao.getGraph().left().value();
+ JanusGraphVertex v1 = graph.addVertex();
+ v1.property("prop1", 123);
+ JanusGraphVertex v2 = graph.addVertex();
+ v2.property("prop1", 456);
+ JanusGraphEdge addEdge = v1.addEdge("label11", v2);
+ addEdge.property("edgeProp", "my prop edge");
+ graph.tx().commit();
+
+ Either<JanusGraphVertex, JanusGraphOperationStatus> v11 = janusGraphDao.getVertexByProperty("prop1", 123);
+ Iterator<Edge> edges = v11.left().value().edges(Direction.OUT, "label11");
+ Edge edge = edges.next();
+ // String value = (String)edge.value("edgeProp");
+ String value = (String) janusGraphDao.getProperty(edge, "edgeProp");
+ log.debug(value);
+
+ }
+
+ @Test
+ public void testCrudNode() {
+
+ String id = "userId12345abc";
+ UserData userData = new UserData("Myname123", "Mylastname", id, "email123", "Tester",
+ UserStatusEnum.ACTIVE.name(), null);
+
+ Either<UserData, JanusGraphOperationStatus> newNode = janusGraphDao.createNode(userData, UserData.class);
+
+ assertTrue(newNode.isLeft());
+
+ log.debug("{}", newNode.left().value());
+
+ janusGraphDao.commit();
+
+ ImmutablePair<String, Object> keyValueId = userData.getKeyValueId();
+ Either<UserData, JanusGraphOperationStatus> node = janusGraphDao.getNode(keyValueId.getKey(), keyValueId.getValue(),
+ UserData.class);
+ janusGraphDao.commit();
+ assertTrue(node.isLeft());
+ log.debug("{}", node.left().value());
+
+ userData.setRole("Designer");
+ node = janusGraphDao.updateNode(userData, UserData.class);
+ assertTrue(node.isLeft());
+ log.debug("{}", node.left().value());
+ assertEquals(null, "Designer", node.left().value().getRole());
+ janusGraphDao.commit();
+
+ node = janusGraphDao.deleteNode(userData, UserData.class);
+ assertTrue(node.isLeft());
+ log.debug("{}", node.left().value());
+ janusGraphDao.commit();
+
+ node = janusGraphDao.getNode(keyValueId.getKey(), keyValueId.getValue(), UserData.class);
+ assertTrue(node.isRight());
+ log.debug("{}", node.right().value());
+
+ }
+
+ @Test
+ public void testGetByCategoryAndAll() {
+
+ // create 2 nodes
+ String id = "userId12345abc";
+ UserData userData1 = new UserData("Myname123", "Mylastname", id, "email123", "Tester",
+ UserStatusEnum.ACTIVE.name(), null);
+
+ Either<UserData, JanusGraphOperationStatus> node1 = janusGraphDao.createNode(userData1, UserData.class);
+ assertTrue(node1.isLeft());
+ log.debug("{}", node1.left().value());
+
+ id = "userIddfkoer45abc";
+ UserData userData2 = new UserData("Mynadyhme123", "Mylasghtname", id, "emaighdl123", "Designer",
+ UserStatusEnum.ACTIVE.name(), null);
+ Either<UserData, JanusGraphOperationStatus> node2 = janusGraphDao.createNode(userData2, UserData.class);
+ assertTrue(node2.isLeft());
+ log.debug("{}", node2.left().value());
+
+ janusGraphDao.commit();
+
+ ImmutablePair<String, Object> keyValueId1 = userData1.getKeyValueId();
+ // get first node
+ Either<UserData, JanusGraphOperationStatus> node = janusGraphDao.getNode(keyValueId1.getKey(), keyValueId1.getValue(),
+ UserData.class);
+ assertTrue(node.isLeft());
+ log.debug("{}", node.left().value());
+ janusGraphDao.commit();
+
+ // get all must be 2 + 1 default user = 3
+ Either<List<UserData>, JanusGraphOperationStatus> all = janusGraphDao.getAll(NodeTypeEnum.User, UserData.class);
+ assertTrue(all.isLeft());
+ assertTrue(all.left().value().size() > 0);
+
+ log.debug("{}", all.left().value());
+
+ Map<String, Object> props = new HashMap<>();
+
+ props.put(keyValueId1.getKey(), keyValueId1.getValue());
+
+ // get by criteria. must be 1
+ Either<List<UserData>, JanusGraphOperationStatus> byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.User, props,
+ UserData.class);
+ assertTrue(byCriteria.isLeft());
+ assertEquals(1, byCriteria.left().value().size());
+
+ log.debug("{}", byCriteria.left().value());
+
+ // delete all nodes
+ node = janusGraphDao.deleteNode(userData1, UserData.class);
+ assertTrue(node.isLeft());
+ node = janusGraphDao.deleteNode(userData2, UserData.class);
+ assertTrue(node.isLeft());
+ }
+
+ @Test
+ public void testGetEdgesForNode() {
+ String id = "userId12345abc";
+ UserData userData = new UserData("Myname123", "Mylastname", id, "email123", UserRoleEnum.ADMIN.name(),
+ UserStatusEnum.ACTIVE.name(), null);
+ janusGraphDao.createNode(userData, UserData.class);
+ ResourceMetadataData resourceData = new ResourceMetadataData();
+ resourceData.getMetadataDataDefinition().setName("resourceForLock");
+ resourceData.getMetadataDataDefinition().setVersion("0.1");
+ resourceData.getMetadataDataDefinition().setState("newState");
+ resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
+ + resourceData.getMetadataDataDefinition().getVersion());
+
+ janusGraphDao.createNode(resourceData, ResourceMetadataData.class);
+ janusGraphDao.createRelation(userData, resourceData, GraphEdgeLabels.LAST_MODIFIER, null);
+ janusGraphDao.commit();
+
+ Either<List<Edge>, JanusGraphOperationStatus> eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.OUT);
+ assertTrue(eitherEdges.isLeft());
assertEquals(1, eitherEdges.left().value().size());
- eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.IN);
- assertTrue(eitherEdges.isLeft());
+ eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.IN);
+ assertTrue(eitherEdges.isLeft());
assertEquals(0, eitherEdges.left().value().size());
- eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.OUT);
- assertTrue(eitherEdges.isLeft());
+ eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.OUT);
+ assertTrue(eitherEdges.isLeft());
assertEquals(0, eitherEdges.left().value().size());
- eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.IN);
- assertTrue(eitherEdges.isLeft());
+ eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.IN);
+ assertTrue(eitherEdges.isLeft());
assertEquals(1, eitherEdges.left().value().size());
- eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.BOTH);
- assertTrue(eitherEdges.isLeft());
+ eitherEdges = janusGraphDao.getEdgesForNode(resourceData, Direction.BOTH);
+ assertTrue(eitherEdges.isLeft());
assertEquals(1, eitherEdges.left().value().size());
- eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.BOTH);
- assertTrue(eitherEdges.isLeft());
+ eitherEdges = janusGraphDao.getEdgesForNode(userData, Direction.BOTH);
+ assertTrue(eitherEdges.isLeft());
assertEquals(1, eitherEdges.left().value().size());
- janusGraphDao.deleteNode(userData, UserData.class);
- janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class);
- janusGraphDao.commit();
- }
+ janusGraphDao.deleteNode(userData, UserData.class);
+ janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class);
+ janusGraphDao.commit();
+ }
+
+ @Test
+ public void testLockElement() {
+
+ ResourceMetadataData resourceData = new ResourceMetadataData();
+
+ resourceData.getMetadataDataDefinition().setName("resourceForLock");
+ resourceData.getMetadataDataDefinition().setVersion("0.1");
+ resourceData.getMetadataDataDefinition().setState("newState");
+ resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
+ + resourceData.getMetadataDataDefinition().getVersion());
+
+ Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData,
+ ResourceMetadataData.class);
+ assertTrue(resource1.isLeft());
+ janusGraphDao.commit();
+ String lockId = "lock_" + resourceData.getLabel() + "_" + resource1.left().value().getUniqueId();
+
+ Either<GraphNodeLock, JanusGraphOperationStatus> nodeLock = janusGraphDao
+ .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isRight());
+ assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
+
+ JanusGraphOperationStatus status = janusGraphDao.lockElement(resourceData);
+ assertEquals(JanusGraphOperationStatus.OK, status);
- @Test
- public void testLockElement() {
-
- ResourceMetadataData resourceData = new ResourceMetadataData();
+ nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isLeft());
+ assertEquals(lockId, nodeLock.left().value().getUniqueId());
- resourceData.getMetadataDataDefinition().setName("resourceForLock");
- resourceData.getMetadataDataDefinition().setVersion("0.1");
- resourceData.getMetadataDataDefinition().setState("newState");
- resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
- + resourceData.getMetadataDataDefinition().getVersion());
+ janusGraphDao.commit();
- Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData,
- ResourceMetadataData.class);
- assertTrue(resource1.isLeft());
- janusGraphDao.commit();
- String lockId = "lock_" + resourceData.getLabel() + "_" + resource1.left().value().getUniqueId();
+ status = janusGraphDao.lockElement(resourceData);
+ assertEquals(JanusGraphOperationStatus.ALREADY_LOCKED, status);
- Either<GraphNodeLock, JanusGraphOperationStatus> nodeLock = janusGraphDao
- .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isRight());
- assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
+ status = janusGraphDao.releaseElement(resourceData);
+ assertEquals(JanusGraphOperationStatus.OK, status);
- JanusGraphOperationStatus status = janusGraphDao.lockElement(resourceData);
- assertEquals(JanusGraphOperationStatus.OK, status);
+ nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isRight());
+ assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
+ janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class);
+ janusGraphDao.commit();
- nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isLeft());
- assertEquals(lockId, nodeLock.left().value().getUniqueId());
+ }
- janusGraphDao.commit();
+ @Test
+ public void testReLockElement() throws InterruptedException {
- status = janusGraphDao.lockElement(resourceData);
- assertEquals(JanusGraphOperationStatus.ALREADY_LOCKED, status);
+ ResourceMetadataData resourceData = new ResourceMetadataData();
- status = janusGraphDao.releaseElement(resourceData);
- assertEquals(JanusGraphOperationStatus.OK, status);
+ resourceData.getMetadataDataDefinition().setName("resourceForReLock");
+ resourceData.getMetadataDataDefinition().setVersion("0.1");
+ resourceData.getMetadataDataDefinition().setState("newState");
+ resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
+ + resourceData.getMetadataDataDefinition().getVersion());
- nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isRight());
- assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
- janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class);
- janusGraphDao.commit();
+ Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData,
+ ResourceMetadataData.class);
+ assertTrue(resource1.isLeft());
+ janusGraphDao.commit();
+ String lockId = "lock_" + resourceData.getLabel() + "_" + resource1.left().value().getUniqueId();
- }
+ Either<GraphNodeLock, JanusGraphOperationStatus> nodeLock = janusGraphDao
+ .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isRight());
+ assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
- @Test
- public void testReLockElement() throws InterruptedException {
-
- ResourceMetadataData resourceData = new ResourceMetadataData();
+ // lock
+ JanusGraphOperationStatus status = janusGraphDao.lockElement(resourceData);
+ assertEquals(JanusGraphOperationStatus.OK, status);
- resourceData.getMetadataDataDefinition().setName("resourceForReLock");
- resourceData.getMetadataDataDefinition().setVersion("0.1");
- resourceData.getMetadataDataDefinition().setState("newState");
- resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
- + resourceData.getMetadataDataDefinition().getVersion());
+ nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isLeft());
+ assertEquals(lockId, nodeLock.left().value().getUniqueId());
+ long time1 = nodeLock.left().value().getTime();
- Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData,
- ResourceMetadataData.class);
- assertTrue(resource1.isLeft());
- janusGraphDao.commit();
- String lockId = "lock_" + resourceData.getLabel() + "_" + resource1.left().value().getUniqueId();
+ janusGraphDao.commit();
- Either<GraphNodeLock, JanusGraphOperationStatus> nodeLock = janusGraphDao
- .getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isRight());
- assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
+ // timeout
+ configurationManager.getConfiguration().setJanusGraphLockTimeout(2L);
+ Thread.sleep(5001);
- // lock
- JanusGraphOperationStatus status = janusGraphDao.lockElement(resourceData);
- assertEquals(JanusGraphOperationStatus.OK, status);
+ // relock
+ status = janusGraphDao.lockElement(resourceData);
+ assertEquals(JanusGraphOperationStatus.OK, status);
- nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isLeft());
- assertEquals(lockId, nodeLock.left().value().getUniqueId());
- long time1 = nodeLock.left().value().getTime();
+ nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isLeft());
+ assertEquals(lockId, nodeLock.left().value().getUniqueId());
- janusGraphDao.commit();
+ long time2 = nodeLock.left().value().getTime();
- // timeout
- configurationManager.getConfiguration().setJanusGraphLockTimeout(2L);
- Thread.sleep(5001);
+ assertTrue(time2 > time1);
- // relock
- status = janusGraphDao.lockElement(resourceData);
- assertEquals(JanusGraphOperationStatus.OK, status);
+ status = janusGraphDao.releaseElement(resourceData);
+ assertEquals(JanusGraphOperationStatus.OK, status);
- nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isLeft());
- assertEquals(lockId, nodeLock.left().value().getUniqueId());
+ nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
+ assertTrue(nodeLock.isRight());
+ assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
- long time2 = nodeLock.left().value().getTime();
+ janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class);
+ janusGraphDao.commit();
- assertTrue(time2 > time1);
+ }
+
+ @Test
+ public void testBoolean() {
+ ResourceMetadataData resourceData = new ResourceMetadataData();
- status = janusGraphDao.releaseElement(resourceData);
- assertEquals(JanusGraphOperationStatus.OK, status);
+ resourceData.getMetadataDataDefinition().setName("resourceForLock");
+ resourceData.getMetadataDataDefinition().setVersion("0.1");
+ resourceData.getMetadataDataDefinition().setState("NOT_CERTIFIED_CHECKOUT");
+ resourceData.getMetadataDataDefinition().setHighestVersion(true);
+ resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
+ + resourceData.getMetadataDataDefinition().getVersion());
- nodeLock = janusGraphDao.getNode(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), lockId, GraphNodeLock.class);
- assertTrue(nodeLock.isRight());
- assertEquals(JanusGraphOperationStatus.NOT_FOUND, nodeLock.right().value());
-
- janusGraphDao.deleteNode(resourceData, ResourceMetadataData.class);
- janusGraphDao.commit();
+ Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData,
+ ResourceMetadataData.class);
+ assertTrue(resource1.isLeft());
- }
-
- @Test
- public void testBoolean() {
- ResourceMetadataData resourceData = new ResourceMetadataData();
-
- resourceData.getMetadataDataDefinition().setName("resourceForLock");
- resourceData.getMetadataDataDefinition().setVersion("0.1");
- resourceData.getMetadataDataDefinition().setState("NOT_CERTIFIED_CHECKOUT");
- resourceData.getMetadataDataDefinition().setHighestVersion(true);
- resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
- + resourceData.getMetadataDataDefinition().getVersion());
+ resourceData = new ResourceMetadataData();
+
+ resourceData.getMetadataDataDefinition().setName("resourceForLock");
+ resourceData.getMetadataDataDefinition().setVersion("0.2");
+ resourceData.getMetadataDataDefinition().setState("NOT_CERTIFIED_CHECKOUT");
+ resourceData.getMetadataDataDefinition().setHighestVersion(false);
+ resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
+ + resourceData.getMetadataDataDefinition().getVersion());
+
+ Either<ResourceMetadataData, JanusGraphOperationStatus> resource2 = janusGraphDao.createNode(resourceData,
+ ResourceMetadataData.class);
+ janusGraphDao.commit();
+
+ Map<String, Object> props = new HashMap<>();
+
+ props.put(GraphPropertiesDictionary.STATE.getProperty(), "NOT_CERTIFIED_CHECKOUT");
+ props.put("name", "resourceForLock");
+ props.put(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), false);
+
+ // get by criteria. must be 1
+ Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao
+ .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isLeft());
+
+ janusGraphDao.deleteNode(resource1.left().value(), ResourceMetadataData.class);
+
+ janusGraphDao.deleteNode(resource2.left().value(), ResourceMetadataData.class);
+ janusGraphDao.commit();
+ }
+
+ @Test
+ public void testStringSearch() {
+ JanusGraph graph;
+
+ BaseConfiguration conf = new BaseConfiguration();
+ conf.setProperty("storage.backend", "inmemory");
+ graph = JanusGraphFactory.open(conf);
+
+ // JanusGraphManagement graphMgt = graph.getManagementSystem();
+ JanusGraphManagement graphMgt = graph.openManagement();
+ PropertyKey propKey = graphMgt.makePropertyKey("string1").dataType(String.class).make();
+ graphMgt.buildIndex("string1", Vertex.class).addKey(propKey).unique().buildCompositeIndex();
+
+ propKey = graphMgt.makePropertyKey("string2").dataType(String.class).make();
+
+ graphMgt.buildIndex("string2", Vertex.class).addKey(propKey).unique().buildCompositeIndex();
+ graphMgt.commit();
+
+ log.debug("**** predicat index search non case");
+ Iterable<JanusGraphVertex> vertices = graph.query().has("string1", Text.REGEX, "my new string 1").vertices();
+ Iterator<JanusGraphVertex> iter = vertices.iterator();
+ while (iter.hasNext()) {
+ Vertex ver = iter.next();
+ // System.out.println(com.tinkerpop.blueprints.util.ElementHelper.getProperties(ver));
+ log.debug("{}", janusGraphDao.getProperties(ver));
+ }
+
+ }
+
+ @Test
+ public void testDuplicateResultDueToJanusGraphBug() {
+
+ ResourceMetadataData resourceData1 = new ResourceMetadataData();
+ resourceData1.getMetadataDataDefinition().setUniqueId("A");
+ ((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true);
+ resourceData1.getMetadataDataDefinition().setName("aaaa");
+
+ Either<ResourceMetadataData, JanusGraphOperationStatus> newNode1 = janusGraphDao.createNode(resourceData1,
+ ResourceMetadataData.class);
+ assertTrue(newNode1.isLeft());
+ log.debug("{}", newNode1.left().value());
+ // janusGraphDao.commit();
+
+ Map<String, Object> props = new HashMap<>();
+ props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), true);
+ Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao
+ .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isLeft());
+ assertEquals("check one result returned", 1, byCriteria.left().value().size());
+ // janusGraphDao.commit();
+
+ ResourceMetadataData resourceToUpdate = new ResourceMetadataData();
+ ((ResourceMetadataDataDefinition) resourceToUpdate.getMetadataDataDefinition()).setAbstract(false);
+ resourceToUpdate.getMetadataDataDefinition().setUniqueId("A");
+ Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceToUpdate,
+ ResourceMetadataData.class);
+ assertTrue(updateNode.isLeft());
+ // janusGraphDao.commit();
+
+ byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria.right().value());
+
+ AdditionalInfoParameterData infoParameterData = new AdditionalInfoParameterData();
+ infoParameterData.getAdditionalInfoParameterDataDefinition().setUniqueId("123");
+ Map<String, String> idToKey = new HashMap<>();
+ idToKey.put("key1", "value1");
+ infoParameterData.setIdToKey(idToKey);
+
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> newNode2 = janusGraphDao.createNode(infoParameterData,
+ AdditionalInfoParameterData.class);
+ assertTrue(newNode2.isLeft());
+ log.debug("{}", newNode2.left().value());
+ // janusGraphDao.commit();
+
+ Map<String, String> idToKey2 = new HashMap<>();
+ idToKey2.put("key1", "value2");
+
+ Map<String, Object> props2 = new HashMap<>();
+ props2.put(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), "123");
+ Gson gson = new Gson();
+ props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(), gson.toJson(idToKey2));
+ // props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(),
+ // idToKey2);
+
+ Either<List<AdditionalInfoParameterData>, JanusGraphOperationStatus> byCriteria2 = janusGraphDao
+ .getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2, AdditionalInfoParameterData.class);
+ assertTrue(byCriteria2.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria2.right().value());
+
+ infoParameterData.setIdToKey(idToKey2);
+
+ Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode2 = janusGraphDao.updateNode(infoParameterData,
+ AdditionalInfoParameterData.class);
+ assertTrue(updateNode2.isLeft());
+ // janusGraphDao.commit();
+
+ props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(), idToKey);
+ byCriteria2 = janusGraphDao.getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2,
+ AdditionalInfoParameterData.class);
+ assertTrue(byCriteria2.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria2.right().value());
+
+ ComponentInstanceData resourceInstanceData = new ComponentInstanceData();
+ resourceInstanceData.getComponentInstDataDefinition().setUniqueId("ri123");
+ resourceInstanceData.getComponentInstDataDefinition().setPosX("22");
+ resourceInstanceData.getComponentInstDataDefinition().setName("myresource_1");
+
+ Either<ComponentInstanceData, JanusGraphOperationStatus> newNode3 = janusGraphDao.createNode(resourceInstanceData,
+ ComponentInstanceData.class);
+ assertTrue(newNode3.isLeft());
+ log.debug("{}", newNode3.left().value());
+ // janusGraphDao.commit();
+
+ resourceInstanceData.getComponentInstDataDefinition().setPosX("50");
+ Either<ComponentInstanceData, JanusGraphOperationStatus> updateNode3 = janusGraphDao.updateNode(resourceInstanceData,
+ ComponentInstanceData.class);
+ assertTrue(updateNode3.isLeft());
+ // janusGraphDao.commit();
+
+ resourceInstanceData.getComponentInstDataDefinition().setName("myresource_2");
+ updateNode3 = janusGraphDao.updateNode(resourceInstanceData, ComponentInstanceData.class);
+ assertTrue(updateNode3.isLeft());
+ // janusGraphDao.commit();
+
+ Map<String, Object> props3 = new HashMap<>();
+ props3.put("positionX", "22");
+ Either<List<ComponentInstanceData>, JanusGraphOperationStatus> byCriteria3 = janusGraphDao
+ .getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class);
+ assertTrue(byCriteria3.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria3.right().value());
+
+ props3.put("positionX", "50");
+ byCriteria3 = janusGraphDao.getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class);
+ assertTrue(byCriteria3.isLeft());
+
+ /////////////////////////// check integer ////////////////////////
+
+ ArtifactData artifactData = new ArtifactData();
+ artifactData.getArtifactDataDefinition().setUniqueId("ad234");
+ artifactData.getArtifactDataDefinition().setTimeout(100);
+
+ Either<ArtifactData, JanusGraphOperationStatus> newNode4 = janusGraphDao.createNode(artifactData, ArtifactData.class);
+ assertTrue(newNode4.isLeft());
+ log.debug("{}", newNode4.left().value());
+ // janusGraphDao.commit();
+
+ artifactData.getArtifactDataDefinition().setTimeout(50);
+ Either<ArtifactData, JanusGraphOperationStatus> updateNode4 = janusGraphDao.updateNode(artifactData, ArtifactData.class);
+ assertTrue(updateNode4.isLeft());
+ // janusGraphDao.commit();
+
+ Map<String, Object> props4 = new HashMap<>();
+ props4.put("timeout", 100);
+ Either<List<ArtifactData>, JanusGraphOperationStatus> byCriteria4 = janusGraphDao.getByCriteria(NodeTypeEnum.ArtifactRef,
+ props4, ArtifactData.class);
+ assertTrue(byCriteria4.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria4.right().value());
+
+ props4.put("timeout", 50);
+ byCriteria4 = janusGraphDao.getByCriteria(NodeTypeEnum.ArtifactRef, props4, ArtifactData.class);
+ assertTrue(byCriteria4.isLeft());
+
+ janusGraphDao.rollback();
+ }
+
+ @Test
+ public void testDuplicateResultUSeHasNotQueryDueToJanusGraphBug() {
+
+ String name = "bbbb";
+
+ ResourceMetadataData resourceData1 = new ResourceMetadataData();
+ resourceData1.getMetadataDataDefinition().setUniqueId("A");
+ ((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true);
+ resourceData1.getMetadataDataDefinition().setName(name);
+
+ Either<ResourceMetadataData, JanusGraphOperationStatus> newNode1 = janusGraphDao.createNode(resourceData1,
+ ResourceMetadataData.class);
+ assertTrue(newNode1.isLeft());
+ log.debug("{}", newNode1.left().value());
+ // janusGraphDao.commit();
+
+ Map<String, Object> props = new HashMap<>();
+ props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), true);
+ Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao
+ .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isLeft());
+ assertEquals("check one result returned", 1, byCriteria.left().value().size());
+ // janusGraphDao.commit();
+
+ ResourceMetadataData resourceToUpdate = new ResourceMetadataData();
+ ((ResourceMetadataDataDefinition) resourceToUpdate.getMetadataDataDefinition()).setAbstract(false);
+ resourceToUpdate.getMetadataDataDefinition().setUniqueId("A");
+ Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceToUpdate,
+ ResourceMetadataData.class);
+ assertTrue(updateNode.isLeft());
+ // janusGraphDao.commit();
+
+ // no result where isAbstract = true
+ byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria.right().value());
+
+ // one result where isAbstract != true
+ byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isLeft());
+ assertEquals("check one result returned", 1, byCriteria.left().value().size());
+
+ props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), false);
+ byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class);
+ assertTrue(byCriteria.isRight());
+ assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
+ byCriteria.right().value());
+
+ janusGraphDao.rollback();
+
+ }
- Either<ResourceMetadataData, JanusGraphOperationStatus> resource1 = janusGraphDao.createNode(resourceData,
- ResourceMetadataData.class);
- assertTrue(resource1.isLeft());
-
- resourceData = new ResourceMetadataData();
-
- resourceData.getMetadataDataDefinition().setName("resourceForLock");
- resourceData.getMetadataDataDefinition().setVersion("0.2");
- resourceData.getMetadataDataDefinition().setState("NOT_CERTIFIED_CHECKOUT");
- resourceData.getMetadataDataDefinition().setHighestVersion(false);
- resourceData.getMetadataDataDefinition().setUniqueId(resourceData.getMetadataDataDefinition().getName() + "."
- + resourceData.getMetadataDataDefinition().getVersion());
-
- Either<ResourceMetadataData, JanusGraphOperationStatus> resource2 = janusGraphDao.createNode(resourceData,
- ResourceMetadataData.class);
- janusGraphDao.commit();
-
- Map<String, Object> props = new HashMap<>();
-
- props.put(GraphPropertiesDictionary.STATE.getProperty(), "NOT_CERTIFIED_CHECKOUT");
- props.put("name", "resourceForLock");
- props.put(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), false);
-
- // get by criteria. must be 1
- Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao
- .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isLeft());
-
- janusGraphDao.deleteNode(resource1.left().value(), ResourceMetadataData.class);
-
- janusGraphDao.deleteNode(resource2.left().value(), ResourceMetadataData.class);
- janusGraphDao.commit();
- }
-
- // @Test
- public void testStringSearch() {
- JanusGraph graph;
-
- BaseConfiguration conf = new BaseConfiguration();
- conf.setProperty("storage.backend", "inmemory");
- graph = JanusGraphFactory.open(conf);
-
- // JanusGraphManagement graphMgt = graph.getManagementSystem();
- JanusGraphManagement graphMgt = graph.openManagement();
- PropertyKey propKey = graphMgt.makePropertyKey("string1").dataType(String.class).make();
- graphMgt.buildIndex("string1", Vertex.class).addKey(propKey).unique().buildCompositeIndex();
-
- propKey = graphMgt.makePropertyKey("string2").dataType(String.class).make();
-
- graphMgt.buildIndex("string2", Vertex.class).addKey(propKey).unique().buildCompositeIndex();
- graphMgt.commit();
-
-
- log.debug("**** predicat index search non case");
- Iterable<JanusGraphVertex> vertices = graph.query().has("string1", Text.REGEX, "my new string 1").vertices();
- Iterator<JanusGraphVertex> iter = vertices.iterator();
- while (iter.hasNext()) {
- Vertex ver = iter.next();
- // System.out.println(com.tinkerpop.blueprints.util.ElementHelper.getProperties(ver));
- log.debug("{}", janusGraphDao.getProperties(ver));
- }
-
- }
-
- @Test
- public void testDuplicateResultDueToJanusGraphBug() {
-
- ResourceMetadataData resourceData1 = new ResourceMetadataData();
- resourceData1.getMetadataDataDefinition().setUniqueId("A");
- ((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true);
- resourceData1.getMetadataDataDefinition().setName("aaaa");
-
- Either<ResourceMetadataData, JanusGraphOperationStatus> newNode1 = janusGraphDao.createNode(resourceData1,
- ResourceMetadataData.class);
- assertTrue(newNode1.isLeft());
- log.debug("{}", newNode1.left().value());
- // janusGraphDao.commit();
-
- Map<String, Object> props = new HashMap<>();
- props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), true);
- Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao
- .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isLeft());
- assertEquals("check one result returned", 1, byCriteria.left().value().size());
- // janusGraphDao.commit();
-
- ResourceMetadataData resourceToUpdate = new ResourceMetadataData();
- ((ResourceMetadataDataDefinition) resourceToUpdate.getMetadataDataDefinition()).setAbstract(false);
- resourceToUpdate.getMetadataDataDefinition().setUniqueId("A");
- Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceToUpdate,
- ResourceMetadataData.class);
- assertTrue(updateNode.isLeft());
- // janusGraphDao.commit();
-
- byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria.right().value());
-
- AdditionalInfoParameterData infoParameterData = new AdditionalInfoParameterData();
- infoParameterData.getAdditionalInfoParameterDataDefinition().setUniqueId("123");
- Map<String, String> idToKey = new HashMap<>();
- idToKey.put("key1", "value1");
- infoParameterData.setIdToKey(idToKey);
-
- Either<AdditionalInfoParameterData, JanusGraphOperationStatus> newNode2 = janusGraphDao.createNode(infoParameterData,
- AdditionalInfoParameterData.class);
- assertTrue(newNode2.isLeft());
- log.debug("{}", newNode2.left().value());
- // janusGraphDao.commit();
-
- Map<String, String> idToKey2 = new HashMap<>();
- idToKey2.put("key1", "value2");
-
- Map<String, Object> props2 = new HashMap<>();
- props2.put(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), "123");
- Gson gson = new Gson();
- props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(), gson.toJson(idToKey2));
- // props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(),
- // idToKey2);
-
- Either<List<AdditionalInfoParameterData>, JanusGraphOperationStatus> byCriteria2 = janusGraphDao
- .getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2, AdditionalInfoParameterData.class);
- assertTrue(byCriteria2.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria2.right().value());
-
- infoParameterData.setIdToKey(idToKey2);
-
- Either<AdditionalInfoParameterData, JanusGraphOperationStatus> updateNode2 = janusGraphDao.updateNode(infoParameterData,
- AdditionalInfoParameterData.class);
- assertTrue(updateNode2.isLeft());
- // janusGraphDao.commit();
-
- props2.put(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty(), idToKey);
- byCriteria2 = janusGraphDao.getByCriteria(NodeTypeEnum.AdditionalInfoParameters, props2,
- AdditionalInfoParameterData.class);
- assertTrue(byCriteria2.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria2.right().value());
-
- ComponentInstanceData resourceInstanceData = new ComponentInstanceData();
- resourceInstanceData.getComponentInstDataDefinition().setUniqueId("ri123");
- resourceInstanceData.getComponentInstDataDefinition().setPosX("22");
- resourceInstanceData.getComponentInstDataDefinition().setName("myresource_1");
-
- Either<ComponentInstanceData, JanusGraphOperationStatus> newNode3 = janusGraphDao.createNode(resourceInstanceData,
- ComponentInstanceData.class);
- assertTrue(newNode3.isLeft());
- log.debug("{}", newNode3.left().value());
- // janusGraphDao.commit();
-
- resourceInstanceData.getComponentInstDataDefinition().setPosX("50");
- Either<ComponentInstanceData, JanusGraphOperationStatus> updateNode3 = janusGraphDao.updateNode(resourceInstanceData,
- ComponentInstanceData.class);
- assertTrue(updateNode3.isLeft());
- // janusGraphDao.commit();
-
- resourceInstanceData.getComponentInstDataDefinition().setName("myresource_2");
- updateNode3 = janusGraphDao.updateNode(resourceInstanceData, ComponentInstanceData.class);
- assertTrue(updateNode3.isLeft());
- // janusGraphDao.commit();
-
- Map<String, Object> props3 = new HashMap<>();
- props3.put("positionX", "22");
- Either<List<ComponentInstanceData>, JanusGraphOperationStatus> byCriteria3 = janusGraphDao
- .getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class);
- assertTrue(byCriteria3.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria3.right().value());
-
- props3.put("positionX", "50");
- byCriteria3 = janusGraphDao.getByCriteria(NodeTypeEnum.ResourceInstance, props3, ComponentInstanceData.class);
- assertTrue(byCriteria3.isLeft());
-
- /////////////////////////// check integer ////////////////////////
-
- ArtifactData artifactData = new ArtifactData();
- artifactData.getArtifactDataDefinition().setUniqueId("ad234");
- artifactData.getArtifactDataDefinition().setTimeout(100);
-
- Either<ArtifactData, JanusGraphOperationStatus> newNode4 = janusGraphDao.createNode(artifactData, ArtifactData.class);
- assertTrue(newNode4.isLeft());
- log.debug("{}", newNode4.left().value());
- // janusGraphDao.commit();
-
- artifactData.getArtifactDataDefinition().setTimeout(50);
- Either<ArtifactData, JanusGraphOperationStatus> updateNode4 = janusGraphDao.updateNode(artifactData, ArtifactData.class);
- assertTrue(updateNode4.isLeft());
- // janusGraphDao.commit();
-
- Map<String, Object> props4 = new HashMap<>();
- props4.put("timeout", 100);
- Either<List<ArtifactData>, JanusGraphOperationStatus> byCriteria4 = janusGraphDao.getByCriteria(NodeTypeEnum.ArtifactRef,
- props4, ArtifactData.class);
- assertTrue(byCriteria4.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria4.right().value());
-
- props4.put("timeout", 50);
- byCriteria4 = janusGraphDao.getByCriteria(NodeTypeEnum.ArtifactRef, props4, ArtifactData.class);
- assertTrue(byCriteria4.isLeft());
-
- janusGraphDao.rollback();
- }
-
- @Test
- public void testDuplicateResultUSeHasNotQueryDueToJanusGraphBug() {
-
- String name = "bbbb";
-
- ResourceMetadataData resourceData1 = new ResourceMetadataData();
- resourceData1.getMetadataDataDefinition().setUniqueId("A");
- ((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true);
- resourceData1.getMetadataDataDefinition().setName(name);
-
- Either<ResourceMetadataData, JanusGraphOperationStatus> newNode1 = janusGraphDao.createNode(resourceData1,
- ResourceMetadataData.class);
- assertTrue(newNode1.isLeft());
- log.debug("{}", newNode1.left().value());
- // janusGraphDao.commit();
-
- Map<String, Object> props = new HashMap<>();
- props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), true);
- Either<List<ResourceMetadataData>, JanusGraphOperationStatus> byCriteria = janusGraphDao
- .getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isLeft());
- assertEquals("check one result returned", 1, byCriteria.left().value().size());
- // janusGraphDao.commit();
-
- ResourceMetadataData resourceToUpdate = new ResourceMetadataData();
- ((ResourceMetadataDataDefinition) resourceToUpdate.getMetadataDataDefinition()).setAbstract(false);
- resourceToUpdate.getMetadataDataDefinition().setUniqueId("A");
- Either<ResourceMetadataData, JanusGraphOperationStatus> updateNode = janusGraphDao.updateNode(resourceToUpdate,
- ResourceMetadataData.class);
- assertTrue(updateNode.isLeft());
- // janusGraphDao.commit();
-
- // no result where isAbstract = true
- byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria.right().value());
-
- // one result where isAbstract != true
- byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isLeft());
- assertEquals("check one result returned", 1, byCriteria.left().value().size());
-
- props.put(GraphPropertiesDictionary.IS_ABSTRACT.getProperty(), false);
- byCriteria = janusGraphDao.getByCriteria(NodeTypeEnum.Resource, null, props, ResourceMetadataData.class);
- assertTrue(byCriteria.isRight());
- assertEquals("check one result returned due to janusgraph bug", JanusGraphOperationStatus.NOT_FOUND,
- byCriteria.right().value());
-
- janusGraphDao.rollback();
-
- }
-
}
diff --git a/catalog-fe/pom.xml b/catalog-fe/pom.xml
index e3883b75d8..170c39d426 100644
--- a/catalog-fe/pom.xml
+++ b/catalog-fe/pom.xml
@@ -1,689 +1,703 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>catalog-fe</artifactId>
- <packaging>war</packaging>
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>sdc-main</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- </parent>
-
- <dependencies>
-
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>${lombok.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.functionaljava</groupId>
- <artifactId>functionaljava</artifactId>
- <version>${functionaljava.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.common</groupId>
- <artifactId>onap-configuration-management-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>common-app-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- File changes listener -->
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.janino</groupId>
- <artifactId>janino</artifactId>
- <version>${janino.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>${snakeyaml.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet</artifactId>
- <version>${jersey-bom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-multipart</artifactId>
- <version>${jersey-bom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-moxy</artifactId>
- <version>${jersey-bom.version}</version>
- <scope>compile</scope>
- </dependency>
-
-
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jackson</artifactId>
- <version>${jersey-bom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.inject</groupId>
- <artifactId>jersey-hk2</artifactId>
- <version>${jersey-bom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson-annotations.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- http client -->
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>${httpcore.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpmime</artifactId>
- <version>${httpclient.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons-logging}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec}</version>
- <scope>compile</scope>
- </dependency>
- <!-- http client END -->
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${servlet-api.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- JSON and YAML Parsing -->
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-yaml</artifactId>
- <version>${jackson.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Jetty Proxy -->
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-proxy</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Proxy servlet -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Aspects -->
- <dependency>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-aspects</artifactId>
- <version>${jcabi.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectjrt.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${lang3.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>${jaxb-api.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.hibernate.validator</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate.validator.version}</version>
- </dependency>
-
- <!-- Inserted for ECOMP Portal Integration -->
- <dependency>
- <groupId>org.owasp.esapi</groupId>
- <artifactId>esapi</artifactId>
- <version>${org.owasp.esapi.version}</version>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.xmlgraphics</groupId>
- <artifactId>xmlgraphics-commons</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-fw</artifactId>
- <version>${ecomp.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>com.att.nsa</groupId>
- <artifactId>cambriaClient</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- System metrics -->
- <dependency>
- <groupId>org.fusesource</groupId>
- <artifactId>sigar</artifactId>
- <version>${sigar.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- TEST -->
- <dependency>
- <groupId>org.glassfish.jersey.test-framework.providers</groupId>
- <artifactId>jersey-test-framework-provider-bundle</artifactId>
- <version>${jersey-bom.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-continuation</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>com.google.code.bean-matchers</groupId>
- <artifactId>bean-matchers</artifactId>
- <version>${bean-matchers.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${ws.rs.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>${javax.validation.version}</version>
- </dependency>
- </dependencies>
-
- <build>
-
- <finalName>${project.artifactId}-${project.version}</finalName>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- </archive>
-
- <webResources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </webResources>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>${jetty.version}</version>
- <configuration>
- <webApp>
- <contextPath>/</contextPath>
- <webInfIncludeJarPattern>.*/.*jersey-[^/]\.jar$</webInfIncludeJarPattern>
- </webApp>
- <war>${project.build.directory}/${project.build.finalName}.war</war>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-maven-plugin</artifactId>
- <version>${jcabi.maven.plugin.version}</version>
- <dependencies>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjtools</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <goals>
- <goal>ajc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <executions>
- <execution>
- <id>clean.catalog.fe.folder</id>
- <phase>clean</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <filesets>
- <!-- FE WAR's -->
- <fileset>
- <directory>${project.parent.basedir}/catalog-fe/sdc-frontend/</directory>
- <followSymlinks>false</followSymlinks>
- <includes>
- <include>*.war</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.github.sylvainlaurent.maven</groupId>
- <artifactId>yaml-json-validator-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>validate</id>
- <phase>validate</phase>
- <goals>
- <goal>validate</goal>
- </goals>
- <configuration>
- <validationSets>
- <validationSet>
- <includes>
- <include>src/main/resources/**/*.y*ml</include>
- <include>src/test/resources/**/*.y*ml</include>
- </includes>
- </validationSet>
- <validationSet>
- <includes>
- <include>src/main/resources/**/*.json</include>
- <include>src/test/resources/**/*.json</include>
- </includes>
- </validationSet>
- </validationSets>
- <skip>${skipYamlJsonValidator}</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
-
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
-
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-maven-plugin</artifactId>
- <versionRange>[0.0,)</versionRange>
- <goals>
- <goal>ajc</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute/>
- </action>
- </pluginExecution>
-
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
-
- <!-- jacbi (log injection) -->
-
- </plugins>
- </pluginManagement>
-
- </build>
-
- <profiles>
- <profile>
- <id>catalog</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
-
- <build>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <artifactId>catalog-fe</artifactId>
+ <build>
+
<finalName>${project.artifactId}-${project.version}</finalName>
- </build>
- </profile>
- <profile>
- <id>docker</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <docker.username>docker</docker.username>
- <docker.password>docker</docker.password>
- </properties>
- <build>
+
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <artifactId>lifecycle-mapping</artifactId>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+
+ <pluginExecution>
+ <action>
+ <execute/>
+ </action>
+ <pluginExecutionFilter>
+ <artifactId>jcabi-maven-plugin</artifactId>
+ <goals>
+ <goal>ajc</goal>
+ </goals>
+ <groupId>com.jcabi</groupId>
+ <versionRange>[0.0,)</versionRange>
+ </pluginExecutionFilter>
+ </pluginExecution>
+
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ <groupId>org.eclipse.m2e</groupId>
+ <version>1.0.0</version>
+ </plugin>
+
+ <!-- jacbi (log injection) -->
+
+ </plugins>
+ </pluginManagement>
+
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-resources-fe</id>
- <phase>verify</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
<configuration>
- <outputDirectory>${basedir}/sdc-frontend</outputDirectory>
- <resources>
- <resource>
- <directory>${project.parent.basedir}/catalog-fe/target</directory>
- <includes>
- <include>catalog-fe-${project.version}.war</include>
- </includes>
- </resource>
- <resource>
- <directory>${project.parent.basedir}/openecomp-ui/target</directory>
- <includes>
- <include>onboarding-fe-${project.version}.war</include>
- </includes>
- </resource>
- </resources>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+
+ <webResources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </webResources>
</configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <configuration>
- <verbose>${verbose}</verbose>
- <apiVersion>${docker.api.version}</apiVersion>
- <registry>nexus3.onap.org:10001</registry>
- <authConfig>
- <pull>
- <username>${docker.username}</username>
- <password>${docker.password}</password>
- </pull>
- </authConfig>
- <images>
-
- <!-- Build frontend image -->
- <image>
- <name>onap/sdc-frontend</name>
- <alias>sdc-frontend</alias>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${project.basedir}/sdc-frontend</dockerFileDir>
- <tags>
- <tag>latest</tag>
- <tag>
- ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
- </tag>
- <tag>
- ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
- </tag>
- </tags>
- </build>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>clean-images</id>
- <phase>pre-clean</phase>
- <goals>
- <goal>remove</goal>
- </goals>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+
+ <plugin>
+ <artifactId>jetty-maven-plugin</artifactId>
<configuration>
- <removeAll>true</removeAll>
- <image>onap/sdc-frontend</image>
+ <war>${project.build.directory}/${project.build.finalName}.war</war>
+ <webApp>
+ <contextPath>/</contextPath>
+ <webInfIncludeJarPattern>.*/.*jersey-[^/]\.jar$</webInfIncludeJarPattern>
+ </webApp>
</configuration>
- </execution>
-
- <execution>
- <id>generate-images</id>
- <phase>install</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
-
- <execution>
- <id>push-images</id>
- <phase>deploy</phase>
- <goals>
- <goal>push</goal>
- </goals>
+ <groupId>org.eclipse.jetty</groupId>
+ <version>${jetty.version}</version>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <image>onap/sdc-frontend</image>
+ <skip>true</skip>
</configuration>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+
+ <plugin>
+ <artifactId>jcabi-maven-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <artifactId>aspectjtools</artifactId>
+ <groupId>org.aspectj</groupId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>aspectjweaver</artifactId>
+ <groupId>org.aspectj</groupId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ajc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <groupId>com.jcabi</groupId>
+ <version>${jcabi.maven.plugin.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <filesets>
+ <!-- FE WAR's -->
+ <fileset>
+ <directory>${project.parent.basedir}/catalog-fe/sdc-frontend/
+ </directory>
+ <followSymlinks>false</followSymlinks>
+ <includes>
+ <include>*.war</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <id>clean.catalog.fe.folder</id>
+ <phase>clean</phase>
+ </execution>
+ </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>yaml-json-validator-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <skip>${skipYamlJsonValidator}</skip>
+ <validationSets>
+ <validationSet>
+ <includes>
+ <include>src/main/resources/**/*.y*ml</include>
+ <include>src/test/resources/**/*.y*ml</include>
+ </includes>
+ </validationSet>
+ <validationSet>
+ <includes>
+ <include>src/main/resources/**/*.json</include>
+ <include>src/test/resources/**/*.json</include>
+ </includes>
+ </validationSet>
+ </validationSets>
+ </configuration>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <id>validate</id>
+ <phase>validate</phase>
+ </execution>
+ </executions>
+ <groupId>com.github.sylvainlaurent.maven</groupId>
+ </plugin>
+
</plugins>
- </build>
- </profile>
- </profiles>
+
+ </build>
+ <dependencies>
+
+ <dependency>
+ <artifactId>lombok</artifactId>
+ <groupId>org.projectlombok</groupId>
+ <version>${lombok.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>functionaljava</artifactId>
+ <groupId>org.functionaljava</groupId>
+ <scope>compile</scope>
+ <version>${functionaljava.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>onap-configuration-management-api</artifactId>
+ <groupId>org.onap.sdc.common</groupId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>common-app-api</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- File changes listener -->
+ <dependency>
+ <artifactId>logback-classic</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <scope>compile</scope>
+ <version>${logback.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>groovy</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>janino</artifactId>
+ <groupId>org.codehaus.janino</groupId>
+ <scope>compile</scope>
+ <version>${janino.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>snakeyaml</artifactId>
+ <groupId>org.yaml</groupId>
+ <scope>compile</scope>
+ <version>${snakeyaml.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-jci-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>commons-io</artifactId>
+ <groupId>commons-io</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.apache.commons</groupId>
+ <scope>compile</scope>
+ <version>${commons-jci-core.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>gson</artifactId>
+ <groupId>com.google.code.gson</groupId>
+ <scope>compile</scope>
+ <version>${gson.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-container-servlet</artifactId>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <scope>compile</scope>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-media-multipart</artifactId>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <scope>compile</scope>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-media-moxy</artifactId>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <scope>compile</scope>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <scope>compile</scope>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-hk2</artifactId>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <scope>compile</scope>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jackson-databind</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jackson-annotations</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <scope>compile</scope>
+ <version>${jackson-annotations.version}</version>
+ </dependency>
+
+ <!-- http client -->
+ <dependency>
+ <artifactId>httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <scope>compile</scope>
+ <version>${httpclient.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>httpcore</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <scope>compile</scope>
+ <version>${httpcore.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>httpmime</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <scope>compile</scope>
+ <version>${httpclient.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-logging</artifactId>
+ <groupId>commons-logging</groupId>
+ <scope>compile</scope>
+ <version>${commons-logging}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-codec</artifactId>
+ <groupId>commons-codec</groupId>
+ <scope>compile</scope>
+ <version>${commons-codec}</version>
+ </dependency>
+ <!-- http client END -->
+
+ <dependency>
+ <artifactId>javax.servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ <scope>provided</scope>
+ <version>${servlet-api.version}</version>
+ </dependency>
+
+ <!-- JSON and YAML Parsing -->
+ <dependency>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <scope>compile</scope>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <!-- Jetty Proxy -->
+ <dependency>
+ <artifactId>jetty-proxy</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jetty-servlets</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+
+ <!-- Proxy servlet -->
+ <dependency>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ <scope>compile</scope>
+ <version>${guava.version}</version>
+ </dependency>
+
+ <!-- Aspects -->
+ <dependency>
+ <artifactId>jcabi-aspects</artifactId>
+ <groupId>com.jcabi</groupId>
+ <scope>compile</scope>
+ <version>${jcabi.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>aspectjrt</artifactId>
+ <groupId>org.aspectj</groupId>
+ <scope>compile</scope>
+ <version>${aspectjrt.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-lang3</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <scope>compile</scope>
+ <version>${lang3.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jaxb-api</artifactId>
+ <groupId>javax.xml.bind</groupId>
+ <scope>compile</scope>
+ <version>${jaxb-api.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>hibernate-validator</artifactId>
+ <groupId>org.hibernate.validator</groupId>
+ <version>${hibernate.validator.version}</version>
+ </dependency>
+
+ <!-- Inserted for ECOMP Portal Integration -->
+ <dependency>
+ <artifactId>esapi</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-io</artifactId>
+ <groupId>commons-io</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commons-fileupload</artifactId>
+ <groupId>commons-fileupload</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xmlgraphics-commons</artifactId>
+ <groupId>org.apache.xmlgraphics</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis-ext</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.owasp.esapi</groupId>
+ <version>${org.owasp.esapi.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>epsdk-fw</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>cambriaClient</artifactId>
+ <groupId>com.att.nsa</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.onap.portal.sdk</groupId>
+ <scope>compile</scope>
+ <version>${ecomp.version}</version>
+ </dependency>
+ <!-- System metrics -->
+ <dependency>
+ <artifactId>sigar</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.fusesource</groupId>
+ <scope>compile</scope>
+ <version>${sigar.version}</version>
+ </dependency>
+
+ <!-- TEST -->
+ <dependency>
+ <artifactId>jersey-test-framework-provider-bundle</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-server</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-continuation</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+ <scope>test</scope>
+ <type>pom</type>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>bean-matchers</artifactId>
+ <groupId>com.google.code.bean-matchers</groupId>
+ <scope>test</scope>
+ <version>${bean-matchers.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jetty-servlet</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-server</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jetty-security</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>test</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jetty-webapp</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jetty-servlet</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>test</scope>
+ <version>${jetty.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <version>${jetty.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <groupId>javax.ws.rs</groupId>
+ <scope>compile</scope>
+ <version>${ws.rs.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>validation-api</artifactId>
+ <groupId>javax.validation</groupId>
+ <version>${javax.validation.version}</version>
+ </dependency>
+ </dependencies>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>war</packaging>
+
+ <parent>
+ <artifactId>sdc-main</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.10.0-SNAPSHOT</version>
+ </parent>
+
+ <profiles>
+ <profile>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ </build>
+
+ <id>catalog</id>
+ </profile>
+ <profile>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${basedir}/sdc-frontend</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${project.parent.basedir}/catalog-fe/target
+ </directory>
+ <includes>
+ <include>catalog-fe-${project.version}.war</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>
+ ${project.parent.basedir}/openecomp-ui/target
+ </directory>
+ <includes>
+ <include>onboarding-fe-${project.version}.war
+ </include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <id>copy-resources-fe</id>
+ <phase>verify</phase>
+ </execution>
+ </executions>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <apiVersion>${docker.api.version}</apiVersion>
+ <authConfig>
+ <pull>
+ <password>${docker.password}</password>
+ <username>${docker.username}</username>
+ </pull>
+ </authConfig>
+ <images>
+
+ <!-- Build frontend image -->
+ <image>
+ <alias>sdc-frontend</alias>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${project.basedir}/sdc-frontend
+ </dockerFileDir>
+ <tags>
+ <tag>latest</tag>
+ <tag>
+ ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
+ </tag>
+ <tag>
+ ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
+ </tag>
+ </tags>
+ </build>
+ <name>onap/sdc-frontend</name>
+ </image>
+ </images>
+ <registry>nexus3.onap.org:10001</registry>
+ <verbose>${verbose}</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <configuration>
+ <image>onap/sdc-frontend</image>
+ <removeAll>true</removeAll>
+ </configuration>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ </execution>
+
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ <id>generate-images</id>
+ <phase>install</phase>
+ </execution>
+
+ <execution>
+ <configuration>
+ <image>onap/sdc-frontend</image>
+ </configuration>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ </execution>
+ </executions>
+ <groupId>io.fabric8</groupId>
+ </plugin>
+ </plugins>
+ </build>
+ <id>docker</id>
+ <properties>
+ <docker.password>docker</docker.password>
+ <docker.username>docker</docker.username>
+ </properties>
+ </profile>
+ </profiles>
</project>
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java
index 1bc067e0f4..761e61fe38 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,15 +20,20 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static org.assertj.core.api.Assertions.assertThat;
+
import fj.data.Either;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
@@ -40,41 +45,26 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum;
import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* Created by yavivi on 21/03/2018.
*/
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(value = {"classpath:application-context-test.xml", "classpath:healing-context-test.xml"})
+@SpringJUnitConfig(locations = {"classpath:application-context-test.xml", "classpath:healing-context-test.xml"})
public class ArchiveOperationTest extends ModelTestBase {
private static final String CI_UID_RES1_CP = "cp_uid";
private static final String CI_UID_RES2_VL = "vl_uid";
private static final String CI_UID_SVC_PROXY = "svc_proxy_uid";
-
+ GraphVertex archiveVertex;
+ GraphVertex catalogVertex;
@Resource
private ArchiveOperation archiveOperation;
-
@Resource
private JanusGraphDao janusGraphDao;
-
private boolean isInitialized;
-
private GraphVertex serviceVertex1;
private GraphVertex archivedVertex1;
-
- GraphVertex archiveVertex;
- GraphVertex catalogVertex;
-
private GraphVertex serviceVertex1_0;
private GraphVertex serviceVertex1_1;
private GraphVertex serviceVertex2_0;
@@ -98,14 +88,14 @@ public class ArchiveOperationTest extends ModelTestBase {
private GraphVertex vfResource0_1;
private GraphVertex vfResource0_2;
private GraphVertex vfResource1_0;
- private String csarUuid = "123456789";;
+ private String csarUuid = "123456789";
- @BeforeClass
- public static void initTest(){
+ @BeforeAll
+ public static void initTest() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void beforeTest() {
if (!isInitialized) {
GraphTestUtils.clearGraph(janusGraphDao);
@@ -115,7 +105,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testArchiveComponentSingleVersion(){
+ public void testArchiveComponentSingleVersion() {
String componentId = serviceVertex1.getUniqueId();
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(componentId);
assertThat(actionStatus.isLeft()).isTrue();
@@ -123,7 +113,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testArchiveComponentFailsWhenInCheckoutSingleVersion(){
+ public void testArchiveComponentFailsWhenInCheckoutSingleVersion() {
checkoutComponent(serviceVertex1);
String componentId = serviceVertex1.getUniqueId();
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(componentId);
@@ -146,7 +136,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testScenario2_archive_1_0(){
+ public void testScenario2_archive_1_0() {
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(serviceVertex1_0.getUniqueId());
assertThat(actionStatus.isLeft()).isTrue();
assertThat(actionStatus.left().value()).containsExactlyInAnyOrder(serviceVertex1_0.getUniqueId(), serviceVertex1_1.getUniqueId());
@@ -155,7 +145,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testScenario2_archive_1_1(){
+ public void testScenario2_archive_1_1() {
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(serviceVertex1_1.getUniqueId());
assertThat(actionStatus.left().value()).containsExactlyInAnyOrder(serviceVertex1_0.getUniqueId(), serviceVertex1_1.getUniqueId());
assertArchived(serviceVertex1_0.getUniqueId());
@@ -163,9 +153,10 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testScenario4_oneLowOneHighestVersion(){
+ public void testScenario4_oneLowOneHighestVersion() {
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(serviceVertex0_2.getUniqueId());
- assertThat(actionStatus.left().value()).containsExactlyInAnyOrder(serviceVertex0_2.getUniqueId(), serviceVertex0_1.getUniqueId(), serviceVertex0_3.getUniqueId(), serviceVertex0_4.getUniqueId(), serviceVertex0_5.getUniqueId());
+ assertThat(actionStatus.left().value()).containsExactlyInAnyOrder(serviceVertex0_2.getUniqueId(), serviceVertex0_1.getUniqueId(),
+ serviceVertex0_3.getUniqueId(), serviceVertex0_4.getUniqueId(), serviceVertex0_5.getUniqueId());
assertArchived(serviceVertex0_1.getUniqueId());
assertArchived(serviceVertex0_2.getUniqueId());
assertArchived(serviceVertex0_3.getUniqueId());
@@ -174,13 +165,14 @@ public class ArchiveOperationTest extends ModelTestBase {
actionStatus = this.archiveOperation.restoreComponent(serviceVertex0_2.getUniqueId());
assertThat(actionStatus.isLeft()).isTrue();
- assertThat(actionStatus.left().value()).containsExactlyInAnyOrder(serviceVertex0_2.getUniqueId(), serviceVertex0_1.getUniqueId(), serviceVertex0_3.getUniqueId(), serviceVertex0_4.getUniqueId(), serviceVertex0_5.getUniqueId());
+ assertThat(actionStatus.left().value()).containsExactlyInAnyOrder(serviceVertex0_2.getUniqueId(), serviceVertex0_1.getUniqueId(),
+ serviceVertex0_3.getUniqueId(), serviceVertex0_4.getUniqueId(), serviceVertex0_5.getUniqueId());
}
/////////////// Continue Here //////////////////
@Test
- public void testScenario4_archiveFromNonHighest(){
+ public void testScenario4_archiveFromNonHighest() {
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(serviceVertex0_2.getUniqueId());
assertArchived(serviceVertex0_1.getUniqueId());
assertArchived(serviceVertex0_2.getUniqueId());
@@ -197,14 +189,14 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testArchiveFailsWhenHighestVersionIsInCheckoutState(){
+ public void testArchiveFailsWhenHighestVersionIsInCheckoutState() {
checkoutComponent(serviceVertex0_5);
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(serviceVertex0_2.getUniqueId());
assertThat(actionStatus.right().value()).isEqualTo(ActionStatus.INVALID_SERVICE_STATE);
}
@Test
- public void testScenario3_archive_3_0(){
+ public void testScenario3_archive_3_0() {
Either<List<String>, ActionStatus> actionStatus = this.archiveOperation.archiveComponent(serviceVertex3_0.getUniqueId());
assertArchived(serviceVertex3_0.getUniqueId());
assertArchived(serviceVertex3_1.getUniqueId());
@@ -212,7 +204,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testArchivedOriginsCalculation(){
+ public void testArchivedOriginsCalculation() {
//Archive the CP resource
this.archiveOperation.archiveComponent(this.compositionResource1.getUniqueId());
@@ -242,7 +234,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testNoArchivedOriginsCalculation(){
+ public void testNoArchivedOriginsCalculation() {
List<String> ciWithArchivedOrigins = this.archiveOperation.setArchivedOriginsFlagInComponentInstances(this.compositionService);
//Validate that method returns the CI of CP
@@ -250,7 +242,7 @@ public class ArchiveOperationTest extends ModelTestBase {
}
@Test
- public void testOnVspArchivedAndRestored(){
+ public void testOnVspArchivedAndRestored() {
this.archiveOperation.onVspArchived(csarUuid);
//assertOnCommit();
@@ -290,7 +282,7 @@ public class ArchiveOperationTest extends ModelTestBase {
assertOnCommit();
}
- private void assertOnCommit(){
+ private void assertOnCommit() {
final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
}
@@ -303,7 +295,7 @@ public class ArchiveOperationTest extends ModelTestBase {
assertArchivedOrRestored(ArchiveOperation.Action.RESTORE, componentUniqueId);
}
- private void assertArchivedOrRestored(ArchiveOperation.Action action, String componentUniqueId) {
+ private void assertArchivedOrRestored(ArchiveOperation.Action action, String componentUniqueId) {
GraphVertex v = janusGraphDao.getVertexById(componentUniqueId).left().value();
EdgeLabelEnum requiredEdge = action == ArchiveOperation.Action.ARCHIVE ? EdgeLabelEnum.ARCHIVE_ELEMENT : EdgeLabelEnum.CATALOG_ELEMENT;
@@ -317,7 +309,8 @@ public class ArchiveOperationTest extends ModelTestBase {
parent = janusGraphDao.getParentVertex(v, requiredEdge, JsonParseFlagEnum.NoParse).left().value();
otherLookup = janusGraphDao.getParentVertex(v, otherEdge, JsonParseFlagEnum.NoParse);
assertThat(otherLookup.isRight()).isTrue(); //Verify that component is not linked to Catalog/Archive Root
- assertThat(parent.getUniqueId()).isEqualTo(action == ArchiveOperation.Action.ARCHIVE ? this.archiveVertex.getUniqueId() : this.catalogVertex.getUniqueId()); //Verify that parent is indeed Archive Root
+ assertThat(parent.getUniqueId()).isEqualTo(action == ArchiveOperation.Action.ARCHIVE ? this.archiveVertex.getUniqueId()
+ : this.catalogVertex.getUniqueId()); //Verify that parent is indeed Archive Root
}
assertArchivedOrRestoredProps(action, v);
@@ -325,13 +318,13 @@ public class ArchiveOperationTest extends ModelTestBase {
private void assertArchivedProps(String uniqueId) {
GraphVertex v =
- janusGraphDao.getVertexById(uniqueId).left().value();
+ janusGraphDao.getVertexById(uniqueId).left().value();
assertArchivedOrRestoredProps(ArchiveOperation.Action.ARCHIVE, v);
}
private void assertRestoredProps(String uniqueId) {
GraphVertex v =
- janusGraphDao.getVertexById(uniqueId).left().value();
+ janusGraphDao.getVertexById(uniqueId).left().value();
assertArchivedOrRestoredProps(ArchiveOperation.Action.RESTORE, v);
}
@@ -418,7 +411,7 @@ public class ArchiveOperationTest extends ModelTestBase {
.createEdge(catalogVertex, serviceVertex0_5, EdgeLabelEnum.CATALOG_ELEMENT, null);
}
- private void createResourcesForArchivedVsp(){
+ private void createResourcesForArchivedVsp() {
Map<GraphPropertyEnum, Object> vfPropsNonHighest = propsForNonHighestVersion();
Map<GraphPropertyEnum, Object> vfPropsHighest = propsForNonHighestVersion();
@@ -443,7 +436,7 @@ public class ArchiveOperationTest extends ModelTestBase {
janusGraphDao.createEdge(archiveVertex, archivedVertex1, EdgeLabelEnum.ARCHIVE_ELEMENT, null);
}
- private void createServiceCompositionForCalculatingArchivedOrigins(){
+ private void createServiceCompositionForCalculatingArchivedOrigins() {
//Service that point to another service in composition
this.compositionService = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
this.compositionAnotherService = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion());
@@ -487,7 +480,7 @@ public class ArchiveOperationTest extends ModelTestBase {
instance.setUniqueId(CI_UID_SVC_PROXY);
instance.setComponentUid(compositionServiceProxy.getUniqueId());
instances.put(CI_UID_SVC_PROXY, instance);
-
+
//Add Instances to Composition
composition.setComponentInstances(instances);
//Add to full composition
@@ -498,14 +491,14 @@ public class ArchiveOperationTest extends ModelTestBase {
janusGraphDao.updateVertex(compositionService);
}
- private Map<GraphPropertyEnum, Object> propsForHighestVersion(){
+ private Map<GraphPropertyEnum, Object> propsForHighestVersion() {
Map<GraphPropertyEnum, Object> props = new HashMap();
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
return props;
}
- private Map<GraphPropertyEnum, Object> propsForNonHighestVersion(){
+ private Map<GraphPropertyEnum, Object> propsForNonHighestVersion() {
Map<GraphPropertyEnum, Object> props = new HashMap();
props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, false);
props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKIN);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java
index 2febef610f..505c13f2b6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,16 +20,25 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs;
@@ -37,20 +46,12 @@ import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper;
import org.openecomp.sdc.be.model.operations.StorageException;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.annotation.Resource;
-import java.util.*;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.when;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* Created by yavivi on 26/01/2018.
*/
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class ExternalReferencesOperationTest extends ModelTestBase {
private static final String COMPONENT_ID = "ci-MyComponentName";
@@ -83,12 +84,12 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
private IdMapper idMapper;
- @BeforeClass
- public static void initTest(){
+ @BeforeAll
+ public static void initTest() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void beforeTest() {
idMapper = Mockito.mock(IdMapper.class);
this.externalReferenceOperation.setIdMapper(idMapper);
@@ -101,8 +102,9 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
}
@Test
- public void testAddComponentInstanceExternalRef(){
- Either<String, ActionStatus> addResult = externalReferenceOperation.addExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_4);
+ public void testAddComponentInstanceExternalRef() {
+ Either<String, ActionStatus> addResult = externalReferenceOperation.addExternalReference(this.serviceVertexUuid, COMPONENT_ID,
+ MONITORING_OBJECT_TYPE, REF_4);
assertThat(addResult.isLeft()).isEqualTo(true);
//commit changes to janusgraph
@@ -145,31 +147,38 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
assertThat(allExternalReferences.size()).isZero();
}
- @Test(expected=StorageException.class)
+ @Test
public void testGetAllCIExternalRefs_nonExitingService_throwsException() {
- externalReferenceOperation.getAllExternalReferences("FAKE", COMPONENT_ID);
+ Assertions.assertThrows(StorageException.class, () -> externalReferenceOperation.getAllExternalReferences("FAKE", COMPONENT_ID));
}
@Test
- public void testGetComponentInstanceExternalRef(){
- assertThat(externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE).left().value()).contains(REF_1, REF_2, REF_3, REF_5);
- assertThat(externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, WORKFLOW_OBJECT_TYPE).left().value()).containsExactly(REF_6);
+ public void testGetComponentInstanceExternalRef() {
+ assertThat(
+ externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE).left().value()).contains(
+ REF_1, REF_2, REF_3, REF_5);
+ assertThat(externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, WORKFLOW_OBJECT_TYPE).left()
+ .value()).containsExactly(REF_6);
}
@Test
- public void testGetComponentInstanceExternalRefForNonExistingObjectId(){
- assertThat(externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE).left().value()).contains(REF_1, REF_2, REF_3, REF_5);
- Either<List<String>, ActionStatus> getResult = externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, "FAKE_OBJECT_TYPE");
+ public void testGetComponentInstanceExternalRefForNonExistingObjectId() {
+ assertThat(
+ externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE).left().value()).contains(
+ REF_1, REF_2, REF_3, REF_5);
+ Either<List<String>, ActionStatus> getResult = externalReferenceOperation.getExternalReferences(this.serviceVertexUuid, COMPONENT_ID,
+ "FAKE_OBJECT_TYPE");
assertThat(getResult.left().value()).isEmpty();
}
@Test
- public void testDeleteComponentInstanceExternalRef(){
+ public void testDeleteComponentInstanceExternalRef() {
//Test the precondition
assertThat(getServiceExternalRefs()).contains(REF_5);
//Remove REF 5
- Either<String, ActionStatus> deleteStatus = externalReferenceOperation.deleteExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_5);
+ Either<String, ActionStatus> deleteStatus = externalReferenceOperation.deleteExternalReference(this.serviceVertexUuid, COMPONENT_ID,
+ MONITORING_OBJECT_TYPE, REF_5);
assertThat(deleteStatus.isLeft()).isEqualTo(true);
//commit changes to janusgraph
@@ -181,12 +190,13 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
}
@Test
- public void testUpdateComponentInstanceExternalRef(){
+ public void testUpdateComponentInstanceExternalRef() {
//Test the precondition
assertThat(getServiceExternalRefs()).contains(REF_5).doesNotContain(REF_4);
//Update REF 5 with REF_4
- Either<String, ActionStatus> updateResult = externalReferenceOperation.updateExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_5, REF_4);
+ Either<String, ActionStatus> updateResult = externalReferenceOperation.updateExternalReference(this.serviceVertexUuid, COMPONENT_ID,
+ MONITORING_OBJECT_TYPE, REF_5, REF_4);
assertThat(updateResult.isLeft()).isEqualTo(true);
@@ -198,7 +208,7 @@ public class ExternalReferencesOperationTest extends ModelTestBase {
assertThat(getServiceExternalRefs()).doesNotContain(REF_5).contains(REF_1, REF_2, REF_3, REF_4);
}
- private List<String> getServiceExternalRefs(){
+ private List<String> getServiceExternalRefs() {
//Get service vertex
final Either<GraphVertex, JanusGraphOperationStatus> externalRefsVertexResult = this.janusGraphDao
.getChildVertex(this.serviceVertex, EdgeLabelEnum.EXTERNAL_REFS, JsonParseFlagEnum.ParseJson);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
index bad361562b..ab4e991b7f 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,15 +25,14 @@ import static org.assertj.core.api.Assertions.assertThat;
import fj.data.Either;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
-import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.GroupDefinition;
@@ -42,30 +41,26 @@ import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
+@SpringJUnitConfig(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class GroupsOperationTest extends ModelTestBase {
@Autowired
- private GroupsOperation groupsOperation;
-
+ private HealingJanusGraphDao janusGraphDao;
@Autowired
- HealingJanusGraphDao janusGraphDao;
-
+ private GroupsOperation groupsOperation;
@Autowired
private ToscaOperationFacade toscaOperationFacade;
private Component container;
- @BeforeClass
+ @BeforeAll
public static void initClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
container = new Resource();
container.setUniqueId(CONTAINER_ID);
@@ -74,7 +69,7 @@ public class GroupsOperationTest extends ModelTestBase {
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
janusGraphDao.rollback();
}
@@ -90,8 +85,8 @@ public class GroupsOperationTest extends ModelTestBase {
getGroupsFilter.setIgnoreGroups(false);
Component cmptWithGroups = toscaOperationFacade.getToscaElement(CONTAINER_ID, getGroupsFilter).left().value();
assertThat(cmptWithGroups.getGroups())
- .usingElementComparatorOnFields("name", "uniqueId")
- .containsExactlyInAnyOrder(g1, g2);
+ .usingElementComparatorOnFields("name", "uniqueId")
+ .containsExactlyInAnyOrder(g1, g2);
}
@Test
@@ -109,8 +104,8 @@ public class GroupsOperationTest extends ModelTestBase {
getGroupsFilter.setIgnoreGroups(false);
Component cmptWithGroups = toscaOperationFacade.getToscaElement(CONTAINER_ID, getGroupsFilter).left().value();
assertThat(cmptWithGroups.getGroups())
- .usingElementComparatorOnFields("name", "uniqueId")
- .containsExactlyInAnyOrder(g1, g2, g3, g4);
+ .usingElementComparatorOnFields("name", "uniqueId")
+ .containsExactlyInAnyOrder(g1, g2, g3, g4);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java
index 4925c87ce4..7353c511db 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,15 +31,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
@@ -64,11 +63,9 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.common.util.ValidationUtils;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class InterfaceOperationTest extends ModelTestBase {
private static final String RESOURCE_NAME = "Resource Name";
@@ -91,12 +88,12 @@ public class InterfaceOperationTest extends ModelTestBase {
private ToscaElementLifecycleOperation lifecycleOperation;
private GraphVertex ownerVertex;
- @BeforeClass
+ @BeforeAll
public static void initInterfacesOperation() {
init();
}
- @Before
+ @BeforeEach
public void setupBefore() {
GraphTestUtils.clearGraph(janusGraphDao);
createUsers();
@@ -149,7 +146,7 @@ public class InterfaceOperationTest extends ModelTestBase {
metadataProperties.put(GraphPropertyEnum.LABEL, VertexTypeEnum.RESOURCE_CATEGORY.getName());
metadataProperties.put(GraphPropertyEnum.NAME, categoryName);
metadataProperties
- .put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
+ .put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
@@ -161,14 +158,14 @@ public class InterfaceOperationTest extends ModelTestBase {
metadataProperties.put(GraphPropertyEnum.LABEL, VertexTypeEnum.RESOURCE_SUBCATEGORY.getName());
metadataProperties.put(GraphPropertyEnum.NAME, subcategory);
metadataProperties
- .put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(subcategory));
+ .put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(subcategory));
subCat.setMetadataProperties(metadataProperties);
subCat.updateMetadataJsonWithCurrentMetadataProperties();
Either<GraphVertex, JanusGraphOperationStatus> catRes = janusGraphDao.createVertex(cat);
Either<GraphVertex, JanusGraphOperationStatus> subCatRes = janusGraphDao.createVertex(subCat);
janusGraphDao.createEdge(catRes.left().value().getVertex(), subCatRes.left().value().getVertex(),
- EdgeLabelEnum.SUB_CATEGORY, new HashMap<>());
+ EdgeLabelEnum.SUB_CATEGORY, new HashMap<>());
}
private void createServiceCategory() {
@@ -180,7 +177,7 @@ public class InterfaceOperationTest extends ModelTestBase {
metadataProperties.put(GraphPropertyEnum.LABEL, VertexTypeEnum.SERVICE_CATEGORY.getName());
metadataProperties.put(GraphPropertyEnum.NAME, categoryName);
metadataProperties
- .put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
+ .put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
janusGraphDao.createVertex(cat);
@@ -197,7 +194,7 @@ public class InterfaceOperationTest extends ModelTestBase {
vf.getMetadata().put(JsonPresentationFields.VERSION.getPresentation(), "1.0");
vf.getMetadata().put(JsonPresentationFields.TYPE.getPresentation(), ResourceTypeEnum.VFC.name());
vf.getMetadata()
- .put(JsonPresentationFields.LIFECYCLE_STATE.getPresentation(), LifecycleStateEnum.CERTIFIED.name());
+ .put(JsonPresentationFields.LIFECYCLE_STATE.getPresentation(), LifecycleStateEnum.CERTIFIED.name());
vf.getMetadata().put(JsonPresentationFields.TOSCA_RESOURCE_NAME.getPresentation(), "root");
vf.getMetadata().put(JsonPresentationFields.HIGHEST_VERSION.getPresentation(), true);
@@ -236,7 +233,7 @@ public class InterfaceOperationTest extends ModelTestBase {
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes =
- janusGraphDao.getVertexById(createVFRes.left().value().getUniqueId());
+ janusGraphDao.getVertexById(createVFRes.left().value().getUniqueId());
getNodeTyeRes.left().value();
}
@@ -280,10 +277,10 @@ public class InterfaceOperationTest extends ModelTestBase {
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes =
- janusGraphDao.getVertexById(createVFRes.left().value().getUniqueId());
+ janusGraphDao.getVertexById(createVFRes.left().value().getUniqueId());
GraphVertex vfVertex = getNodeTyeRes.left().value();
StorageOperationStatus status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES,
- VertexTypeEnum.PROPERTIES, addProperties, JsonPresentationFields.NAME);
+ VertexTypeEnum.PROPERTIES, addProperties, JsonPresentationFields.NAME);
assertSame(StorageOperationStatus.OK, status);
PropertyDataDefinition prop33 = new PropertyDataDefinition();
@@ -291,8 +288,8 @@ public class InterfaceOperationTest extends ModelTestBase {
prop33.setDefaultValue("def33");
status = nodeTypeOperation
- .addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES,
- prop33, JsonPresentationFields.NAME);
+ .addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES,
+ prop33, JsonPresentationFields.NAME);
assertSame(StorageOperationStatus.OK, status);
PropertyDataDefinition prop44 = new PropertyDataDefinition();
@@ -300,7 +297,7 @@ public class InterfaceOperationTest extends ModelTestBase {
prop44.setDefaultValue("def44");
status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex.getUniqueId(), EdgeLabelEnum.PROPERTIES,
- VertexTypeEnum.PROPERTIES, prop44, JsonPresentationFields.NAME);
+ VertexTypeEnum.PROPERTIES, prop44, JsonPresentationFields.NAME);
assertSame(StorageOperationStatus.OK, status);
PropertyDataDefinition capProp = new PropertyDataDefinition();
@@ -314,13 +311,13 @@ public class InterfaceOperationTest extends ModelTestBase {
capProps.put("capName", dataToCreate);
nodeTypeOperation.associateElementToData(vfVertex, VertexTypeEnum.CAPABILITIES_PROPERTIES,
- EdgeLabelEnum.CAPABILITIES_PROPERTIES, capProps);
+ EdgeLabelEnum.CAPABILITIES_PROPERTIES, capProps);
List<String> pathKeys = new ArrayList<>();
pathKeys.add("capName");
capProp.setDefaultValue("BBBB");
nodeTypeOperation.updateToscaDataDeepElementOfToscaElement(vfVertex, EdgeLabelEnum.CAPABILITIES_PROPERTIES,
- VertexTypeEnum.CAPABILITIES_PROPERTIES, capProp, pathKeys, JsonPresentationFields.NAME);
+ VertexTypeEnum.CAPABILITIES_PROPERTIES, capProp, pathKeys, JsonPresentationFields.NAME);
}
private void createTopologyTemplate(String name) {
@@ -341,14 +338,14 @@ public class InterfaceOperationTest extends ModelTestBase {
service.setComponentType(ComponentTypeEnum.SERVICE);
Either<TopologyTemplate, StorageOperationStatus> createRes =
- topologyTemplateOperation.createTopologyTemplate(service);
+ topologyTemplateOperation.createTopologyTemplate(service);
Either<GraphVertex, JanusGraphOperationStatus> getNodeTyeRes =
- janusGraphDao.getVertexById(createRes.left().value().getUniqueId());
+ janusGraphDao.getVertexById(createRes.left().value().getUniqueId());
getNodeTyeRes.left().value();
}
- @After
+ @AfterEach
public void cleanAfter() {
GraphTestUtils.clearGraph(janusGraphDao);
}
@@ -361,9 +358,9 @@ public class InterfaceOperationTest extends ModelTestBase {
private void testAddSingleInterface(Component component) {
InterfaceDefinition interfaceDefinition = buildInterfaceDefinition("1");
Either<List<InterfaceDefinition>, StorageOperationStatus> res = interfaceOperation
- .addInterfaces(component.getUniqueId(),
- Collections.singletonList(
- interfaceDefinition));
+ .addInterfaces(component.getUniqueId(),
+ Collections.singletonList(
+ interfaceDefinition));
Assert.assertTrue(res.isLeft());
Assert.assertEquals("1", res.left().value().get(0).getUniqueId());
}
@@ -402,7 +399,7 @@ public class InterfaceOperationTest extends ModelTestBase {
interfaceDefinitions.add(interfaceDefinition1);
interfaceDefinitions.add(interfaceDefinition2);
Either<List<InterfaceDefinition>, StorageOperationStatus> res =
- interfaceOperation.addInterfaces(component.getUniqueId(), interfaceDefinitions);
+ interfaceOperation.addInterfaces(component.getUniqueId(), interfaceDefinitions);
Assert.assertTrue(res.isLeft());
Assert.assertEquals(2, res.left().value().size());
}
@@ -415,16 +412,16 @@ public class InterfaceOperationTest extends ModelTestBase {
private void testUpdateInterface(Component component) {
InterfaceDefinition interfaceDefinition = buildInterfaceDefinition("1");
Either<List<InterfaceDefinition>, StorageOperationStatus> res = interfaceOperation
- .addInterfaces(component.getUniqueId(),
- Collections.singletonList(
- interfaceDefinition));
+ .addInterfaces(component.getUniqueId(),
+ Collections.singletonList(
+ interfaceDefinition));
Assert.assertTrue(res.isLeft());
List<InterfaceDefinition> value = res.left().value();
InterfaceDefinition createdInterfaceDef = value.get(0);
String newDescription = "New Description";
createdInterfaceDef.setDescription(newDescription);
res = interfaceOperation
- .updateInterfaces(component.getUniqueId(), Collections.singletonList(createdInterfaceDef));
+ .updateInterfaces(component.getUniqueId(), Collections.singletonList(createdInterfaceDef));
assertTrue(res.isLeft());
assertEquals(newDescription, res.left().value().get(0).getDescription());
}
@@ -442,13 +439,13 @@ public class InterfaceOperationTest extends ModelTestBase {
private void testDeleteInterface(Component component) {
InterfaceDefinition interfaceDefinition = buildInterfaceDefinition("1");
Either<List<InterfaceDefinition>, StorageOperationStatus> res = interfaceOperation
- .addInterfaces(component.getUniqueId(),
- Collections.singletonList(
- interfaceDefinition));
+ .addInterfaces(component.getUniqueId(),
+ Collections.singletonList(
+ interfaceDefinition));
Assert.assertTrue(res.isLeft());
List<InterfaceDefinition> value = res.left().value();
Either<String, StorageOperationStatus> deleteInterfaceOperationRes =
- interfaceOperation.deleteInterface(component.getUniqueId(), value.get(0).getUniqueId());
+ interfaceOperation.deleteInterface(component.getUniqueId(), value.get(0).getUniqueId());
assertTrue(deleteInterfaceOperationRes.isLeft());
}
@@ -463,7 +460,7 @@ public class InterfaceOperationTest extends ModelTestBase {
InterfaceDefinition interfaceDefinition = buildInterfaceDefinitionWithoutOperation();
interfaceDefinition.setOperationsMap(createMockOperationMap());
Either<List<InterfaceDefinition>, StorageOperationStatus> res = interfaceOperation.updateInterfaces(
- component.getUniqueId(), Collections.singletonList(interfaceDefinition));
+ component.getUniqueId(), Collections.singletonList(interfaceDefinition));
Assert.assertTrue(res.isRight());
}
@@ -499,7 +496,7 @@ public class InterfaceOperationTest extends ModelTestBase {
}
private InterfaceDefinition createInterface(String uniqueId, String description, String type,
- String toscaResourceName, Map<String, Operation> op) {
+ String toscaResourceName, Map<String, Operation> op) {
InterfaceDefinition id = new InterfaceDefinition();
id.setType(type);
id.setDescription(description);
@@ -509,7 +506,7 @@ public class InterfaceOperationTest extends ModelTestBase {
return id;
}
- @After
+ @AfterEach
public void teardown() {
GraphTestUtils.clearGraph(janusGraphDao);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java
index 576aa8a680..b2db75933a 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,8 +25,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -42,15 +40,16 @@ import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.io.IoCore;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
@@ -59,100 +58,99 @@ import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
-public class NodeTemplateOperationGraphTest extends ModelTestBase{
+@SpringJUnitConfig(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
+public class NodeTemplateOperationGraphTest extends ModelTestBase {
+
+ String outputDirectory = "C:\\Output";
@Resource
private HealingJanusGraphDao janusGraphDao;
@Resource
private NodeTemplateOperation nodeTemplateOperation;
-
private JanusGraph graphT;
- private GraphVertex containerVertex;
+ private GraphVertex containerVertex;
private String containeId;
-
- @BeforeClass
+
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
- public void before(){
-
+
+ @BeforeEach
+ public void before() {
+
Either<JanusGraph, JanusGraphOperationStatus> graph = janusGraphDao.getGraph();
graphT = graph.left().value();
-
+
containerVertex = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
containeId = "containerId";
containerVertex.setUniqueId(containeId);
Either<GraphVertex, JanusGraphOperationStatus> createVertex = janusGraphDao.createVertex(containerVertex);
assertTrue(createVertex.isLeft());
}
-
- @After
- public void after(){
+
+ @AfterEach
+ public void after() {
janusGraphDao.rollback();
-
+
}
-
-
- String outputDirectory = "C:\\Output";
-
+
@Test
- public void testCreateInstanceEdge(){
-
+ public void testCreateInstanceEdge() {
+
Map<String, List<String>> mapOriginToInstId = new HashMap<>();
createIntancesFromSameResource(mapOriginToInstId, 1, 3);
createIntancesFromSameResource(mapOriginToInstId, 2, 4);
createIntancesFromSameResource(mapOriginToInstId, 3, 1);
-
+
// exportGraphMl(graphT);
-
+
validateOnGraph(mapOriginToInstId, 3);
}
-
+
@Test
- public void testRemoveInstanceEdge(){
+ public void testRemoveInstanceEdge() {
//create 3 instances from same resource orig1
Map<String, List<String>> mapOriginToInstId = new HashMap<>();
String originId = createIntancesFromSameResource(mapOriginToInstId, 1, 3);
validateOnGraph(mapOriginToInstId, 1);
-
+
//remove instance 2
- String instanceId = removeInstanceEdge(containerVertex, originId, 1, 1);
+ String instanceId = removeInstanceEdge(containerVertex, originId, 1, 1);
mapOriginToInstId.get(originId).remove(instanceId);
validateOnGraph(mapOriginToInstId, 1);
-
+
//create new instance from orig1
- instanceId = createInstanceEdge(containerVertex, originId, 1, 4, false, null);
+ instanceId = createInstanceEdge(containerVertex, originId, 1, 4, false, null);
mapOriginToInstId.get(originId).add(instanceId);
validateOnGraph(mapOriginToInstId, 1);
-
+
//create 1 instance from same resource orig2
originId = createIntancesFromSameResource(mapOriginToInstId, 2, 1);
validateOnGraph(mapOriginToInstId, 2);
-
+
//remove instance of orig 2
- instanceId = removeInstanceEdge(containerVertex, originId, 2, 1);
+ instanceId = removeInstanceEdge(containerVertex, originId, 2, 1);
mapOriginToInstId.get(originId).remove(instanceId);
validateOnGraph(mapOriginToInstId, 1);
-
+
}
-
+
@Test
- public void testProxyInstanceEdge(){
+ public void testProxyInstanceEdge() {
Map<String, List<String>> mapOriginToInstId = new HashMap<>();
- String proxyId = createOrigin(2);
+ String proxyId = createOrigin(2);
createIntancesFromSameResource(mapOriginToInstId, 1, 1, true, proxyId);
-
- validateOnGraph(mapOriginToInstId, 1);
+
+ validateOnGraph(mapOriginToInstId, 1);
}
+
private void validateOnGraph(Map<String, List<String>> mapOriginToInstId, int expectedEdgeCount) {
validateOnGraph(mapOriginToInstId, expectedEdgeCount, false);
}
+
private void validateOnGraph(Map<String, List<String>> mapOriginToInstId, int expectedEdgeCount, boolean validateProxy) {
Iterable vertices = graphT.query().has(GraphPropertyEnum.UNIQUE_ID.getProperty(), containeId).vertices();
assertNotNull(vertices);
@@ -160,44 +158,46 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
assertTrue(iterator.hasNext());
Vertex containerV = iterator.next();
validatePerEdgeType(mapOriginToInstId, expectedEdgeCount, containerV, EdgeLabelEnum.INSTANCE_OF);
- if ( validateProxy ){
+ if (validateProxy) {
validatePerEdgeType(mapOriginToInstId, expectedEdgeCount, containerV, EdgeLabelEnum.PROXY_OF);
}
}
+
private void validatePerEdgeType(Map<String, List<String>> mapOriginToInstId, int expectedEdgeCount, Vertex containerV, EdgeLabelEnum edgeLabel) {
Iterator<Edge> edges = containerV.edges(Direction.OUT, edgeLabel.name());
assertNotNull(edges);
-
+
int counter = 0;
- while (edges.hasNext()){
+ while (edges.hasNext()) {
Edge edge = edges.next();
counter++;
validateEdge(edge, mapOriginToInstId);
}
assertEquals("check edge size", expectedEdgeCount, counter);
}
-
-
+
+
private String createIntancesFromSameResource(Map<String, List<String>> mapOriginToInstId, int originIndex, int countInstances) {
- return createIntancesFromSameResource(mapOriginToInstId, originIndex, countInstances, false, null);
+ return createIntancesFromSameResource(mapOriginToInstId, originIndex, countInstances, false, null);
}
-
- private String createIntancesFromSameResource(Map<String, List<String>> mapOriginToInstId, int originIndex, int countInstances, boolean isProxy, String proxyId) {
-
+
+ private String createIntancesFromSameResource(Map<String, List<String>> mapOriginToInstId, int originIndex, int countInstances, boolean isProxy,
+ String proxyId) {
+
List<String> exp = new ArrayList();
String originId = createOrigin(originIndex);
-
- for ( int i = 0; i < countInstances; i++){
- String instanceId = createInstanceEdge(containerVertex, originId, originIndex, i+1, isProxy, proxyId);
+
+ for (int i = 0; i < countInstances; i++) {
+ String instanceId = createInstanceEdge(containerVertex, originId, originIndex, i + 1, isProxy, proxyId);
exp.add(instanceId);
}
mapOriginToInstId.put(originId, exp);
- if ( isProxy ){
- mapOriginToInstId.put(proxyId, exp);
+ if (isProxy) {
+ mapOriginToInstId.put(proxyId, exp);
}
return originId;
}
-
+
private String createInstanceEdge(GraphVertex containerVertex, String originId, int originIndex, int insIndex, boolean isProxy, String proxyId) {
ComponentInstanceDataDefinition componentInstance = new ComponentInstanceDataDefinition();
componentInstance.setComponentUid(originId);
@@ -209,12 +209,13 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
assertEquals("assertion createInstanceEdge", StorageOperationStatus.OK, edgeStatus);
return instanceId;
}
-
+
private String buildInstanceId(int originIndex, int insIndex) {
StringBuilder sb = new StringBuilder("instanceId_");
sb.append(originIndex).append("-").append(insIndex);
- return sb.toString();
+ return sb.toString();
}
+
private String removeInstanceEdge(GraphVertex containerVertex, String originId, int originIndex, int insIndex) {
ComponentInstanceDataDefinition componentInstance = new ComponentInstanceDataDefinition();
componentInstance.setComponentUid(originId);
@@ -224,8 +225,8 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
assertEquals("assertion removeInstanceEdge", StorageOperationStatus.OK, edgeStatus);
return instanceId;
}
-
-
+
+
private String createOrigin(int index) {
Either<GraphVertex, JanusGraphOperationStatus> createVertex;
GraphVertex originVertex = new GraphVertex(VertexTypeEnum.NODE_TYPE);
@@ -235,18 +236,19 @@ public class NodeTemplateOperationGraphTest extends ModelTestBase{
assertTrue(createVertex.isLeft());
return originId;
}
+
private void validateEdge(Edge edge, Map<String, List<String>> mapOriginToInstId) {
List<String> expextedInList;
-
+
Vertex originV = edge.inVertex();
- String id = (String) janusGraphDao.getProperty((JanusGraphVertex)originV, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ String id = (String) janusGraphDao.getProperty((JanusGraphVertex) originV, GraphPropertyEnum.UNIQUE_ID.getProperty());
expextedInList = mapOriginToInstId.get(id);
-
+
List<String> list = (List<String>) janusGraphDao.getProperty(edge, EdgePropertyEnum.INSTANCES);
assertThat(list).hasSameSizeAs(expextedInList);
assertThat(list).containsOnlyElementsOf(expextedInList);
}
-
+
private String exportGraphMl(JanusGraph graph) {
String result = null;
String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml";
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java
index 37e360c5c2..64cad65301 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,15 +20,22 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static org.apache.commons.collections.ListUtils.union;
+import static org.assertj.core.api.Assertions.assertThat;
+
import fj.data.Either;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
-import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
+import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
@@ -43,24 +50,13 @@ import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.commons.collections.ListUtils.union;
-import static org.assertj.core.api.Assertions.assertThat;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
+@SpringJUnitConfig(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class PolicyOperationIntegrationTest extends ModelTestBase {
- private static final String CONTAINER_ID = "container";
public static final String POLICY_ID = "policy";
+ private static final String CONTAINER_ID = "container";
@Resource
private TopologyTemplateOperation topologyTemplateOperation;
@Resource
@@ -70,13 +66,13 @@ public class PolicyOperationIntegrationTest extends ModelTestBase {
private PropertyDataDefinition prop1, prop2;
private PolicyDefinition policy;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
prop1 = new PropertyDataDefinition();
prop1.setUniqueId("prop1");
@@ -97,11 +93,12 @@ public class PolicyOperationIntegrationTest extends ModelTestBase {
resource.addMetadataProperty(GraphPropertyEnum.UNIQUE_ID, CONTAINER_ID);
janusGraphDao.createVertex(resource);
GraphVertex loadedResource = janusGraphDao.getVertexById(CONTAINER_ID).left().value();
- topologyTemplateOperation.addToscaDataToToscaElement(loadedResource, EdgeLabelEnum.POLICIES, VertexTypeEnum.POLICIES, policy, JsonPresentationFields.UNIQUE_ID);
+ topologyTemplateOperation.addToscaDataToToscaElement(loadedResource, EdgeLabelEnum.POLICIES, VertexTypeEnum.POLICIES, policy,
+ JsonPresentationFields.UNIQUE_ID);
// janusGraphDao.commit();
}
- @After
+ @AfterEach
public void tearDown() {
janusGraphDao.rollback();
}
@@ -134,7 +131,8 @@ public class PolicyOperationIntegrationTest extends ModelTestBase {
ComponentParametersView componentParametersView = new ComponentParametersView();
componentParametersView.disableAll();
componentParametersView.setIgnorePolicies(false);
- Either<ToscaElement, StorageOperationStatus> loadedCmptEither = topologyTemplateOperation.getToscaElement(CONTAINER_ID, componentParametersView);
+ Either<ToscaElement, StorageOperationStatus> loadedCmptEither = topologyTemplateOperation.getToscaElement(CONTAINER_ID,
+ componentParametersView);
assertThat(loadedCmptEither.isLeft()).isTrue();
ToscaElement loadedCmpt = loadedCmptEither.left().value();
@@ -148,6 +146,6 @@ public class PolicyOperationIntegrationTest extends ModelTestBase {
PolicyDataDefinition policy = policies.get(POLICY_ID);
List<PropertyDataDefinition> policyProperties = policy.getProperties();
assertThat(policyProperties).usingElementComparatorOnFields("value")
- .containsAll(expectedUpdatedProperties);
+ .containsAll(expectedUpdatedProperties);
}
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
index bfa3dd6175..5dbb96e4f2 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,14 +20,20 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
-import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
+import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
@@ -40,19 +46,9 @@ import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
+@SpringJUnitConfig(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTestBase {
private static final String CONTAINER_ID = "id";
@@ -68,13 +64,13 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
private CapabilityPropertyDataObject capabilityProperty2;
private CapabilityPropertyDataObject capabilityProperty3;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
capabilitiesPropsMap = new HashMap<>();
@@ -83,22 +79,24 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
capabilityProperty3 = new CapabilityPropertyDataObject("instance2", "capability3", "prop3", "val3");
capabilitiesProperties = Arrays.asList(capabilityProperty1, capabilityProperty2, capabilityProperty3);
-
//capablities props == Map<instance id, Map<capability id, Map<prop id, property>>>
capabilitiesProperties.forEach(capabilitiesProperty -> {
capabilitiesPropsMap.computeIfAbsent(capabilitiesProperty.getInstanceId(), k -> new MapCapabilityProperty(new HashMap<>()))
- .getMapToscaDataDefinition().computeIfAbsent(capabilitiesProperty.getCapabilityId(), k -> new MapPropertiesDataDefinition(new HashMap<>()))
- .getMapToscaDataDefinition().computeIfAbsent(capabilitiesProperty.getPropName(), k -> new PropertyDefinition(createPropWithValue(capabilitiesProperty.getPropValue())));
+ .getMapToscaDataDefinition()
+ .computeIfAbsent(capabilitiesProperty.getCapabilityId(), k -> new MapPropertiesDataDefinition(new HashMap<>()))
+ .getMapToscaDataDefinition().computeIfAbsent(capabilitiesProperty.getPropName(),
+ k -> new PropertyDefinition(createPropWithValue(capabilitiesProperty.getPropValue())));
});
GraphVertex resource = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE);
resource.addMetadataProperty(GraphPropertyEnum.UNIQUE_ID, CONTAINER_ID);
janusGraphDao.createVertex(resource);
GraphVertex loadedResource = janusGraphDao.getVertexById(CONTAINER_ID).left().value();
- topologyTemplateOperation.associateElementToData(loadedResource, VertexTypeEnum.CALCULATED_CAP_PROPERTIES, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, capabilitiesPropsMap).left().value();
+ topologyTemplateOperation.associateElementToData(loadedResource, VertexTypeEnum.CALCULATED_CAP_PROPERTIES,
+ EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, capabilitiesPropsMap).left().value();
}
- @After
+ @AfterEach
public void tearDown() {
janusGraphDao.rollback();
}
@@ -111,7 +109,8 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
capabilityProperty3.setPropValue("newVal3");
setPropertyValue(capabilitiesPropsMap, capabilityProperty1);
setPropertyValue(capabilitiesPropsMap, capabilityProperty3);
- StorageOperationStatus storageOperationStatus = topologyTemplateOperation.overrideToscaDataOfToscaElement(CONTAINER_ID, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, capabilitiesPropsMap);
+ StorageOperationStatus storageOperationStatus = topologyTemplateOperation.overrideToscaDataOfToscaElement(CONTAINER_ID,
+ EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, capabilitiesPropsMap);
assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.OK);
Map<String, MapCapabilityProperty> updatedCapPropsMap = fetchCapabilitiesProps(CONTAINER_ID);
compareCapabilitiesProperties(capabilitiesProperties, updatedCapPropsMap);
@@ -132,7 +131,8 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
Component component = new org.openecomp.sdc.be.model.Resource();
component.setUniqueId(CONTAINER_ID);
- StorageOperationStatus updateStatus = topologyTemplateOperation.updateToscaDataDeepElementsBlockToToscaElement(CONTAINER_ID, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, instance1Props, "instance1");
+ StorageOperationStatus updateStatus = topologyTemplateOperation.updateToscaDataDeepElementsBlockToToscaElement(CONTAINER_ID,
+ EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, instance1Props, "instance1");
assertThat(updateStatus).isEqualTo(StorageOperationStatus.OK);
assertCapabilityPropValue(capabilityProperty1, "newVal1");
@@ -143,13 +143,15 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
private Map<String, MapCapabilityProperty> fetchCapabilitiesProps(String containerId) {
ComponentParametersView capabilityPropsFilter = new ComponentParametersView(true);
capabilityPropsFilter.setIgnoreCapabiltyProperties(false);
- return ((TopologyTemplate) topologyTemplateOperation.getToscaElement(containerId, capabilityPropsFilter).left().value()).getCalculatedCapabilitiesProperties();
+ return ((TopologyTemplate) topologyTemplateOperation.getToscaElement(containerId, capabilityPropsFilter).left()
+ .value()).getCalculatedCapabilitiesProperties();
}
private void compareCapabilitiesProperties(List<CapabilityPropertyDataObject> expected, Map<String, MapCapabilityProperty> actual) {
expected.forEach(expectedCapabilityProp -> {
- assertThat(getPropertyValue(actual, expectedCapabilityProp.instanceId, expectedCapabilityProp.capabilityId, expectedCapabilityProp.propName))
- .isEqualTo(expectedCapabilityProp.propValue);
+ assertThat(
+ getPropertyValue(actual, expectedCapabilityProp.instanceId, expectedCapabilityProp.capabilityId, expectedCapabilityProp.propName))
+ .isEqualTo(expectedCapabilityProp.propValue);
});
}
@@ -164,8 +166,8 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
private void setPropertyValue(MapCapabilityProperty capabilitiesInstanceProperties, CapabilityPropertyDataObject capabilityProperty) {
capabilitiesInstanceProperties.getMapToscaDataDefinition().get(capabilityProperty.getCapabilityId())
- .getMapToscaDataDefinition().get(capabilityProperty.getPropName())
- .setValue(capabilityProperty.getPropValue());
+ .getMapToscaDataDefinition().get(capabilityProperty.getPropName())
+ .setValue(capabilityProperty.getPropValue());
}
private void assertCapabilityPropValue(CapabilityPropertyDataObject prop, String expectedValue) {
@@ -182,6 +184,7 @@ public class TopologyTemplateOperationCapabilityIntegrationTest extends ModelTes
}
private static class CapabilityPropertyDataObject {
+
private String instanceId;
private String capabilityId;
private String propName;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java
index 3da37c098a..821f23e191 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java
@@ -20,16 +20,24 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
-import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
-import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
+import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -44,42 +52,31 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.EntryData;
import org.openecomp.sdc.be.utils.TypeUtils;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.*;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* Created by chaya on 6/12/2017.
*/
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class ToscaElementOperationTest extends ModelTestBase {
+ @Rule
+ public TestName testName = new TestName();
private List<GraphVertex> allVertices = new ArrayList<>();
private boolean isInitialized = false;
-
@javax.annotation.Resource
private ToscaElementOperationTestImpl toscaElementOperation;
-
@javax.annotation.Resource
private JanusGraphDao janusGraphDao;
- @BeforeClass
+ @BeforeAll
public static void initTest() {
ModelTestBase.init();
}
- @Rule
- public TestName testName = new TestName();
-
- @Before
+ @BeforeEach
public void beforeTest() {
if (!isInitialized) {
GraphTestUtils.clearGraph(janusGraphDao);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java
index d60a574064..3cb2208c30 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,16 +20,25 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static java.util.Arrays.asList;
+import static java.util.Collections.singletonList;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertTrue;
+
import fj.data.Either;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
+import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
@@ -38,22 +47,9 @@ import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertTrue;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
+@SpringJUnitConfig(classes = {JanusGraphSpringConfig.class, ModelOperationsSpringConfig.class})
public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
@Autowired
@@ -63,12 +59,12 @@ public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
private PolicyDefinition policy1, policy2;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
policy1 = createPolicyDefinition("type1");
policy2 = createPolicyDefinition("type2");
@@ -76,7 +72,7 @@ public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
createPoliciesOnGraph(policy1, policy2);
}
- private void createPoliciesOnGraph(PolicyDefinition ... policies) {
+ private void createPoliciesOnGraph(PolicyDefinition... policies) {
for (int i = 0; i < policies.length; i++) {
PolicyDefinition policy = policies[i];
Either<PolicyDefinition, StorageOperationStatus> createdPolicy = toscaOperationFacade.associatePolicyToComponent(CONTAINER_ID, policy, i);
@@ -84,7 +80,7 @@ public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
}
}
- @After
+ @AfterEach
public void tearDown() {
janusGraphDao.rollback();
}
@@ -117,14 +113,15 @@ public class ToscaOperationFacadePoliciesTest extends ModelTestBase {
private PolicyDefinition clonePolicyWithTargets(PolicyDefinition policy) {
PolicyDefinition originalPolicy = new PolicyDefinition(policy);
- Map<PolicyTargetType, List<String>> clonedTargetMap = policy.getTargets().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> new ArrayList<>(entry.getValue())));
+ Map<PolicyTargetType, List<String>> clonedTargetMap = policy.getTargets().entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, entry -> new ArrayList<>(entry.getValue())));
originalPolicy.setTargets(clonedTargetMap);
return originalPolicy;
}
private void verifyPolicyTargets(PolicyDefinition updatedPolicy, PolicyDefinition expectedPolicy) {
assertThat(updatedPolicy.getTargets())
- .isEqualTo(expectedPolicy.getTargets());
+ .isEqualTo(expectedPolicy.getTargets());
}
private void updatePolicyTypeTargetsIds(PolicyDefinition policy, PolicyTargetType targetType, List<String> updatedTargetIds) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java
index 1494f206f6..6a069a04b9 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,12 +20,16 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
+import static org.assertj.core.api.Assertions.assertThat;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Resource;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
@@ -33,7 +37,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.ComponentDependency;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.ModelTestBase;
+import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
@@ -41,17 +49,9 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import static org.assertj.core.api.Assertions.assertThat;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class UpgradeOperationTest extends ModelTestBase {
private boolean isInitialized;
@@ -64,7 +64,7 @@ public class UpgradeOperationTest extends ModelTestBase {
@Resource
private NodeTemplateOperation nodeTemplateOperation;
@Resource
- private UserAdminOperation userAdminOperation;
+ private UserAdminOperation userAdminOperation;
@javax.annotation.Resource
private IElementOperation elementOperation;
@@ -72,14 +72,14 @@ public class UpgradeOperationTest extends ModelTestBase {
private CategoryDefinition resourceCategory;
private CategoryDefinition serviceCategory;
-
- @BeforeClass
+
+ @BeforeAll
public static void initTest() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void beforeTest() {
if (!isInitialized) {
GraphTestUtils.clearGraph(janusGraphDao);
@@ -90,22 +90,21 @@ public class UpgradeOperationTest extends ModelTestBase {
@Test
public void testGetSimpleDependency() {
-
+
TopologyTemplate vf = createVf("vf1");
-
+
TopologyTemplate service = createServiceWitnInstance("service1", vf);
-
Either<List<ComponentDependency>, StorageOperationStatus> result = upgradeOperation.getComponentDependencies(vf.getUniqueId());
assertThat(result.isLeft()).isTrue();
List<ComponentDependency> dependencies = result.left().value();
assertThat(dependencies).hasSize(1);
-
+
ComponentDependency dependency = dependencies.get(0);
assertThat(dependency.getName()).isEqualTo(vf.getName());
assertThat(dependency.getVersion()).isEqualTo(vf.getVersion());
assertThat(dependency.getDependencies()).hasSize(1);
-
+
ComponentDependency container = dependency.getDependencies().get(0);
assertThat(container.getName()).isEqualTo(service.getName());
assertThat(container.getVersion()).isEqualTo(service.getVersion());
@@ -123,12 +122,12 @@ public class UpgradeOperationTest extends ModelTestBase {
GraphTestUtils.createRootCatalogVertex(janusGraphDao);
resourceCategory = createResourceCategories();
- serviceCategory = createServiceCategory();
-
+ serviceCategory = createServiceCategory();
+
}
private TopologyTemplate createServiceWitnInstance(String name, TopologyTemplate createdVf) {
-
+
TopologyTemplate serviceNew = createTopologyTemplate(ComponentTypeEnum.SERVICE, name);
List<CategoryDefinition> categoriesService = new ArrayList<>();
categoriesService.add(serviceCategory);
@@ -136,12 +135,13 @@ public class UpgradeOperationTest extends ModelTestBase {
Either<TopologyTemplate, StorageOperationStatus> createService = topologyTemplateOperation.createTopologyTemplate(serviceNew);
assertThat(createService.isLeft()).isTrue();
-
+
ComponentInstance vfInstance = new ComponentInstance();
vfInstance.setUniqueId(createdVf.getUniqueId() + createdVf.getName());
vfInstance.setComponentUid(createdVf.getUniqueId());
vfInstance.setName(createdVf.getName());
- Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addInstance = nodeTemplateOperation.addComponentInstanceToTopologyTemplate(serviceNew, createdVf, "0", vfInstance, false, user);
+ Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addInstance = nodeTemplateOperation.addComponentInstanceToTopologyTemplate(
+ serviceNew, createdVf, "0", vfInstance, false, user);
assertThat(addInstance.isLeft()).isTrue();
return serviceNew;
}
@@ -151,14 +151,14 @@ public class UpgradeOperationTest extends ModelTestBase {
categoryService.setName("servicecategory");
categoryService.setNormalizedName("servicecategory");
categoryService.setUniqueId("servicecategory");
- Either<CategoryDefinition, ActionStatus> createCategory = elementOperation.createCategory(categoryService , NodeTypeEnum.ServiceNewCategory);
-
+ Either<CategoryDefinition, ActionStatus> createCategory = elementOperation.createCategory(categoryService, NodeTypeEnum.ServiceNewCategory);
+
assertThat(createCategory.isLeft()).isTrue();
return categoryService;
}
private TopologyTemplate createVf(String name) {
-
+
TopologyTemplate resource = createTopologyTemplate(ComponentTypeEnum.RESOURCE, name);
resource.setResourceType(ResourceTypeEnum.VF);
@@ -166,7 +166,7 @@ public class UpgradeOperationTest extends ModelTestBase {
categories.add(resourceCategory);
resource.setCategories(categories);
Either<TopologyTemplate, StorageOperationStatus> createVf = topologyTemplateOperation.createTopologyTemplate(resource);
- assertThat( createVf.isLeft()).isTrue();
+ assertThat(createVf.isLeft()).isTrue();
return resource;
}
@@ -175,11 +175,11 @@ public class UpgradeOperationTest extends ModelTestBase {
category.setName("category1");
category.setNormalizedName("category1");
category.setUniqueId("category1");
- Either<CategoryDefinition, ActionStatus> createCategory = elementOperation.createCategory(category , NodeTypeEnum.ResourceNewCategory);
+ Either<CategoryDefinition, ActionStatus> createCategory = elementOperation.createCategory(category, NodeTypeEnum.ResourceNewCategory);
assertThat(createCategory.isLeft()).isTrue();
-
+
SubCategoryDefinition subCategory = new SubCategoryDefinition();
-
+
subCategory.setName("subcategory1");
subCategory.setNormalizedName("subcategory1");
subCategory.setUniqueId("subcategory1");
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java
index 169a844e3a..b61ff3224b 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperationTest.java
@@ -20,16 +20,21 @@
package org.openecomp.sdc.be.model.operations.impl;
-import org.janusgraph.core.JanusGraphEdge;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
-import fj.data.Either;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import fj.data.Either;
+import java.util.Iterator;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphEdge;
+import org.janusgraph.core.JanusGraphVertex;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
@@ -40,20 +45,11 @@ import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil;
import org.openecomp.sdc.be.resources.data.UserData;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import java.util.Iterator;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class AdditionalInformationOperationTest extends ModelTestBase {
+
private static final JanusGraphGenericDao JANUS_GRAPH_GENERIC_DAO = mock(JanusGraphGenericDao.class);
private static String USER_ID = "muUserId";
private static String CATEGORY_NAME = "category/mycategory";
@@ -66,20 +62,20 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
@javax.annotation.Resource(name = "additional-information-operation")
private AdditionalInformationOperation additionalInformationOperation;
- @Before
- public void createUserAndCategory() {
- deleteAndCreateCategory(CATEGORY_NAME);
- deleteAndCreateUser(USER_ID, "first_" + USER_ID, "last_" + USER_ID);
-
- }
-
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
+ @BeforeEach
+ public void createUserAndCategory() {
+ deleteAndCreateCategory(CATEGORY_NAME);
+ deleteAndCreateUser(USER_ID, "first_" + USER_ID, "last_" + USER_ID);
+
+ }
+
@Test
public void testDummy() {
@@ -88,24 +84,24 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
}
@Test
- public void testAddInfoParameter_InvalidId(){
+ public void testAddInfoParameter_InvalidId() {
Either<AdditionalInformationDefinition, JanusGraphOperationStatus> result;
String uid = "uid";
String componentId = "componentId";
- when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(eq(uid),eq(componentId))).thenReturn(Either.left(janusGraphVertex));
+ when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(eq(uid), eq(componentId))).thenReturn(Either.left(janusGraphVertex));
result = additionalInformationOperation.addAdditionalInformationParameter
- (NodeTypeEnum.Resource,componentId,"key","value");
+ (NodeTypeEnum.Resource, componentId, "key", "value");
assertThat(result.isRight());
}
@Test
- public void testUpdateInfoParameter_InvalidId(){
+ public void testUpdateInfoParameter_InvalidId() {
Either<AdditionalInformationDefinition, JanusGraphOperationStatus> result;
String uid = "uid";
String componentId = "componentId";
- when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(eq(uid),eq(componentId))).thenReturn(Either.left(janusGraphVertex));
+ when(JANUS_GRAPH_GENERIC_DAO.getVertexByProperty(eq(uid), eq(componentId))).thenReturn(Either.left(janusGraphVertex));
result = additionalInformationOperation.updateAdditionalInformationParameter
- (NodeTypeEnum.Resource,componentId,"id","key","value");
+ (NodeTypeEnum.Resource, componentId, "id", "key", "value");
assertTrue(result.isRight());
}
@@ -119,7 +115,7 @@ public class AdditionalInformationOperationTest extends ModelTestBase {
v1.property("uid", componentId);
v1.property(GraphPropertiesDictionary.LABEL.getProperty(), "resource");
JanusGraphVertex v2 = graph.addVertex();
- v2.property(id,id);
+ v2.property(id, id);
JanusGraphEdge addEdge = v1.addEdge(GraphEdgeLabels.ADDITIONAL_INFORMATION.getProperty(), v2);
addEdge.property("edgeProp", "resource");
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java
index df164b9d31..8919f2c6ec 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/AnnotationTypeOperationsTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,27 +20,24 @@
package org.openecomp.sdc.be.model.operations.impl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static java.util.Arrays.asList;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import javax.annotation.Resource;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.model.AnnotationTypeDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.utils.TypeUtils;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import javax.annotation.Resource;
-
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class AnnotationTypeOperationsTest extends ModelTestBase {
static final String TYPE = "org.openecomp.annotations.source";
@@ -60,18 +57,18 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
private PropertyDefinition prop1, prop2;
private AnnotationTypeDefinition initialAnnotationDefinition;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void initTestData() {
removeGraphVertices(janusGraphGenericDao.getGraph());
prop1 = createSimpleProperty("val1", "prop1", "string");
}
- @After
+ @AfterEach
public void tearDown() {
janusGraphGenericDao.rollback();
}
@@ -83,14 +80,14 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
AnnotationTypeDefinition result = annotationTypeOperations.addType(initialAnnotationDefinition);
assertThat(result.getUniqueId()).isNotEmpty();
assertThat(result)
- .isEqualToComparingOnlyGivenFields(initialAnnotationDefinition, "description", "type");
+ .isEqualToComparingOnlyGivenFields(initialAnnotationDefinition, "description", "type");
assertThat(result.getProperties())
- .usingElementComparatorOnFields("defaultValue", "name", "type")
- .containsExactlyInAnyOrder(prop1);
+ .usingElementComparatorOnFields("defaultValue", "name", "type")
+ .containsExactlyInAnyOrder(prop1);
assertThat(result.isHighestVersion()).isTrue();
}
- @Test
+ @Test
public void testGetLatestType_TypeDoesntExist_shouldReturnNull() {
AnnotationTypeDefinition latestType = annotationTypeOperations.getLatestType(TYPE);
assertThat(latestType).isNull();
@@ -155,8 +152,8 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
AnnotationTypeDefinition updatedType = annotationTypeOperations.updateType(initialAnnotationDefinition, advancedDefinition);
assertThat(updatedType.getDescription()).isEqualTo(NEW_DESCRIPTION);
assertThat(updatedType.getProperties())
- .usingElementComparatorOnFields("defaultValue", "name", "type")
- .containsExactlyInAnyOrder(prop1, prop2);
+ .usingElementComparatorOnFields("defaultValue", "name", "type")
+ .containsExactlyInAnyOrder(prop1, prop2);
}
@Test
@@ -166,8 +163,8 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
AnnotationTypeDefinition advancedDefinition = buildAnnotationDefinition(DESCRIPTION, TYPE, prop2);
AnnotationTypeDefinition updatedType = annotationTypeOperations.updateType(initialAnnotationDefinition, advancedDefinition);
assertThat(updatedType.getProperties())
- .usingElementComparatorOnFields("defaultValue", "name", "type")
- .containsExactlyInAnyOrder(prop2);
+ .usingElementComparatorOnFields("defaultValue", "name", "type")
+ .containsExactlyInAnyOrder(prop2);
}
@Test
@@ -178,34 +175,38 @@ public class AnnotationTypeOperationsTest extends ModelTestBase {
AnnotationTypeDefinition advancedDefinition = buildAnnotationDefinition(DESCRIPTION, TYPE, prop2);
AnnotationTypeDefinition updatedType = annotationTypeOperations.updateType(initialAnnotationDefinition, advancedDefinition);
assertThat(updatedType.getProperties())
- .usingElementComparatorOnFields("defaultValue", "name", "type", "description")
- .containsExactlyInAnyOrder(prop2);
+ .usingElementComparatorOnFields("defaultValue", "name", "type", "description")
+ .containsExactlyInAnyOrder(prop2);
}
- @Test(expected = StorageException.class)
+ @Test
public void testUpdateType_propertyTypeModification_shouldFail() {
+ Assertions.assertThrows(StorageException.class,()->{
addAnnotationType();
prop2 = createSimpleProperty("val1", "prop1", "int");
AnnotationTypeDefinition advancedDefinition = buildAnnotationDefinition(DESCRIPTION, TYPE, prop2);
annotationTypeOperations.updateType(initialAnnotationDefinition, advancedDefinition);
+ });
}
- @Test(expected = StorageException.class)
+ @Test
public void testUpdateType_propertyRemoved_shouldFail() {
- addAnnotationType();
- prop2 = createSimpleProperty("val1", "prop2", "int");
- AnnotationTypeDefinition advancedDefinition = buildAnnotationDefinition(DESCRIPTION, TYPE, prop2);
- annotationTypeOperations.updateType(initialAnnotationDefinition, advancedDefinition);
+ Assertions.assertThrows(StorageException.class,()->{
+ addAnnotationType();
+ prop2 = createSimpleProperty("val1", "prop2", "int");
+ AnnotationTypeDefinition advancedDefinition = buildAnnotationDefinition(DESCRIPTION, TYPE, prop2);
+ annotationTypeOperations.updateType(initialAnnotationDefinition, advancedDefinition);
+ });
}
private void prepareInitialType() {
initialAnnotationDefinition = buildAnnotationDefinition(DESCRIPTION,
- TYPE,
- prop1);
+ TYPE,
+ prop1);
initialAnnotationDefinition.setVersion(TypeUtils.getFirstCertifiedVersionVersion());
}
- private AnnotationTypeDefinition buildAnnotationDefinition(String description, String type, PropertyDefinition ... properties) {
+ private AnnotationTypeDefinition buildAnnotationDefinition(String description, String type, PropertyDefinition... properties) {
AnnotationTypeDefinition annotationTypeDefinition = new AnnotationTypeDefinition();
annotationTypeDefinition.setDescription(description);
annotationTypeDefinition.setType(type);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
index d6414c5f25..25e1f28612 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,55 +20,56 @@
package org.openecomp.sdc.be.model.operations.impl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import fj.data.Either;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.HeatParameterDefinition;
+import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil;
-import org.openecomp.sdc.be.resources.data.*;
+import org.openecomp.sdc.be.resources.data.ArtifactData;
+import org.openecomp.sdc.be.resources.data.HeatParameterData;
+import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
+import org.openecomp.sdc.be.resources.data.UniqueIdData;
+import org.openecomp.sdc.be.resources.data.UserData;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import static org.junit.Assert.*;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class ArtifactOperationTest extends ModelTestBase {
private static final String ARTIFACT_NAME = "myHeatArtifact";
-
+ private static final String RESOURCE_ID = "resourceId";
+ private static final String RESOURCE_ID_2 = "resourceId2";
+ private static final String USER_ID = "muUserId";
@javax.annotation.Resource(name = "janusgraph-generic-dao")
private JanusGraphGenericDao janusGraphDao;
-
@javax.annotation.Resource
private ArtifactOperation artifactOperation;
- private static final String RESOURCE_ID = "resourceId";
- private static final String RESOURCE_ID_2 = "resourceId2";
-
- private static final String USER_ID = "muUserId";
-
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void createUserAndCategory() {
String CATEGORY_NAME = "category/mycategory";
deleteAndCreateCategory(CATEGORY_NAME);
@@ -84,17 +85,21 @@ public class ArtifactOperationTest extends ModelTestBase {
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
- Either<ArtifactDefinition, StorageOperationStatus> removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
+ Either<ArtifactDefinition, StorageOperationStatus> removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID,
+ artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
assertTrue(removeArifact.isLeft());
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, JanusGraphOperationStatus> artifactAfterDelete = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterDelete = janusGraphDao.getNode(artifactData.getUniqueIdKey(),
+ artifactData.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterDelete.isRight());
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isRight());
janusGraphDao.deleteNode(new UniqueIdData(NodeTypeEnum.Resource, RESOURCE_ID), ResourceMetadataData.class);
@@ -109,7 +114,8 @@ public class ArtifactOperationTest extends ModelTestBase {
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
// update to artifact without params
@@ -119,17 +125,20 @@ public class ArtifactOperationTest extends ModelTestBase {
artifactNoParams.setArtifactVersion("2");
artifactNoParams.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
- Either<ArtifactDefinition, StorageOperationStatus> updateArifact = artifactOperation.updateArifactOnResource(artifactNoParams, RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, false);
+ Either<ArtifactDefinition, StorageOperationStatus> updateArifact = artifactOperation.updateArifactOnResource(artifactNoParams, RESOURCE_ID,
+ artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, false);
assertTrue(updateArifact.isLeft());
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, JanusGraphOperationStatus> artifactAfterUpdate = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterUpdate = janusGraphDao.getNode(artifactData.getUniqueIdKey(),
+ artifactData.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterUpdate.isLeft());
ArtifactData artifactAfterUpdateValue = artifactAfterUpdate.left().value();
assertEquals(artifactNoParams.getArtifactVersion(), artifactAfterUpdateValue.getArtifactDataDefinition()
- .getArtifactVersion());
+ .getArtifactVersion());
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isRight());
artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
@@ -147,7 +156,8 @@ public class ArtifactOperationTest extends ModelTestBase {
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
// update to artifact without params
@@ -155,17 +165,20 @@ public class ArtifactOperationTest extends ModelTestBase {
artifactWithHeat.setArtifactChecksum(null);
artifactWithHeat.setPayloadData(null);
- Either<ArtifactDefinition, StorageOperationStatus> updateArifact = artifactOperation.updateArifactOnResource(artifactWithHeat, RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, false);
+ Either<ArtifactDefinition, StorageOperationStatus> updateArifact = artifactOperation.updateArifactOnResource(artifactWithHeat, RESOURCE_ID,
+ artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, false);
assertTrue(updateArifact.isLeft());
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, JanusGraphOperationStatus> artifactAfterUpdate = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterUpdate = janusGraphDao.getNode(artifactData.getUniqueIdKey(),
+ artifactData.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterUpdate.isLeft());
ArtifactData artifactAfterUpdateValue = artifactAfterUpdate.left().value();
assertEquals(artifactWithHeat.getArtifactVersion(), artifactAfterUpdateValue.getArtifactDataDefinition()
- .getArtifactVersion());
+ .getArtifactVersion());
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isLeft());
artifactOperation.removeArifactFromResource(RESOURCE_ID_2, artifactAfterUpdateValue.getUniqueId(), NodeTypeEnum.Resource, true, false);
@@ -181,7 +194,8 @@ public class ArtifactOperationTest extends ModelTestBase {
ResourceMetadataData resource2 = createResource(RESOURCE_ID_2);
Map<String, Object> props = new HashMap<>();
props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), ArtifactGroupTypeEnum.DEPLOYMENT.name());
- Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphDao.createRelation(resource2, new ArtifactData(artifactWithHeat), GraphEdgeLabels.ARTIFACT_REF, props);
+ Either<GraphRelation, JanusGraphOperationStatus> createRelation = janusGraphDao.createRelation(resource2, new ArtifactData(artifactWithHeat),
+ GraphEdgeLabels.ARTIFACT_REF, props);
assertTrue(createRelation.isLeft());
List<HeatParameterDefinition> heatParameters = artifactWithHeat.getListHeatParameters();
@@ -189,7 +203,8 @@ public class ArtifactOperationTest extends ModelTestBase {
assertEquals(1, heatParameters.size());
HeatParameterDefinition parameter = heatParameters.get(0);
HeatParameterData parameterData = new HeatParameterData(parameter);
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNode = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNode.isLeft());
ArtifactDefinition atifactToUpdate = new ArtifactDefinition(artifactWithHeat);
@@ -205,28 +220,32 @@ public class ArtifactOperationTest extends ModelTestBase {
heatParametersUpdated.add(heatParamUpdate);
atifactToUpdate.setListHeatParameters(heatParametersUpdated);
- Either<ArtifactDefinition, StorageOperationStatus> updateArifact = artifactOperation.updateArifactOnResource(atifactToUpdate, RESOURCE_ID_2, atifactToUpdate.getUniqueId(), NodeTypeEnum.Resource, false);
+ Either<ArtifactDefinition, StorageOperationStatus> updateArifact = artifactOperation.updateArifactOnResource(atifactToUpdate, RESOURCE_ID_2,
+ atifactToUpdate.getUniqueId(), NodeTypeEnum.Resource, false);
assertTrue(updateArifact.isLeft());
// verify old artifact and parameter still exist
ArtifactData artifactData = new ArtifactData(artifactWithHeat);
- Either<ArtifactData, JanusGraphOperationStatus> origArtifact = janusGraphDao.getNode(artifactData.getUniqueIdKey(), artifactData.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> origArtifact = janusGraphDao.getNode(artifactData.getUniqueIdKey(),
+ artifactData.getUniqueId(), ArtifactData.class);
assertTrue(origArtifact.isLeft());
ArtifactData origArtifactData = origArtifact.left().value();
assertEquals(artifactWithHeat.getArtifactVersion(), origArtifactData.getArtifactDataDefinition()
- .getArtifactVersion());
+ .getArtifactVersion());
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(),
+ parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isLeft());
// verify new artifact and new parameter
ArtifactDefinition artifactDefinitionUpdated = updateArifact.left().value();
ArtifactData artifactDataUpdated = new ArtifactData(artifactDefinitionUpdated);
- Either<ArtifactData, JanusGraphOperationStatus> updatedArtifact = janusGraphDao.getNode(artifactDataUpdated.getUniqueIdKey(), artifactDataUpdated.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> updatedArtifact = janusGraphDao.getNode(artifactDataUpdated.getUniqueIdKey(),
+ artifactDataUpdated.getUniqueId(), ArtifactData.class);
assertTrue(updatedArtifact.isLeft());
ArtifactData updatedArtifactData = updatedArtifact.left().value();
assertEquals(atifactToUpdate.getArtifactVersion(), updatedArtifactData.getArtifactDataDefinition()
- .getArtifactVersion());
+ .getArtifactVersion());
assertFalse(updatedArtifactData.getUniqueId().equalsIgnoreCase(origArtifactData.getUniqueId()));
List<HeatParameterDefinition> heatParametersAfterUpdate = artifactDefinitionUpdated.getListHeatParameters();
@@ -234,11 +253,13 @@ public class ArtifactOperationTest extends ModelTestBase {
assertEquals(1, heatParametersAfterUpdate.size());
HeatParameterDefinition UpdatedHeatParameter = heatParametersAfterUpdate.get(0);
assertFalse(UpdatedHeatParameter.getUniqueId().equalsIgnoreCase(parameterData.getUniqueId()));
- Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterUpdate = janusGraphDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), UpdatedHeatParameter.getUniqueId(), HeatParameterData.class);
+ Either<HeatParameterData, JanusGraphOperationStatus> parameterNodeAfterUpdate = janusGraphDao.getNode(
+ new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), UpdatedHeatParameter.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterUpdate.isLeft());
// delete new artifact
- Either<ArtifactDefinition, StorageOperationStatus> removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID_2, artifactDefinitionUpdated.getUniqueId(), NodeTypeEnum.Resource, true, false);
+ Either<ArtifactDefinition, StorageOperationStatus> removeArifact = artifactOperation.removeArifactFromResource(RESOURCE_ID_2,
+ artifactDefinitionUpdated.getUniqueId(), NodeTypeEnum.Resource, true, false);
assertTrue(removeArifact.isLeft());
// verify old artifact and parameter still exist
@@ -246,16 +267,18 @@ public class ArtifactOperationTest extends ModelTestBase {
assertTrue(origArtifact.isLeft());
origArtifactData = origArtifact.left().value();
assertEquals(artifactWithHeat.getArtifactVersion(), origArtifactData.getArtifactDataDefinition()
- .getArtifactVersion());
+ .getArtifactVersion());
parameterNodeAfterDelete = janusGraphDao.getNode(parameterData.getUniqueIdKey(), parameterData.getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isLeft());
// verify new artifact is deleted
- Either<ArtifactData, JanusGraphOperationStatus> artifactAfterDelete = janusGraphDao.getNode(artifactDataUpdated.getUniqueIdKey(), artifactDataUpdated.getUniqueId(), ArtifactData.class);
+ Either<ArtifactData, JanusGraphOperationStatus> artifactAfterDelete = janusGraphDao.getNode(artifactDataUpdated.getUniqueIdKey(),
+ artifactDataUpdated.getUniqueId(), ArtifactData.class);
assertTrue(artifactAfterDelete.isRight());
- parameterNodeAfterDelete = janusGraphDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(), new HeatParameterData(UpdatedHeatParameter).getUniqueId(), HeatParameterData.class);
+ parameterNodeAfterDelete = janusGraphDao.getNode(new HeatParameterData(UpdatedHeatParameter).getUniqueIdKey(),
+ new HeatParameterData(UpdatedHeatParameter).getUniqueId(), HeatParameterData.class);
assertTrue(parameterNodeAfterDelete.isRight());
artifactOperation.removeArifactFromResource(RESOURCE_ID, artifactWithHeat.getUniqueId(), NodeTypeEnum.Resource, true, false);
@@ -279,7 +302,8 @@ public class ArtifactOperationTest extends ModelTestBase {
heatParams.add(heatParam);
artifactDefinition.setListHeatParameters(heatParams);
- Either<ArtifactDefinition, StorageOperationStatus> artifact = artifactOperation.addArifactToComponent(artifactDefinition, RESOURCE_ID, NodeTypeEnum.Resource, true, false);
+ Either<ArtifactDefinition, StorageOperationStatus> artifact = artifactOperation.addArifactToComponent(artifactDefinition, RESOURCE_ID,
+ NodeTypeEnum.Resource, true, false);
assertTrue(artifact.isLeft());
return artifact.left().value();
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
index 6ed482f948..8b8e813501 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,8 +25,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
import java.util.ArrayList;
import java.util.HashMap;
@@ -39,14 +37,15 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Resource;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
-import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.datatypes.enums.ModelTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
@@ -60,14 +59,9 @@ import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint;
import org.openecomp.sdc.be.resources.data.CapabilityTypeData;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.*;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class CapabilityTypeOperationTest extends ModelTestBase {
@Resource(name = "janusgraph-generic-dao")
@@ -75,16 +69,20 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
@Resource(name = "capability-type-operation")
private CapabilityTypeOperation capabilityTypeOperation;
-
+
@Resource(name = "model-operation")
private ModelOperation modelOperation;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
-
- @Before
+
+ private static Map<String, PropertyDefinition> asMap(PropertyDefinition... props) {
+ return Stream.of(props).collect(Collectors.toMap(PropertyDefinition::getName, Function.identity()));
+ }
+
+ @BeforeEach
public void cleanUp() {
HealingJanusGraphGenericDao janusGraphGenericDao = capabilityTypeOperation.janusGraphGenericDao;
Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphGenericDao.getGraph();
@@ -114,21 +112,24 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeDefinition.setDescription("desc1");
capabilityTypeDefinition.setType("tosca.capabilities.Container1");
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
assertTrue("check capability type added", addCapabilityType1.isLeft());
CapabilityTypeDefinition capabilityTypeAdded = addCapabilityType1.left().value();
compareBetweenCreatedToSent(capabilityTypeDefinition, capabilityTypeAdded);
- Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(capabilityTypeAdded.getUniqueId());
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(
+ capabilityTypeAdded.getUniqueId());
compareBetweenCreatedToSent(capabilityTypeByUid.left().value(), capabilityTypeDefinition);
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType2 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType2 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
assertTrue("check capability type failed", addCapabilityType2.isRight());
assertEquals("check returned error", StorageOperationStatus.SCHEMA_VIOLATION, addCapabilityType2.right().value());
}
-
+
@Test
public void testAddCapabilityTypeWithModel() {
@@ -136,28 +137,31 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeDefinition.setDescription("desc1");
capabilityTypeDefinition.setType("tosca.capabilities.Container1");
capabilityTypeDefinition.setModel("testModel");
-
+
Model model = new Model("testModel", ModelTypeEnum.NORMATIVE);
- modelOperation.createModel(model , true);
+ modelOperation.createModel(model, true);
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
assertTrue("check capability type added", addCapabilityType1.isLeft());
CapabilityTypeDefinition capabilityTypeAdded = addCapabilityType1.left().value();
compareBetweenCreatedToSent(capabilityTypeDefinition, capabilityTypeAdded);
- Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(capabilityTypeAdded.getUniqueId());
+ Either<CapabilityTypeDefinition, JanusGraphOperationStatus> capabilityTypeByUid = capabilityTypeOperation.getCapabilityTypeByUid(
+ capabilityTypeAdded.getUniqueId());
compareBetweenCreatedToSent(capabilityTypeByUid.left().value(), capabilityTypeDefinition);
-
+
CapabilityTypeDefinition capabilityTypeWithDerivedFrom = new CapabilityTypeDefinition();
capabilityTypeWithDerivedFrom.setDescription("desc2");
capabilityTypeWithDerivedFrom.setType("tosca.capabilities.Container2");
capabilityTypeWithDerivedFrom.setDerivedFrom("tosca.capabilities.Container1");
capabilityTypeWithDerivedFrom.setModel("testModel");
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType2 = capabilityTypeOperation.addCapabilityType(capabilityTypeWithDerivedFrom, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType2 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeWithDerivedFrom, true);
assertTrue("check capability type added", addCapabilityType2.isLeft());
-
+
capabilityTypeAdded = addCapabilityType2.left().value();
compareBetweenCreatedToSent(capabilityTypeWithDerivedFrom, capabilityTypeAdded);
@@ -168,7 +172,8 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
CapabilityTypeDefinition capabilityTypeDefinition = createCapabilityTypeDef("tosca.capabilities.Container2", "desc1", "derivedFrom");
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
// assertEquals("check capability type parent not exist",
// StorageOperationStatus.INVALID_ID,
// addCapabilityType1.right().value());
@@ -197,10 +202,12 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeDefinition.setProperties(properties);
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
CapabilityTypeDefinition capabilityTypeDefinitionCreated = addCapabilityType1.left().value();
- Either<CapabilityTypeDefinition, StorageOperationStatus> capabilityType = capabilityTypeOperation.getCapabilityType(capabilityTypeDefinitionCreated.getUniqueId(), true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> capabilityType = capabilityTypeOperation.getCapabilityType(
+ capabilityTypeDefinitionCreated.getUniqueId(), true);
assertTrue("check capability type fetched", capabilityType.isLeft());
CapabilityTypeDefinition fetchedCTD = capabilityType.left().value();
@@ -234,10 +241,12 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeDefinition.setProperties(properties);
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
CapabilityTypeDefinition capabilityTypeDefinitionCreated = addCapabilityType1.left().value();
- Either<CapabilityTypeDefinition, StorageOperationStatus> capabilityType = capabilityTypeOperation.getCapabilityType(capabilityTypeDefinitionCreated.getUniqueId());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> capabilityType = capabilityTypeOperation.getCapabilityType(
+ capabilityTypeDefinitionCreated.getUniqueId());
assertTrue("check capability type fetched", capabilityType.isLeft());
CapabilityTypeDefinition fetchedCTD = capabilityType.left().value();
@@ -274,14 +283,13 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
assertEquals("check not found is returned", StorageOperationStatus.NOT_FOUND, capabilityType.right().value());
}
-
-
-
+
@Test
public void updateCapabilityType_returnNotFoundErrorIfTryingToUpdateANonExistingType() {
CapabilityTypeDefinition currType = createCapabilityTypeDef();
CapabilityTypeDefinition updatedType = createCapabilityTypeDef();
- Either<CapabilityTypeDefinition, StorageOperationStatus> updateCapabilityTypeRes = capabilityTypeOperation.updateCapabilityType(updatedType, currType);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> updateCapabilityTypeRes = capabilityTypeOperation.updateCapabilityType(updatedType,
+ currType);
assertThat(updateCapabilityTypeRes.right().value()).isEqualTo(StorageOperationStatus.NOT_FOUND);
}
@@ -293,7 +301,8 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
CapabilityTypeDefinition updatedType = createCapabilityTypeDef("type1", "description2");
capabilityTypeOperation.updateCapabilityType(updatedType, currCapabilityType.left().value());
- Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(createdType.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(
+ createdType.getType());
CapabilityTypeDefinition fetchedCapabilityType = fetchedUpdatedType.left().value();
assertThat(fetchedCapabilityType.getProperties()).isNullOrEmpty();
assertThat(fetchedCapabilityType.getDerivedFrom()).isNullOrEmpty();
@@ -314,17 +323,18 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
PropertyDefinition prop3 = createSimpleProperty("val3", "prop3", "string");
CapabilityTypeDefinition updatedCapabilityType = createCapabilityTypeDef(asMap(updatedProp1, prop3));
- Either<CapabilityTypeDefinition, StorageOperationStatus> updatedCapabilityTypeRes =
- capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
-
+ Either<CapabilityTypeDefinition, StorageOperationStatus> updatedCapabilityTypeRes =
+ capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
+
assertTrue(updatedCapabilityTypeRes.isRight());
assertEquals(StorageOperationStatus.MATCH_NOT_FOUND, updatedCapabilityTypeRes.right().value());
- Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(capabilityType.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(
+ capabilityType.getType());
assertEquals(fetchedUpdatedType.left().value().getProperties(), asMap(prop1));
}
-
+
@Test
public void updateCapabilityType_updatePropertiesFailedDueDeletedProp() {
PropertyDefinition prop1 = createSimpleProperty("val1", "prop1", "string");
@@ -334,17 +344,18 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
PropertyDefinition prop3 = createSimpleProperty("val3", "prop3", "string");
CapabilityTypeDefinition updatedCapabilityType = createCapabilityTypeDef(asMap(prop3));
- Either<CapabilityTypeDefinition, StorageOperationStatus> updatedCapabilityTypeRes =
- capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
-
+ Either<CapabilityTypeDefinition, StorageOperationStatus> updatedCapabilityTypeRes =
+ capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
+
assertTrue(updatedCapabilityTypeRes.isRight());
assertEquals(StorageOperationStatus.MATCH_NOT_FOUND, updatedCapabilityTypeRes.right().value());
- Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(capabilityType.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(
+ capabilityType.getType());
assertEquals(fetchedUpdatedType.left().value().getProperties(), asMap(prop1));
}
-
+
@Test
public void updateCapabilityType_updateProperties() {
PropertyDefinition prop1 = createSimpleProperty("val1", "prop1", "string");
@@ -355,11 +366,12 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
PropertyDefinition prop3 = createSimpleProperty("val3", "prop3", "string");
CapabilityTypeDefinition updatedCapabilityType = createCapabilityTypeDef(asMap(updatedProp1, prop3));
- Either<CapabilityTypeDefinition, StorageOperationStatus> updatedCapabilityTypeRes =
- capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> updatedCapabilityTypeRes =
+ capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
assertTrue(updatedCapabilityTypeRes.isLeft());
-
- Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(capabilityType.getType());
+
+ Either<CapabilityTypeDefinition, StorageOperationStatus> fetchedUpdatedType = capabilityTypeOperation.getCapabilityType(
+ capabilityType.getType());
assertEquals(fetchedUpdatedType.left().value().getProperties(), asMap(updatedProp1, prop3));
}
@@ -373,7 +385,8 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
Either<CapabilityTypeDefinition, StorageOperationStatus> currCapabilityType = capabilityTypeOperation.addCapabilityType(capabilityType1);
capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
- Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(capabilityType1.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(
+ capabilityType1.getType());
assertThat(latestCapabilityType.left().value().getDerivedFrom()).isEqualTo(rootCapabilityType.getType());
verifyDerivedFromNodeEqualsToRootCapabilityType(rootCapabilityType, latestCapabilityType.left().value().getUniqueId());
}
@@ -386,12 +399,13 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeOperation.addCapabilityType(rootCapabilityType);
Either<CapabilityTypeDefinition, StorageOperationStatus> currCapabilityType = capabilityTypeOperation.addCapabilityType(capabilityType1);
- Either<CapabilityTypeDefinition, StorageOperationStatus> updateRes =
- capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
-
+ Either<CapabilityTypeDefinition, StorageOperationStatus> updateRes =
+ capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
+
assertThat(updateRes.right().value()).isEqualTo(StorageOperationStatus.NOT_FOUND);
- Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(capabilityType1.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(
+ capabilityType1.getType());
assertThat(latestCapabilityType.left().value().getDerivedFrom()).isEqualTo(rootCapabilityType.getType());
}
@@ -408,11 +422,12 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
- Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(capabilityType1.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(
+ capabilityType1.getType());
assertThat(latestCapabilityType.left().value().getDerivedFrom()).isEqualTo(derivedType1.getType());
verifyDerivedFromNodeEqualsToRootCapabilityType(derivedType1, latestCapabilityType.left().value().getUniqueId());
}
-
+
@Test
public void updateCapabilityType_updateDerivedFrom_Failed_NewParentIsNotChildOfOldOne() {
CapabilityTypeDefinition rootCapabilityType = createCapabilityTypeDef();
@@ -424,23 +439,26 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeOperation.addCapabilityType(notDerivedType);
Either<CapabilityTypeDefinition, StorageOperationStatus> currCapabilityType = capabilityTypeOperation.addCapabilityType(capabilityType1);
- Either<CapabilityTypeDefinition, StorageOperationStatus> result = capabilityTypeOperation.updateCapabilityType(updatedCapabilityType, currCapabilityType.left().value());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> result = capabilityTypeOperation.updateCapabilityType(updatedCapabilityType,
+ currCapabilityType.left().value());
assertThat(result.right().value()).isEqualTo(StorageOperationStatus.CANNOT_UPDATE_EXISTING_ENTITY);
- Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(capabilityType1.getType());
+ Either<CapabilityTypeDefinition, StorageOperationStatus> latestCapabilityType = capabilityTypeOperation.getCapabilityType(
+ capabilityType1.getType());
assertThat(latestCapabilityType.left().value().getDerivedFrom()).isEqualTo(rootCapabilityType.getType());
verifyDerivedFromNodeEqualsToRootCapabilityType(rootCapabilityType, latestCapabilityType.left().value().getUniqueId());
}
-
+
private CapabilityTypeDefinition createCapabilityTypeDef() {
- return createCapabilityTypeDef("tosca.capabilities.Root", "The TOSCA root Capability Type all other TOSCA base Capability Types derived from", null, new HashMap<>());
+ return createCapabilityTypeDef("tosca.capabilities.Root", "The TOSCA root Capability Type all other TOSCA base Capability Types derived from",
+ null, new HashMap<>());
}
private CapabilityTypeDefinition createCapabilityTypeDef(Map<String, PropertyDefinition> properties) {
return createCapabilityTypeDef("tosca.capabilities.Root",
- "The TOSCA root Capability Type all other TOSCA base Capability Types derived from", null, properties);
+ "The TOSCA root Capability Type all other TOSCA base Capability Types derived from", null, properties);
}
-
+
private CapabilityTypeDefinition createCapabilityTypeDef(String type, String description) {
return createCapabilityTypeDef(type, description, null, null);
}
@@ -449,8 +467,8 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
return createCapabilityTypeDef(type, description, derivedFrom, null);
}
-
- private CapabilityTypeDefinition createCapabilityTypeDef(String type, String description, String derivedFrom, Map<String, PropertyDefinition> properties) {
+ private CapabilityTypeDefinition createCapabilityTypeDef(String type, String description, String derivedFrom,
+ Map<String, PropertyDefinition> properties) {
CapabilityTypeDefinition capabilityTypeDefinition = new CapabilityTypeDefinition();
capabilityTypeDefinition.setDescription(description);
capabilityTypeDefinition.setType(type);
@@ -470,15 +488,12 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
return updatedProp1;
}
- private static Map<String, PropertyDefinition> asMap(PropertyDefinition ... props) {
- return Stream.of(props).collect(Collectors.toMap(PropertyDefinition::getName, Function.identity()));
- }
-
private void verifyDerivedFromNodeEqualsToRootCapabilityType(CapabilityTypeDefinition rootCapabilityType, String parentCapabilityId) {
- Either<ImmutablePair<CapabilityTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), parentCapabilityId, GraphEdgeLabels.DERIVED_FROM,
- NodeTypeEnum.CapabilityType, CapabilityTypeData.class);
+ Either<ImmutablePair<CapabilityTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphDao.getChild(
+ UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.CapabilityType), parentCapabilityId, GraphEdgeLabels.DERIVED_FROM,
+ NodeTypeEnum.CapabilityType, CapabilityTypeData.class);
assertThat(derivedFromRelation.left().value().getLeft().getCapabilityTypeDataDefinition())
- .isEqualToComparingFieldByField(rootCapabilityType);
+ .isEqualToComparingFieldByField(rootCapabilityType);
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java
index 19812e6d61..546506aa92 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,10 +38,9 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphVertex;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
@@ -61,11 +60,9 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.tosca.ToscaType;
import org.openecomp.sdc.be.resources.data.CapabilityTypeData;
import org.openecomp.sdc.be.resources.data.GroupTypeData;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class GroupTypeOperationTest extends ModelTestBase {
private static final String TOSCA_GROUPS_ROOT = "tosca.groups.Root";
@@ -73,22 +70,22 @@ public class GroupTypeOperationTest extends ModelTestBase {
@Resource(name = "janusgraph-generic-dao")
private HealingJanusGraphGenericDao janusGraphDao;
-
+
@Resource(name = "capability-type-operation")
private CapabilityTypeOperation capabilityTypeOperation;
-
+
@Resource(name = "group-type-operation")
private GroupTypeOperation groupTypeOperation;
@Resource(name = "model-operation")
private ModelOperation modelOperation;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @After
+ @AfterEach
public void tearDown() {
janusGraphDao.rollback();
cleanUp();
@@ -105,8 +102,8 @@ public class GroupTypeOperationTest extends ModelTestBase {
List<GroupTypeDefinition> allGroupTypesNoExclusion = groupTypeOperation.getAllGroupTypes(null, null);
assertThat(allGroupTypesNoExclusion)
- .usingElementComparatorOnFields("type", "icon", "name")
- .containsExactlyInAnyOrder(rootGroupDefinition, type1, type2);
+ .usingElementComparatorOnFields("type", "icon", "name")
+ .containsExactlyInAnyOrder(rootGroupDefinition, type1, type2);
}
@Test
@@ -120,45 +117,45 @@ public class GroupTypeOperationTest extends ModelTestBase {
List<GroupTypeDefinition> allGroupTypes = groupTypeOperation.getAllGroupTypes(newHashSet("type1", "type2"), null);
assertThat(allGroupTypes)
- .usingElementComparatorOnFields("type")
- .containsExactly(rootGroupDefinition);
+ .usingElementComparatorOnFields("type")
+ .containsExactly(rootGroupDefinition);
}
@Test
public void groupTypeWithoutCapabilityCreated() {
GroupTypeData rootNode = getOrCreateRootGroupTypeNode();
-
+
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
groupTypeDefinition.setDerivedFrom(TOSCA_GROUPS_ROOT);
groupTypeDefinition.setDescription("groups l3-networks in network collection");
groupTypeDefinition.setType("org.openecomp.groups.NetworkCollection");
groupTypeDefinition.setVersion("1.0");
-
+
List<PropertyDefinition> properties = asList(
- buildProperty("network_collection_type", "l3-network", "network collection type, defined with default value"),
- buildProperty("network_collection_subtype", "sub-interface", "network collection subtype, defined with default value"),
- buildProperty("network_collection_role", null, "network collection role"),
- buildProperty("network_collection_description", null, "network collection description, free format text"));
-
- groupTypeDefinition.setProperties(properties );
-
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+ buildProperty("network_collection_type", "l3-network", "network collection type, defined with default value"),
+ buildProperty("network_collection_subtype", "sub-interface", "network collection subtype, defined with default value"),
+ buildProperty("network_collection_role", null, "network collection role"),
+ buildProperty("network_collection_description", null, "network collection description, free format text"));
+
+ groupTypeDefinition.setProperties(properties);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
+
addGroupTypeResult = groupTypeOperation.getGroupTypeByTypeAndVersion("org.openecomp.groups.NetworkCollection", "1.0", null);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
+
Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
.getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
GroupTypeData groupTypeNode = extractVal(groupTypeResult);
-
+
Either<Edge, JanusGraphOperationStatus> edgeResult = janusGraphDao
.getEdgeByNodes(groupTypeNode, rootNode, GraphEdgeLabels.DERIVED_FROM);
validate(edgeResult);
}
-
+
@Test
public void groupTypeWithCapabilityAndPropsButCapTypeWithoutProps() {
getOrCreateRootGroupTypeNode();
@@ -176,21 +173,20 @@ public class GroupTypeOperationTest extends ModelTestBase {
Map<String, CapabilityDefinition> mapCapabilities = new HashMap<>();
ComponentInstanceProperty property = new ComponentInstanceProperty(
- buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
+ buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
CapabilityDefinition capabilityDef = buildCapabilityDefintion(asList(property));
mapCapabilities.put("vlan_assignment", capabilityDef);
groupTypeDefinition.setCapabilities(mapCapabilities);
-
List<PropertyDefinition> properties = asList(
- buildProperty("vfc_instance_group_role", null, "role of this VFC group"),
- buildProperty("vfc_parent_port_role", null, "common role of parent ports of VFCs in this group"),
- buildProperty("network_collection_role", null, "network collection role assigned to this group"),
- buildProperty("subinterface_role", null, "common role of subinterfaces of VFCs in this group, criteria the group is created"));
+ buildProperty("vfc_instance_group_role", null, "role of this VFC group"),
+ buildProperty("vfc_parent_port_role", null, "common role of parent ports of VFCs in this group"),
+ buildProperty("network_collection_role", null, "network collection role assigned to this group"),
+ buildProperty("subinterface_role", null, "common role of subinterfaces of VFCs in this group, criteria the group is created"));
- groupTypeDefinition.setProperties(properties );
+ groupTypeDefinition.setProperties(properties);
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue(addGroupTypeResult.isRight());
assertEquals(StorageOperationStatus.MATCH_NOT_FOUND, addGroupTypeResult.right().value());
}
@@ -198,16 +194,16 @@ public class GroupTypeOperationTest extends ModelTestBase {
@Test
public void groupTypeWithCapabilityTypeAndEdgeCreated() {
GroupTypeData rootNode = getOrCreateRootGroupTypeNode();
-
+
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference",
- buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
+ buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
CapabilityTypeDefinition capabilityTypeDef = createCapabilityType(capTypeProperties);
Either<CapabilityTypeData, JanusGraphOperationStatus> capabilityTypeResult = janusGraphDao
.getNode(GraphPropertiesDictionary.TYPE.getProperty(), capabilityTypeDef.getType(), CapabilityTypeData.class);
extractVal(capabilityTypeResult);
-
+
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
groupTypeDefinition.setDerivedFrom(TOSCA_GROUPS_ROOT);
groupTypeDefinition.setDescription("groups l3-networks in network collection");
@@ -215,28 +211,27 @@ public class GroupTypeOperationTest extends ModelTestBase {
Map<String, CapabilityDefinition> mapCapabilities = new HashMap<>();
ComponentInstanceProperty property = new ComponentInstanceProperty(
- buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
+ buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance"));
CapabilityDefinition capabilityDef = buildCapabilityDefintion(asList(property));
mapCapabilities.put("vlan_assignment", capabilityDef);
groupTypeDefinition.setCapabilities(mapCapabilities);
-
-
+
List<PropertyDefinition> properties = asList(
- buildProperty("vfc_instance_group_role", null, "role of this VFC group"),
- buildProperty("vfc_parent_port_role", null, "common role of parent ports of VFCs in this group"),
- buildProperty("network_collection_role", null, "network collection role assigned to this group"),
- buildProperty("subinterface_role", null, "common role of subinterfaces of VFCs in this group, criteria the group is created"));
-
- groupTypeDefinition.setProperties(properties );
-
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+ buildProperty("vfc_instance_group_role", null, "role of this VFC group"),
+ buildProperty("vfc_parent_port_role", null, "common role of parent ports of VFCs in this group"),
+ buildProperty("network_collection_role", null, "network collection role assigned to this group"),
+ buildProperty("subinterface_role", null, "common role of subinterfaces of VFCs in this group, criteria the group is created"));
+
+ groupTypeDefinition.setProperties(properties);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
+
Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
.getNode(GraphPropertiesDictionary.TYPE.getProperty(), groupTypeDefinition.getType(), GroupTypeData.class);
GroupTypeData groupTypeNode = extractVal(groupTypeResult);
-
+
Either<GroupTypeDefinition, StorageOperationStatus> groupTypeDefResult = groupTypeOperation.getGroupTypeByUid(groupTypeNode.getUniqueId());
assertTrue(groupTypeDefResult.isLeft());
GroupTypeDefinition groupTypeDefinitionRetrieved = groupTypeDefResult.left().value();
@@ -247,17 +242,18 @@ public class GroupTypeOperationTest extends ModelTestBase {
assertTrue(capabilityDefs.containsKey("vlan_assignment"));
CapabilityDefinition updatedCapabilityDef = capabilityDefs.get("vlan_assignment");
assertEquals(2, updatedCapabilityDef.getProperties().size());
-
+
Either<Edge, JanusGraphOperationStatus> edgeDerivedFromResult = janusGraphDao
.getEdgeByNodes(groupTypeNode, rootNode, GraphEdgeLabels.DERIVED_FROM);
validate(edgeDerivedFromResult);
}
-
+
@Test
public void groupTypeWithCapabilityTypeAndEdgeCreated_OverrideDefaultCapabilityTypeValue() {
getOrCreateRootGroupTypeNode();
- PropertyDefinition property = buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance");
+ PropertyDefinition property = buildProperty("vfc_instance_group_reference", null,
+ "Ability to recognize capability per vfc instance group on vnf instance");
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
@@ -278,16 +274,15 @@ public class GroupTypeOperationTest extends ModelTestBase {
mapCapabilities.put("vlan_assignment", capabilityDef);
groupTypeDefinition.setCapabilities(mapCapabilities);
-
List<PropertyDefinition> properties = asList(
- buildProperty("vfc_instance_group_role", null, "role of this VFC group"),
- buildProperty("vfc_parent_port_role", null, "common role of parent ports of VFCs in this group"),
- buildProperty("network_collection_role", null, "network collection role assigned to this group"),
- buildProperty("subinterface_role", null, "common role of subinterfaces of VFCs in this group, criteria the group is created"));
+ buildProperty("vfc_instance_group_role", null, "role of this VFC group"),
+ buildProperty("vfc_parent_port_role", null, "common role of parent ports of VFCs in this group"),
+ buildProperty("network_collection_role", null, "network collection role assigned to this group"),
+ buildProperty("subinterface_role", null, "common role of subinterfaces of VFCs in this group, criteria the group is created"));
- groupTypeDefinition.setProperties(properties );
+ groupTypeDefinition.setProperties(properties);
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
@@ -308,13 +303,14 @@ public class GroupTypeOperationTest extends ModelTestBase {
assertEquals("new_value", capDefinition.getProperties().get(0).getValue());
assertEquals(2, capDefinition.getProperties().size());
}
-
-
+
+
@Test
public void updateGroupTypeWithCapability_FailedDueToCapabilityDeleteAttempt() {
createRootGroupTypeNode();
- PropertyDefinition property = buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance");
+ PropertyDefinition property = buildProperty("vfc_instance_group_reference", null,
+ "Ability to recognize capability per vfc instance group on vnf instance");
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
@@ -335,24 +331,26 @@ public class GroupTypeOperationTest extends ModelTestBase {
mapCapabilities.put("vlan_assignment", capabilityDef);
groupTypeDefinition.setCapabilities(mapCapabilities);
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition);
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition);
assertTrue(addGroupTypeResult.isLeft());
-
+
GroupTypeDefinition newGroupTypeDefinition = new GroupTypeDefinition();
newGroupTypeDefinition.setDerivedFrom(TOSCA_GROUPS_ROOT);
newGroupTypeDefinition.setDescription("groups l3-networks in network collection");
newGroupTypeDefinition.setType("org.openecomp.groups.NetworkCollection");
- Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeResult = groupTypeOperation.updateGroupType(newGroupTypeDefinition, addGroupTypeResult.left().value());
+ Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeResult = groupTypeOperation.updateGroupType(newGroupTypeDefinition,
+ addGroupTypeResult.left().value());
assertTrue(updateGroupTypeResult.isRight());
assertEquals(StorageOperationStatus.MATCH_NOT_FOUND, updateGroupTypeResult.right().value());
}
-
+
@Test
public void updateGroupTypeWithCapability_FailedDueToCapabilityChangeTypeAttempt() {
createRootGroupTypeNode();
- PropertyDefinition property = buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance");
+ PropertyDefinition property = buildProperty("vfc_instance_group_reference", null,
+ "Ability to recognize capability per vfc instance group on vnf instance");
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
@@ -373,14 +371,14 @@ public class GroupTypeOperationTest extends ModelTestBase {
mapCapabilities.put("vlan_assignment", capabilityDef);
groupTypeDefinition.setCapabilities(mapCapabilities);
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition);
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition);
assertTrue(addGroupTypeResult.isLeft());
-
+
GroupTypeDefinition newGroupTypeDefinition = new GroupTypeDefinition();
newGroupTypeDefinition.setDerivedFrom(TOSCA_GROUPS_ROOT);
newGroupTypeDefinition.setDescription("groups l3-networks in network collection");
newGroupTypeDefinition.setType("org.openecomp.groups.NetworkCollection");
-
+
Map<String, CapabilityDefinition> updatedMapCapabilities = new HashMap<>();
property.setValue("new_value");
ComponentInstanceProperty newCapDefProperty = new ComponentInstanceProperty(property);
@@ -388,17 +386,19 @@ public class GroupTypeOperationTest extends ModelTestBase {
updatedCapabilityDef.setType("Another type");
updatedMapCapabilities.put("vlan_assignment", updatedCapabilityDef);
newGroupTypeDefinition.setCapabilities(updatedMapCapabilities);
-
- Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeResult = groupTypeOperation.updateGroupType(newGroupTypeDefinition, addGroupTypeResult.left().value());
+
+ Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeResult = groupTypeOperation.updateGroupType(newGroupTypeDefinition,
+ addGroupTypeResult.left().value());
assertTrue(updateGroupTypeResult.isRight());
assertEquals(StorageOperationStatus.MATCH_NOT_FOUND, updateGroupTypeResult.right().value());
}
-
+
@Test
public void updateGroupTypeWithCapability_Success() {
createRootGroupTypeNode();
- PropertyDefinition property = buildProperty("vfc_instance_group_reference", null, "Ability to recognize capability per vfc instance group on vnf instance");
+ PropertyDefinition property = buildProperty("vfc_instance_group_reference", null,
+ "Ability to recognize capability per vfc instance group on vnf instance");
Map<String, PropertyDefinition> capTypeProperties = new HashMap<>();
capTypeProperties.put("vfc_instance_group_reference", property);
@@ -419,22 +419,23 @@ public class GroupTypeOperationTest extends ModelTestBase {
mapCapabilities.put("vlan_assignment", capabilityDef);
groupTypeDefinition.setCapabilities(mapCapabilities);
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition);
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition);
assertTrue(addGroupTypeResult.isLeft());
-
+
GroupTypeDefinition newGroupTypeDefinition = new GroupTypeDefinition();
newGroupTypeDefinition.setDerivedFrom(TOSCA_GROUPS_ROOT);
newGroupTypeDefinition.setDescription("groups l3-networks in network collection");
newGroupTypeDefinition.setType("org.openecomp.groups.NetworkCollection");
-
+
Map<String, CapabilityDefinition> updatedMapCapabilities = new HashMap<>();
property.setValue("another_value");
ComponentInstanceProperty newCapDefProperty = new ComponentInstanceProperty(property);
CapabilityDefinition updatedCapabilityDef = buildCapabilityDefintion(asList(newCapDefProperty));
updatedMapCapabilities.put("vlan_assignment", updatedCapabilityDef);
newGroupTypeDefinition.setCapabilities(updatedMapCapabilities);
-
- Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeResult = groupTypeOperation.updateGroupType(newGroupTypeDefinition, addGroupTypeResult.left().value());
+
+ Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeResult = groupTypeOperation.updateGroupType(newGroupTypeDefinition,
+ addGroupTypeResult.left().value());
assertTrue(updateGroupTypeResult.isLeft());
}
@@ -448,23 +449,24 @@ public class GroupTypeOperationTest extends ModelTestBase {
groupTypeDefinition.setVersion("1.0");
List<PropertyDefinition> properties = singletonList(
- buildProperty("network_collection_type", "l2-network", "network collection type, defined with default value"));
-
- groupTypeDefinition.setProperties(properties );
-
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+ buildProperty("network_collection_type", "l2-network", "network collection type, defined with default value"));
+
+ groupTypeDefinition.setProperties(properties);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
+
addGroupTypeResult = groupTypeOperation.getGroupTypeByTypeAndVersion("org.openecomp.groups.PrivateCollection", "1.0", null);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
- Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition, groupTypeDefinition);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition,
+ groupTypeDefinition);
assertNotNull(upgradeResult);
assertTrue(upgradeResult.isLeft());
}
-
+
@Test
public void testUpdateNonExistingGroupType() {
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
@@ -472,70 +474,74 @@ public class GroupTypeOperationTest extends ModelTestBase {
groupTypeDefinition.setDescription("groups l2-networks in network collection");
groupTypeDefinition.setType("org.openecomp.groups.MyCollection");
groupTypeDefinition.setVersion("1.0");
-
- Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition, groupTypeDefinition);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition,
+ groupTypeDefinition);
assertNotNull(upgradeResult);
assertTrue(upgradeResult.isRight());
}
-
+
@Test
public void testUpdateNotDerivedGroupType() {
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
groupTypeDefinition.setDescription("groups social-networks in school");
groupTypeDefinition.setType("org.openecomp.groups.Teachers");
groupTypeDefinition.setVersion("1.0");
-
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
- Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition, groupTypeDefinition);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition,
+ groupTypeDefinition);
assertNotNull(upgradeResult);
assertTrue(upgradeResult.isLeft());
assertThat(groupTypeDefinition).isEqualToIgnoringGivenFields(upgradeResult.left().value(), "properties", "capabilities");
}
-
+
@Test
public void testUpdateGroupTypeWithNonExistingParent() {
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
groupTypeDefinition.setDescription("groups social-networks in work");
groupTypeDefinition.setType("org.openecomp.groups.Cowokers");
groupTypeDefinition.setVersion("1.0");
-
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
+
groupTypeDefinition.setDerivedFrom("Non.existing.parent");
- Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition, groupTypeDefinition);
+ Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition,
+ groupTypeDefinition);
assertNotNull(upgradeResult);
assertTrue(upgradeResult.isRight());
}
-
+
@Test
public void testUpgradeGroupType() {
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
groupTypeDefinition.setDescription("groups social-networks in university");
groupTypeDefinition.setType("org.openecomp.groups.Students");
groupTypeDefinition.setVersion("1.0");
-
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
+
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(groupTypeDefinition, true);
assertTrue("check group type added", addGroupTypeResult.isLeft());
compareBetweenCreatedToSent(groupTypeDefinition, addGroupTypeResult.left().value());
-
+
GroupTypeDefinition parentGroupTypeDefinition = new GroupTypeDefinition();
parentGroupTypeDefinition.setDescription("groups social-networks in university");
parentGroupTypeDefinition.setType("org.openecomp.groups.Parents");
parentGroupTypeDefinition.setVersion("1.0");
parentGroupTypeDefinition.setHighestVersion(true);
-
- Either<GroupTypeDefinition, StorageOperationStatus> addParentGroupTypeResult = groupTypeOperation.addGroupType(parentGroupTypeDefinition, true);
+ Either<GroupTypeDefinition, StorageOperationStatus> addParentGroupTypeResult = groupTypeOperation.addGroupType(parentGroupTypeDefinition,
+ true);
assertTrue("check group type added", addParentGroupTypeResult.isLeft());
compareBetweenCreatedToSent(parentGroupTypeDefinition, addParentGroupTypeResult.left().value());
-
+
groupTypeDefinition.setDerivedFrom("org.openecomp.groups.Parents");
- Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition, addGroupTypeResult.left().value());
+ Either<GroupTypeDefinition, StorageOperationStatus> upgradeResult = groupTypeOperation.updateGroupType(groupTypeDefinition,
+ addGroupTypeResult.left().value());
assertNotNull(upgradeResult);
assertTrue(upgradeResult.isLeft());
assertThat(groupTypeDefinition).isEqualToIgnoringGivenFields(upgradeResult.left().value(), "properties", "capabilities");
@@ -546,37 +552,37 @@ public class GroupTypeOperationTest extends ModelTestBase {
GroupTypeDefinition groupTypeDefinition = createGroupTypeDef();
groupTypeDefinition.setModel("testModel");
Model model = new Model("testModel", ModelTypeEnum.NORMATIVE);
- modelOperation.createModel(model , true);
+ modelOperation.createModel(model, true);
Either<GroupTypeDefinition, StorageOperationStatus> addGroupType = groupTypeOperation.addGroupType(groupTypeDefinition);
assertTrue(addGroupType.isLeft());
Either<GroupTypeDefinition, StorageOperationStatus> eitherGroupTypeFetched =
- groupTypeOperation.getLatestGroupTypeByType(groupTypeDefinition.getType(), groupTypeDefinition.getModel());
+ groupTypeOperation.getLatestGroupTypeByType(groupTypeDefinition.getType(), groupTypeDefinition.getModel());
assertTrue(eitherGroupTypeFetched.isLeft());
assertEquals(groupTypeDefinition.getModel(), eitherGroupTypeFetched.left().value().getModel());
}
-
+
private GroupTypeData getOrCreateRootGroupTypeNode() {
Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
.getNode(GraphPropertiesDictionary.TYPE.getProperty(), TOSCA_GROUPS_ROOT, GroupTypeData.class);
- if(groupTypeResult.isLeft()) {
+ if (groupTypeResult.isLeft()) {
return groupTypeResult.left().value();
}
-
+
return createRootGroupTypeNode();
}
-
+
private GroupTypeData createRootGroupTypeNode() {
GroupTypeDefinition rootGroupDefinition = createRootGroupDefinition();
- Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(rootGroupDefinition, false);
+ Either<GroupTypeDefinition, StorageOperationStatus> addGroupTypeResult = groupTypeOperation.addGroupType(rootGroupDefinition, false);
assertTrue("check group type added", addGroupTypeResult.isLeft());
-
+
Either<GroupTypeData, JanusGraphOperationStatus> groupTypeResult = janusGraphDao
.getNode(GraphPropertiesDictionary.TYPE.getProperty(), rootGroupDefinition.getType(), GroupTypeData.class);
- return extractVal(groupTypeResult);
+ return extractVal(groupTypeResult);
}
-
+
private GroupTypeDefinition createRootGroupDefinition() {
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
groupTypeDefinition.setDescription("The TOSCA Group Type all other TOSCA Group Types derive from");
@@ -593,7 +599,7 @@ public class GroupTypeOperationTest extends ModelTestBase {
groupTypeDefinition.setIcon(type + "icon");
return groupTypeDefinition;
}
-
+
private CapabilityTypeDefinition createCapabilityType(Map<String, PropertyDefinition> properties) {
CapabilityTypeDefinition rootCapabilityTypeDefinition = new CapabilityTypeDefinition();
rootCapabilityTypeDefinition.setType("tosca.capabilities.Root");
@@ -601,7 +607,6 @@ public class GroupTypeOperationTest extends ModelTestBase {
rootCapabilityTypeDefinition.setVersion("1.0");
capabilityTypeOperation.addCapabilityType(rootCapabilityTypeDefinition, true);
-
CapabilityTypeDefinition parentCapabilityTypeDefinition = new CapabilityTypeDefinition();
parentCapabilityTypeDefinition.setType("tosca.capabilities.Parent");
parentCapabilityTypeDefinition.setDescription("Dummy parent type");
@@ -613,7 +618,6 @@ public class GroupTypeOperationTest extends ModelTestBase {
parentCapabilityTypeDefinition.setProperties(capTypeProperties);
capabilityTypeOperation.addCapabilityType(parentCapabilityTypeDefinition, true);
-
CapabilityTypeDefinition capabilityTypeDefinition = new CapabilityTypeDefinition();
capabilityTypeDefinition.setDescription("ability to expose routing information of the internal network");
capabilityTypeDefinition.setType("org.openecomp.capabilities.VLANAssignment");
@@ -622,15 +626,16 @@ public class GroupTypeOperationTest extends ModelTestBase {
capabilityTypeDefinition.setProperties(properties);
- Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityTypeResult = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
+ Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityTypeResult = capabilityTypeOperation.addCapabilityType(
+ capabilityTypeDefinition, true);
assertTrue("check capability type added", addCapabilityTypeResult.isLeft());
CapabilityTypeDefinition capabilityTypeAdded = addCapabilityTypeResult.left().value();
compareBetweenCreatedToSent(capabilityTypeDefinition, capabilityTypeAdded);
-
+
return capabilityTypeDefinition;
}
-
+
private CapabilityDefinition buildCapabilityDefintion(List<ComponentInstanceProperty> properties) {
CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
capabilityDefinition.setName("vlan_assignment");
@@ -650,27 +655,27 @@ public class GroupTypeOperationTest extends ModelTestBase {
return property;
}
-
+
private void compareBetweenCreatedToSent(CapabilityTypeDefinition expected, CapabilityTypeDefinition actual) {
assertEquals(expected.getDerivedFrom(), actual.getDerivedFrom());
assertEquals(expected.getType(), actual.getType());
assertEquals(expected.getDescription(), actual.getDescription());
}
-
+
private void compareBetweenCreatedToSent(GroupTypeDefinition expected, GroupTypeDefinition actual) {
assertEquals(expected.getType(), actual.getType());
assertEquals(expected.getDescription(), actual.getDescription());
}
-
+
private <T> void validate(Either<T, JanusGraphOperationStatus> result) {
extractVal(result);
}
-
+
private <T> T extractVal(Either<T, JanusGraphOperationStatus> result) {
assertTrue(result.isLeft());
T t = result.left().value();
assertNotNull(t);
-
+
return t;
}
@@ -709,11 +714,12 @@ public class GroupTypeOperationTest extends ModelTestBase {
updatedType.setIcon("icon");
groupTypeOperation.updateGroupType(updatedType, currGroupType.left().value());
- Either<GroupTypeDefinition, StorageOperationStatus> fetchedUpdatedType = groupTypeOperation.getLatestGroupTypeByType(createdType.getType(), createdType.getModel());
+ Either<GroupTypeDefinition, StorageOperationStatus> fetchedUpdatedType = groupTypeOperation.getLatestGroupTypeByType(createdType.getType(),
+ createdType.getModel());
GroupTypeDefinition fetchedGroupType = fetchedUpdatedType.left().value();
assertThat(fetchedGroupType.getProperties()).isEmpty();
assertThat(fetchedGroupType)
- .isEqualToIgnoringGivenFields(updatedType, "properties", "capabilities");
+ .isEqualToIgnoringGivenFields(updatedType, "properties", "capabilities");
}
@@ -727,25 +733,26 @@ public class GroupTypeOperationTest extends ModelTestBase {
PropertyDefinition prop3 = createSimpleProperty("val3", "prop3", "string");
GroupTypeDefinition updatedGroupType = createGroupTypeDef(updatedProp1, prop3);
- Either<GroupTypeDefinition, StorageOperationStatus> updatedGroupTypeRetrieved = groupTypeOperation.updateGroupType(updatedGroupType, currGroupType.left().value());
+ Either<GroupTypeDefinition, StorageOperationStatus> updatedGroupTypeRetrieved = groupTypeOperation.updateGroupType(updatedGroupType,
+ currGroupType.left().value());
assertEquals(StorageOperationStatus.MATCH_NOT_FOUND, updatedGroupTypeRetrieved.right().value());
}
-
+
@Test
public void validateGroupType_FailedDueAttempToCreateGroupTypeWithPropertyWhichTypeIsDifferentFromTypeOfParentPropertyWithTheSameName() {
GroupTypeDefinition rootGroupType = createGroupTypeDef();
Either<GroupTypeDefinition, StorageOperationStatus> rootGroupTypeRes = groupTypeOperation.addGroupType(rootGroupType);
assertTrue(rootGroupTypeRes.isLeft());
-
+
PropertyDefinition prop = createSimpleProperty("val1", "prop", "string");
GroupTypeDefinition groupType1 = createGroupTypeDef("type1", "descr1", rootGroupType.getType(), prop);
Either<GroupTypeDefinition, StorageOperationStatus> groupType1Res = groupTypeOperation.addGroupType(groupType1);
assertTrue(groupType1Res.isLeft());
-
+
PropertyDefinition prop1 = createSimpleProperty("33", "prop", "int");
PropertyDefinition prop2 = createSimpleProperty("val2", "prop2", "string");
GroupTypeDefinition groupType2 = createGroupTypeDef("type2", "descr", groupType1.getType(), prop1, prop2);
-
+
Either<GroupTypeDefinition, StorageOperationStatus> updatedGroupTypeRetrieved = groupTypeOperation.validateUpdateProperties(groupType2);
assertEquals(StorageOperationStatus.PROPERTY_NAME_ALREADY_EXISTS, updatedGroupTypeRetrieved.right().value());
}
@@ -759,7 +766,8 @@ public class GroupTypeOperationTest extends ModelTestBase {
Either<GroupTypeDefinition, StorageOperationStatus> currGroupType = groupTypeOperation.addGroupType(groupType1);
groupTypeOperation.updateGroupType(updatedGroupType, currGroupType.left().value());
- Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(groupType1.getType(), groupType1.getModel());
+ Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(groupType1.getType(),
+ groupType1.getModel());
assertThat(latestGroupType.left().value().getDerivedFrom()).isEqualTo(rootGroupType.getType());
verifyDerivedFromNodeEqualsToRootGroupType(rootGroupType, latestGroupType.left().value().getUniqueId());
}
@@ -772,10 +780,12 @@ public class GroupTypeOperationTest extends ModelTestBase {
groupTypeOperation.addGroupType(rootGroupType);
Either<GroupTypeDefinition, StorageOperationStatus> currGroupType = groupTypeOperation.addGroupType(groupType1);
- Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeRes = groupTypeOperation.updateGroupType(updatedGroupType, currGroupType.left().value());
+ Either<GroupTypeDefinition, StorageOperationStatus> updateGroupTypeRes = groupTypeOperation.updateGroupType(updatedGroupType,
+ currGroupType.left().value());
assertThat(updateGroupTypeRes.right().value()).isEqualTo(StorageOperationStatus.NOT_FOUND);
- Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(groupType1.getType(), groupType1.getModel());
+ Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(groupType1.getType(),
+ groupType1.getModel());
assertThat(latestGroupType.left().value().getDerivedFrom()).isEqualTo(rootGroupType.getType());
}
@@ -792,10 +802,11 @@ public class GroupTypeOperationTest extends ModelTestBase {
groupTypeOperation.updateGroupType(updatedGroupType, currGroupType.left().value());
- Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(groupType1.getType(), groupType1.getModel());
+ Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(groupType1.getType(),
+ groupType1.getModel());
assertThat(latestGroupType.left().value().getDerivedFrom()).isEqualTo(derivedType1.getType());
}
-
+
@Test
public void updateGroupType_updateDerivedFrom_CauseEndlessRecursion() {
GroupTypeDefinition rootGroupType = createGroupTypeDef();
@@ -807,10 +818,12 @@ public class GroupTypeOperationTest extends ModelTestBase {
Either<GroupTypeDefinition, StorageOperationStatus> currGroupType = groupTypeOperation.addGroupType(derivedType1);
groupTypeOperation.addGroupType(groupType1);
- Either<GroupTypeDefinition, StorageOperationStatus> updateResult = groupTypeOperation.updateGroupType(updatedGroupType, currGroupType.left().value());
+ Either<GroupTypeDefinition, StorageOperationStatus> updateResult = groupTypeOperation.updateGroupType(updatedGroupType,
+ currGroupType.left().value());
assertThat(updateResult.right().value()).isEqualTo(StorageOperationStatus.GENERAL_ERROR);
- Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(updatedGroupType.getType(), updatedGroupType.getModel());
+ Either<GroupTypeDefinition, StorageOperationStatus> latestGroupType = groupTypeOperation.getLatestGroupTypeByType(updatedGroupType.getType(),
+ updatedGroupType.getModel());
assertThat(latestGroupType.left().value().getDerivedFrom()).isEqualTo(rootGroupType.getType());
}
@@ -827,7 +840,7 @@ public class GroupTypeOperationTest extends ModelTestBase {
.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), parentGroupId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.GroupType, GroupTypeData.class);
assertThat(derivedFromRelation.left().value().getLeft().getGroupTypeDataDefinition())
- .isEqualToComparingFieldByField(rootGroupType);
+ .isEqualToComparingFieldByField(rootGroupType);
}
private void verifyDerivedFromRelationDoesntExist(String parentGroupId) {
@@ -835,19 +848,21 @@ public class GroupTypeOperationTest extends ModelTestBase {
.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), parentGroupId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.GroupType, GroupTypeData.class);
assertThat(derivedFromRelation.right().value())
- .isEqualTo(JanusGraphOperationStatus.NOT_FOUND);
+ .isEqualTo(JanusGraphOperationStatus.NOT_FOUND);
}
private GroupTypeDefinition createGroupTypeDef() {
- return createGroupTypeDef("tosca.groups.Root", "description: The TOSCA Group Type all other TOSCA Group Types derive from", null, new PropertyDefinition[]{});
+ return createGroupTypeDef("tosca.groups.Root", "description: The TOSCA Group Type all other TOSCA Group Types derive from", null,
+ new PropertyDefinition[]{});
}
- private GroupTypeDefinition createGroupTypeDef(PropertyDefinition ... props) {
- return createGroupTypeDef("tosca.groups.Root", null, props);
+ private GroupTypeDefinition createGroupTypeDef(PropertyDefinition... props) {
+ return createGroupTypeDef("tosca.groups.Root", null, props);
}
- private GroupTypeDefinition createGroupTypeDef(String type, String derivedFrom, PropertyDefinition ... props) {
- GroupTypeDefinition groupType = createGroupTypeDef(type, "description: The TOSCA Group Type all other TOSCA Group Types derive from", derivedFrom);
+ private GroupTypeDefinition createGroupTypeDef(String type, String derivedFrom, PropertyDefinition... props) {
+ GroupTypeDefinition groupType = createGroupTypeDef(type, "description: The TOSCA Group Type all other TOSCA Group Types derive from",
+ derivedFrom);
groupType.setProperties(asList(props));
return groupType;
}
@@ -856,7 +871,7 @@ public class GroupTypeOperationTest extends ModelTestBase {
return createGroupTypeDef(type, description, derivedFrom, null);
}
- private GroupTypeDefinition createGroupTypeDef(String type, String description, String derivedFrom, PropertyDefinition ... props) {
+ private GroupTypeDefinition createGroupTypeDef(String type, String description, String derivedFrom, PropertyDefinition... props) {
GroupTypeDataDefinition groupTypeDataDefinition = new GroupTypeDataDefinition();
groupTypeDataDefinition.setDescription(description);
groupTypeDataDefinition.setType(type);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
index 1a7f1c8ba3..7ccf1f6d6b 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,18 +26,17 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
+import fj.data.Either;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
@@ -60,14 +59,11 @@ import org.openecomp.sdc.be.resources.data.OperationData;
import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
import org.openecomp.sdc.be.resources.data.UserData;
import org.openecomp.sdc.be.resources.data.category.CategoryData;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import fj.data.Either;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class InterfaceLifecycleOperationTest {
+
private static String USER_ID = "muUserId";
private static String CATEGORY_NAME = "category/mycategory";
private static String MODEL_NAME = "Test";
@@ -77,20 +73,20 @@ public class InterfaceLifecycleOperationTest {
@InjectMocks
private InterfaceLifecycleOperation interfaceLifecycleOperation = new InterfaceLifecycleOperation();
- @Before
+ @BeforeAll
+ public static void setupBeforeClass() {
+ ModelTestBase.init();
+ }
+
+ @BeforeEach
public void createUserAndCategory() {
MockitoAnnotations.initMocks(this);
CategoryData categoryData = new CategoryData(NodeTypeEnum.ResourceCategory);
- when(janusGraphGenericDao.createNode(any(),any())).thenReturn(Either.left(categoryData));
+ when(janusGraphGenericDao.createNode(any(), any())).thenReturn(Either.left(categoryData));
deleteAndCreateCategory(CATEGORY_NAME);
deleteAndCreateUser(USER_ID, "first_" + USER_ID, "last_" + USER_ID);
}
- @BeforeClass
- public static void setupBeforeClass() {
- ModelTestBase.init();
- }
-
@Test
public void testDummy() {
assertNotNull(interfaceLifecycleOperation);
@@ -125,24 +121,31 @@ public class InterfaceLifecycleOperationTest {
@Test
public void createInterfaceOnResourceTest() {
- when(janusGraphGenericDao.getChildrenNodes(any(), any(), any(), any(), eq(InterfaceData.class))).thenReturn(Either.right(JanusGraphOperationStatus.GRAPH_IS_NOT_AVAILABLE));
- when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class))).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ when(janusGraphGenericDao.getChildrenNodes(any(), any(), any(), any(), eq(InterfaceData.class))).thenReturn(
+ Either.right(JanusGraphOperationStatus.GRAPH_IS_NOT_AVAILABLE));
+ when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class))).thenReturn(
+ Either.right(JanusGraphOperationStatus.NOT_FOUND));
when(janusGraphGenericDao.getNode(any(), any(), eq(InterfaceData.class))).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
when(janusGraphGenericDao.createNode(any(), eq(InterfaceData.class))).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
- when(janusGraphGenericDao.createRelation(any(), any(), eq(GraphEdgeLabels.INTERFACE), any())).thenReturn(Either.right(JanusGraphOperationStatus.OK));
+ when(janusGraphGenericDao.createRelation(any(), any(), eq(GraphEdgeLabels.INTERFACE), any())).thenReturn(
+ Either.right(JanusGraphOperationStatus.OK));
Assert.assertTrue(interfaceLifecycleOperation.createInterfaceOnResource(buildInterfaceDefinition(), "", "", false, false).isRight());
- when(janusGraphGenericDao.createRelation(any(), any(), eq(GraphEdgeLabels.INTERFACE), any())).thenReturn(Either.left(Mockito.mock(GraphRelation.class)));
+ when(janusGraphGenericDao.createRelation(any(), any(), eq(GraphEdgeLabels.INTERFACE), any())).thenReturn(
+ Either.left(Mockito.mock(GraphRelation.class)));
Assert.assertTrue(interfaceLifecycleOperation.createInterfaceOnResource(buildInterfaceDefinition(), "", "", false, false).isRight());
}
@Test
public void getAllInterfacesOfResourceTest() {
assertTrue(interfaceLifecycleOperation.getAllInterfacesOfResource(null, true).isRight());
- when(janusGraphGenericDao.getChildrenNodes(any(), any(), any(), any(), eq(InterfaceData.class))).thenReturn(Either.right(JanusGraphOperationStatus.GRAPH_IS_NOT_AVAILABLE));
- when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class))).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ when(janusGraphGenericDao.getChildrenNodes(any(), any(), any(), any(), eq(InterfaceData.class))).thenReturn(
+ Either.right(JanusGraphOperationStatus.GRAPH_IS_NOT_AVAILABLE));
+ when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class))).thenReturn(
+ Either.right(JanusGraphOperationStatus.NOT_FOUND));
assertTrue(interfaceLifecycleOperation.getAllInterfacesOfResource("null", true).isLeft());
- when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class))).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
+ when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class))).thenReturn(
+ Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
assertTrue(interfaceLifecycleOperation.getAllInterfacesOfResource("null", true).isRight());
ResourceMetadataData key = Mockito.mock(ResourceMetadataData.class);
@@ -151,8 +154,8 @@ public class InterfaceLifecycleOperationTest {
when(key.getMetadataDataDefinition()).thenReturn(def);
ImmutablePair<ResourceMetadataData, GraphEdge> pair = new ImmutablePair<>(key, Mockito.mock(GraphEdge.class));
when(janusGraphGenericDao.getChild(any(), any(), any(), eq(NodeTypeEnum.Resource), eq(ResourceMetadataData.class)))
- .thenReturn(Either.left(pair))
- .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ .thenReturn(Either.left(pair))
+ .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
assertTrue(interfaceLifecycleOperation.getAllInterfacesOfResource("null", true).isLeft());
}
@@ -160,7 +163,8 @@ public class InterfaceLifecycleOperationTest {
public void testGetAllInterfaceLifecycleTypes_TypesNotFound() {
when(janusGraphGenericDao.getByCriteriaForModel(NodeTypeEnum.Interface, Collections.emptyMap(), StringUtils.EMPTY,
InterfaceData.class)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
- Either<Map<String, InterfaceDefinition>, StorageOperationStatus> types = interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(StringUtils.EMPTY);
+ Either<Map<String, InterfaceDefinition>, StorageOperationStatus> types = interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(
+ StringUtils.EMPTY);
Assert.assertEquals(types.isRight(), Boolean.TRUE);
}
@@ -175,15 +179,18 @@ public class InterfaceLifecycleOperationTest {
interfaceDataList.add(interfaceData);
Either<List<InterfaceData>, JanusGraphOperationStatus> allInterfaceTypes = Either.left(interfaceDataList);
when(janusGraphGenericDao
- .getByCriteriaForModel(NodeTypeEnum.Interface, Collections.emptyMap(), StringUtils.EMPTY, InterfaceData.class)).thenReturn(allInterfaceTypes);
+ .getByCriteriaForModel(NodeTypeEnum.Interface, Collections.emptyMap(), StringUtils.EMPTY, InterfaceData.class)).thenReturn(
+ allInterfaceTypes);
List<ImmutablePair<OperationData, GraphEdge>> list = new ArrayList<>();
Either<List<ImmutablePair<OperationData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = Either.left(list);
- when(janusGraphGenericDao.getChildrenNodes(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class)).thenReturn(childrenNodes);
+ when(janusGraphGenericDao.getChildrenNodes(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION,
+ NodeTypeEnum.InterfaceOperation, OperationData.class)).thenReturn(childrenNodes);
when(janusGraphGenericDao.getParentNode(any(), any(), any(), any(), any()))
- .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
- Either<Map<String, InterfaceDefinition>, StorageOperationStatus> types = interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(StringUtils.EMPTY);
- Assert.assertEquals(types.left().value().size(),1);
+ .thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ Either<Map<String, InterfaceDefinition>, StorageOperationStatus> types = interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(
+ StringUtils.EMPTY);
+ Assert.assertEquals(types.left().value().size(), 1);
}
@Test
@@ -200,10 +207,12 @@ public class InterfaceLifecycleOperationTest {
interfaceTypes.add(interfaceData);
when(janusGraphGenericDao.getParentNode(any(), any(), any(), any(), any()))
- .thenReturn(Either.left(modelNode));
+ .thenReturn(Either.left(modelNode));
when(janusGraphGenericDao
- .getByCriteriaForModel(NodeTypeEnum.Interface, Collections.emptyMap(), MODEL_NAME, InterfaceData.class)).thenReturn(Either.left(interfaceTypes));
- when(janusGraphGenericDao.getChildrenNodes(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class)).thenReturn(Either.left(Collections.emptyList()));
+ .getByCriteriaForModel(NodeTypeEnum.Interface, Collections.emptyMap(), MODEL_NAME, InterfaceData.class)).thenReturn(
+ Either.left(interfaceTypes));
+ when(janusGraphGenericDao.getChildrenNodes(interfaceData.getUniqueIdKey(), interfaceData.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION,
+ NodeTypeEnum.InterfaceOperation, OperationData.class)).thenReturn(Either.left(Collections.emptyList()));
Assert.assertEquals(1, interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(MODEL_NAME).left().value().size());
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java
index a6b2aa687a..9fd929852a 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperationTest.java
@@ -25,6 +25,8 @@ import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+
+import fj.data.Either;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;
@@ -32,10 +34,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphVertex;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
@@ -51,12 +52,9 @@ import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.PolicyTypeData;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import fj.data.Either;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class PolicyTypeOperationTest extends ModelTestBase {
private static final String NULL_STRING = null;
@@ -68,13 +66,13 @@ public class PolicyTypeOperationTest extends ModelTestBase {
@Autowired
private HealingJanusGraphGenericDao janusGraphGenericDao;
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void cleanUp() {
JanusGraphGenericDao janusGraphGenericDao = policyTypeOperation.janusGraphGenericDao;
Either<JanusGraph, JanusGraphOperationStatus> graphResult = janusGraphGenericDao.getGraph();
@@ -107,7 +105,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
@Test
public void testGetLatestPolicyTypeByType() {
PolicyTypeDefinition policyTypeCreated = policyTypeOperation.addPolicyType(createPolicyTypeDef()).left().value();
- Either<PolicyTypeDefinition, StorageOperationStatus> eitherPolicyTypeFetched = policyTypeOperation.getLatestPolicyTypeByType(policyTypeCreated.getType(), policyTypeCreated.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> eitherPolicyTypeFetched = policyTypeOperation.getLatestPolicyTypeByType(
+ policyTypeCreated.getType(), policyTypeCreated.getModel());
assertTrue(eitherPolicyTypeFetched.isLeft());
PolicyTypeDefinition policyTypeFetched = eitherPolicyTypeFetched.left().value();
assertEquals(policyTypeFetched.toString(), policyTypeCreated.toString());
@@ -118,7 +117,7 @@ public class PolicyTypeOperationTest extends ModelTestBase {
PolicyTypeDefinition policyTypeDefinition = createPolicyTypeDef();
policyTypeDefinition.setModel("testModel");
Model model = new Model("testModel", ModelTypeEnum.NORMATIVE);
- modelOperation.createModel(model , true);
+ modelOperation.createModel(model, true);
Either<PolicyTypeDefinition, StorageOperationStatus> addPolicyType = policyTypeOperation.addPolicyType(policyTypeDefinition);
assertTrue(addPolicyType.isLeft());
@@ -134,7 +133,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
String derivedFromRootType = rootPolicyType.getType();
PolicyTypeDefinition policyType1 = createPolicyTypeDef("tosca.policies.type1", "desc1", derivedFromRootType);
policyTypeOperation.addPolicyType(policyType1);
- Either<PolicyTypeDefinition, StorageOperationStatus> eitherPolicyTypeFetched = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(), policyType1.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> eitherPolicyTypeFetched = policyTypeOperation.getLatestPolicyTypeByType(
+ policyType1.getType(), policyType1.getModel());
assertThat(eitherPolicyTypeFetched.left().value().getDerivedFrom()).isEqualTo(rootPolicyType.getType());
}
@@ -145,7 +145,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
PolicyTypeDefinition policyType1 = createPolicyTypeDef("tosca.policies.type1", null, prop1, prop2);
PolicyTypeDefinition policyType2 = createPolicyTypeDef("tosca.policies.type2", "desc3", policyType1.getType(), null);
addPolicyTypesToDB(policyType1, policyType2);
- Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType2 = policyTypeOperation.getLatestPolicyTypeByType(policyType2.getType(), policyType2.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType2 = policyTypeOperation.getLatestPolicyTypeByType(policyType2.getType(),
+ policyType2.getModel());
assertThat(latestPolicyType2.isLeft()).isTrue();
assertThat(latestPolicyType2.left().value().getProperties())
.usingElementComparatorOnFields("defaultValue", "name", "type")
@@ -166,7 +167,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
addPolicyTypesToDB(rootPolicyType, policyType1, policyType2, policyType3, policyType4);
- Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType3 = policyTypeOperation.getLatestPolicyTypeByType(policyType4.getType(), policyType4.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType3 = policyTypeOperation.getLatestPolicyTypeByType(policyType4.getType(),
+ policyType4.getModel());
assertThat(latestPolicyType3.isLeft()).isTrue();
assertThat(latestPolicyType3.left().value().getProperties())
.usingElementComparatorOnFields("defaultValue", "name", "type")
@@ -220,7 +222,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
Either<PolicyTypeDefinition, StorageOperationStatus> addedPolicyTypeResult = policyTypeOperation.addPolicyType(policyType1);
assertThat(addedPolicyTypeResult.isLeft()).isTrue();
- Either<PolicyTypeDefinition, StorageOperationStatus> fetchedPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(), policyType1.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> fetchedPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(),
+ policyType1.getModel());
PolicyTypeDefinition fetchedPolicyTypeVal = fetchedPolicyType.left().value();
assertThat(fetchedPolicyTypeVal.getDerivedFrom()).isEqualTo(derivedFromRootType);
verifyDerivedFromNodeEqualsToRootPolicyType(rootPolicyType, fetchedPolicyTypeVal.getUniqueId());
@@ -245,7 +248,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
updatedType.setIcon("icon");
policyTypeOperation.updatePolicyType(updatedType, currPolicyType.left().value());
- Either<PolicyTypeDefinition, StorageOperationStatus> fetchedUpdatedType = policyTypeOperation.getLatestPolicyTypeByType(createdType.getType(), createdType.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> fetchedUpdatedType = policyTypeOperation.getLatestPolicyTypeByType(createdType.getType(),
+ createdType.getModel());
PolicyTypeDefinition fetchedPolicyType = fetchedUpdatedType.left().value();
assertThat(fetchedPolicyType.getProperties()).isEmpty();
assertThat(fetchedPolicyType)
@@ -266,7 +270,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
policyTypeOperation.updatePolicyType(updatedPolicyType, currPolicyType.left().value());
- Either<PolicyTypeDefinition, StorageOperationStatus> fetchedUpdatedType = policyTypeOperation.getLatestPolicyTypeByType(policyType.getType(), policyType.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> fetchedUpdatedType = policyTypeOperation.getLatestPolicyTypeByType(policyType.getType(),
+ policyType.getModel());
assertThat(fetchedUpdatedType.left().value().getProperties())
.usingElementComparatorOnFields("name", "defaultValue", "type")
.containsExactlyInAnyOrder(updatedProp1, prop3);
@@ -282,7 +287,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
Either<PolicyTypeDefinition, StorageOperationStatus> currPolicyType = policyTypeOperation.addPolicyType(policyType1);
policyTypeOperation.updatePolicyType(updatedPolicyType, currPolicyType.left().value());
- Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(), policyType1.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(),
+ policyType1.getModel());
assertThat(latestPolicyType.left().value().getDerivedFrom()).isEqualTo(rootPolicyType.getType());
verifyDerivedFromNodeEqualsToRootPolicyType(rootPolicyType, latestPolicyType.left().value().getUniqueId());
}
@@ -297,7 +303,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
policyTypeOperation.updatePolicyType(updatedPolicyType, currPolicyType.left().value());
- Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(), policyType1.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(),
+ policyType1.getModel());
assertThat(latestPolicyType.left().value().getDerivedFrom()).isNull();
verifyDerivedFromRelationDoesntExist(latestPolicyType.left().value().getUniqueId());
}
@@ -315,7 +322,8 @@ public class PolicyTypeOperationTest extends ModelTestBase {
policyTypeOperation.updatePolicyType(updatedPolicyType, currPolicyType.left().value());
- Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(), policyType1.getModel());
+ Either<PolicyTypeDefinition, StorageOperationStatus> latestPolicyType = policyTypeOperation.getLatestPolicyTypeByType(policyType1.getType(),
+ policyType1.getModel());
assertThat(latestPolicyType.left().value().getDerivedFrom()).isEqualTo(rootPolicyType.getType());
verifyDerivedFromNodeEqualsToRootPolicyType(rootPolicyType, latestPolicyType.left().value().getUniqueId());
}
@@ -329,14 +337,16 @@ public class PolicyTypeOperationTest extends ModelTestBase {
}
private void verifyDerivedFromNodeEqualsToRootPolicyType(PolicyTypeDefinition rootPolicyType, String parentPolicyId) {
- Either<ImmutablePair<PolicyTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<PolicyTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphGenericDao.getChild(
+ UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.PolicyType, PolicyTypeData.class);
assertThat(derivedFromRelation.left().value().getLeft().getPolicyTypeDataDefinition())
.isEqualToComparingFieldByField(rootPolicyType);
}
private void verifyDerivedFromRelationDoesntExist(String parentPolicyId) {
- Either<ImmutablePair<PolicyTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
+ Either<ImmutablePair<PolicyTypeData, GraphEdge>, JanusGraphOperationStatus> derivedFromRelation = janusGraphGenericDao.getChild(
+ UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.PolicyType), parentPolicyId, GraphEdgeLabels.DERIVED_FROM,
NodeTypeEnum.PolicyType, PolicyTypeData.class);
assertThat(derivedFromRelation.right().value())
.isEqualTo(JanusGraphOperationStatus.NOT_FOUND);
@@ -350,15 +360,17 @@ public class PolicyTypeOperationTest extends ModelTestBase {
}
private PolicyTypeDefinition createPolicyTypeDef() {
- return createPolicyTypeDef("tosca.policies.Root", "description: The TOSCA Policy Type all other TOSCA Policy Types derive from", null, new PropertyDefinition[]{});
+ return createPolicyTypeDef("tosca.policies.Root", "description: The TOSCA Policy Type all other TOSCA Policy Types derive from", null,
+ new PropertyDefinition[]{});
}
- private PolicyTypeDefinition createPolicyTypeDef(PropertyDefinition ... props) {
- return createPolicyTypeDef("tosca.policies.Root", null, props);
+ private PolicyTypeDefinition createPolicyTypeDef(PropertyDefinition... props) {
+ return createPolicyTypeDef("tosca.policies.Root", null, props);
}
- private PolicyTypeDefinition createPolicyTypeDef(String type, String derivedFrom, PropertyDefinition ... props) {
- PolicyTypeDefinition policyType = createPolicyTypeDef(type, "description: The TOSCA Policy Type all other TOSCA Policy Types derive from", derivedFrom);
+ private PolicyTypeDefinition createPolicyTypeDef(String type, String derivedFrom, PropertyDefinition... props) {
+ PolicyTypeDefinition policyType = createPolicyTypeDef(type, "description: The TOSCA Policy Type all other TOSCA Policy Types derive from",
+ derivedFrom);
policyType.setProperties(asList(props));
return policyType;
}
@@ -367,7 +379,7 @@ public class PolicyTypeOperationTest extends ModelTestBase {
return createPolicyTypeDef(type, description, derivedFrom, null);
}
- private PolicyTypeDefinition createPolicyTypeDef(String type, String description, String derivedFrom, PropertyDefinition ... props) {
+ private PolicyTypeDefinition createPolicyTypeDef(String type, String description, String derivedFrom, PropertyDefinition... props) {
PolicyTypeDataDefinition policyTypeDataDefinition = new PolicyTypeDataDefinition();
policyTypeDataDefinition.setDescription(description);
policyTypeDataDefinition.setType(type);
@@ -383,7 +395,7 @@ public class PolicyTypeOperationTest extends ModelTestBase {
return policyTypeDefinition;
}
- private void addPolicyTypesToDB(PolicyTypeDefinition ... policyTypeDefinitions) {
+ private void addPolicyTypesToDB(PolicyTypeDefinition... policyTypeDefinitions) {
Stream.of(policyTypeDefinitions).forEach(policyTypeOperation::addPolicyType);
}
} \ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
index 371c3edfe5..ee3ea9e026 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
@@ -24,21 +24,18 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import fj.data.Either;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
-import fj.data.Either;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -64,11 +61,9 @@ import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint;
import org.openecomp.sdc.be.resources.data.ModelData;
import org.openecomp.sdc.be.resources.data.RelationshipTypeData;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class RelationshipTypeOperationTest extends ModelTestBase {
private static final String PROP = "prop";
@@ -98,12 +93,12 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
relationshipTypeDefinition.setUniqueId("tosca.relationships.Container1");
}
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() {
ModelTestBase.init();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
@@ -119,18 +114,17 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@Test
public void testAddRelationshipTypeValidationFailStatusNullInTransactionFalse() {
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED))
- .when(propertyOperation)
- .getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
-
+ .when(propertyOperation)
+ .getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition)))
- .when(janusGraphGenericDao).getNode(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
-
- Mockito.doReturn(Either.left(Collections.singletonMap("derivedFromProp1", new PropertyDefinition()))).when(propertyOperation)
- .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
+ .when(janusGraphGenericDao).getNode(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doReturn(Either.left(Collections.singletonMap("derivedFromProp1", new PropertyDefinition()))).when(propertyOperation)
+ .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
Either<RelationshipTypeDefinition, StorageOperationStatus> addRelationshipType =
- relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, false);
+ relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, false);
assertTrue(addRelationshipType.isRight());
}
@@ -138,18 +132,18 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@Test
public void testAddRelationshipTypeValidationFailStatusPropertiesReturnedInTransactionFalse() {
Mockito.doReturn(Either.left(Collections.singletonMap("prop1", new PropertyDefinition()))).when(propertyOperation)
- .getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
+ .getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(propertyOperation)
- .validatePropertiesUniqueness(Mockito.any(), Mockito.any());
-
+ .validatePropertiesUniqueness(Mockito.any(), Mockito.any());
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition)))
- .when(janusGraphGenericDao).getNode(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
-
+ .when(janusGraphGenericDao).getNode(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+
Mockito.doReturn(Either.left(Collections.singletonMap("derivedFromProp1", new PropertyDefinition()))).when(propertyOperation)
- .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
+ .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
Either<RelationshipTypeDefinition, StorageOperationStatus> addRelationshipType =
- relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, false);
+ relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, false);
assertTrue(addRelationshipType.isRight());
}
@@ -158,7 +152,7 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
public void testGetAllRelationshipTypesNotFound() {
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(
janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
- RelationshipTypeData.class);
+ RelationshipTypeData.class);
Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes(null);
assertTrue(either.isLeft() && MapUtils.isEmpty(either.left().value()));
@@ -168,7 +162,7 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
public void testGetAllRelationshipTypesNotConnnected() {
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED)).when(
janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
- RelationshipTypeData.class);
+ RelationshipTypeData.class);
Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes(null);
assertTrue(either.isRight() && JanusGraphOperationStatus.NOT_CONNECTED == either.right().value());
@@ -187,33 +181,33 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
relationshipTypeDataList.add(relationshipTypeData1);
Mockito.doReturn(Either.left(relationshipTypeDataList))
- .when(janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
+ .when(janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
RelationshipTypeData.class);
Mockito.doReturn(Either.left(relationshipTypeData1)).when(janusGraphGenericDao)
- .getNode(Mockito.anyString(), Mockito.anyString(), Mockito.eq(RelationshipTypeData.class));
+ .getNode(Mockito.anyString(), Mockito.anyString(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(createPropertyData("prop1"))).when(propertyOperation)
- .findPropertiesOfNode(NodeTypeEnum.RelationshipType, "tosca.relationships.Root1");
+ .findPropertiesOfNode(NodeTypeEnum.RelationshipType, "tosca.relationships.Root1");
RelationshipInstDataDefinition derivedFromRelationshipTypeDefinition = new RelationshipInstDataDefinition();
derivedFromRelationshipTypeDefinition.setUniqueId("tosca.relationships.Root1");
derivedFromRelationshipTypeDefinition.setType("tosca.relationships.Parent");
Mockito.doReturn(Either.left(new RelationshipTypeData(derivedFromRelationshipTypeDefinition)))
- .when(derivedFromOperation)
- .getDerivedFromChild("tosca.relationships.Root1", NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
+ .when(derivedFromOperation)
+ .getDerivedFromChild("tosca.relationships.Root1", NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either =
- relationshipTypeOperation.getAllRelationshipTypes(null);
+ relationshipTypeOperation.getAllRelationshipTypes(null);
assertTrue(either.isLeft());
RelationshipTypeDefinition relationshipTypeDefinition = either.left().value().get("tosca.relationships.Root1");
assertEquals("tosca.relationships.Parent", relationshipTypeDefinition.getDerivedFrom());
-
+
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND))
.when(janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, "modelA",
- RelationshipTypeData.class);
+ RelationshipTypeData.class);
either = relationshipTypeOperation.getAllRelationshipTypes("modelA");
assertTrue(either.isLeft());
assertTrue(MapUtils.isEmpty(either.left().value()));
@@ -241,11 +235,11 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
relationshipTypeDefinition.setProperties(properties);
Either<RelationshipTypeDefinition, StorageOperationStatus> addRelationshipType1 =
- relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, true);
+ relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, true);
RelationshipTypeDefinition relationshipTypeDefinitionCreated = addRelationshipType1.left().value();
Either<RelationshipTypeDefinition, StorageOperationStatus> relationshipType =
- relationshipTypeOperation.getRelationshipType(relationshipTypeDefinitionCreated.getUniqueId(), true);
+ relationshipTypeOperation.getRelationshipType(relationshipTypeDefinitionCreated.getUniqueId(), true);
assertTrue("check relationship type fetched", relationshipType.isLeft());
RelationshipTypeDefinition fetchedCTD = relationshipType.left().value();
@@ -260,7 +254,7 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
private void compareProperties(Map<String, PropertyDefinition> first, Map<String, PropertyDefinition> second) {
assertTrue("check properties are full or empty",
- ((first == null && second == null) || (first != null && second != null)));
+ ((first == null && second == null) || (first != null && second != null)));
if (first != null) {
assertEquals("check properties size", first.size(), second.size());
@@ -282,11 +276,11 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
private void comparePropertyDefinition(PropertyDefinition first, PropertyDefinition second) {
assertTrue("check objects are full or empty",
- ((first == null && second == null) || (first != null && second != null)));
+ ((first == null && second == null) || (first != null && second != null)));
if (first != null) {
assertTrue("check property description", compareValue(first.getDescription(), second.getDescription()));
assertTrue("check property default value", compareValue((String) first.getDefaultValue(),
- (String) second.getDefaultValue()));
+ (String) second.getDefaultValue()));
assertTrue("check property type", compareValue(first.getType(), second.getType()));
compareList(first.getConstraints(), second.getConstraints());
}
@@ -296,7 +290,7 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
private void compareList(List<PropertyConstraint> first, List<PropertyConstraint> second) {
assertTrue("check lists are full or empty",
- ((first == null && second == null) || (first != null && second != null)));
+ ((first == null && second == null) || (first != null && second != null)));
if (first != null) {
assertEquals("check list size", first.size(), second.size());
}
@@ -321,7 +315,7 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
PropertyDefinition property1 = new PropertyDefinition();
property1.setDefaultValue("10");
property1.setDescription("Size of the local disk, in Gigabytes (GB), "
- + "available to applications running on the Compute node.");
+ + "available to applications running on the Compute node.");
property1.setType(ToscaType.INTEGER.name().toLowerCase());
List<PropertyConstraint> constraints = new ArrayList<>();
GreaterThanConstraint propertyConstraint1 = new GreaterThanConstraint("0");
@@ -362,55 +356,53 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
RelationshipTypeDefinition relationshipTypeDefinition = new RelationshipTypeDefinition(relationshipTypeData);
relationshipTypeDefinition.setProperties(createPropertyData("prop1"));
relationshipTypeDefinition.setDerivedFrom("tosca.relationships.Root");
-
-
Mockito.doReturn(Either.left(Collections.singletonMap("prop1", new PropertyDefinition()))).when(propertyOperation)
- .getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
+ .getAllTypePropertiesFromAllDerivedFrom(Mockito.anyString(), Mockito.any(), Mockito.any());
Mockito.doReturn(Either.left(new ArrayList<>(relationshipTypeDefinition.getProperties().values()))).when(propertyOperation)
- .validatePropertiesUniqueness(Mockito.any(), Mockito.any());
+ .validatePropertiesUniqueness(Mockito.any(), Mockito.any());
Mockito.doReturn(Either.left(relationshipTypeData)).when(janusGraphGenericDao)
- .createNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
-
+ .createNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
+
Mockito.doReturn(Either.left(new HashMap())).when(propertyOperation)
- .addPropertiesToElementType(Mockito.anyString(), Mockito.any(), Mockito.anyMap());
+ .addPropertiesToElementType(Mockito.anyString(), Mockito.any(), Mockito.anyMap());
Mockito.doReturn(Either.left(relationshipTypeDefinition))
- .when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
+ .when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
Mockito.doReturn(Either.left(new GraphRelation()))
- .when(derivedFromOperation)
- .addDerivedFromRelation(Mockito.anyString(), Mockito.anyString(), Mockito.any());
+ .when(derivedFromOperation)
+ .addDerivedFromRelation(Mockito.anyString(), Mockito.anyString(), Mockito.any());
Mockito.doReturn(Either.left(relationshipTypeDefinition))
- .when(relationshipTypeOperation).getRelationshipType(Mockito.anyString(), Mockito.anyBoolean());
+ .when(relationshipTypeOperation).getRelationshipType(Mockito.anyString(), Mockito.anyBoolean());
Mockito.doReturn(Either.left(Collections.singletonMap("derivedFromProp1", new PropertyDefinition()))).when(propertyOperation)
- .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
-
+ .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
+
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(janusGraphGenericDao)
- .getChild(Mockito.any(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
-
+ .getChild(Mockito.any(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition)))
- .when(janusGraphGenericDao).getNode(Mockito.anyString(), Mockito.any(), Mockito.eq(RelationshipTypeData.class), Mockito.any());
-
-
+ .when(janusGraphGenericDao).getNode(Mockito.anyString(), Mockito.any(), Mockito.eq(RelationshipTypeData.class), Mockito.any());
+
ModelData modelData = new ModelData("modelA", "modelA", ModelTypeEnum.NORMATIVE);
ImmutablePair<ModelData, GraphEdge> pair = new ImmutablePair<>(modelData, new GraphEdge());
Mockito.doReturn(Either.left(pair))
- .when(janusGraphGenericDao).getParentNode("uid", relationshipInstDataDefinition1.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
-
+ .when(janusGraphGenericDao)
+ .getParentNode("uid", relationshipInstDataDefinition1.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
+
Either<RelationshipTypeDefinition, StorageOperationStatus> either =
- relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, true);
+ relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, true);
assertTrue(either.isLeft());
}
-
+
@Test
public void testAddRelationshipTypeToModel() {
-
+
final String relationshipName = "tosca.relationships.MyRelationship";
final String derivedFromRelationshipName = "tosca.relationships.Root";
final String modelName = "modelA";
@@ -421,66 +413,72 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
relationshipTypeDefinition.setType(relationshipName);
relationshipTypeDefinition.setModel(modelName);
relationshipTypeDefinition.setDerivedFrom(derivedFromRelationshipName);
-
+
RelationshipTypeData derivedFromRelationshipTypeData = new RelationshipTypeData();
RelationshipInstDataDefinition dervideFromRelationshipInstDataDefinition = new RelationshipInstDataDefinition();
dervideFromRelationshipInstDataDefinition.setUniqueId("modelA.tosca.relationships.Root");
dervideFromRelationshipInstDataDefinition.setType("tosca.relationships.Root");
derivedFromRelationshipTypeData.setRelationshipTypeDataDefinition(dervideFromRelationshipInstDataDefinition);
-
+
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND))
- .when(janusGraphGenericDao).getNode("uid", relationshipTypeDefinition.getUniqueId(), RelationshipTypeData.class);
-
+ .when(janusGraphGenericDao).getNode("uid", relationshipTypeDefinition.getUniqueId(), RelationshipTypeData.class);
+
Mockito.doReturn(Either.left(derivedFromRelationshipTypeData))
- .when(janusGraphGenericDao).getNode("type", "tosca.relationships.Root", RelationshipTypeData.class, "modelA");
-
+ .when(janusGraphGenericDao).getNode("type", "tosca.relationships.Root", RelationshipTypeData.class, "modelA");
+
Mockito.doReturn(Either.left(Collections.singletonMap("prop1", new PropertyDefinition()))).when(propertyOperation)
- .getAllTypePropertiesFromAllDerivedFrom(modelName + DOT + derivedFromRelationshipName, NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
-
+ .getAllTypePropertiesFromAllDerivedFrom(modelName + DOT + derivedFromRelationshipName, NodeTypeEnum.RelationshipType,
+ RelationshipTypeData.class);
+
Mockito.doReturn(Either.left(new ArrayList<>(relationshipTypeDefinition.getProperties().values()))).when(propertyOperation)
- .validatePropertiesUniqueness(Mockito.any(), Mockito.any());
-
+ .validatePropertiesUniqueness(Mockito.any(), Mockito.any());
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition))).when(janusGraphGenericDao)
- .createNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
-
+ .createNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
+
Mockito.doReturn(Either.left(new HashMap())).when(propertyOperation)
- .addPropertiesToElementType(Mockito.anyString(), Mockito.any(), Mockito.anyMap());
-
+ .addPropertiesToElementType(Mockito.anyString(), Mockito.any(), Mockito.anyMap());
+
Mockito.doReturn(Either.left(new GraphRelation())).when(janusGraphGenericDao)
- .createRelation(Mockito.any(), Mockito.any(), Mockito.eq(GraphEdgeLabels.MODEL_ELEMENT), Mockito.any());
-
+ .createRelation(Mockito.any(), Mockito.any(), Mockito.eq(GraphEdgeLabels.MODEL_ELEMENT), Mockito.any());
+
Mockito.doReturn(Either.left(Collections.singletonMap("derivedFromProp1", new PropertyDefinition()))).when(propertyOperation)
- .findPropertiesOfNode(NodeTypeEnum.RelationshipType, derivedFromRelationshipTypeData.getUniqueId());
-
+ .findPropertiesOfNode(NodeTypeEnum.RelationshipType, derivedFromRelationshipTypeData.getUniqueId());
+
Mockito.doReturn(Either.left(Collections.singletonMap("prop1", new PropertyDefinition()))).when(propertyOperation)
- .findPropertiesOfNode(NodeTypeEnum.RelationshipType, relationshipTypeDefinition.getUniqueId());
-
+ .findPropertiesOfNode(NodeTypeEnum.RelationshipType, relationshipTypeDefinition.getUniqueId());
+
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(janusGraphGenericDao)
- .getChild("uid", derivedFromRelationshipTypeData.getUniqueId(), GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
-
+ .getChild("uid", derivedFromRelationshipTypeData.getUniqueId(), GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.RelationshipType,
+ RelationshipTypeData.class);
+
Mockito.doReturn(Either.left(new ImmutablePair(new RelationshipTypeData(relationshipTypeDefinition), null))).when(janusGraphGenericDao)
- .getChild("uid", relationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
-
-
+ .getChild("uid", relationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.RelationshipType,
+ RelationshipTypeData.class);
+
Mockito.doReturn(Either.left(new GraphRelation())).when(derivedFromOperation)
- .addDerivedFromRelation(relationshipTypeDefinition.getUniqueId(), derivedFromRelationshipTypeData.getUniqueId(), NodeTypeEnum.RelationshipType);
-
+ .addDerivedFromRelation(relationshipTypeDefinition.getUniqueId(), derivedFromRelationshipTypeData.getUniqueId(),
+ NodeTypeEnum.RelationshipType);
+
ModelData modelData = new ModelData("modelA", "modelA", ModelTypeEnum.NORMATIVE);
ImmutablePair<ModelData, GraphEdge> pair = new ImmutablePair<>(modelData, new GraphEdge());
Mockito.doReturn(Either.left(pair))
- .when(janusGraphGenericDao).getParentNode("uid", dervideFromRelationshipInstDataDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
-
+ .when(janusGraphGenericDao)
+ .getParentNode("uid", dervideFromRelationshipInstDataDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model,
+ ModelData.class);
+
Mockito.doReturn(Either.left(pair))
- .when(janusGraphGenericDao).getParentNode("uid", relationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
-
+ .when(janusGraphGenericDao)
+ .getParentNode("uid", relationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition)))
- .when(janusGraphGenericDao).getNode("uid", relationshipTypeDefinition.getUniqueId(), RelationshipTypeData.class);
-
+ .when(janusGraphGenericDao).getNode("uid", relationshipTypeDefinition.getUniqueId(), RelationshipTypeData.class);
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition)))
- .when(janusGraphGenericDao).getNode("type", relationshipTypeDefinition.getUniqueId(), RelationshipTypeData.class, "modelA");
-
+ .when(janusGraphGenericDao).getNode("type", relationshipTypeDefinition.getUniqueId(), RelationshipTypeData.class, "modelA");
+
Either<RelationshipTypeDefinition, StorageOperationStatus> either =
- relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, true);
+ relationshipTypeOperation.addRelationshipType(relationshipTypeDefinition, true);
assertTrue(either.isLeft());
}
@@ -488,10 +486,10 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@Test
public void testGetRelationshipTypeNotConnected() {
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED))
- .when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
+ .when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
Either<RelationshipTypeDefinition, StorageOperationStatus> either =
- relationshipTypeOperation.getRelationshipType(Mockito.anyString(), Mockito.anyBoolean());
+ relationshipTypeOperation.getRelationshipType(Mockito.anyString(), Mockito.anyBoolean());
assertTrue(either.isRight());
}
@@ -499,10 +497,10 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@Test
public void testGetRelationshipTypeSuccess() {
Mockito.doReturn(Either.left(relationshipTypeDefinition))
- .when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
+ .when(relationshipTypeOperation).getRelationshipTypeByUid(Mockito.anyString());
Either<RelationshipTypeDefinition, StorageOperationStatus> either =
- relationshipTypeOperation.getRelationshipType(Mockito.anyString(), Mockito.anyBoolean());
+ relationshipTypeOperation.getRelationshipType(Mockito.anyString(), Mockito.anyBoolean());
assertTrue(either.isLeft());
}
@@ -517,42 +515,43 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
newRelationshipTypeDefinition.setProperties(createPropertyData("prop1"));
Mockito.doReturn(Either.left(new RelationshipTypeData(newRelationshipTypeDefinition))).when(
- janusGraphGenericDao)
- .updateNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
+ janusGraphGenericDao)
+ .updateNode(Mockito.any(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(newRelationshipTypeDefinition.getProperties()))
- .when(propertyOperation).deletePropertiesAssociatedToNode(Mockito.any(), Mockito.anyString());
+ .when(propertyOperation).deletePropertiesAssociatedToNode(Mockito.any(), Mockito.anyString());
Mockito.doReturn(Either.left(newRelationshipTypeDefinition.getProperties()))
- .when(propertyOperation).addPropertiesToElementType(Mockito.anyString(), Mockito.any(), Mockito.anyMap());
+ .when(propertyOperation).addPropertiesToElementType(Mockito.anyString(), Mockito.any(), Mockito.anyMap());
Mockito.doReturn(Either.left(newRelationshipTypeDefinition)).when(relationshipTypeOperation)
- .getRelationshipTypeByUid(Mockito.anyString());
+ .getRelationshipTypeByUid(Mockito.anyString());
Mockito.doReturn(StorageOperationStatus.OK).when(derivedFromOperation)
- .removeDerivedFromRelation(Mockito.anyString(), Mockito.anyString(), Mockito.any());
+ .removeDerivedFromRelation(Mockito.anyString(), Mockito.anyString(), Mockito.any());
Mockito.doReturn(Either.left(new GraphRelation()))
- .when(derivedFromOperation)
- .addDerivedFromRelation(Mockito.anyString(), Mockito.anyString(), Mockito.any());
-
+ .when(derivedFromOperation)
+ .addDerivedFromRelation(Mockito.anyString(), Mockito.anyString(), Mockito.any());
+
Mockito.doReturn(Either.left(new RelationshipTypeData(relationshipTypeDefinition)))
- .when(janusGraphGenericDao).getNode(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
-
+ .when(janusGraphGenericDao).getNode(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+
Mockito.doReturn(Either.left(Collections.singletonMap("derivedFromProp1", new PropertyDefinition()))).when(propertyOperation)
- .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
-
+ .findPropertiesOfNode(Mockito.any(), Mockito.anyString());
+
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(janusGraphGenericDao)
- .getChild(Mockito.any(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
-
+ .getChild(Mockito.any(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
+
ModelData modelData = new ModelData("modelA", "modelA", ModelTypeEnum.NORMATIVE);
ImmutablePair<ModelData, GraphEdge> pair = new ImmutablePair<>(modelData, new GraphEdge());
Mockito.doReturn(Either.left(pair))
- .when(janusGraphGenericDao).getParentNode("uid", newRelationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
+ .when(janusGraphGenericDao)
+ .getParentNode("uid", newRelationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
Either<RelationshipTypeDefinition, StorageOperationStatus> either =
- relationshipTypeOperation.updateRelationshipType(relationshipTypeDefinition,
- newRelationshipTypeDefinition, false);
+ relationshipTypeOperation.updateRelationshipType(relationshipTypeDefinition,
+ newRelationshipTypeDefinition, false);
assertTrue(either.isLeft());
}
@@ -562,29 +561,30 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
RelationshipTypeData relationshipTypeData = new RelationshipTypeData(relationshipTypeDefinition);
Mockito.doReturn(Either.left(relationshipTypeData)).when(janusGraphGenericDao)
- .getNode(Mockito.anyString(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
+ .getNode(Mockito.anyString(), Mockito.any(), Mockito.eq(RelationshipTypeData.class));
Mockito.doReturn(Either.left(relationshipTypeDefinition.getProperties()))
- .when(propertyOperation).findPropertiesOfNode(Mockito.any(), Mockito.anyString());
+ .when(propertyOperation).findPropertiesOfNode(Mockito.any(), Mockito.anyString());
RelationshipTypeDefinition childRelationshipTypeDefinition = new RelationshipTypeDefinition();
childRelationshipTypeDefinition.setType("tosca.relationships.ContainerChild");
Mockito.doReturn(Either.left(new ImmutablePair(new RelationshipTypeData(childRelationshipTypeDefinition), null))).when(
- janusGraphGenericDao)
- .getChild(Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any(),
- Mockito.eq(RelationshipTypeData.class));
-
+ janusGraphGenericDao)
+ .getChild(Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any(),
+ Mockito.eq(RelationshipTypeData.class));
+
ModelData modelData = new ModelData("modelA", "modelA", ModelTypeEnum.NORMATIVE);
ImmutablePair<ModelData, GraphEdge> pair = new ImmutablePair<>(modelData, new GraphEdge());
Mockito.doReturn(Either.left(pair))
- .when(janusGraphGenericDao).getParentNode("uid", relationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
+ .when(janusGraphGenericDao)
+ .getParentNode("uid", relationshipTypeDefinition.getUniqueId(), GraphEdgeLabels.MODEL_ELEMENT, NodeTypeEnum.Model, ModelData.class);
Either<RelationshipTypeDefinition, JanusGraphOperationStatus> either =
- relationshipTypeOperation.getRelationshipTypeByUid("tosca.relationships.Container1");
+ relationshipTypeOperation.getRelationshipTypeByUid("tosca.relationships.Container1");
assertTrue(either.isLeft()
- && "tosca.relationships.ContainerChild".equals(either.left().value().getDerivedFrom()));
+ && "tosca.relationships.ContainerChild".equals(either.left().value().getDerivedFrom()));
}
private Map<String, PropertyDefinition> createPropertyData(String value) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
index 4817f7a1c4..abb5a1888b 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
@@ -37,13 +37,12 @@ import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.io.IoCore;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphVertex;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
@@ -74,44 +73,36 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycl
import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.util.ValidationUtils;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("classpath:application-context-test.xml")
+@SpringJUnitConfig(locations = "classpath:application-context-test.xml")
public class ToscaElementLifecycleOperationTest extends ModelTestBase {
+ @Rule
+ public TestName name = new TestName();
@javax.annotation.Resource
protected JanusGraphDao janusGraphDao;
-
+ String categoryName = "category";
+ String subcategory = "mycategory";
+ String outputDirectory = "C:\\Output";
@javax.annotation.Resource
private NodeTypeOperation nodeTypeOperation;
-
@javax.annotation.Resource
private TopologyTemplateOperation topologyTemplateOperation;
-
@javax.annotation.Resource
private ToscaElementLifecycleOperation lifecycleOperation;
-
- String categoryName = "category";
- String subcategory = "mycategory";
- String outputDirectory = "C:\\Output";
-
- @Rule
- public TestName name = new TestName();
-
- @BeforeClass
- public static void initLifecycleOperation() {
- ModelTestBase.init();
- }
-
private GraphVertex ownerVertex;
private GraphVertex modifierVertex;
private GraphVertex vfVertex;
private GraphVertex serviceVertex;
private GraphVertex rootVertex;
- @Before
+ @BeforeAll
+ public static void initLifecycleOperation() {
+ ModelTestBase.init();
+ }
+
+ @BeforeEach
public void setupBefore() {
clearGraph();
createUsers();
@@ -125,8 +116,10 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
@Test
public void lifecycleTest() {
- Either<ToscaElement, StorageOperationStatus> res = lifecycleOperation.checkinToscaELement(LifecycleStateEnum.findState((String) vfVertex.getMetadataProperty(GraphPropertyEnum.STATE)), vfVertex.getUniqueId(), modifierVertex.getUniqueId(),
- ownerVertex.getUniqueId());
+ Either<ToscaElement, StorageOperationStatus> res = lifecycleOperation.checkinToscaELement(
+ LifecycleStateEnum.findState((String) vfVertex.getMetadataProperty(GraphPropertyEnum.STATE)), vfVertex.getUniqueId(),
+ modifierVertex.getUniqueId(),
+ ownerVertex.getUniqueId());
StorageOperationStatus status;
assertTrue(res.isLeft());
@@ -147,7 +140,8 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
prop55.setName("prop55");
prop55.setDefaultValue("def55");
- status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop55, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop55,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
CapabilityDataDefinition cap1 = new CapabilityDataDefinition();
@@ -155,10 +149,12 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
cap1.setDescription("create");
cap1.setUniqueId(UniqueIdBuilder.buildCapabilityUid(id, "cap1"));
- status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.CAPABILITIES, VertexTypeEnum.CAPABILITIES, cap1, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.CAPABILITIES, VertexTypeEnum.CAPABILITIES, cap1,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
- res = lifecycleOperation.checkinToscaELement(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, id, ownerVertex.getUniqueId(), ownerVertex.getUniqueId());
+ res = lifecycleOperation.checkinToscaELement(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, id, ownerVertex.getUniqueId(),
+ ownerVertex.getUniqueId());
assertTrue(res.isLeft());
id = res.left().value().getUniqueId();
@@ -167,19 +163,22 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
id = res.left().value().getUniqueId();
prop55.setDefaultValue("AAAAAAAA");
- status = nodeTypeOperation.updateToscaDataOfToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop55, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.updateToscaDataOfToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop55,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
cap1.setDescription("update");
- status = nodeTypeOperation.updateToscaDataOfToscaElement(id, EdgeLabelEnum.CAPABILITIES, VertexTypeEnum.CAPABILITIES, cap1, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.updateToscaDataOfToscaElement(id, EdgeLabelEnum.CAPABILITIES, VertexTypeEnum.CAPABILITIES, cap1,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
PropertyDataDefinition prop66 = new PropertyDataDefinition();
prop66.setName("prop66");
prop66.setDefaultValue("def66");
- status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop66, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop66,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
res = lifecycleOperation.certifyToscaElement(id, modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
@@ -198,10 +197,12 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
prop77.setName("prop77");
prop77.setDefaultValue("def77");
- status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop77, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop77,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
- res = lifecycleOperation.checkinToscaELement(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, id, ownerVertex.getUniqueId(), ownerVertex.getUniqueId());
+ res = lifecycleOperation.checkinToscaELement(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, id, ownerVertex.getUniqueId(),
+ ownerVertex.getUniqueId());
assertTrue(res.isLeft());
id = res.left().value().getUniqueId();
@@ -213,7 +214,8 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
prop88.setName("prop88");
prop88.setDefaultValue("def88");
- status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop88, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop88,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
res = lifecycleOperation.certifyToscaElement(id, modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
@@ -231,10 +233,12 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
prop99.setName("prop99");
prop99.setDefaultValue("def99");
- status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop99, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop99,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
- status = nodeTypeOperation.deleteToscaDataElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, "prop99", JsonPresentationFields.NAME);
+ status = nodeTypeOperation.deleteToscaDataElement(id, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, "prop99",
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
verifyInCatalogData(4, null);
@@ -242,8 +246,9 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
@Test
public void serviceConformanceLevelTest() {
- Either<ToscaElement, StorageOperationStatus> res = lifecycleOperation.checkinToscaELement(LifecycleStateEnum.findState((String) serviceVertex.getMetadataProperty(GraphPropertyEnum.STATE)), serviceVertex.getUniqueId(),
- modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
+ Either<ToscaElement, StorageOperationStatus> res = lifecycleOperation.checkinToscaELement(
+ LifecycleStateEnum.findState((String) serviceVertex.getMetadataProperty(GraphPropertyEnum.STATE)), serviceVertex.getUniqueId(),
+ modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
assertTrue(res.isLeft());
String id = res.left().value().getUniqueId();
@@ -277,22 +282,25 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
expectedIds.add(vertex4.getUniqueId());
verifyInCatalogData(4, expectedIds);
- lifecycleOperation.checkinToscaELement(LifecycleStateEnum.findState((String) vertex4.getMetadataProperty(GraphPropertyEnum.STATE)), vertex4.getUniqueId(), modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
- Either<ToscaElement, StorageOperationStatus> certifyToscaElement = lifecycleOperation.certifyToscaElement(vertex4.getUniqueId(), modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
+ lifecycleOperation.checkinToscaELement(LifecycleStateEnum.findState((String) vertex4.getMetadataProperty(GraphPropertyEnum.STATE)),
+ vertex4.getUniqueId(), modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
+ Either<ToscaElement, StorageOperationStatus> certifyToscaElement = lifecycleOperation.certifyToscaElement(vertex4.getUniqueId(),
+ modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
assertTrue(certifyToscaElement.isLeft());
expectedIds.remove(vertex4.getUniqueId());
String certifiedId = certifyToscaElement.left().value().getUniqueId();
expectedIds.add(certifiedId);
verifyInCatalogData(4, expectedIds);
- Either<ToscaElement, StorageOperationStatus> res = lifecycleOperation.checkoutToscaElement(certifiedId, modifierVertex.getUniqueId(), ownerVertex.getUniqueId());
+ Either<ToscaElement, StorageOperationStatus> res = lifecycleOperation.checkoutToscaElement(certifiedId, modifierVertex.getUniqueId(),
+ ownerVertex.getUniqueId());
assertTrue(certifyToscaElement.isLeft());
expectedIds.add(res.left().value().getUniqueId());
verifyInCatalogData(5, expectedIds);
}
@Test
- public void testGetToscaElOwner_Fail(){
+ public void testGetToscaElOwner_Fail() {
Either<User, StorageOperationStatus> result;
String toscaEleId = "toscaElementId";
janusGraphDao.getVertexById(toscaEleId, JsonParseFlagEnum.NoParse);
@@ -453,21 +461,24 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
prop22.setDefaultValue("def22");
addProperties.add(prop22);
- StorageOperationStatus status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, addProperties, JsonPresentationFields.NAME);
+ StorageOperationStatus status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES,
+ addProperties, JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
PropertyDataDefinition prop33 = new PropertyDataDefinition();
prop33.setName("prop33");
prop33.setDefaultValue("def33");
- status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop33, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex, EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop33,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
PropertyDataDefinition prop44 = new PropertyDataDefinition();
prop44.setName("prop44");
prop44.setDefaultValue("def44");
- status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop44, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.addToscaDataToToscaElement(vfVertex.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, prop44,
+ JsonPresentationFields.NAME);
assertSame(status, StorageOperationStatus.OK);
PropertyDataDefinition capProp = new PropertyDataDefinition();
@@ -480,14 +491,16 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
Map<String, MapDataDefinition> capProps = new HashMap();
capProps.put("capName", dataToCreate);
- Either<GraphVertex, StorageOperationStatus> res = nodeTypeOperation.associateElementToData(vfVertex, VertexTypeEnum.CAPABILITIES_PROPERTIES, EdgeLabelEnum.CAPABILITIES_PROPERTIES, capProps);
+ Either<GraphVertex, StorageOperationStatus> res = nodeTypeOperation.associateElementToData(vfVertex, VertexTypeEnum.CAPABILITIES_PROPERTIES,
+ EdgeLabelEnum.CAPABILITIES_PROPERTIES, capProps);
// exportGraphMl(janusGraphDao.getGraph().left().value());
List<String> pathKeys = new ArrayList<>();
pathKeys.add("capName");
capProp.setDefaultValue("BBBB");
- status = nodeTypeOperation.updateToscaDataDeepElementOfToscaElement(vfVertex, EdgeLabelEnum.CAPABILITIES_PROPERTIES, VertexTypeEnum.CAPABILITIES_PROPERTIES, capProp, pathKeys, JsonPresentationFields.NAME);
+ status = nodeTypeOperation.updateToscaDataDeepElementOfToscaElement(vfVertex, EdgeLabelEnum.CAPABILITIES_PROPERTIES,
+ VertexTypeEnum.CAPABILITIES_PROPERTIES, capProp, pathKeys, JsonPresentationFields.NAME);
return vf;
}
@@ -587,7 +600,7 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
public void verifyInCatalogData(int expected, List<String> expectedIds) {
- Either<List<CatalogComponent>, StorageOperationStatus> highestResourcesRes = topologyTemplateOperation.getElementCatalogData(true, null);
+ Either<List<CatalogComponent>, StorageOperationStatus> highestResourcesRes = topologyTemplateOperation.getElementCatalogData(true, null);
assertTrue(highestResourcesRes.isLeft());
List<CatalogComponent> highestResources = highestResourcesRes.left().value();
// calculate expected count value
@@ -597,7 +610,7 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
}
}
- @After
+ @AfterEach
public void teardown() {
clearGraph();
}
diff --git a/onboarding/pom.xml b/onboarding/pom.xml
index cf8ca1abeb..b820980699 100644
--- a/onboarding/pom.xml
+++ b/onboarding/pom.xml
@@ -14,331 +14,332 @@
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <artifactId>sdc-onboarding</artifactId>
- <artifactId>sdc-onboarding</artifactId>
- <packaging>pom</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>${mvn.jar.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>${mvn.clean.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${project.basedir}/src/test/resources
+ </additionalClasspathElement>
+ </additionalClasspathElements>
+ <printSummary>false</printSummary>
+ <systemPropertyVariables>
+ <config.location>${project.basedir}/configuration</config.location>
+ <logback.configurationFile>src/test/resources/logback-test.xml
+ </logback.configurationFile>
+ </systemPropertyVariables>
+ </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>${mvn.install.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>${mvn.resource.version}</version>
+ </plugin>
+ </plugins>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <excludes>
+ <exclude>**/*</exclude>
+ </excludes>
+ </testResource>
+ </testResources>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <artifactId>lombok</artifactId>
+ <groupId>org.projectlombok</groupId>
+ <scope>provided</scope>
+ <version>${lombok.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>spring-expression</artifactId>
+ <groupId>org.springframework</groupId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>spring-context</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-expression</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>spring-webmvc</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>spring-expression</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-core</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-web</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>org.springframework</groupId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-text</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <version>${apache-commons-text.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jcommander</artifactId>
+ <groupId>com.beust</groupId>
+ <version>${jcommander.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>httpasyncclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <version>${httpasyncclient.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jaxb-impl</artifactId>
+ <groupId>com.sun.xml.bind</groupId>
+ <version>${com.sun.xml.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>bsh</artifactId>
+ <groupId>org.beanshell</groupId>
+ <version>${bsh.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-digester</artifactId>
+ <groupId>commons-digester</groupId>
+ <version>${commons.digester.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>classmate</artifactId>
+ <groupId>com.fasterxml</groupId>
+ <version>${classmate.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>slf4j-api</artifactId>
+ <groupId>org.slf4j</groupId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>groovy-all-minimal</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ <version>${groovy.minimal.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>janino</artifactId>
+ <groupId>org.codehaus.janino</groupId>
+ <scope>provided</scope>
+ <version>${janino.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jackson-annotations</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.annotations.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>aspectjrt</artifactId>
+ <groupId>org.aspectj</groupId>
+ <version>${aspectjrt.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>javax.servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ <scope>provided</scope>
+ <version>${servlet-api.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-beanutils</artifactId>
+ <groupId>commons-beanutils</groupId>
+ <version>${commons-beanutils}</version>
+ </dependency>
+ <dependency>
+ <artifactId>annotations</artifactId>
+ <groupId>com.google.code.findbugs</groupId>
+ <version>3.0.1u2</version>
+ </dependency>
+ <dependency>
+ <artifactId>cglib-nodep</artifactId>
+ <groupId>cglib</groupId>
+ <version>${cglib.nodep.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>logback-classic</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>logback-core</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jackson-databind</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-codec</artifactId>
+ <groupId>commons-codec</groupId>
+ <version>${commons.codec.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>cassandra-driver-core</artifactId>
+ <groupId>com.datastax.cassandra</groupId>
+ <version>${datastax.cassandra.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>cassandra-driver-mapping</artifactId>
+ <groupId>com.datastax.cassandra</groupId>
+ <version>${datastax.cassandra.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <groupId>javax.ws.rs</groupId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>gson</artifactId>
+ <groupId>com.google.code.gson</groupId>
+ <version>${gson.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-io</artifactId>
+ <groupId>commons-io</groupId>
+ <version>${commons.io.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-lang3</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <version>${commons.lang3.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>swagger-annotations</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>wiremock</artifactId>
+ <groupId>com.github.tomakehurst</groupId>
+ <version>${wire-mock.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>sdc-main</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
- <modules>
- <module>../common</module>
- <module>../openecomp-be</module>
- <module>../openecomp-ui</module>
- </modules>
+ <modules>
+ <module>../common</module>
+ <module>../openecomp-be</module>
+ <module>../openecomp-ui</module>
+ </modules>
- <properties>
+ <packaging>pom</packaging>
- <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <parent>
+ <artifactId>sdc-main</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.10.0-SNAPSHOT</version>
+ </parent>
- <!-- Maven plugin versions -->
- <mvn.assembly.version>2.1</mvn.assembly.version>
- <mvn.clean.version>2.5</mvn.clean.version>
- <mvn.resource.version>3.1.0</mvn.resource.version>
- <mvn.deploy.version>2.4</mvn.deploy.version>
- <mvn.install.version>2.4</mvn.install.version>
- <mvn.jar.version>2.4</mvn.jar.version>
- <mvn.war.version>2.1.1</mvn.war.version>
+ <properties>
- <!-- Onboarding 3rd party versions -->
- <aspectjrt.version>${aspectj.version}</aspectjrt.version>
- <bsh.version>2.0b6</bsh.version>
- <cglib.nodep.version>3.2.4</cglib.nodep.version>
- <classmate.version>1.3.3</classmate.version>
- <commons.codec.version>${commons-codec}</commons.codec.version>
- <commons.digester.version>2.1</commons.digester.version>
- <commons.lang3.version>${lang3.version}</commons.lang3.version>
- <datastax.cassandra.version>3.8.0</datastax.cassandra.version>
- <groovy.minimal.version>1.5.8</groovy.minimal.version>
- <http.client.version>${httpclient.version}</http.client.version>
- <http.core.version>4.4.1</http.core.version>
- <httpasyncclient.version>4.1.2</httpasyncclient.version>
- <com.sun.xml.version>2.3.3</com.sun.xml.version>
- <javax.el.version>2.2.6</javax.el.version>
- <javax.el-api.version>3.0.1-b06</javax.el-api.version>
- <javax.inject.version>1</javax.inject.version>
- <jackson.annotations.version>${jackson.version}</jackson.annotations.version>
- <jackson.dataformat.version>${jackson.version}</jackson.dataformat.version>
- <jcommander.version>1.58</jcommander.version>
- <jersey.core.version>1.19.1</jersey.core.version>
- <jersey.multipart.version>1.18.1</jersey.multipart.version>
- <org.everit.json.schema.version>1.5.1</org.everit.json.schema.version>
- <slf4j.version>${slf4j-api.version}</slf4j.version>
- <spring.framework.version>${spring.version}</spring.framework.version>
- <swagger.version>${swagger-core-mvn-plugin.version}</swagger.version>
- <woodstox.version>4.4.1</woodstox.version>
- <zusammen.version>1.0.2</zusammen.version>
- <zusammen-state-store.version>1.0.2</zusammen-state-store.version>
- <zusammen-collaboration-store.version>1.0.2</zusammen-collaboration-store.version>
- <zusammen-index-store.version>1.0.0</zusammen-index-store.version>
- <zusammen-common-utilities.version>1.0.3</zusammen-common-utilities.version>
- <build.tools.version>${project.version}</build.tools.version>
- </properties>
+ <aspectjrt.version>${aspectj.version}</aspectjrt.version>
+ <bsh.version>2.0b6</bsh.version>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>${lombok.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- <version>${spring.framework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.framework.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>${spring.framework.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-text</artifactId>
- <version>${apache-commons-text.version}</version>
- </dependency>
- <dependency>
- <groupId>com.beust</groupId>
- <artifactId>jcommander</artifactId>
- <version>${jcommander.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpasyncclient</artifactId>
- <version>${httpasyncclient.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>${com.sun.xml.version}</version>
- </dependency>
- <dependency>
- <groupId>org.beanshell</groupId>
- <artifactId>bsh</artifactId>
- <version>${bsh.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>${commons.digester.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml</groupId>
- <artifactId>classmate</artifactId>
- <version>${classmate.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all-minimal</artifactId>
- <version>${groovy.minimal.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.janino</groupId>
- <artifactId>janino</artifactId>
- <version>${janino.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.annotations.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectjrt.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${servlet-api.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>${commons-beanutils}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
- <version>3.0.1u2</version>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>${cglib.nodep.version}</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>${logback.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-yaml</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons.codec.version}</version>
- </dependency>
- <dependency>
- <groupId>com.datastax.cassandra</groupId>
- <artifactId>cassandra-driver-core</artifactId>
- <version>${datastax.cassandra.version}</version>
- </dependency>
- <dependency>
- <groupId>com.datastax.cassandra</groupId>
- <artifactId>cassandra-driver-mapping</artifactId>
- <version>${datastax.cassandra.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${ws.rs.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons.lang3.version}</version>
- </dependency>
- <dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>${swagger.version}</version>
- </dependency>
- <dependency>
- <groupId>com.github.tomakehurst</groupId>
- <artifactId>wiremock</artifactId>
- <version>${wire-mock.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <!-- Maven plugin versions -->
+ <build.tools.version>${project.version}</build.tools.version>
+ <cglib.nodep.version>3.2.4</cglib.nodep.version>
+ <classmate.version>1.3.3</classmate.version>
+ <com.sun.xml.version>2.3.3</com.sun.xml.version>
+ <commons.codec.version>${commons-codec}</commons.codec.version>
+ <commons.digester.version>2.1</commons.digester.version>
+ <commons.lang3.version>${lang3.version}</commons.lang3.version>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>${mvn.jar.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>${mvn.clean.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <printSummary>false</printSummary>
- <additionalClasspathElements>
- <additionalClasspathElement>${project.basedir}/src/test/resources
- </additionalClasspathElement>
- </additionalClasspathElements>
- <systemPropertyVariables>
- <logback.configurationFile>src/test/resources/logback-test.xml
- </logback.configurationFile>
- <config.location>${project.basedir}/configuration</config.location>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>${mvn.install.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>${mvn.resource.version}</version>
- </plugin>
- </plugins>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <excludes>
- <exclude>**/*</exclude>
- </excludes>
- </testResource>
- </testResources>
- </build>
+ <!-- Onboarding 3rd party versions -->
+ <datastax.cassandra.version>3.8.0</datastax.cassandra.version>
+ <groovy.minimal.version>1.5.8</groovy.minimal.version>
+ <http.client.version>${httpclient.version}</http.client.version>
+ <http.core.version>4.4.1</http.core.version>
+ <httpasyncclient.version>4.1.2</httpasyncclient.version>
+ <jackson.annotations.version>${jackson.version}</jackson.annotations.version>
+ <jackson.dataformat.version>${jackson.version}</jackson.dataformat.version>
+ <javax.el-api.version>3.0.1-b06</javax.el-api.version>
+ <javax.el.version>2.2.6</javax.el.version>
+ <javax.inject.version>1</javax.inject.version>
+ <javax.servlet.version>${servlet-api.version}</javax.servlet.version>
+ <jcommander.version>1.58</jcommander.version>
+ <jersey.core.version>1.19.1</jersey.core.version>
+ <jersey.multipart.version>1.18.1</jersey.multipart.version>
+ <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
+ <mvn.assembly.version>2.1</mvn.assembly.version>
+ <mvn.clean.version>2.5</mvn.clean.version>
+ <mvn.deploy.version>2.4</mvn.deploy.version>
+ <mvn.install.version>2.4</mvn.install.version>
+ <mvn.jar.version>2.4</mvn.jar.version>
+ <mvn.resource.version>3.1.0</mvn.resource.version>
+ <mvn.war.version>2.1.1</mvn.war.version>
+ <org.everit.json.schema.version>1.5.1</org.everit.json.schema.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <slf4j.version>${slf4j-api.version}</slf4j.version>
+ <spring.framework.version>${spring.version}</spring.framework.version>
+ <swagger.version>${swagger-core-mvn-plugin.version}</swagger.version>
+ <woodstox.version>4.4.1</woodstox.version>
+ <zusammen-collaboration-store.version>1.0.2</zusammen-collaboration-store.version>
+ <zusammen-common-utilities.version>1.0.3</zusammen-common-utilities.version>
+ <zusammen-index-store.version>1.0.0</zusammen-index-store.version>
+ <zusammen-state-store.version>1.0.2</zusammen-state-store.version>
+ <zusammen.version>1.0.2</zusammen.version>
+ </properties>
</project>
diff --git a/openecomp-be/backend/openecomp-sdc-security-util/pom.xml b/openecomp-be/backend/openecomp-sdc-security-util/pom.xml
index 494b9aac57..0ee74c03fe 100644
--- a/openecomp-be/backend/openecomp-sdc-security-util/pom.xml
+++ b/openecomp-be/backend/openecomp-sdc-security-util/pom.xml
@@ -1,71 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>backend</artifactId>
- <groupId>org.openecomp.sdc</groupId>
- <version>1.10.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <artifactId>openecomp-sdc-security-util</artifactId>
+ <dependencies>
+ <dependency>
+ <artifactId>slf4j-api</artifactId>
+ <groupId>org.slf4j</groupId>
+ <version>1.7.25</version>
+ </dependency>
- <artifactId>openecomp-sdc-security-util</artifactId>
+ <dependency>
+ <artifactId>commons-crypto</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <artifactId>commons-lang3</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <version>${commons.lang3.version}</version>
+ </dependency>
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
+ <dependency>
+ <artifactId>functionaljava</artifactId>
+ <groupId>org.functionaljava</groupId>
+ <version>${functionaljava.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-crypto</artifactId>
- <version>1.0.0</version>
- </dependency>
+ <dependency>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>jackson-databind</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jackson-core</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ </exclusion>
+ </exclusions>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <version>${jackson.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons.lang3.version}</version>
- </dependency>
+ <dependency>
+ <artifactId>commons-codec</artifactId>
+ <groupId>commons-codec</groupId>
+ <version>${commons-codec}</version>
+ </dependency>
- <dependency>
- <groupId>org.functionaljava</groupId>
- <artifactId>functionaljava</artifactId>
- <version>${functionaljava.version}</version>
- </dependency>
+ <dependency>
+ <artifactId>javax.servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ <version>${servlet-api.version}</version>
+ </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ </dependencies>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec}</version>
- </dependency>
+ <modelVersion>4.0.0</modelVersion>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${javax.servlet.version}</version>
- </dependency>
- </dependencies>
+ <parent>
+ <artifactId>backend</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.10.0-SNAPSHOT</version>
+ </parent>
</project>
diff --git a/pom.xml b/pom.xml
index 9a038bddc0..a430ae9b67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,405 +19,111 @@ limitations under the License.
Modifications copyright (c) 2018-2019 Nokia
================================================================================
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.openecomp.sdc</groupId>
<artifactId>sdc-main</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>sdc</name>
-
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>3.2.0</version>
- <relativePath/>
- </parent>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
-
- <tosca.datatype.version>${project.version}</tosca.datatype.version>
- <!-- 3rd parties versions -->
- <bean-matcher.version>0.11</bean-matcher.version>
- <lang3.version>3.10</lang3.version>
- <guava.version>30.1-jre</guava.version>
- <janusgraph.version>0.3.3</janusgraph.version>
- <spring.version>5.3.9</spring.version>
- <jersey-bom.version>2.34</jersey-bom.version>
- <netty.version>4.1.66.Final</netty.version>
- <servlet-api.version>3.1.0</servlet-api.version>
- <wire-mock.version>2.26.3</wire-mock.version>
- <ecomp.version>3.4.0</ecomp.version>
- <cassandra.unit.version>4.3.1.0</cassandra.unit.version>
- <cadi.version>2.1.8</cadi.version>
- <lombok.version>1.18.20</lombok.version>
- <commons-beanutils>1.9.4</commons-beanutils>
- <commons.io.version>2.8.0</commons.io.version>
- <commons-configuration>2.7</commons-configuration>
- <apache-poi.version>4.1.0</apache-poi.version>
- <onap.logging.version>1.6.1</onap.logging.version>
- <apache-commons-text.version>1.9</apache-commons-text.version>
- <jaxb-api.version>2.3.1</jaxb-api.version>
- <io.vavr.version>0.10.3</io.vavr.version>
- <groovy.version>3.0.7</groovy.version>
- <swagger-core-mvn-plugin.version>2.1.7</swagger-core-mvn-plugin.version>
- <maven-antrun-plugin.version>3.0.0</maven-antrun-plugin.version>
- <hibernate.validator.version>6.1.6.Final</hibernate.validator.version>
-
- <commons.collections.version>4.1</commons.collections.version>
- <ws.rs.version>2.1.1</ws.rs.version>
- <javax.validation.version>2.0.1.Final</javax.validation.version>
- <javax.servlet.version>4.0.1</javax.servlet.version>
-
- <jetty.version>9.4.41.v20210516</jetty.version>
- <cxf.version>3.4.4</cxf.version>
-
- <org.owasp.esapi.version>2.2.0.0</org.owasp.esapi.version>
- <org.dom4j.version>2.1.3</org.dom4j.version>
-
- <!-- JSON and YAML Parsing -->
- <jackson.version>2.12.4</jackson.version>
- <jackson-annotations.version>${jackson.version}</jackson-annotations.version>
-
- <clearspring.version>2.1.1</clearspring.version>
- <skipYamlJsonValidator>false</skipYamlJsonValidator>
-
- <!-- Yaml for properties -->
- <snakeyaml.version>1.29</snakeyaml.version>
- <functionaljava.version>4.9</functionaljava.version>
- <httpclient.version>4.5.13</httpclient.version>
- <httpcore.version>4.4.1</httpcore.version>
- <json-simple.version>1.1</json-simple.version>
-
- <!-- PM Dictionary validation -->
- <onap.vnfsdk.validation.pmdictionary.version>1.2.15
- </onap.vnfsdk.validation.pmdictionary.version>
-
- <!-- Logging start -->
- <!-- logback -->
- <logback.version>1.2.3</logback.version>
- <slf4j-api.version>1.7.25</slf4j-api.version>
- <commons-codec>1.15</commons-codec>
- <commons-logging>1.2</commons-logging>
- <janino.version>3.0.6</janino.version>
- <log4j.version>2.13.1</log4j.version>
-
- <!-- aspects -->
- <jcabi.version>0.20.1</jcabi.version>
- <aspectj.version>1.9.7</aspectj.version>
- <aspectjrt.version>${aspectj.version}</aspectjrt.version>
- <jcabi.maven.plugin.version>0.13.2</jcabi.maven.plugin.version>
-
- <!-- Logging end -->
- <!-- System Metrics -->
- <sigar.version>1.6.4</sigar.version>
-
- <regex.version>3.0.3</regex.version>
-
- <!--GSON-->
- <gson.version>2.3.1</gson.version>
-
- <!--listen to file changes-->
- <commons-jci-core.version>1.1</commons-jci-core.version>
-
- <!--TESTING-->
- <mockito.version>3.7.7</mockito.version>
- <mockitoJupiter.version>${mockito.version}</mockitoJupiter.version>
- <jmockit.version>1.35</jmockit.version>
- <junit.platform.version>1.7.1</junit.platform.version>
- <junitJupiter.version>5.7.2</junitJupiter.version>
- <assertj.version>3.16.0</assertj.version>
- <testng.version>7.4.0</testng.version>
- <cucumber.version>6.8.1</cucumber.version>
- <bean-matchers.version>0.11</bean-matchers.version>
- <hamcrest.version>2.2</hamcrest.version>
- <hamcrest-all.version>1.3</hamcrest-all.version>
- <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
- <maven-jar-plugin.version>2.4</maven-jar-plugin.version>
- <jMapper.version>1.6.0.1</jMapper.version>
-
- <!-- sonar -->
- <sonar.projectVersion>${project.version}</sonar.projectVersion>
- <sonar.nodejs.executable>${project.basedir}/node/node</sonar.nodejs.executable>
- <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports
- </sonar.surefire.reportsPath>
- <sonar.javascript.lcov.reportPaths>${project.build.directory}/code-coverage/lcov.info
- </sonar.javascript.lcov.reportPaths>
- <sonar.coverage.jacoco.xmlReportPaths>
- ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml
- </sonar.coverage.jacoco.xmlReportPaths>
- <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding>
- <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir>
- <sonar.coverage.exclusions>pom.xml,src/test</sonar.coverage.exclusions>
- <!--cassandra -->
- <cassandra.driver.version>3.8.0</cassandra.driver.version>
- <!-- maven central (Nexus) -->
- <nexus.id.release>nexus</nexus.id.release>
- <nexus.id.snapshot>nexus</nexus.id.snapshot>
-
- <!--nexus-->
- <npm.registry>https://nexus3.onap.org/repository/npm.public/npm/-/</npm.registry>
- <nexus.proxy>https://nexus.onap.org</nexus.proxy>
- <sitePath>/content/sites/site/org/openecomp/sdc/${project.version}</sitePath>
- <staging.profile.id>176c31dfe190a</staging.profile.id>
- <!--togglz version-->
- <togglz.version>2.6.1.Final</togglz.version>
-
- <joda.time.version>2.9.9</joda.time.version>
-
- <!--sdc-security-utils-->
- <security.util.lib.version>1.6.0</security.util.lib.version>
- <!--jacoco-->
- <jacoco.version>0.8.7</jacoco.version>
-
- <java.driver.core.version>4.5.1</java.driver.core.version>
-
- <!-- Surefire parameters -->
- <surefire.forkCount>1C</surefire.forkCount>
- <surefire.reuseForks>true</surefire.reuseForks>
- <surefire.skip.tests>false</surefire.skip.tests>
-
- <docker.api.version>1.35</docker.api.version>
- <bouncycastle.version>1.69</bouncycastle.version>
-
- <verbose>false</verbose>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-bean-validation</artifactId>
- <version>${jersey-bom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.hk2.external</groupId>
- <artifactId>asm-all-repackaged</artifactId>
- <version>2.4.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jmockit</groupId>
- <artifactId>jmockit</artifactId>
- <version>${jmockit.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.github.tomakehurst</groupId>
- <artifactId>wiremock-standalone</artifactId>
- <version>${wire-mock.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.cucumber</groupId>
- <artifactId>cucumber-java</artifactId>
- <version>${cucumber.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.cucumber</groupId>
- <artifactId>cucumber-junit</artifactId>
- <version>${cucumber.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${lang3.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>io.swagger.core.v3</groupId>
- <artifactId>swagger-maven-plugin</artifactId>
- <version>${swagger-core-mvn-plugin.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <!-- must be on the classpath -->
- <groupId>org.jacoco</groupId>
- <artifactId>org.jacoco.agent</artifactId>
- <classifier>runtime</classifier>
- <version>${jacoco.version}</version>
- <scope>test</scope>
- </dependency>
- <!--JUnit Jupiter Engine to depend on the JUnit5 engine and JUnit 5 API -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junitJupiter.version}</version>
- <scope>test</scope>
- </dependency>
- <!--JUnit Jupiter Engine to depend on the JUnit4 engine and JUnit 4 API -->
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <version>${junitJupiter.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>${mockito.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>3.0.1</version>
- <configuration>
- <failOnError>false</failOnError>
- <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
- <docletArtifact>
- <groupId>org.umlgraph</groupId>
- <artifactId>umlgraph</artifactId>
- <version>5.6</version>
- </docletArtifact>
- <useStandardDocletOptions>true</useStandardDocletOptions>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
<build>
<pluginManagement>
<plugins>
<plugin>
- <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
+ <groupId>org.jacoco</groupId>
<version>${jacoco.version}</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
- <version>3.1.0</version>
<configuration>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>3.1.0</version>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
<version>1.6.0</version>
</plugin>
<plugin>
- <groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
+ <groupId>org.sonarsource.scanner.maven</groupId>
<version>3.7.0.1746</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>3.1.0</version>
</plugin>
<plugin>
- <groupId>ru.yaal.maven</groupId>
<artifactId>write-text-files-maven-plugin</artifactId>
+ <groupId>ru.yaal.maven</groupId>
<version>1.1</version>
</plugin>
<plugin>
- <groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
+ <groupId>org.codehaus.gmaven</groupId>
<version>1.5</version>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
<version>3.2.0</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>2.8.2</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>3.1.1</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>3.2.0</version>
</plugin>
<plugin>
- <groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
+ <groupId>io.fabric8</groupId>
<version>0.31.0</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>3.2.2</version>
</plugin>
<plugin>
- <groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
+ <groupId>com.github.eirslett</groupId>
<version>1.12.0</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
<version>3.8.1</version>
</plugin>
<plugin>
- <groupId>com.github.sylvainlaurent.maven</groupId>
<artifactId>yaml-json-validator-maven-plugin</artifactId>
+ <groupId>com.github.sylvainlaurent.maven</groupId>
<version>1.0.2</version>
</plugin>
<plugin>
- <groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
+ <groupId>pl.project13.maven</groupId>
<version>4.0.0</version>
</plugin>
</plugins>
@@ -426,83 +132,77 @@ Modifications copyright (c) 2018-2019 Nokia
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.17</version>
<configuration>
- <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
+ <skip>${checkstyle.skip}</skip>
<suppressionsFileExpression>checkstyle.suppressions.file
</suppressionsFileExpression>
- <skip>${checkstyle.skip}</skip>
+ <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
+ <version>2.17</version>
</plugin>
<!-- plugin for parsing the project version -->
<plugin>
- <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
- <id>parse-version</id>
- <phase>pre-clean</phase>
<goals>
<goal>parse-version</goal>
</goals>
+ <id>parse-version</id>
+ <phase>pre-clean</phase>
</execution>
</executions>
+ <groupId>org.codehaus.mojo</groupId>
</plugin>
<!-- Java Code Coverage -->
<plugin>
- <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <inherited>false</inherited>
<executions>
<execution>
- <id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
+ <id>default-instrument</id>
</execution>
<execution>
- <id>default-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
+ <id>default-restore-instrumented-classes</id>
</execution>
<execution>
- <id>default-report</id>
- <goals>
- <goal>report</goal>
- </goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
</configuration>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <id>default-report</id>
</execution>
</executions>
+ <groupId>org.jacoco</groupId>
+ <inherited>false</inherited>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>3.7.1</version>
<dependencies>
<dependency>
- <groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
+ <groupId>org.apache.maven.wagon</groupId>
<version>3.0.0</version>
</dependency>
</dependencies>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>3.7.1</version>
</plugin>
<!-- Set the deployment repositories properties. -->
<plugin>
- <groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
- <inherited>false</inherited>
- <phase>integration-test</phase>
- <goals>
- <goal>execute</goal>
- </goals>
<configuration>
<source>
pom.properties['deploy.url'] =
@@ -514,57 +214,57 @@ Modifications copyright (c) 2018-2019 Nokia
project.distributionManagement.repository.id;
</source>
</configuration>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <inherited>false</inherited>
+ <phase>integration-test</phase>
</execution>
</executions>
+ <groupId>org.codehaus.gmaven</groupId>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
+ <forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>11</source>
<target>11</target>
- <forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
+ <groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>surefire-junit-platform</artifactId>
- <version>${maven-surefire-plugin.version}</version>
- </dependency>
- </dependencies>
<configuration>
+ <forkCount>${surefire.forkCount}</forkCount>
+ <parallel>methods</parallel>
<printSummary>false</printSummary>
+ <reuseForks>${surefire.reuseForks}</reuseForks>
+ <skip>${surefire.skip.tests}</skip>
<systemPropertyVariables>
<jacoco-agent.destfile>${project.build.directory}/jacoco.exec
</jacoco-agent.destfile>
</systemPropertyVariables>
- <forkCount>${surefire.forkCount}</forkCount>
- <reuseForks>${surefire.reuseForks}</reuseForks>
- <parallel>methods</parallel>
- <skip>${surefire.skip.tests}</skip>
</configuration>
+ <dependencies>
+ <dependency>
+ <artifactId>surefire-junit-platform</artifactId>
+ <groupId>org.apache.maven.surefire</groupId>
+ <version>${maven-surefire-plugin.version}</version>
+ </dependency>
+ </dependencies>
+ <groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
- <groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>revision</goal>
- </goals>
- </execution>
- </executions>
<configuration>
+ <failOnNoGitDirectory>true</failOnNoGitDirectory>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>
${project.build.outputDirectory}/META-INF/git.properties
</generateGitPropertiesFilename>
- <failOnNoGitDirectory>true</failOnNoGitDirectory>
- <verbose>false</verbose>
+ <gitDescribe>
+ <skip>true</skip>
+ </gitDescribe>
<includeOnlyProperties>
<includeOnlyProperty>git.build.version</includeOnlyProperty>
<includeOnlyProperty>git.build.time</includeOnlyProperty>
@@ -575,24 +275,165 @@ Modifications copyright (c) 2018-2019 Nokia
<includeOnlyProperty>git.commit.message.short</includeOnlyProperty>
<includeOnlyProperty>git.commit.message.full</includeOnlyProperty>
</includeOnlyProperties>
- <gitDescribe>
- <skip>true</skip>
- </gitDescribe>
<useNativeGit>false</useNativeGit>
+ <verbose>false</verbose>
</configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>revision</goal>
+ </goals>
+ </execution>
+ </executions>
+ <groupId>pl.project13.maven</groupId>
</plugin>
</plugins>
</build>
+ <dependencies>
+ <dependency>
+ <!-- must be on the classpath -->
+ <artifactId>org.jacoco.agent</artifactId>
+ <classifier>runtime</classifier>
+ <groupId>org.jacoco</groupId>
+ <scope>test</scope>
+ <version>${jacoco.version}</version>
+ </dependency>
+ <!--JUnit Jupiter Engine to depend on the JUnit5 engine and JUnit 5 API -->
+ <dependency>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <scope>test</scope>
+ <version>${junitJupiter.version}</version>
+ </dependency>
+ <!--JUnit Jupiter Engine to depend on the JUnit4 engine and JUnit 4 API -->
+ <dependency>
+ <artifactId>junit-vintage-engine</artifactId>
+ <groupId>org.junit.vintage</groupId>
+ <scope>test</scope>
+ <version>${junitJupiter.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>mockito-core</artifactId>
+ <groupId>org.mockito</groupId>
+ <scope>test</scope>
+ <version>${mockito.version}</version>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ <version>${guava.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jersey-bean-validation</artifactId>
+ <groupId>org.glassfish.jersey.ext</groupId>
+ <version>${jersey-bom.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>asm-all-repackaged</artifactId>
+ <groupId>org.glassfish.hk2.external</groupId>
+ <version>2.4.0</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>assertj-core</artifactId>
+ <groupId>org.assertj</groupId>
+ <version>${assertj.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>jmockit</artifactId>
+ <groupId>org.jmockit</groupId>
+ <version>${jmockit.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>wiremock-standalone</artifactId>
+ <groupId>com.github.tomakehurst</groupId>
+ <version>${wire-mock.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>cucumber-java</artifactId>
+ <groupId>io.cucumber</groupId>
+ <version>${cucumber.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>cucumber-junit</artifactId>
+ <groupId>io.cucumber</groupId>
+ <version>${cucumber.version}</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>commons-lang3</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <version>${lang3.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>groovy</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>netty-all</artifactId>
+ <groupId>io.netty</groupId>
+ <version>${netty.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>netty-handler</artifactId>
+ <groupId>io.netty</groupId>
+ <version>${netty.version}</version>
+ </dependency>
+ <dependency>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <version>${swagger-core-mvn-plugin.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>Release Repository</name>
+ <url>${nexus.proxy}/content/repositories/releases/</url>
+ </repository>
+ <site>
+ <id>ecomp-site</id>
+ <url>dav:${nexus.proxy}${sitePath}</url>
+ </site>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>Snapshot Repository</name>
+ <url>${nexus.proxy}/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+ <groupId>org.openecomp.sdc</groupId>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>sdc</name>
+
+ <packaging>pom</packaging>
+
+ <parent>
+ <artifactId>oparent</artifactId>
+ <groupId>org.onap.oparent</groupId>
+ <relativePath/>
+ <version>3.2.0</version>
+ </parent>
<profiles>
<profile>
- <id>all</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
- <properties>
- <checkstyle.skip>true</checkstyle.skip>
- </properties>
+ <id>all</id>
<modules>
<module>onboarding</module>
<module>common-app-logging</module>
@@ -609,13 +450,12 @@ Modifications copyright (c) 2018-2019 Nokia
<module>utils/webseal-simulator</module>
<module>integration-tests</module>
</modules>
- </profile>
- <profile>
- <id>all-for-integration-tests-only</id>
<properties>
<checkstyle.skip>true</checkstyle.skip>
- <surefire.skip.tests>true</surefire.skip.tests>
</properties>
+ </profile>
+ <profile>
+ <id>all-for-integration-tests-only</id>
<modules>
<module>onboarding</module>
<module>common-app-logging</module>
@@ -632,18 +472,19 @@ Modifications copyright (c) 2018-2019 Nokia
<module>utils/webseal-simulator</module>
<module>integration-tests</module>
</modules>
+ <properties>
+ <checkstyle.skip>true</checkstyle.skip>
+ <surefire.skip.tests>true</surefire.skip.tests>
+ </properties>
</profile>
<profile>
- <id>skip-integration-tests</id>
<activation>
<property>
<name>skipITs</name>
<value>true</value>
</property>
</activation>
- <properties>
- <checkstyle.skip>true</checkstyle.skip>
- </properties>
+ <id>skip-integration-tests</id>
<modules>
<module>onboarding</module>
<module>common-app-logging</module>
@@ -659,19 +500,18 @@ Modifications copyright (c) 2018-2019 Nokia
<module>sdc-os-chef</module>
<module>utils/webseal-simulator</module>
</modules>
+ <properties>
+ <checkstyle.skip>true</checkstyle.skip>
+ </properties>
</profile>
<profile>
- <id>skip-tests</id>
<activation>
<property>
<name>skipTests</name>
<value>true</value>
</property>
</activation>
- <properties>
- <checkstyle.skip>true</checkstyle.skip>
- <maven.test.skip>true</maven.test.skip>
- </properties>
+ <id>skip-tests</id>
<modules>
<module>onboarding</module>
<module>common-app-logging</module>
@@ -687,20 +527,16 @@ Modifications copyright (c) 2018-2019 Nokia
<module>sdc-os-chef</module>
<module>utils/webseal-simulator</module>
</modules>
+ <properties>
+ <checkstyle.skip>true</checkstyle.skip>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
</profile>
<profile>
- <id>fast-build</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
- <properties>
- <maven.test.skip>true</maven.test.skip>
- <skipYamlJsonValidator>true</skipYamlJsonValidator>
- <checkstyle.skip>true</checkstyle.skip>
- <jacoco.skip>true</jacoco.skip>
- <maven.antrun.skip>true</maven.antrun.skip>
- <swagger.skip>true</swagger.skip>
- </properties>
+ <id>fast-build</id>
<modules>
<module>onboarding</module>
<module>common-app-logging</module>
@@ -716,58 +552,237 @@ Modifications copyright (c) 2018-2019 Nokia
<module>sdc-os-chef</module>
<module>utils/webseal-simulator</module>
</modules>
+ <properties>
+ <checkstyle.skip>true</checkstyle.skip>
+ <jacoco.skip>true</jacoco.skip>
+ <maven.antrun.skip>true</maven.antrun.skip>
+ <maven.test.skip>true</maven.test.skip>
+ <skipYamlJsonValidator>true</skipYamlJsonValidator>
+ <swagger.skip>true</swagger.skip>
+ </properties>
</profile>
<profile>
- <id>start-sdc</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+ <id>start-sdc</id>
+ <modules>
+ <module>integration-tests</module>
+ </modules>
<properties>
- <maven.test.skip>true</maven.test.skip>
- <skipYamlJsonValidator>true</skipYamlJsonValidator>
<checkstyle.skip>true</checkstyle.skip>
- <jacoco.skip>true</jacoco.skip>
<docker.keepRunning>true</docker.keepRunning>
+ <jacoco.skip>true</jacoco.skip>
+ <maven.test.skip>true</maven.test.skip>
+ <skipYamlJsonValidator>true</skipYamlJsonValidator>
</properties>
- <modules>
- <module>integration-tests</module>
- </modules>
</profile>
<profile>
- <id>stop-sdc</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+ <id>stop-sdc</id>
+ <modules>
+ <module>integration-tests</module>
+ </modules>
<properties>
- <maven.test.skip>true</maven.test.skip>
- <skipYamlJsonValidator>true</skipYamlJsonValidator>
<checkstyle.skip>true</checkstyle.skip>
+ <docker.skip.run>true</docker.skip.run>
<jacoco.skip>true</jacoco.skip>
+ <maven.test.skip>true</maven.test.skip>
- <docker.skip.run>true</docker.skip.run>
+ <skipYamlJsonValidator>true</skipYamlJsonValidator>
</properties>
- <modules>
- <module>integration-tests</module>
- </modules>
</profile>
<profile>
- <id>run-integration-tests</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
+ <id>run-integration-tests</id>
+ <modules>
+ <module>integration-tests</module>
+ </modules>
<properties>
- <skipYamlJsonValidator>true</skipYamlJsonValidator>
<checkstyle.skip>true</checkstyle.skip>
<docker.skip>true</docker.skip>
+ <skipYamlJsonValidator>true</skipYamlJsonValidator>
</properties>
- <modules>
- <module>integration-tests</module>
- </modules>
</profile>
</profiles>
+ <properties>
+ <apache-commons-text.version>1.9</apache-commons-text.version>
+ <apache-poi.version>4.1.0</apache-poi.version>
+
+ <aspectj.version>1.9.7</aspectj.version>
+ <!-- 3rd parties versions -->
+ <aspectjrt.version>${aspectj.version}</aspectjrt.version>
+ <assertj.version>3.16.0</assertj.version>
+ <bean-matcher.version>0.11</bean-matcher.version>
+ <bean-matchers.version>0.11</bean-matchers.version>
+ <bouncycastle.version>1.69</bouncycastle.version>
+ <cadi.version>2.1.8</cadi.version>
+ <cassandra.driver.version>3.8.0</cassandra.driver.version>
+ <cassandra.unit.version>4.3.1.0</cassandra.unit.version>
+ <clearspring.version>2.1.1</clearspring.version>
+ <commons-beanutils>1.9.4</commons-beanutils>
+ <commons-codec>1.15</commons-codec>
+ <commons-configuration>2.7</commons-configuration>
+ <commons-jci-core.version>1.1</commons-jci-core.version>
+ <commons-logging>1.2</commons-logging>
+ <commons.collections.version>4.1</commons.collections.version>
+ <commons.io.version>2.8.0</commons.io.version>
+ <cucumber.version>6.8.1</cucumber.version>
+ <cxf.version>3.4.4</cxf.version>
+ <docker.api.version>1.35</docker.api.version>
+ <ecomp.version>3.4.0</ecomp.version>
+ <functionaljava.version>4.9</functionaljava.version>
+ <groovy.version>3.0.7</groovy.version>
+ <gson.version>2.3.1</gson.version>
+ <guava.version>30.1-jre</guava.version>
+ <hamcrest-all.version>1.3</hamcrest-all.version>
+
+ <hamcrest.version>2.2</hamcrest.version>
+ <hibernate.validator.version>6.1.6.Final</hibernate.validator.version>
+ <httpclient.version>4.5.13</httpclient.version>
+ <httpcore.version>4.4.1</httpcore.version>
+
+ <io.vavr.version>0.10.3</io.vavr.version>
+ <jMapper.version>1.6.0.1</jMapper.version>
+
+ <jackson-annotations.version>${jackson.version}</jackson-annotations.version>
+ <jackson.version>2.12.4</jackson.version>
+
+ <!-- JSON and YAML Parsing -->
+ <jacoco.version>0.8.7</jacoco.version>
+ <janino.version>3.0.6</janino.version>
+
+ <janusgraph.version>0.3.3</janusgraph.version>
+ <java.driver.core.version>4.5.1</java.driver.core.version>
+
+ <!-- Yaml for properties -->
+ <javax.servlet.version>4.0.1</javax.servlet.version>
+ <javax.validation.version>2.0.1.Final</javax.validation.version>
+ <jaxb-api.version>2.3.1</jaxb-api.version>
+ <jcabi.maven.plugin.version>0.13.2</jcabi.maven.plugin.version>
+ <jcabi.version>0.20.1</jcabi.version>
+
+ <!-- PM Dictionary validation -->
+ <jersey-bom.version>2.34</jersey-bom.version>
+
+ <!-- Logging start -->
+ <!-- logback -->
+ <jetty.version>9.4.41.v20210516</jetty.version>
+ <jmockit.version>1.35</jmockit.version>
+ <joda.time.version>2.9.9</joda.time.version>
+ <json-simple.version>1.1</json-simple.version>
+ <junit.platform.version>1.7.1</junit.platform.version>
+ <junitJupiter.version>5.7.2</junitJupiter.version>
+
+ <!-- aspects -->
+ <lang3.version>3.10</lang3.version>
+ <log4j.version>2.13.1</log4j.version>
+ <logback.version>1.2.3</logback.version>
+ <lombok.version>1.18.20</lombok.version>
+
+ <!-- Logging end -->
+ <!-- System Metrics -->
+ <maven-antrun-plugin.version>3.0.0</maven-antrun-plugin.version>
+
+ <maven-jar-plugin.version>2.4</maven-jar-plugin.version>
+
+ <!--GSON-->
+ <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
+
+ <!--listen to file changes-->
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+
+ <!--TESTING-->
+ <mockito.version>3.7.7</mockito.version>
+ <mockitoJupiter.version>${mockito.version}</mockitoJupiter.version>
+ <netty.version>4.1.66.Final</netty.version>
+ <nexus.id.release>nexus</nexus.id.release>
+ <nexus.id.snapshot>nexus</nexus.id.snapshot>
+ <nexus.proxy>https://nexus.onap.org</nexus.proxy>
+ <npm.registry>https://nexus3.onap.org/repository/npm.public/npm/-/</npm.registry>
+ <onap.logging.version>1.6.1</onap.logging.version>
+ <onap.vnfsdk.validation.pmdictionary.version>1.2.15
+ </onap.vnfsdk.validation.pmdictionary.version>
+ <org.dom4j.version>2.1.3</org.dom4j.version>
+ <org.owasp.esapi.version>2.2.0.0</org.owasp.esapi.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <regex.version>3.0.3</regex.version>
+ <security.util.lib.version>1.6.0</security.util.lib.version>
+
+ <!-- sonar -->
+ <servlet-api.version>4.0.1</servlet-api.version>
+ <sigar.version>1.6.4</sigar.version>
+ <sitePath>/content/sites/site/org/openecomp/sdc/${project.version}</sitePath>
+ <skipYamlJsonValidator>false</skipYamlJsonValidator>
+ <slf4j-api.version>1.7.25</slf4j-api.version>
+ <snakeyaml.version>1.29</snakeyaml.version>
+ <sonar.coverage.exclusions>pom.xml,src/test</sonar.coverage.exclusions>
+ <sonar.coverage.jacoco.xmlReportPaths>
+ ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml
+ </sonar.coverage.jacoco.xmlReportPaths>
+ <!--cassandra -->
+ <sonar.javascript.lcov.reportPaths>${project.build.directory}/code-coverage/lcov.info
+ </sonar.javascript.lcov.reportPaths>
+ <!-- maven central (Nexus) -->
+ <sonar.nodejs.executable>${project.basedir}/node/node</sonar.nodejs.executable>
+ <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir>
+
+ <!--nexus-->
+ <sonar.projectVersion>${project.version}</sonar.projectVersion>
+ <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding>
+ <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports
+ </sonar.surefire.reportsPath>
+ <spring.version>5.3.9</spring.version>
+ <!--togglz version-->
+ <staging.profile.id>176c31dfe190a</staging.profile.id>
+
+ <surefire.forkCount>1C</surefire.forkCount>
+
+ <!--sdc-security-utils-->
+ <surefire.reuseForks>true</surefire.reuseForks>
+ <!--jacoco-->
+ <surefire.skip.tests>false</surefire.skip.tests>
+
+ <swagger-core-mvn-plugin.version>2.1.7</swagger-core-mvn-plugin.version>
+
+ <!-- Surefire parameters -->
+ <testng.version>7.4.0</testng.version>
+ <togglz.version>2.6.1.Final</togglz.version>
+ <tosca.datatype.version>${project.version}</tosca.datatype.version>
+
+ <verbose>false</verbose>
+ <wire-mock.version>2.26.3</wire-mock.version>
+
+ <ws.rs.version>2.1.1</ws.rs.version>
+ </properties>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <artifactId>umlgraph</artifactId>
+ <groupId>org.umlgraph</groupId>
+ <version>5.6</version>
+ </docletArtifact>
+ <failOnError>false</failOnError>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>3.0.1</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
<repositories>
<!-- LF repositories -->
<repository>
@@ -788,20 +803,5 @@ Modifications copyright (c) 2018-2019 Nokia
<!-- LF repositories END-->
</repositories>
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>Release Repository</name>
- <url>${nexus.proxy}/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>Snapshot Repository</name>
- <url>${nexus.proxy}/content/repositories/snapshots/</url>
- </snapshotRepository>
- <site>
- <id>ecomp-site</id>
- <url>dav:${nexus.proxy}${sitePath}</url>
- </site>
- </distributionManagement>
+ <version>1.10.0-SNAPSHOT</version>
</project>
diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml
index e9801c9402..180ac3cff1 100644
--- a/utils/webseal-simulator/pom.xml
+++ b/utils/webseal-simulator/pom.xml
@@ -1,164 +1,137 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
<artifactId>webseal-simulator</artifactId>
- <packaging>war</packaging>
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>sdc-main</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- <relativePath>../../</relativePath>
- </parent>
-
- <properties>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <nexus.proxy>https://nexus.onap.org</nexus.proxy>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sonar.skip>true</sonar.skip>
- </properties>
-
+ <build>
+ <finalName>WSSimulator-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>yaml-json-validator-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <skip>${skipYamlJsonValidator}</skip>
+ <validationSets>
+ <validationSet>
+ <includes>
+ <include>src/main/resources/**/*.y*ml</include>
+ <include>src/test/resources/**/*.y*ml</include>
+ </includes>
+ </validationSet>
+ <validationSet>
+ <includes>
+ <include>src/main/resources/**/*.json</include>
+ <include>src/test/resources/**/*.json</include>
+ </includes>
+ </validationSet>
+ </validationSets>
+ </configuration>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <id>validate</id>
+ <phase>validate</phase>
+ </execution>
+ </executions>
+ <groupId>com.github.sylvainlaurent.maven</groupId>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
- <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
- <version>${javax.servlet.version}</version>
+ <groupId>javax.servlet</groupId>
+ <scope>compile</scope>
+ <version>${servlet-api.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
+ <groupId>commons-logging</groupId>
<version>1.0.4</version>
</dependency>
<dependency>
- <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
+ <groupId>commons-io</groupId>
<version>${commons.io.version}</version>
</dependency>
<dependency>
- <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>${commons-codec}</version>
+ <groupId>commons-codec</groupId>
<scope>compile</scope>
+ <version>${commons-codec}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-proxy</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
<exclusions>
<exclusion>
- <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
</exclusion>
</exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
- <version>${jetty.version}</version>
- <scope>compile</scope>
<exclusions>
<exclusion>
- <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
</exclusion>
</exclusions>
+ <groupId>org.eclipse.jetty</groupId>
+ <scope>compile</scope>
+ <version>${jetty.version}</version>
</dependency>
<!-- Proxy servlet -->
<dependency>
- <groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
- <version>1.0.2</version>
+ <groupId>com.typesafe</groupId>
<scope>compile</scope>
+ <version>1.0.2</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-logging-api</artifactId>
- <version>${project.version}</version>
<exclusions>
<exclusion>
- <groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
+ <groupId>org.powermock</groupId>
</exclusion>
</exclusions>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
- <build>
- <finalName>WSSimulator-${project.version}</finalName>
- <plugins>
- <plugin>
- <groupId>com.github.sylvainlaurent.maven</groupId>
- <artifactId>yaml-json-validator-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>validate</id>
- <phase>validate</phase>
- <goals>
- <goal>validate</goal>
- </goals>
- <configuration>
- <validationSets>
- <validationSet>
- <includes>
- <include>src/main/resources/**/*.y*ml</include>
- <include>src/test/resources/**/*.y*ml</include>
- </includes>
- </validationSet>
- <validationSet>
- <includes>
- <include>src/main/resources/**/*.json</include>
- <include>src/test/resources/**/*.json</include>
- </includes>
- </validationSet>
- </validationSets>
- <skip>${skipYamlJsonValidator}</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <modelVersion>4.0.0</modelVersion>
- <repositories>
- <!-- LF repositories -->
- <repository>
- <id>ecomp-releases</id>
- <name>Release Repository</name>
- <url>${nexus.proxy}/content/repositories/releases/</url>
- </repository>
- <repository>
- <id>ecomp-snapshots</id>
- <name>Snapshots Repository</name>
- <url>${nexus.proxy}/content/repositories/snapshots/</url>
- </repository>
- <repository>
- <id>ecomp-public</id>
- <name>Public Repository</name>
- <url>${nexus.proxy}/content/repositories/public/</url>
- </repository>
- <!-- LF repositories END-->
- </repositories>
+ <packaging>war</packaging>
+
+ <parent>
+ <artifactId>sdc-main</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <relativePath>../../</relativePath>
+ <version>1.10.0-SNAPSHOT</version>
+ </parent>
<profiles>
<profile>
- <id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
@@ -167,38 +140,33 @@
<plugin>
<artifactId>maven-clean-plugin</artifactId>
- <version>3.0.0</version>
<executions>
<execution>
- <id>clean-static-files</id>
- <phase>clean</phase>
- <goals>
- <goal>clean</goal>
- </goals>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/sdc-simulator</directory>
+ <followSymlinks>false</followSymlinks>
<includes>
<include>*.war</include>
</includes>
- <followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ <id>clean-static-files</id>
+ <phase>clean</phase>
</execution>
</executions>
+ <version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
- <id>copy-resources-simulator</id>
- <phase>verify</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
<configuration>
<outputDirectory>${project.basedir}/sdc-simulator
</outputDirectory>
@@ -211,28 +179,29 @@
</resource>
</resources>
</configuration>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <id>copy-resources-simulator</id>
+ <phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
- <groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
- <verbose>${verbose}</verbose>
<apiVersion>${docker.api.version}</apiVersion>
- <registry>nexus3.onap.org:10001</registry>
<authConfig>
<pull>
- <username>docker</username>
<password>docker</password>
+ <username>docker</username>
</pull>
</authConfig>
<images>
<!-- Build simulator image -->
<image>
- <name>onap/sdc-simulator</name>
<alias>sdc-simulator</alias>
<build>
<cleanup>try</cleanup>
@@ -248,35 +217,67 @@
</tag>
</tags>
</build>
+ <name>onap/sdc-simulator</name>
</image>
</images>
+ <registry>nexus3.onap.org:10001</registry>
+ <verbose>${verbose}</verbose>
</configuration>
<executions>
<execution>
- <id>clean-images</id>
- <phase>pre-clean</phase>
<goals>
<goal>remove</goal>
</goals>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
</execution>
<execution>
- <id>generate-images</id>
- <phase>install</phase>
<goals>
<goal>build</goal>
</goals>
+ <id>generate-images</id>
+ <phase>install</phase>
</execution>
<execution>
- <id>push-images</id>
- <phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
+ <id>push-images</id>
+ <phase>deploy</phase>
</execution>
</executions>
+ <groupId>io.fabric8</groupId>
</plugin>
</plugins>
</build>
+ <id>docker</id>
</profile>
</profiles>
+
+ <properties>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <nexus.proxy>https://nexus.onap.org</nexus.proxy>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <sonar.skip>true</sonar.skip>
+ </properties>
+
+ <repositories>
+ <!-- LF repositories -->
+ <repository>
+ <id>ecomp-releases</id>
+ <name>Release Repository</name>
+ <url>${nexus.proxy}/content/repositories/releases/</url>
+ </repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <name>Snapshots Repository</name>
+ <url>${nexus.proxy}/content/repositories/snapshots/</url>
+ </repository>
+ <repository>
+ <id>ecomp-public</id>
+ <name>Public Repository</name>
+ <url>${nexus.proxy}/content/repositories/public/</url>
+ </repository>
+ <!-- LF repositories END-->
+ </repositories>
</project>