summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore18
-rw-r--r--deliveries/.gitignore4
-rwxr-xr-xepsdk-app-onap/.classpath31
-rw-r--r--epsdk-app-onap/.gitignore7
-rwxr-xr-xepsdk-app-onap/.project42
-rwxr-xr-xepsdk-app-onap/.settings/.jsdtscope13
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.core.resources.prefs5
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.jdt.core.prefs8
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.m2e.core.prefs4
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.wst.common.component19
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml7
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.xml8
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.container1
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.name1
-rwxr-xr-xepsdk-app-onap/.settings/org.eclipse.wst.validation.prefs2
-rwxr-xr-xvid-app-common/.classpath42
-rw-r--r--vid-app-common/.gitignore8
-rwxr-xr-xvid-app-common/.project42
-rwxr-xr-xvid-app-common/.settings/.jsdtscope13
-rwxr-xr-xvid-app-common/.settings/org.eclipse.core.resources.prefs7
-rwxr-xr-xvid-app-common/.settings/org.eclipse.jdt.core.prefs8
-rwxr-xr-xvid-app-common/.settings/org.eclipse.m2e.core.prefs4
-rwxr-xr-xvid-app-common/.settings/org.eclipse.wst.common.component18
-rwxr-xr-xvid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml7
-rwxr-xr-xvid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml8
-rwxr-xr-xvid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container1
-rwxr-xr-xvid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name1
-rwxr-xr-xvid-app-common/.settings/org.eclipse.wst.validation.prefs2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java60
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/utils/Intersection.java61
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java492
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java28
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java155
-rw-r--r--vid-app-common/src/test/resources/change-management-request.json47
-rw-r--r--vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json28
-rw-r--r--vid-app-common/src/test/resources/vnf-workflow-relation-request.json25
-rw-r--r--vid-automation/.gitignore45
-rw-r--r--vid-ext-services-simulator/.classpath31
-rw-r--r--vid-ext-services-simulator/.gitignore5
-rw-r--r--vid-ext-services-simulator/.project23
-rw-r--r--vid-ext-services-simulator/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--vid-ext-services-simulator/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--vid-ext-services-simulator/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--vid-webpack-master/.gitignore3
46 files changed, 715 insertions, 637 deletions
diff --git a/.gitignore b/.gitignore
index 978c4cbd7..348bcfd17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,5 @@
blackDuckHubProjectName.txt
blackDuckHubProjectVersionName.txt
-epsdk-app-onap/target/
-vid-app-common/target/
vid-parent_bdio.jsonld
-deliveries/target/
-*.log
-*/.idea/
*.iml
-/vid-app-common/.idea/workspace.xml
-/vid-app-common/.settings/org.eclipse.core.resources.prefs
-/vid-webpack-master/target/antrun/build-main.xml
-/vid-webpack-master/target/maven-archiver/pom.properties
-/vid-webpack-master/target/vid-webpack-master.war
-/vid-webpack-master/target/vid-webpack-master/app/ui/NO-WEBPACK.txt
-/vid-webpack-master/target/vid-webpack-master/WEB-INF/web.xml
-/vid-automation/.classpath
-/vid-automation/.project
-/vid-automation/.settings/org.eclipse.jdt.core.prefs
-/vid-automation/.settings/org.eclipse.m2e.core.prefs
-/vid-ext-services-simulator/.gitignore
+.idea/ \ No newline at end of file
diff --git a/deliveries/.gitignore b/deliveries/.gitignore
index 54a4f4f69..47adc4455 100644
--- a/deliveries/.gitignore
+++ b/deliveries/.gitignore
@@ -1,2 +1,4 @@
# provide developers possibility to add or override custom properties in compose without polluting code base
-docker-compose.override.yml \ No newline at end of file
+docker-compose.override.yml
+
+target/ \ No newline at end of file
diff --git a/epsdk-app-onap/.classpath b/epsdk-app-onap/.classpath
deleted file mode 100755
index d19be4237..000000000
--- a/epsdk-app-onap/.classpath
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/epsdk-app-onap/.gitignore b/epsdk-app-onap/.gitignore
new file mode 100644
index 000000000..8c70e09aa
--- /dev/null
+++ b/epsdk-app-onap/.gitignore
@@ -0,0 +1,7 @@
+target/
+overlays/
+logs/
+debug-logs/
+.settings/
+.classpath
+.project \ No newline at end of file
diff --git a/epsdk-app-onap/.project b/epsdk-app-onap/.project
deleted file mode 100755
index 7d373625e..000000000
--- a/epsdk-app-onap/.project
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>epsdk-app-onap</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- </natures>
-</projectDescription>
diff --git a/epsdk-app-onap/.settings/.jsdtscope b/epsdk-app-onap/.settings/.jsdtscope
deleted file mode 100755
index c34a33690..000000000
--- a/epsdk-app-onap/.settings/.jsdtscope
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
- <classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
- <attributes>
- <attribute name="hide" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
- <classpathentry kind="output" path=""/>
-</classpath>
diff --git a/epsdk-app-onap/.settings/org.eclipse.core.resources.prefs b/epsdk-app-onap/.settings/org.eclipse.core.resources.prefs
deleted file mode 100755
index 365bbd609..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/main/resources=UTF-8
-encoding//src/test/java=UTF-8
-encoding/<project>=UTF-8
diff --git a/epsdk-app-onap/.settings/org.eclipse.jdt.core.prefs b/epsdk-app-onap/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100755
index 1ab2bb53a..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/epsdk-app-onap/.settings/org.eclipse.m2e.core.prefs b/epsdk-app-onap/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100755
index 302f92325..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=onap
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/epsdk-app-onap/.settings/org.eclipse.wst.common.component b/epsdk-app-onap/.settings/org.eclipse.wst.common.component
deleted file mode 100755
index 57b075ec9..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.wst.common.component
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
- <wb-module deploy-name="epsdk-app-onap">
- <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
- <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
- <dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/org/openecomp/ecompsdkos/epsdk-app-overlay/1.1.0-SNAPSHOT/epsdk-app-overlay-1.1.0-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
- <dependency-type>consumes</dependency-type>
- </dependent-module>
- <dependent-module deploy-path="/" handle="module:/overlay/prj/vid-app-common?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
- <dependency-type>consumes</dependency-type>
- </dependent-module>
- <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
- <dependency-type>consumes</dependency-type>
- </dependent-module>
- <property name="java-output-path" value="/epsdk-app-onap/target/classes"/>
- <property name="context-root" value="vid"/>
- </wb-module>
-</project-modules>
diff --git a/epsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/epsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
deleted file mode 100755
index b01fdb78f..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<root>
- <facet id="jst.jaxrs">
- <node name="libprov">
- <attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
- </node>
- </facet>
-</root>
diff --git a/epsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.xml b/epsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100755
index 91e8c54be..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <fixed facet="wst.jsdt.web"/>
- <installed facet="java" version="1.8"/>
- <installed facet="jst.web" version="3.1"/>
- <installed facet="jst.jaxrs" version="2.0"/>
- <installed facet="wst.jsdt.web" version="1.0"/>
-</faceted-project>
diff --git a/epsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.container b/epsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.container
deleted file mode 100755
index 3bd5d0a48..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.container
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file
diff --git a/epsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.name b/epsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.name
deleted file mode 100755
index 05bd71b6e..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.wst.jsdt.ui.superType.name
+++ /dev/null
@@ -1 +0,0 @@
-Window \ No newline at end of file
diff --git a/epsdk-app-onap/.settings/org.eclipse.wst.validation.prefs b/epsdk-app-onap/.settings/org.eclipse.wst.validation.prefs
deleted file mode 100755
index 6f1cba68d..000000000
--- a/epsdk-app-onap/.settings/org.eclipse.wst.validation.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-disabled=06target
-eclipse.preferences.version=1
diff --git a/vid-app-common/.classpath b/vid-app-common/.classpath
deleted file mode 100755
index 6d66a1410..000000000
--- a/vid-app-common/.classpath
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/classes" path="target/generated-sources">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/vid-app-common/.gitignore b/vid-app-common/.gitignore
new file mode 100644
index 000000000..675c1faed
--- /dev/null
+++ b/vid-app-common/.gitignore
@@ -0,0 +1,8 @@
+.settings/
+overlays/
+logs/
+debug-logs/
+target/
+.idea/
+.classpath
+.project \ No newline at end of file
diff --git a/vid-app-common/.project b/vid-app-common/.project
deleted file mode 100755
index f0b63c382..000000000
--- a/vid-app-common/.project
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>vid-app-common</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- </natures>
-</projectDescription>
diff --git a/vid-app-common/.settings/.jsdtscope b/vid-app-common/.settings/.jsdtscope
deleted file mode 100755
index c34a33690..000000000
--- a/vid-app-common/.settings/.jsdtscope
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
- <classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
- <attributes>
- <attribute name="hide" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
- <classpathentry kind="output" path=""/>
-</classpath>
diff --git a/vid-app-common/.settings/org.eclipse.core.resources.prefs b/vid-app-common/.settings/org.eclipse.core.resources.prefs
deleted file mode 100755
index a54705a11..000000000
--- a/vid-app-common/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/main/resources=UTF-8
-encoding//src/test/java=UTF-8
-encoding//src/test/resources=UTF-8
-encoding//target/generated-sources=UTF-8
-encoding/<project>=UTF-8
diff --git a/vid-app-common/.settings/org.eclipse.jdt.core.prefs b/vid-app-common/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100755
index 1ab2bb53a..000000000
--- a/vid-app-common/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/vid-app-common/.settings/org.eclipse.m2e.core.prefs b/vid-app-common/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100755
index 14b697b7b..000000000
--- a/vid-app-common/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/vid-app-common/.settings/org.eclipse.wst.common.component b/vid-app-common/.settings/org.eclipse.wst.common.component
deleted file mode 100755
index 40a2cb3cc..000000000
--- a/vid-app-common/.settings/org.eclipse.wst.common.component
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
- <wb-module deploy-name="vid-app-common">
- <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
- <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
- <dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/org/openecomp/ecompsdkos/epsdk-app-overlay/1.1.0-SNAPSHOT/epsdk-app-overlay-1.1.0-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
- <dependency-type>consumes</dependency-type>
- </dependent-module>
- <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
- <dependency-type>consumes</dependency-type>
- </dependent-module>
- <property name="java-output-path" value="/vid-app-common/target/classes"/>
- <property name="component.exclusion.patterns" value="WEB-INF/lib/*.jar"/>
- <property name="context-root" value="vid-common"/>
- </wb-module>
-</project-modules>
diff --git a/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
deleted file mode 100755
index b01fdb78f..000000000
--- a/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<root>
- <facet id="jst.jaxrs">
- <node name="libprov">
- <attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
- </node>
- </facet>
-</root>
diff --git a/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml b/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100755
index 91e8c54be..000000000
--- a/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <fixed facet="wst.jsdt.web"/>
- <installed facet="java" version="1.8"/>
- <installed facet="jst.web" version="3.1"/>
- <installed facet="jst.jaxrs" version="2.0"/>
- <installed facet="wst.jsdt.web" version="1.0"/>
-</faceted-project>
diff --git a/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container b/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container
deleted file mode 100755
index 3bd5d0a48..000000000
--- a/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file
diff --git a/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name b/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name
deleted file mode 100755
index 05bd71b6e..000000000
--- a/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name
+++ /dev/null
@@ -1 +0,0 @@
-Window \ No newline at end of file
diff --git a/vid-app-common/.settings/org.eclipse.wst.validation.prefs b/vid-app-common/.settings/org.eclipse.wst.validation.prefs
deleted file mode 100755
index 6f1cba68d..000000000
--- a/vid-app-common/.settings/org.eclipse.wst.validation.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-disabled=06target
-eclipse.preferences.version=1
diff --git a/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java b/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java
index 59fe61fd0..88875b510 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java
@@ -1,12 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright 2018 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.controllers;
+import static org.onap.vid.utils.Logging.getMethodName;
+import static org.springframework.http.HttpStatus.BAD_REQUEST;
+import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
+import static org.springframework.http.HttpStatus.OK;
+
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.Collection;
+import java.util.Collections;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.json.simple.JSONArray;
import org.onap.portalsdk.core.controller.UnRestrictedBaseController;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.vid.changeManagement.*;
+import org.onap.vid.changeManagement.ChangeManagementRequest;
+import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest;
+import org.onap.vid.changeManagement.GetWorkflowsResponse;
+import org.onap.vid.changeManagement.VnfWorkflowRelationAllResponse;
+import org.onap.vid.changeManagement.VnfWorkflowRelationRequest;
+import org.onap.vid.changeManagement.VnfWorkflowRelationResponse;
import org.onap.vid.exceptions.NotFoundException;
import org.onap.vid.model.ExceptionResponse;
import org.onap.vid.model.MsoExceptionResponse;
@@ -18,17 +54,18 @@ import org.onap.vid.services.WorkflowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.WebApplicationException;
-import java.util.Collection;
-import java.util.Collections;
-
-import static org.onap.vid.utils.Logging.getMethodName;
-import static org.springframework.http.HttpStatus.*;
-
/**
* Controller to handle ChangeManagement feature requests.
*/
@@ -68,8 +105,7 @@ public class ChangeManagementController extends UnRestrictedBaseController {
}
@RequestMapping(value = "/workflow/{vnfName}", method = RequestMethod.POST)
- public ResponseEntity<String> changeManagement(@PathVariable("vnfName") String vnfName,
- HttpServletRequest request,
+ public ResponseEntity<String> changeManagement(HttpServletRequest request, @PathVariable("vnfName") String vnfName,
@RequestBody ChangeManagementRequest changeManagmentRequest)
throws Exception {
return this.changeManagementService.doChangeManagement(changeManagmentRequest, vnfName);
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java
index 91617ff42..85caac424 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java
@@ -22,6 +22,7 @@ package org.onap.vid.model;
* ============LICENSE_END=========================================================
*/
+import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@@ -82,7 +83,7 @@ public class CategoryParameter extends VidBaseEntity {
@OneToMany(fetch = FetchType.EAGER, mappedBy = "categoryParameter")
public Set<CategoryParameterOption> getOptions() {
- return options;
+ return Collections.unmodifiableSet(options);
}
public void setOptions(Set<CategoryParameterOption> options) {
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index c5bee2448..acdf0afb5 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -235,8 +235,7 @@ public class AaiServiceImpl implements AaiService {
resultList.add(getServicesByProjectNames(projects, roleValidator));
}
if (!resultList.isEmpty()) {
- Intersection<ServiceInstanceSearchResult> intersection = new Intersection<>();
- serviceInstancesSearchResults.serviceInstances = intersection.intersectMultipileArray(resultList);
+ serviceInstancesSearchResults.serviceInstances = Intersection.of(resultList);
}
return new AaiResponse<>(serviceInstancesSearchResults, null, HttpStatus.SC_OK);
diff --git a/vid-app-common/src/main/java/org/onap/vid/utils/Intersection.java b/vid-app-common/src/main/java/org/onap/vid/utils/Intersection.java
index 6e0d1fc25..ed1be5c76 100644
--- a/vid-app-common/src/main/java/org/onap/vid/utils/Intersection.java
+++ b/vid-app-common/src/main/java/org/onap/vid/utils/Intersection.java
@@ -1,31 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.utils;
-import java.util.List;
-import java.util.stream.Collectors;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
-/**
- * Created by moriya1 on 10/10/2017.
- */
-public class Intersection<T> {
- public List<T> intersectMultipileArray(List<List<T>> lists) {
- if (lists.size() == 1) {
- return lists.get(0);
- } else {
- List<T> intersectResult = intersectTwoArrays(lists.get(0),lists.get(1));
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
- lists.remove(0);
- lists.remove(0);
- lists.add(0,intersectResult);
- return intersectMultipileArray(lists);
- }
+public class Intersection {
+ private Intersection() {
}
- public List<T> intersectTwoArrays(List<T> list1, List<T> list2) {
-
- List<T> intersect = list1.stream()
- .filter(list2::contains)
- .collect(Collectors.toList());
- return intersect;
+ /**
+ * Returns intersection of given lists. Treats those lists as sets, ignores repetitions.
+ */
+ public static <T> List<T> of(Collection<List<T>> lists) {
+ return lists
+ .stream()
+ .map(elements -> (Set<T>) Sets.newHashSet(elements))
+ .reduce(Sets::intersection)
+ .map(set -> (List<T>) Lists.newArrayList(set))
+ .orElse(Collections.emptyList());
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java
index 58406a662..3c8250b26 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java
@@ -1,157 +1,455 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright 2018 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.controllers;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.BDDMockito.willThrow;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.isA;
+import static org.onap.vid.controllers.ChangeManagementController.CHANGE_MANAGEMENT;
+import static org.onap.vid.controllers.ChangeManagementController.GET_VNF_WORKFLOW_RELATION;
+import static org.onap.vid.controllers.ChangeManagementController.SCHEDULER_BY_SCHEDULE_ID;
+import static org.onap.vid.controllers.ChangeManagementController.VNF_WORKFLOW_RELATION;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableList;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Scanner;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.log4j.BasicConfigurator;
import org.json.simple.JSONArray;
+import org.junit.Before;
import org.junit.Test;
-import org.onap.vid.changeManagement.ChangeManagementRequest;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest;
-import org.onap.vid.changeManagement.VnfWorkflowRelationRequest;
-import org.onap.vid.mso.MsoResponseWrapperInterface;
-import org.onap.vid.services.ChangeManagementServiceImpl;
-import org.onap.vid.services.WorkflowServiceImpl;
+import org.onap.vid.changeManagement.GetWorkflowsResponse;
+import org.onap.vid.changeManagement.VnfDetailsWithWorkflows;
+import org.onap.vid.changeManagement.VnfWorkflowRelationAllResponse;
+import org.onap.vid.changeManagement.VnfWorkflowRelationResponse;
+import org.onap.vid.domain.mso.InstanceIds;
+import org.onap.vid.domain.mso.RequestStatus;
+import org.onap.vid.exceptions.NotFoundException;
+import org.onap.vid.model.ExceptionResponse;
+import org.onap.vid.mso.rest.Request;
+import org.onap.vid.services.ChangeManagementService;
+import org.onap.vid.services.WorkflowService;
+import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletRequest;
-import java.util.Collection;
-
+@RunWith(MockitoJUnitRunner.class)
public class ChangeManagementControllerTest {
- private ChangeManagementController createTestSubject() {
- return new ChangeManagementController(new WorkflowServiceImpl(), new ChangeManagementServiceImpl(null, null, null),
- null);
+ private static final String FILE_NAME = "file";
+ private static final String GET_VNF_WORKFLOW_RELATION_URL =
+ "/" + CHANGE_MANAGEMENT + "/" + GET_VNF_WORKFLOW_RELATION;
+ private static final String WORKFLOW_URL = "/" + CHANGE_MANAGEMENT + "/workflow";
+ private static final String WORKFLOW_NAME_URL = WORKFLOW_URL + "/{name}";
+ private static final String MSO_URL = "/" + CHANGE_MANAGEMENT + "/mso";
+ private static final String UPLOAD_CONFIG_UPDATE_FILE_URL = "/" + CHANGE_MANAGEMENT + "/uploadConfigUpdateFile";
+ private static final String SCHEDULER_URL = "/" + CHANGE_MANAGEMENT + "/scheduler";
+ private static final String SCHEDULER_BY_SCHEDULE_ID_URL = "/" + CHANGE_MANAGEMENT + SCHEDULER_BY_SCHEDULE_ID;
+ private static final String VNF_WORKFLOW_RELATION_URL = "/" + CHANGE_MANAGEMENT + "/" + VNF_WORKFLOW_RELATION;
+ private static final String VNFS = "vnfs";
+
+ private static final String FAILED_TO_GET_MSG = "Failed to get workflows for vnf";
+ private static final String FAILED_TO_ADD_MSG = "Failed to add vnf to workflow relation";
+ private static final String FAILED_TO_GET_ALL_MSG = "Failed to get all vnf to workflow relations";
+ private static final String FAILED_TO_DELETE_MSG = "Failed to delete vnf from workflow relation";
+
+ private final ObjectMapper objectMapper = new ObjectMapper();
+ private ChangeManagementController controller;
+ private MockMvc mockMvc;
+ @Mock
+ private WorkflowService workflowService;
+ @Mock
+ private ChangeManagementService changeManagementService;
+ @Mock
+ private Response mockResponse;
+ @Mock
+ private Response.StatusType statusType;
+ private ClassLoader classLoader = getClass().getClassLoader();
+ private final String CHANGE_MANAGEMENT_REQUEST_JSON = getRequestContent("change-management-request.json");
+ private final String GET_VNF_WORKFLOW_RELATION_REQUEST_JSON = getRequestContent(
+ "get-vnf-workflow-relation-request.json");
+ private final String VNF_WORKFLOW_RELATION_REQUEST_JSON = getRequestContent("vnf-workflow-relation-request.json");
+
+ @Before
+ public void setUp() {
+ controller = new ChangeManagementController(workflowService, changeManagementService, objectMapper);
+ BasicConfigurator.configure();
+ mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
}
@Test
- public void testGetWorkflow() throws Exception {
- ChangeManagementController testSubject;
- Collection<String> vnfs = null;
- ResponseEntity<Collection<String>> result;
+ public void getWorkflow_shouldReturnListOfVnfs_whenServiceReturnsCorrectValue() throws Exception {
- // default test
- testSubject = createTestSubject();
- try {
- result = testSubject.getWorkflow(vnfs);
- } catch (
+ Collection<String> givenVnfs = ImmutableList.of("vnf1", "vnf2", "vnf3");
+ Collection<String> resultWorkflows = ImmutableList.of("workflow1", "workflow2");
- Exception e) {
- }
+ given(
+ workflowService.getWorkflowsForVNFs(argThat(other -> CollectionUtils.isEqualCollection(givenVnfs, other))))
+ .willReturn(resultWorkflows);
+
+ mockMvc.perform(get(WORKFLOW_URL)
+ .param(VNFS, StringUtils.join(givenVnfs, ",")))
+ .andExpect(status().isOk())
+ .andExpect(content().json(objectMapper.writeValueAsString(resultWorkflows)));
}
@Test
- public void testGetMSOChangeManagements() throws Exception {
- ChangeManagementController testSubject;
+ public void getMSOChangeManagements_shouldReturnCollectionOfRequests_whenServiceReturnsCorrectValue()
+ throws Exception {
- // default test
- testSubject = createTestSubject();
- try {
- testSubject.getMSOChangeManagements();
- } catch (
+ Collection<Request> requests = ImmutableList.of(
+ createRequest("network-instance-id-1", "status-message-1"),
+ createRequest("network-instance-id-2", "status-message-2"));
- Exception e) {
- }
+ given(changeManagementService.getMSOChangeManagements()).willReturn(requests);
+
+ mockMvc.perform(get(MSO_URL))
+ .andExpect(status().isOk())
+ .andExpect(content().json(objectMapper.writeValueAsString(requests)));
}
@Test
- public void testChangeManagement() throws Exception {
- ChangeManagementController testSubject;
- String vnfName = "";
- HttpServletRequest request = null;
- ChangeManagementRequest changeManagmentRequest = null;
- ResponseEntity<String> result;
+ public void changeManagement_shouldReturnOkResponse_whenServiceReturnsCorrectValue() throws Exception {
+
+ String vnfName = "vnfName1";
+ String jsonBody = "{'param1': 'paramparam'}";
+
+ given(changeManagementService.doChangeManagement(
+ argThat(request -> matches(request, CHANGE_MANAGEMENT_REQUEST_JSON)), eq(vnfName)))
+ .willReturn(ResponseEntity.ok().body(jsonBody));
+
+ mockMvc.perform(post(WORKFLOW_NAME_URL, vnfName)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(CHANGE_MANAGEMENT_REQUEST_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().json(jsonBody));
+ }
+
+ @Test
+ public void uploadConfigUpdateFile_shouldReturnOkResponse_whenServiceReturnsCorrectJson() throws Exception {
+
+ String jsonString = "{'param1': 'paramparam'}";
+ byte[] fileContent = "some file content".getBytes(StandardCharsets.UTF_8);
+ MockMultipartFile file = new MockMultipartFile(FILE_NAME, fileContent);
+
+ given(changeManagementService
+ .uploadConfigUpdateFile(argThat(multipartFileMatcher(file))))
+ .willReturn(jsonString);
- // default test
- testSubject = createTestSubject();
- result = testSubject.changeManagement(vnfName, request, changeManagmentRequest);
+ mockMvc.perform(MockMvcRequestBuilders
+ .fileUpload(UPLOAD_CONFIG_UPDATE_FILE_URL)
+ .file(file))
+ .andExpect(status().isOk())
+ .andExpect(content().json(jsonString));
}
@Test
- public void testUploadConfigUpdateFile() throws Exception {
- ChangeManagementController testSubject;
- MultipartFile file = null;
- ResponseEntity result;
+ public void uploadConfigUpdateFile_shouldReturnResponseStatus_whenServiceThrowsWebApplicationException()
+ throws Exception {
- // default test
- testSubject = createTestSubject();
- result = testSubject.uploadConfigUpdateFile(file);
+ byte[] fileContent = "some file content".getBytes(StandardCharsets.UTF_8);
+ MockMultipartFile file = new MockMultipartFile(FILE_NAME, fileContent);
+
+ given(statusType.getStatusCode()).willReturn(HttpStatus.NOT_FOUND.value());
+ given(mockResponse.getStatus()).willReturn(HttpStatus.NOT_FOUND.value());
+ given(mockResponse.getStatusInfo()).willReturn(statusType);
+
+ WebApplicationException exception = new WebApplicationException(mockResponse);
+
+ willThrow(exception).given(changeManagementService)
+ .uploadConfigUpdateFile(argThat(multipartFileMatcher(file)));
+
+ mockMvc.perform(MockMvcRequestBuilders
+ .fileUpload(UPLOAD_CONFIG_UPDATE_FILE_URL)
+ .file(file))
+ .andExpect(status().isNotFound())
+ .andExpect(content().json(objectMapper.writeValueAsString(new ExceptionResponse(exception))));
}
@Test
- public void testGetSchedulerChangeManagements() throws Exception {
- ChangeManagementController testSubject;
- ResponseEntity<JSONArray> result;
+ public void uploadConfigUpdateFile_shouldReturnInternalServerError_whenServiceThrowsRuntimeException()
+ throws Exception {
+
+ byte[] fileContent = "some file content".getBytes(StandardCharsets.UTF_8);
+ MockMultipartFile file = new MockMultipartFile(FILE_NAME, fileContent);
+
+ RuntimeException exception = new RuntimeException("runtime exception message");
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSchedulerChangeManagements();
+ willThrow(exception).given(changeManagementService)
+ .uploadConfigUpdateFile(argThat(multipartFileMatcher(file)));
+
+ mockMvc.perform(MockMvcRequestBuilders
+ .fileUpload(UPLOAD_CONFIG_UPDATE_FILE_URL)
+ .file(file))
+ .andExpect(status().isInternalServerError())
+ .andExpect(content().json(objectMapper.writeValueAsString(new ExceptionResponse(exception))));
}
@Test
- public void testDeleteSchedule() throws Exception {
- ChangeManagementController testSubject;
- String scheduleId = "";
- ResponseEntity result;
+ public void getSchedulerChangeManagements_shouldReturnJsonArray_whenServiceReturnsCorrectValue() throws Exception {
+
+ JSONArray array = new JSONArray();
+ array.add("element1");
+ array.add("element2");
+
+ given(changeManagementService.getSchedulerChangeManagements()).willReturn(array);
- // default test
- testSubject = createTestSubject();
- result = testSubject.deleteSchedule(scheduleId);
+ mockMvc.perform(get(SCHEDULER_URL))
+ .andExpect(status().isOk())
+ .andExpect(content().json(array.toJSONString()));
}
@Test
- public void testGetWorkflows() throws Exception {
- ChangeManagementController testSubject;
- GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null;
- ResponseEntity result;
+ public void deleteSchedule_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+ String id = "schedule-id-1";
+ Pair<String, Integer> pair = new ImmutablePair<>("myString", HttpStatus.OK.value());
+
+ given(changeManagementService.deleteSchedule(id)).willReturn(pair);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getWorkflows(getVnfWorkflowRelationRequest);
+ mockMvc.perform(delete(SCHEDULER_BY_SCHEDULE_ID_URL, id))
+ .andExpect(status().isOk());
}
@Test
- public void testCreateWorkflowRelation() throws Exception {
- ChangeManagementController testSubject;
- VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
- ResponseEntity result;
+ public void deleteSchedule_shouldReturnNotFoundResponse_whenServiceReturnsNotFoundStatus() throws Exception {
- // default test
- testSubject = createTestSubject();
- result = testSubject.createWorkflowRelation(vnfWorkflowRelationRequest);
+ String id = "schedule-id-1";
+ Pair<String, Integer> pair = new ImmutablePair<>("myString", HttpStatus.NOT_FOUND.value());
+
+ given(changeManagementService.deleteSchedule(id)).willReturn(pair);
+
+ mockMvc.perform(delete(SCHEDULER_BY_SCHEDULE_ID_URL, id))
+ .andExpect(status().isNotFound());
}
@Test
- public void testGetAllWorkflowRelation() throws Exception {
- ChangeManagementController testSubject;
- ResponseEntity result;
+ public void getWorkflows_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+ ImmutableList<String> elements = ImmutableList.of("workflow1", "workflow2");
+ GetWorkflowsResponse response = new GetWorkflowsResponse();
+ response.setWorkflows(elements);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAllWorkflowRelation();
+ given(changeManagementService
+ .getWorkflowsForVnf(argThat(request -> matches(request, GET_VNF_WORKFLOW_RELATION_REQUEST_JSON))))
+ .willReturn(elements);
+
+ mockMvc.perform(post(GET_VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(GET_VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
}
@Test
- public void testDeleteWorkflowRelation() throws Exception {
- ChangeManagementController testSubject;
- VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
- ResponseEntity result;
+ public void getWorkflows_shouldReturnNotFound_whenServiceThrowsNotFoundException() throws Exception {
+
+ String errorMsg = "not found";
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(errorMsg));
+
+ willThrow(new NotFoundException(errorMsg))
+ .given(changeManagementService)
+ .getWorkflowsForVnf(argThat(request -> matches(request, GET_VNF_WORKFLOW_RELATION_REQUEST_JSON)));
- // default test
- testSubject = createTestSubject();
- result = testSubject.deleteWorkflowRelation(vnfWorkflowRelationRequest);
+ mockMvc.perform(post(GET_VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(GET_VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isNotFound())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
}
@Test
- public void testClientDerivedExceptionAsBadRequest() throws Exception {
- ChangeManagementController testSubject;
- Exception e = null;
- MsoResponseWrapperInterface result;
+ public void getWorkflows_shouldReturnInternalServerError_whenServiceThrowsRuntimeException() throws Exception {
- // default test
- try {
- testSubject = createTestSubject();
- result = testSubject.clientDerivedExceptionAsBadRequest(e);
- } catch (
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_GET_MSG));
+
+ willThrow(new RuntimeException("runtime exception message"))
+ .given(changeManagementService).getWorkflowsForVnf(isA(GetVnfWorkflowRelationRequest.class));
- Exception ex) {
+ mockMvc.perform(post(GET_VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isInternalServerError())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ @Test
+ public void createWorkflowRelation_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse();
+
+ given(changeManagementService
+ .addVnfWorkflowRelation(argThat(request -> matches(request, VNF_WORKFLOW_RELATION_REQUEST_JSON))))
+ .willReturn(response);
+
+ mockMvc.perform(post(VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ @Test
+ public void createWorkflowRelation_shouldReturnInternalServerError_whenServiceThrowsException() throws Exception {
+
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_ADD_MSG));
+
+ willThrow(new RuntimeException("runtime exception message"))
+ .given(changeManagementService).addVnfWorkflowRelation(argThat(request -> matches(request,
+ VNF_WORKFLOW_RELATION_REQUEST_JSON)));
+
+ mockMvc.perform(post(VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isInternalServerError())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ @Test
+ public void getAllWorkflowRelation_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+ VnfDetailsWithWorkflows workflows = new VnfDetailsWithWorkflows();
+ workflows.setWorkflows(ImmutableList.of("workflow1", "workflow2"));
+ VnfWorkflowRelationAllResponse response = new VnfWorkflowRelationAllResponse(ImmutableList.of(workflows));
+
+ given(changeManagementService.getAllVnfWorkflowRelations()).willReturn(response);
+
+ mockMvc.perform(get(VNF_WORKFLOW_RELATION_URL))
+ .andExpect(status().isOk())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ @Test
+ public void getAllWorkflowRelation_shouldReturnInternalServerError_whenServiceThrowsRuntimeException()
+ throws Exception {
+
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_GET_ALL_MSG));
+
+ willThrow(new RuntimeException("runtime exception message"))
+ .given(changeManagementService).getAllVnfWorkflowRelations();
+
+ mockMvc.perform(get(VNF_WORKFLOW_RELATION_URL))
+ .andExpect(status().isInternalServerError())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ @Test
+ public void deleteWorkflowRelation_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of("abc"));
+
+ given(changeManagementService.deleteVnfWorkflowRelation(argThat(request -> matches(request,
+ VNF_WORKFLOW_RELATION_REQUEST_JSON))))
+ .willReturn(response);
+
+ mockMvc.perform(delete(VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ @Test
+ public void deleteWorkflowRelation_shouldReturnInternalServerError_whenServiceThrowsRuntimeException()
+ throws Exception {
+ VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_DELETE_MSG));
+
+ willThrow(new RuntimeException("runtime exception message"))
+ .given(changeManagementService).deleteVnfWorkflowRelation(argThat(request -> matches(request,
+ VNF_WORKFLOW_RELATION_REQUEST_JSON)));
+
+ mockMvc.perform(delete(VNF_WORKFLOW_RELATION_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+ .andExpect(status().isInternalServerError())
+ .andExpect(content().json(objectMapper.writeValueAsString(response)));
+ }
+
+ private <T> boolean matches(T request, String expectedJson) {
+ try {
+ return objectMapper.writeValueAsString(request).equals(expectedJson);
+ } catch (JsonProcessingException e) {
+ System.out.println("Exception occurred: " + e.getMessage());
}
+ return false;
+ }
+
+ private ArgumentMatcher<MultipartFile> multipartFileMatcher(MultipartFile otherFile) {
+ return other -> {
+ try {
+ return other.getName().equals(otherFile.getName())
+ && other.getSize() == otherFile.getSize()
+ && Arrays.equals(other.getBytes(), otherFile.getBytes());
+ } catch (IOException e) {
+ System.out.println("IOException occurred: " + e.getMessage());
+ }
+ return false;
+ };
+ }
+
+ private Request createRequest(String networkInstanceId, String statusMessage) {
+ Request req = new Request();
+ InstanceIds instanceIds = new InstanceIds();
+ instanceIds.setNetworkInstanceId(networkInstanceId);
+
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setStatusMessage(statusMessage);
+
+ req.setInstanceIds(instanceIds);
+ req.setRequestStatus(requestStatus);
+
+ return req;
+ }
+
+ private String getRequestContent(String filename) {
+ InputStream inputStream = classLoader.getResourceAsStream(filename);
+ return new Scanner(inputStream).useDelimiter("\\A").next().replaceAll("\\s+", "");
}
} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java
index 7a4263c7e..3492a7547 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java
@@ -95,7 +95,8 @@ public class CategoryParameterServiceImplTest {
AddCategoryOptionsRequest optionsRequest = new AddCategoryOptionsRequest();
optionsRequest.options.add(OPTION_NAME);
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
- categoryParameter.getOptions().add(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter));
+ CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+ categoryParameter.addOption(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter));
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
String expectedError = String.format(CategoryParameterServiceImpl.OPTION_ALREADY_EXIST_FOR_CATEGORY
@@ -155,9 +156,10 @@ public class CategoryParameterServiceImplTest {
@Test
public void deleteCategoryOption_happyPath() {
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+ CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
CategoryParameterOption categoryParameterOption =
- new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter);
- categoryParameter.getOptions().add(categoryParameterOption);
+ new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter);
+ categoryParameter.addOption(categoryParameterOption);
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
doReturn(aList).when(dataAccessService).getList(any(), anyString(), any(), any());
@@ -171,9 +173,10 @@ public class CategoryParameterServiceImplTest {
@Test
public void getCategoryParametersTest() {
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+ CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
CategoryParameterOption categoryParameterOption =
- new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter);
- categoryParameter.getOptions().add(categoryParameterOption);
+ new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter);
+ categoryParameter.addOption(categoryParameterOption);
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
doReturn(aList).when(dataAccessService).getList(any(), anyString(), any(), any());
@@ -191,8 +194,9 @@ public class CategoryParameterServiceImplTest {
public void updateCategoryParameterOption_domainObjectGetsSavedSuccessfully() {
CategoryParameterOptionRep optionRepExisting = new CategoryParameterOptionRep(APP_ID_VID, OPTION_NAME);
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
- categoryParameter.getOptions().add(
- new CategoryParameterOption(APP_ID_VID, UNIQUE_OPTION_NAME, categoryParameter));
+ CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+ categoryParameter.addOption(
+ new CategoryParameterOption(APP_ID_VID, UNIQUE_OPTION_NAME, anotherCategoryParameter));
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
doReturn(aList).when(dataAccessService).getList(CategoryParameter.class, QUERY_STRING_FOR_CATEGORY_NAME, null, null);
@@ -207,7 +211,8 @@ public class CategoryParameterServiceImplTest {
public void updateCategoryParameterOption_shouldFailUpdateForbidden() {
CategoryParameterOptionRep optionRep = new CategoryParameterOptionRep("1", CATEGORY_NAME);
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, false);
- categoryParameter.getOptions().add(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter));
+ CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, false);
+ categoryParameter.addOption(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter));
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
doReturn(aList).when(dataAccessService).getList(CategoryParameter.class, QUERY_STRING_FOR_CATEGORY_NAME, null, null);
@@ -222,7 +227,8 @@ public class CategoryParameterServiceImplTest {
CategoryParameterOptionRep optionRep = new CategoryParameterOptionRep("SOME_UNRELATED_ID", CATEGORY_NAME);
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
- categoryParameter.getOptions().add(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, categoryParameter));
+ CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
+ categoryParameter.addOption(new CategoryParameterOption(APP_ID_VID, OPTION_NAME, anotherCategoryParameter));
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
doReturn(aList).when(dataAccessService).getList(CategoryParameter.class, QUERY_STRING_FOR_CATEGORY_NAME, null, null);
@@ -238,9 +244,9 @@ public class CategoryParameterServiceImplTest {
CategoryParameter categoryParameter = createCategoryParameter(CATEGORY_NAME, true);
CategoryParameter anotherCategoryParameter = createCategoryParameter(CATEGORY_NAME, true);
- categoryParameter.getOptions().add(
+ categoryParameter.addOption(
new CategoryParameterOption(APP_ID_VID, UNIQUE_OPTION_NAME, anotherCategoryParameter));
- categoryParameter.getOptions().add(
+ categoryParameter.addOption(
new CategoryParameterOption(APP_ID_SDC, OPTION_NAME, anotherCategoryParameter));
List<CategoryParameter> aList = createCategoryParametersList(categoryParameter);
diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java
index c766d26f3..dcccab008 100644
--- a/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/IntersectionTest.java
@@ -1,101 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.vid.testUtils;
-import org.junit.Assert;
import org.junit.Test;
import org.onap.vid.utils.Intersection;
-import java.util.ArrayList;
import java.util.List;
-/**
- * Created by moriya1 on 10/10/2017.
- */
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.util.Lists.emptyList;
+import static org.assertj.core.util.Lists.list;
+
public class IntersectionTest {
@Test
- public void testFourArrays(){
- List<String> l1 = new ArrayList<String>();
- l1.add("1");
- l1.add("2");
-
- List<String> l2 = new ArrayList<String>();
- l2.add("2");
- l2.add("3");
-
- List<String> l3 = new ArrayList<String>();
- l3.add("2");
- l3.add("4");
-
- List<String> l4 = new ArrayList<String>();
- l4.add("2");
- l4.add("5");
-
- List<List<String>> all = new ArrayList<>();
- all.add(l1);
- all.add(l2);
- all.add(l3);
- all.add(l4);
- Intersection<String> m = new Intersection<>();
- List<String> ans = m.intersectMultipileArray(all);
- Assert.assertEquals(1,ans.size());
- Assert.assertEquals(ans.get(0),"2");
+ public void testFourArrays() {
+ // given
+ List<List<String>> input = list(
+ list("1", "2"),
+ list("2", "3"),
+ list("2", "4"),
+ list("2", "5")
+ );
+ // when
+ List<String> output = Intersection.of(input);
+ // then
+ assertThat(output).containsExactlyInAnyOrder("2");
}
-
-
@Test
- public void testTwoArrays(){
- List<String> l1 = new ArrayList<String>();
- l1.add("1");
- l1.add("2");
-
- List<String> l2 = new ArrayList<String>();
- l2.add("2");
- l2.add("3");
-
- List<List<String>> all = new ArrayList<>();
- all.add(l1);
- all.add(l2);
- Intersection<String> m = new Intersection<>();
- List<String> l3 = m.intersectMultipileArray(all);
- Assert.assertEquals(l3.size(),1);
- Assert.assertEquals(l3.get(0),"2");
+ public void testTwoArrays() {
+ // given
+ List<List<String>> input = list(
+ list("1", "2"),
+ list("2", "3")
+ );
+ // when
+ List<String> output = Intersection.of(input);
+ // then
+ assertThat(output).containsExactlyInAnyOrder("2");
}
@Test
- public void testNoIntersection(){
- List<String> l1 = new ArrayList<String>();
- l1.add("1");
- l1.add("2");
-
- List<String> l2 = new ArrayList<String>();
- l2.add("3");
- l2.add("4");
+ public void testNoIntersection() {
+ // given
+ List<List<String>> input = list(
+ list("1", "2"),
+ list("3", "4")
+ );
+ // when
+ List<String> output = Intersection.of(input);
+ // then
+ assertThat(output).isEmpty();
- List<List<String>> all = new ArrayList<>();
- all.add(l1);
- all.add(l2);
- Intersection<String> m = new Intersection<>();
- List<String> l3 = m.intersectMultipileArray(all);
- Assert.assertEquals(l3.size(),0);
+ }
+ @Test
+ public void testOneArray() {
+ // given
+ List<List<String>> input = list(list("1", "2"));
+ // when
+ List<String> output = Intersection.of(input);
+ // then
+ assertThat(output).containsExactlyInAnyOrder("1", "2");
}
@Test
- public void testOneArrays(){
- List<String> l1 = new ArrayList<String>();
- l1.add("1");
- l1.add("2");
- List<List<String>> all = new ArrayList<>();
- all.add(l1);
- Intersection<String> m = new Intersection<>();
- List<String> l3 = m.intersectMultipileArray(all);
- Assert.assertEquals(l3.size(),2);
- Assert.assertEquals(l3.get(0),"1");
- Assert.assertEquals(l3.get(1),"2");
+ public void testEmptyInput() {
+ // when
+ List<String> output = Intersection.of(emptyList());
+ // then
+ assertThat(output).isEmpty();
+ }
+ @Test
+ public void shouldIgnoreRepetitions() {
+ // when
+ List<String> output = Intersection.of(list(
+ list("1", "1"),
+ list("1", "1")
+ ));
+ // then
+ assertThat(output).containsExactly("1");
}
}
diff --git a/vid-app-common/src/test/resources/change-management-request.json b/vid-app-common/src/test/resources/change-management-request.json
new file mode 100644
index 000000000..09a33b508
--- /dev/null
+++ b/vid-app-common/src/test/resources/change-management-request.json
@@ -0,0 +1,47 @@
+{
+ "requestDetails": [
+ {
+ "modelInfo": {
+ "modelCustomizationName": "vSAMP12 1",
+ "modelCustomizationId": "c539433a-84a6-4082-a12e-5c9b00c3b960",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "254583ad-b38c-498b-bdbd-b8de5e07541b",
+ "modelName": "vSAMP12",
+ "modelType": "vnf",
+ "modelVersion": "2.0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "az2016"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "usePreload": true
+ },
+ "vnfName": "Name",
+ "vnfInstanceId": "Test",
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "{serviceInstanceId}",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "9ebb1521-2e74-47a4-aac7-e71a79f73a79",
+ "modelName": "{parent service model name}",
+ "modelVersion": "2.0",
+ "modelCustomizationName": "vSAMP12 1",
+ "modelCustomizationId": "c539433a-84a6-4082-a12e-5c9b00c3b960"
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "requestType": null
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json b/vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json
new file mode 100644
index 000000000..6bc51e618
--- /dev/null
+++ b/vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json
@@ -0,0 +1,28 @@
+{
+ "vnfsDetails": [
+ {
+ "UUID": "uuid-1",
+ "invariantUUID": "invariantUUID-1"
+ },
+ {
+ "UUID": "uuid-2",
+ "invariantUUID": "invariantUUID-2"
+ },
+ {
+ "UUID": "uuid-3",
+ "invariantUUID": "invariantUUID-3"
+ },
+ {
+ "UUID": "uuid-4",
+ "invariantUUID": "invariantUUID-4"
+ },
+ {
+ "UUID": "uuid-5",
+ "invariantUUID": "invariantUUID-5"
+ },
+ {
+ "UUID": "uuid-6",
+ "invariantUUID": "invariantUUID-6"
+ }
+ ]
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vnf-workflow-relation-request.json b/vid-app-common/src/test/resources/vnf-workflow-relation-request.json
new file mode 100644
index 000000000..4794a933b
--- /dev/null
+++ b/vid-app-common/src/test/resources/vnf-workflow-relation-request.json
@@ -0,0 +1,25 @@
+{
+ "workflowsDetails": [
+ {
+ "vnfDetails": {
+ "UUID": "uuid-1",
+ "invariantUUID": "invariantUuid-1"
+ },
+ "workflowName": "workflow-name-1"
+ },
+ {
+ "vnfDetails": {
+ "UUID": "uuid-1",
+ "invariantUUID": "invariantUuid-1"
+ },
+ "workflowName": "workflow-name-1"
+ },
+ {
+ "vnfDetails": {
+ "UUID": "uuid-1",
+ "invariantUUID": "invariantUuid-1"
+ },
+ "workflowName": "workflow-name-1"
+ }
+ ]
+} \ No newline at end of file
diff --git a/vid-automation/.gitignore b/vid-automation/.gitignore
index 4ced2a7e4..2b83d1e35 100644
--- a/vid-automation/.gitignore
+++ b/vid-automation/.gitignore
@@ -1,43 +1,8 @@
-# Created by .ignore support plugin (hsz.mobi)
-### Java template
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-### Maven template
+.idea/
target/
-pom.xml.tag
-pom.xml.releaseBackup
-pom.xml.versionsBackup
-pom.xml.next
-release.properties
-dependency-reduced-pom.xml
-buildNumber.properties
-.mvn/timing.properties
-
-# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
-!/.mvn/wrapper/maven-wrapper.jar
-
-.idea/*
-target/*
*.iml
ExtentReport
-/bin/
+bin/
+.classpath
+.project
+.settings/ \ No newline at end of file
diff --git a/vid-ext-services-simulator/.classpath b/vid-ext-services-simulator/.classpath
deleted file mode 100644
index 6d7587a81..000000000
--- a/vid-ext-services-simulator/.classpath
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/vid-ext-services-simulator/.gitignore b/vid-ext-services-simulator/.gitignore
new file mode 100644
index 000000000..49d421bb7
--- /dev/null
+++ b/vid-ext-services-simulator/.gitignore
@@ -0,0 +1,5 @@
+.classpath
+.project
+target/
+*.iml
+.settings/ \ No newline at end of file
diff --git a/vid-ext-services-simulator/.project b/vid-ext-services-simulator/.project
deleted file mode 100644
index e84b17476..000000000
--- a/vid-ext-services-simulator/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>vid-ext-services-simulator</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
diff --git a/vid-ext-services-simulator/.settings/org.eclipse.core.resources.prefs b/vid-ext-services-simulator/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 8fb0e2600..000000000
--- a/vid-ext-services-simulator/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/main/resources=UTF-8
diff --git a/vid-ext-services-simulator/.settings/org.eclipse.jdt.core.prefs b/vid-ext-services-simulator/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 714351aec..000000000
--- a/vid-ext-services-simulator/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/vid-ext-services-simulator/.settings/org.eclipse.m2e.core.prefs b/vid-ext-services-simulator/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f1c..000000000
--- a/vid-ext-services-simulator/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/vid-webpack-master/.gitignore b/vid-webpack-master/.gitignore
index cb1cd7b1d..a4d376c64 100644
--- a/vid-webpack-master/.gitignore
+++ b/vid-webpack-master/.gitignore
@@ -1,3 +1,6 @@
+# Target
+target/
+
# Logs
logs
*.log