diff options
Diffstat (limited to 'bpmn')
101 files changed, 4120 insertions, 3047 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index e5becbf6cc..c0e657479f 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -1,604 +1,510 @@ -<?xml version="1.0"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.openecomp.so</groupId>
- <artifactId>bpmn</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
- <artifactId>MSOCommonBPMN</artifactId>
- <name>MSOCommonBPMN</name>
- <packaging>war</packaging>
-
- <properties>
- <camunda.version>7.6.0</camunda.version>
- <spring.version>4.3.2.RELEASE</spring.version>
- <httpclient.version>3.1</httpclient.version>
- <jax.ws.rs>2.0.1</jax.ws.rs>
- <jackson.version>1.1.1</jackson.version>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- </properties>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <execution>
- <id>test-compile</id>
- <phase>compile</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <!-- Build MSOCommonBPMN-${version}.jar -->
- <id>default-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <excludes>
- <exclude>org/openecomp/mso/bpmn/common/MSOCommonApplication.class</exclude>
- <!-- <exclude>META-INF/</exclude> -->
- </excludes>
- </configuration>
- </execution>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- <configuration>
- <forceCreation>true</forceCreation>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>3.0.0</version>
- <executions>
- <execution>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
- <type>jar</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-codegen-plugin</artifactId>
- <version>2.5.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
- </additionalProjectnatures>
- <sourceIncludes>
- <sourceInclude>**/*.groovy</sourceInclude>
- </sourceIncludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/main/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.compile.classpath" />
- </taskdef>
- <mkdir dir="${project.build.outputDirectory}" />
- <groovyc destdir="${project.build.outputDirectory}"
- srcdir="${basedir}/src/main/groovy/" listfiles="true">
- <classpath refid="maven.compile.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>test-compile</id>
- <phase>test-compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/test/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.test.classpath" />
- </taskdef>
- <mkdir dir="${project.build.testOutputDirectory}" />
- <groovyc destdir="${project.build.testOutputDirectory}"
- srcdir="${basedir}/src/test/groovy/" listfiles="true">
- <classpath refid="maven.test.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxb2-maven-plugin</artifactId>
- <version>2.3</version>
- <executions>
- <execution>
- <id>xjc</id>
- <goals>
- <goal>xjc</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <extension>true</extension>
- <arguments>
- <argument>-Xannotate</argument>
- <argument>-Xcommons-lang</argument>
- </arguments>
- <sources>
- <source>src/main/resources/xsd</source>
- </sources>
- <xjbSources>
- <xjbSource>src/main/resources/xjb</xjbSource>
- </xjbSources>
- <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-basics-annotate</artifactId>
- <version>0.6.4</version>
- </dependency>
- <dependency>
- <groupId>org.jvnet.jaxb2_commons</groupId>
- <artifactId>jaxb2-commons-lang</artifactId>
- <version>2.3</version>
- </dependency>
- <dependency>
- <groupId>com.sun.codemodel</groupId>
- <artifactId>codemodel</artifactId>
- <version>2.6</version>
- </dependency>
- </dependencies>
- </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>
- org.apache.maven.plugins
- </groupId>
- <artifactId>
- maven-antrun-plugin
- </artifactId>
- <versionRange>
- [1.3,)
- </versionRange>
- <goals>
- <goal>run</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
-
-
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
-
- <dependency>
- <!-- process engine, in compile scope to include it in the war file -->
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine</artifactId>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Using the `DefaultEjbProcessApplication` result in: `java.sql.SQLException:
- You cannot commit during a managed transaction!` -->
- <dependency>
- <!-- CDI integration, needs to be included in WAR, otherwise CDI can not
- work correctly -->
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-cdi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.camunda.bpm.extension</groupId>
- <artifactId>camunda-bpm-assert</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Spin dataformat support, in compile scope to include it in the war
- file -->
- <dependency>
- <groupId>org.camunda.spin</groupId>
- <artifactId>camunda-spin-dataformat-all</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-plugin-spin</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-plugin-connect</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <!-- Bootstrap for styling via Webjars project -->
- <groupId>org.webjars</groupId>
- <artifactId>bootstrap</artifactId>
- <version>2.3.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-client</artifactId>
- <version>3.0.19.Final</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <!-- Needed for InMemoryH2Test -->
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.uuid</groupId>
- <artifactId>java-uuid-generator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.4</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>MSOCoreBPMN</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <!-- unit test utilities -->
- <groupId>org.openecomp.so</groupId>
- <artifactId>MSOCoreBPMN</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0</version>
- </dependency>
- <!-- for encoding the url the same way A&AI does -->
- <dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>MSOMockServer</artifactId>
- <version>${project.version}</version>
- <classifier>classes</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>MSORESTClient</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.github.tomakehurst</groupId>
- <artifactId>wiremock</artifactId>
- <version>1.56</version>
- <scope>test</scope>
- <classifier>standalone</classifier>
- <exclusions>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.sf.jopt-simple</groupId>
- <artifactId>jopt-simple</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>4.3.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-jaxb-annotations</artifactId>
- <version>2.4.0</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.6.12</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${httpclient.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.appc.client</groupId>
- <artifactId>client-kit</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.appc.client</groupId>
- <artifactId>client-lib</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.onap.aai.aai-common</groupId>
- <artifactId>aai-schema</artifactId>
- <version>1.1.0</version>
- </dependency>
-
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>com.openpojo</groupId>
- <artifactId>openpojo</artifactId>
- <version>0.8.6</version>
- </dependency>
- <dependency>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- <version>2.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${httpclient.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${jax.ws.rs}</version>
- </dependency>
-
- <dependency>
- <groupId>org.openecomp.appc.client</groupId>
- <artifactId>client-kit</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.appc.client</groupId>
- <artifactId>client-lib</artifactId>
- <version>1.1.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-jaxb-annotations</artifactId>
- <version>2.4.0</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.6.12</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- </dependency>
- <dependency>
- <groupId>com.att.nsa</groupId>
- <artifactId>dmaapClient</artifactId>
- <version>0.2.12</version>
- </dependency>
- <dependency>
- <!-- Optional Plugin for Camunda BPM Workbench -->
- <groupId>org.camunda.bpm.workbench</groupId>
- <artifactId>camunda-workbench-dist-embeddable</artifactId>
- <version>1.0.0-alpha8</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jackson2-provider</artifactId>
- <version>3.0.11.Final</version>
- </dependency>
-
- </dependencies>
-</project>
+<?xml version="1.0"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.openecomp.so</groupId> + <artifactId>bpmn</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + <artifactId>MSOCommonBPMN</artifactId> + <name>MSOCommonBPMN</name> + <packaging>jar</packaging> + + <properties> + <camunda.version>7.6.0</camunda.version> + <spring.version>4.3.2.RELEASE</spring.version> + <httpclient.version>3.1</httpclient.version> + <jax.ws.rs>2.0.1</jax.ws.rs> + <jackson.version>1.1.1</jackson.version> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>test-compile</id> + <phase>compile</phase> + <goals> + <goal>testCompile</goal> + </goals> + <configuration> + <skip>false</skip> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>3.0.2</version> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + <configuration> + <skip>false</skip> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-codegen-plugin</artifactId> + <version>2.5.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <version>2.8</version> + <configuration> + <additionalProjectnatures> + <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature> + </additionalProjectnatures> + <sourceIncludes> + <sourceInclude>**/*.groovy</sourceInclude> + </sourceIncludes> + </configuration> + </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <configuration> + <tasks> + <mkdir dir="${basedir}/src/main/groovy" /> + <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"> + <classpath refid="maven.compile.classpath" /> + </taskdef> + <mkdir dir="${project.build.outputDirectory}" /> + <groovyc destdir="${project.build.outputDirectory}" + srcdir="${basedir}/src/main/groovy/" listfiles="true"> + <classpath refid="maven.compile.classpath" /> + </groovyc> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>test-compile</id> + <phase>test-compile</phase> + <configuration> + <tasks> + <mkdir dir="${basedir}/src/test/groovy" /> + <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"> + <classpath refid="maven.test.classpath" /> + </taskdef> + <mkdir dir="${project.build.testOutputDirectory}" /> + <groovyc destdir="${project.build.testOutputDirectory}" + srcdir="${basedir}/src/test/groovy/" listfiles="true"> + <classpath refid="maven.test.classpath" /> + </groovyc> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxb2-maven-plugin</artifactId> + <version>2.3</version> + <executions> + <execution> + <id>xjc</id> + <goals> + <goal>xjc</goal> + </goals> + </execution> + </executions> + <configuration> + <extension>true</extension> + <arguments> + <argument>-Xannotate</argument> + <argument>-Xcommons-lang</argument> + </arguments> + <sources> + <source>src/main/resources/xsd</source> + </sources> + <xjbSources> + <xjbSource>src/main/resources/xjb</xjbSource> + </xjbSources> + <outputDirectory>${project.build.directory}/generated-sources</outputDirectory> + </configuration> + <dependencies> + <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>jaxb2-basics-annotate</artifactId> + <version>0.6.4</version> + </dependency> + <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>jaxb2-commons-lang</artifactId> + <version>2.3</version> + </dependency> + <dependency> + <groupId>com.sun.codemodel</groupId> + <artifactId>codemodel</artifactId> + <version>2.6</version> + </dependency> + </dependencies> + </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> + org.apache.maven.plugins + </groupId> + <artifactId> + maven-antrun-plugin + </artifactId> + <versionRange> + [1.3,) + </versionRange> + <goals> + <goal>run</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <dependencies> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine</artifactId> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-cdi</artifactId> + </dependency> + <dependency> + <groupId>org.camunda.bpm.extension</groupId> + <artifactId>camunda-bpm-assert</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.camunda.spin</groupId> + <artifactId>camunda-spin-dataformat-all</artifactId> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-plugin-spin</artifactId> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-plugin-connect</artifactId> + </dependency> + <dependency> + <!-- Bootstrap for styling via Webjars project --> + <groupId>org.webjars</groupId> + <artifactId>bootstrap</artifactId> + <version>2.3.2</version> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-client</artifactId> + <version>3.0.19.Final</version> + </dependency> + <dependency> + <!-- Needed for InMemoryH2Test --> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.uuid</groupId> + <artifactId>java-uuid-generator</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-all</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.4</version> + </dependency> + <dependency> + <groupId>org.openecomp.so</groupId> + <artifactId>MSOCoreBPMN</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <!-- unit test utilities --> + <groupId>org.openecomp.so</groupId> + <artifactId>MSOCoreBPMN</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.openecomp.so</groupId> + <artifactId>common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.openecomp.so</groupId> + <artifactId>MSORESTClient</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.0.1</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>com.github.tomakehurst</groupId> + <artifactId>wiremock</artifactId> + <version>1.56</version> + <scope>test</scope> + <classifier>standalone</classifier> + <exclusions> + <exclusion> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + </exclusion> + <exclusion> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </exclusion> + <exclusion> + <groupId>org.skyscreamer</groupId> + <artifactId>jsonassert</artifactId> + </exclusion> + <exclusion> + <groupId>xmlunit</groupId> + <artifactId>xmlunit</artifactId> + </exclusion> + <exclusion> + <groupId>com.jayway.jsonpath</groupId> + <artifactId>json-path</artifactId> + </exclusion> + <exclusion> + <groupId>net.sf.jopt-simple</groupId> + <artifactId>jopt-simple</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-spring</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>4.3.2.RELEASE</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.8.7</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>2.8.7</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + <version>2.4.0</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>aspectjrt</artifactId> + <version>1.6.12</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>${httpclient.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.appc.client</groupId> + <artifactId>client-kit</artifactId> + <version>1.1.0</version> + </dependency> + <dependency> + <groupId>org.openecomp.appc.client</groupId> + <artifactId>client-lib</artifactId> + <version>1.1.0</version> + </dependency> + <dependency> + <groupId>org.onap.aai.aai-common</groupId> + <artifactId>aai-schema</artifactId> + <version>1.1.0</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.8.7</version> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>com.openpojo</groupId> + <artifactId>openpojo</artifactId> + <version>0.8.6</version> + </dependency> + <dependency> + <groupId>com.jayway.jsonpath</groupId> + <artifactId>json-path</artifactId> + <version>2.2.0</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>${httpclient.version}</version> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>${jax.ws.rs}</version> + </dependency> + <dependency> + <groupId>org.openecomp.appc.client</groupId> + <artifactId>client-kit</artifactId> + <version>1.1.0</version> + </dependency> + <dependency> + <groupId>org.openecomp.appc.client</groupId> + <artifactId>client-lib</artifactId> + <version>1.1.0</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.8.7</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.8.7</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + <version>2.4.0</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>aspectjrt</artifactId> + <version>1.6.12</version> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + </dependency> + <dependency> + <groupId>com.att.nsa</groupId> + <artifactId>dmaapClient</artifactId> + <version>0.2.12</version> + </dependency> + <dependency> + <!-- Optional Plugin for Camunda BPM Workbench --> + <groupId>org.camunda.bpm.workbench</groupId> + <artifactId>camunda-workbench-dist-embeddable</artifactId> + <version>1.0.0-alpha8</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-jackson2-provider</artifactId> + <version>3.0.11.Final</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>22.0</version> + </dependency> + </dependencies> +</project> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java deleted file mode 100644 index 3e8fd6ee05..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.openecomp.mso.bpmn.common;
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
- */
-
-
-
-import java.util.List;
-
-import org.camunda.bpm.application.PostDeploy;
-import org.camunda.bpm.application.PreUndeploy;
-import org.camunda.bpm.application.ProcessApplication;
-import org.camunda.bpm.application.ProcessApplicationInfo;
-import org.camunda.bpm.application.impl.ServletProcessApplication;
-import org.camunda.bpm.engine.ProcessEngine;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * @since Version 1.0
- *
- */
-@ProcessApplication(name="MSO Common Application", deploymentDescriptors={"../processes.xml"})
-public class MSOCommonApplication extends ServletProcessApplication {
-
- private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Post deployment complete...");
- }
-
- @PreUndeploy
- public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Pre Undeploy complete...");
-
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java index c0be8992ef..d65311dfe8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java @@ -26,8 +26,6 @@ import java.util.List; import java.util.Map;
import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
@@ -38,7 +36,7 @@ import org.openecomp.mso.logger.MsoLogger; /**
* Abstract base class for callback services.
*/
-public abstract class AbstractCallbackService {
+public abstract class AbstractCallbackService extends ProcessEngineAwareService {
public static final long DEFAULT_TIMEOUT_SECONDS = 60;
public static final long FAST_POLL_DUR_SECONDS = 5;
public static final long FAST_POLL_INT_MS = 100;
@@ -46,8 +44,6 @@ public abstract class AbstractCallbackService { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- protected volatile ProcessEngineServices pes4junit = null;
-
/**
* Parameterized callback handler.
*/
@@ -368,16 +364,4 @@ public abstract class AbstractCallbackService { + ":" + execution.getId() + "]";
}
}
-
- protected ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return ProcessEngines.getProcessEngine("infrastructure");
- } else {
- return pes4junit;
- }
- }
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java new file mode 100644 index 0000000000..dbb6674a64 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.common.workflow.service; + +import java.util.Optional; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; + +/** + * Base class for services that must be process-engine aware. The only + * process engine currently supported is the "default" process engine. + */ +public class ProcessEngineAwareService { + + private final String processEngineName = "default"; + private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty(); + + /** + * Gets the process engine name. + * @return the process engine name + */ + public String getProcessEngineName() { + return processEngineName; + } + + /** + * Gets process engine services. + * @return process engine services + */ + public ProcessEngineServices getProcessEngineServices() { + return pes4junit.orElse(ProcessEngines.getProcessEngine( + getProcessEngineName())); + } + + /** + * Allows a particular process engine to be specified, overriding the + * usual process engine lookup by name. Intended primarily for the + * unit test environment. + * @param pes process engine services + */ + public void setProcessEngineServices4junit(ProcessEngineServices pes) { + pes4junit = Optional.ofNullable(pes); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java index 2186e071f4..c5f0d02dff 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java @@ -20,9 +20,6 @@ package org.openecomp.mso.bpmn.common.workflow.service;
-import java.util.HashMap;
-import java.util.Map;
-
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
@@ -30,16 +27,9 @@ import javax.jws.WebService; import javax.ws.rs.core.Context;
import javax.xml.ws.WebServiceContext;
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.ExecutionQuery;
import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
-import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java index 99909b68a0..608adcf756 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -53,7 +53,7 @@ import org.slf4j.MDC; * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
*/
@Path("/async")
-public abstract class WorkflowAsyncResource {
+public class WorkflowAsyncResource extends ProcessEngineAwareService {
private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
protected Optional<ProcessEngineServices> pes4junit = Optional.empty();
@@ -274,12 +274,6 @@ public abstract class WorkflowAsyncResource { }
- protected abstract ProcessEngineServices getProcessEngineServices();
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = Optional.ofNullable(pes);
- }
-
private static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
Map<String, Object> inputVariables = new HashMap<>();
@SuppressWarnings("unchecked")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java index 0521fb4df3..76ff221018 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java @@ -39,7 +39,6 @@ import javax.ws.rs.core.UriInfo; import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.history.HistoricVariableInstance;
import org.camunda.bpm.engine.runtime.ProcessInstance;
@@ -53,10 +52,8 @@ import org.openecomp.mso.logger.MsoLogger; import org.slf4j.MDC;
@Path("/workflow")
-public class WorkflowResource {
+public class WorkflowResource extends ProcessEngineAwareService {
- private ProcessEngineServices pes4junit = null;
-
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
@@ -615,16 +612,4 @@ public class WorkflowResource { return response;
}
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return ProcessEngines.getProcessEngine("infrastructure");
- } else {
- return pes4junit;
- }
- }
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java index 4f99edd660..193b8fe903 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java @@ -26,23 +26,12 @@ import java.util.Set; import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
-
-/**
- * @version 1.0
- * RESTeasy workflow application which wires synchronous and asynchronous response
- *
- */
@ApplicationPath("/")
public class WorkflowResourceApplication extends Application {
private Set<Object> singletons = new HashSet<Object>();
private Set<Class<?>> classes = new HashSet<Class<?>>();
public WorkflowResourceApplication() {
- singletons.add(new WorkflowResource());
- singletons.add(new WorkflowAsyncCommonResource());
- singletons.add(new WorkflowMessageResource());
}
@Override
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java index 4534b56efc..df28baac74 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java @@ -1,32 +1,35 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.bpmn.common.workflow.service;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-
-
-public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {
-
- protected ProcessEngineServices getProcessEngineServices() {
- return pes4junit.orElse(ProcessEngines.getProcessEngine("infrastructure"));
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class PreconditionFailedException extends WebApplicationException { + /** + * + */ + private static final long serialVersionUID = 1L; + + public PreconditionFailedException(String message) { + super(message, Response.Status.PRECONDITION_FAILED); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java new file mode 100644 index 0000000000..e0e3e936be --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; + +import javax.annotation.Priority; +import javax.ws.rs.BadRequestException; +import javax.ws.rs.ForbiddenException; +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.NotAcceptableException; +import javax.ws.rs.NotAllowedException; +import javax.ws.rs.NotAuthorizedException; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.NotSupportedException; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientResponseContext; +import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; + +@Provider +@Priority(value = 1) +public abstract class ResponseExceptionMapper implements ClientResponseFilter { + + @Override + public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { + if (responseContext.getStatus() >= 300) { + String message = "empty message"; + if (responseContext.hasEntity()) { + Optional<String> result = this.extractMessage(responseContext.getEntityStream()); + if (result.isPresent()) { + message = result.get(); + } + } + Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus()); + WebApplicationException webAppException; + switch (status) { + case BAD_REQUEST: + webAppException = new BadRequestException(message); + break; + case UNAUTHORIZED: + webAppException = new NotAuthorizedException(message); + break; + case FORBIDDEN: + webAppException = new ForbiddenException(message); + break; + case NOT_FOUND: + webAppException = new NotFoundException(message); + break; + case METHOD_NOT_ALLOWED: + webAppException = new NotAllowedException(message); + break; + case NOT_ACCEPTABLE: + webAppException = new NotAcceptableException(message); + break; + case PRECONDITION_FAILED: + webAppException = new PreconditionFailedException(message); + break; + case UNSUPPORTED_MEDIA_TYPE: + webAppException = new NotSupportedException(message); + break; + case INTERNAL_SERVER_ERROR: + webAppException = new InternalServerErrorException(message); + break; + case SERVICE_UNAVAILABLE: + webAppException = new WebApplicationException(message); + break; + default: + webAppException = new WebApplicationException(message); + } + throw webAppException; + } + } + + public abstract Optional<String> extractMessage(InputStream stream) throws IOException; +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java new file mode 100644 index 0000000000..0845a2fbcd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; + +import org.apache.commons.io.IOUtils; + +public class ResponseExceptionMapperImpl extends ResponseExceptionMapper { + + @Override + public Optional<String> extractMessage(InputStream stream) throws IOException { + final String input = IOUtils.toString(stream, "UTF-8"); + IOUtils.closeQuietly(stream); + return Optional.of(input); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestProperties.java new file mode 100644 index 0000000000..ae8862de5e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestProperties.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client; + +import java.net.MalformedURLException; +import java.net.URL; + +public interface RestProperties { + + public URL getEndpoint() throws MalformedURLException; + public String getSystemName(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java new file mode 100644 index 0000000000..6d49d9800f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client; + +import java.util.Iterator; +import java.util.ServiceLoader; + +public class RestPropertiesLoader { + + private final ServiceLoader<RestProperties> services; + private RestPropertiesLoader() { + services = ServiceLoader.load(RestProperties.class); + } + + private static class Helper { + private static final RestPropertiesLoader INSTANCE = new RestPropertiesLoader(); + } + + public static RestPropertiesLoader getInstance() { + return Helper.INSTANCE; + } + + public <T> T getImpl(Class<? extends RestProperties> clazz) { + T result = null; + Iterator<RestProperties> propertyImpls = services.iterator(); + RestProperties item; + while (propertyImpls.hasNext()) { + item = propertyImpls.next(); + if (clazz.isAssignableFrom(item.getClass())) { + result = (T)item; + break; + } + } + + return result; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java index f1bafde997..0e00ae5da8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java @@ -22,33 +22,5 @@ package org.openecomp.mso.client.dmaap; public interface Consumer { - /** - * Should this consumer continue to consume messages from the topic? - * @return - */ - public boolean continuePolling(); - /** - * Process a message from a DMaaP topic - * - * @param message - * @throws Exception - */ - public void processMessage(String message) throws Exception; - /** - * Has the request been accepted by the receiving system? - * Should the consumer move to processing messages? - * - * @param message - * @return - */ - public boolean isAccepted(String message); - /** - * The request id to filter messages on - * @return - */ - public String getRequestId(); - /** - * Logic that defines when the consumer should stop processing messages - */ - public void stopProcessingMessages(); + public Iterable<String> fetch(); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DefaultDmaapPropertiesImpl.java new file mode 100644 index 0000000000..9af1fd3f7e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DefaultDmaapPropertiesImpl.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap; + +import java.util.Map; + +import org.openecomp.mso.bpmn.core.PropertyConfiguration; + +public class DefaultDmaapPropertiesImpl implements DmaapProperties { + + private final Map<String, String> properties; + public DefaultDmaapPropertiesImpl() { + this.properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + } + @Override + public Map<String, String> getProperties() { + return this.properties; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java new file mode 100644 index 0000000000..7862c9d41d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Base64; +import java.util.Map; +import java.util.Properties; + +import org.openecomp.mso.bpmn.core.PropertyConfiguration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public abstract class DmaapClient { + + protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + protected final Map<String, String> msoProperties; + protected final Properties properties; + public DmaapClient(String filepath) throws FileNotFoundException, IOException { + Resource resource = new ClassPathResource(filepath); + DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getImpl(); + if (dmaapProperties == null) { + dmaapProperties = new DefaultDmaapPropertiesImpl(); + } + this.msoProperties = dmaapProperties.getProperties(); + this.properties = new Properties(); + this.properties.load(resource.getInputStream()); + this.properties.put("password", this.deobfuscatePassword(this.getPassword())); + this.properties.put("username", this.getUserName()); + this.properties.put("topic", this.getTopic()); + } + protected String deobfuscatePassword(String password) { + + try { + return new String(Base64.getDecoder().decode(password.getBytes())); + } catch(IllegalArgumentException iae) { + + return password; + } + } + + + public abstract String getUserName(); + public abstract String getPassword(); + public abstract String getTopic(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java index 2a618763ff..033951612d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java @@ -22,39 +22,110 @@ package org.openecomp.mso.client.dmaap; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.concurrent.TimeUnit; -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.MRConsumer; +import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure; +import org.openecomp.mso.client.dmaap.exceptions.ExceededMaximumPollingTime; +import org.openecomp.mso.client.dmaap.rest.RestConsumer; -public class DmaapConsumer { +import com.google.common.base.Stopwatch; - private final MRConsumer mrConsumer; - public DmaapConsumer() { - mrConsumer = null; - } - public DmaapConsumer (String filepath) throws FileNotFoundException, IOException { - - mrConsumer = MRClientFactory.createConsumer(filepath); +public abstract class DmaapConsumer extends DmaapClient { + + public DmaapConsumer() throws FileNotFoundException, IOException { + super("dmaap/default-consumer.properties"); } - - public MRConsumer getMRConsumer() { - return mrConsumer; + public Consumer getConsumer() throws FileNotFoundException, IOException { + return new RestConsumer(this.properties); } - public boolean consume(Consumer consumer) throws Exception { + public boolean consume() throws Exception { + + Consumer mrConsumer = this.getConsumer(); + int iterations = 0; boolean accepted = false; - while (consumer.continuePolling()) { - for (String message : this.getMRConsumer().fetch()) { - if (!accepted && consumer.isAccepted(message)) { - accepted = true; - } - if (accepted) { - consumer.processMessage(message); + Stopwatch stopwatch = Stopwatch.createUnstarted(); + try { + while (this.continuePolling()) { + if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) { + final String message = "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic(); + auditLogger.error(message); + throw new ExceededMaximumPollingTime(message); } + stopwatch.start(); + Iterable<String> itr = mrConsumer.fetch(); + stopwatch.stop(); + for (String message : itr) { + if (!accepted && this.isAccepted(message)) { + auditLogger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic()); + accepted = true; + } + if (accepted) { + if (this.isFailure(message)) { + this.stopProcessingMessages(); + auditLogger.info("received dmaap message: " + message); + final String errorMsg = "failure received from dmaap topic " + this.getTopic(); + auditLogger.error(errorMsg); + throw new DMaaPConsumerFailure(errorMsg); + } else { + auditLogger.info("received dmaap message: " + message); + this.processMessage(message); + } + } + } + iterations++; + } + return true; + } catch (Exception e ) { + throw e; + } finally { + if (stopwatch.isRunning()) { + stopwatch.stop(); } } - - return true; } + /** + * Should this consumer continue to consume messages from the topic? + * @return + */ + public abstract boolean continuePolling(); + /** + * Process a message from a DMaaP topic + * + * @param message + * @throws Exception + */ + public abstract void processMessage(String message) throws Exception; + /** + * Has the request been accepted by the receiving system? + * Should the consumer move to processing messages? + * + * @param message + * @return + */ + public abstract boolean isAccepted(String message); + /** + * has the request failed? + * + * @param message + * @return + */ + public abstract boolean isFailure(String message); + /** + * The request id to filter messages on + * @return + */ + public abstract String getRequestId(); + /** + * Logic that defines when the consumer should stop processing messages + */ + public abstract void stopProcessingMessages(); + + /** + * time in milliseconds + */ + public int getMaximumElapsedTime() { + return 180000; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java new file mode 100644 index 0000000000..7bdd7dfe40 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap; + +import java.util.Map; + +public interface DmaapProperties { + + /** + * A map of strings which contains the properties for a dmaap client + * @return + */ + public Map<String, String> getProperties(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java new file mode 100644 index 0000000000..a21dbe8477 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap; + +import java.util.Iterator; +import java.util.ServiceLoader; + +public class DmaapPropertiesLoader { + + private final ServiceLoader<DmaapProperties> services; + private DmaapPropertiesLoader() { + services = ServiceLoader.load(DmaapProperties.class); + } + + private static class Helper { + private static final DmaapPropertiesLoader INSTANCE = new DmaapPropertiesLoader(); + } + + public static DmaapPropertiesLoader getInstance() { + return Helper.INSTANCE; + } + + public DmaapProperties getImpl() { + Iterator<DmaapProperties> propertyImpls = services.iterator(); + while (propertyImpls.hasNext()) { + return propertyImpls.next(); + } + + return null; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java index 4d70a16b73..d2752c531b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java @@ -22,29 +22,30 @@ package org.openecomp.mso.client.dmaap; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.concurrent.TimeUnit; -import com.att.nsa.mr.client.MRBatchingPublisher; -import com.att.nsa.mr.client.MRClientFactory; +import org.openecomp.mso.client.dmaap.rest.RestPublisher; -public class DmaapPublisher { +public abstract class DmaapPublisher extends DmaapClient { - private final long seconds; - private final MRBatchingPublisher publisher; - - public DmaapPublisher(String filepath) throws FileNotFoundException, IOException { + private long seconds; + private final Publisher publisher; + public DmaapPublisher() throws FileNotFoundException, IOException { + super("dmaap/default-consumer.properties"); + this.publisher = new RestPublisher(properties); this.seconds = 20; - this.publisher = MRClientFactory.createBatchingPublisher(filepath); + } - public DmaapPublisher(String filepath, long seconds) throws FileNotFoundException, IOException { + public DmaapPublisher(long seconds) throws FileNotFoundException, IOException { + this(); this.seconds = seconds; - this.publisher = MRClientFactory.createBatchingPublisher(filepath); } public void send(String json) throws IOException, InterruptedException { + auditLogger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json); publisher.send(json); - publisher.close(seconds, TimeUnit.SECONDS); + //publisher.close(seconds, TimeUnit.SECONDS); } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java new file mode 100644 index 0000000000..d89ee6e5c6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap; + +public interface Publisher { + + public void send(String json); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java new file mode 100644 index 0000000000..29472b2180 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap.exceptions; + +public class DMaaPConsumerFailure extends Exception { + + private static final long serialVersionUID = 2499229901897110362L; + + public DMaaPConsumerFailure() { + super(); + } + + public DMaaPConsumerFailure(String message) { + super(message); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java new file mode 100644 index 0000000000..c9d675067e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap.exceptions; + +public class ExceededMaximumPollingTime extends RuntimeException { + + private static final long serialVersionUID = 2331207691092906423L; + + public ExceededMaximumPollingTime() { + super(); + } + + public ExceededMaximumPollingTime(String message) { + super(message); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java new file mode 100644 index 0000000000..124e2c3a28 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap.rest; + +import java.net.URL; +import java.util.Base64; +import java.util.Map; +import java.util.Optional; + +import javax.ws.rs.client.ClientResponseFilter; + +import org.openecomp.mso.client.ResponseExceptionMapperImpl; +import org.openecomp.mso.client.policy.RestClient; + +public class DMaaPRestClient extends RestClient { + + private final String username; + private final String password; + public DMaaPRestClient(URL url, String contentType, String username, String password) { + super(url, contentType); + this.username = username; + this.password = password; + } + + @Override + protected void initializeHeaderMap(Map<String, String> headerMap) { + headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes())); + } + + @Override + protected Optional<ClientResponseFilter> addResponseFilter() { + return Optional.of(new ResponseExceptionMapperImpl()); + } + + @Override + public RestClient addRequestId(String requestId) { + return null; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java new file mode 100644 index 0000000000..fb914a0c13 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java @@ -0,0 +1,131 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap.rest; + +import java.util.Properties; + +public class PropertiesBean { + + private String username; + private String password; + private String environment; + private String partition; + private String contentType; + private String host; + private String topic; + private String timeout; + + + public PropertiesBean(Properties properties) { + this.withUsername(properties.getProperty("username")) + .withPassword(properties.getProperty("password")) + .withTopic(properties.getProperty("topic")) + .withEnvironment(properties.getProperty("environment")) + .withHost(properties.getProperty("host")) + .withTimeout(properties.getProperty("timeout", "20000")) + .withPartition(properties.getProperty("partition")) + .withContentType(properties.getProperty("contentType", "application/json")); + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public PropertiesBean withUsername(String username) { + this.username = username; + return this; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + public PropertiesBean withPassword(String password) { + this.password = password; + return this; + } + public String getEnvironment() { + return environment; + } + public void setEnvironment(String environment) { + this.environment = environment; + } + public PropertiesBean withEnvironment(String environment) { + this.environment = environment; + return this; + } + public String getPartition() { + return partition; + } + public void setPartition(String partition) { + this.partition = partition; + } + public PropertiesBean withPartition(String partition) { + this.partition = partition; + return this; + } + public String getContentType() { + return contentType; + } + public void setContentType(String contentType) { + this.contentType = contentType; + } + public PropertiesBean withContentType(String contentType) { + this.contentType = contentType; + return this; + } + public String getHost() { + return host; + } + public void setHost(String host) { + this.host = host; + } + public PropertiesBean withHost(String host) { + this.host = host; + return this; + } + public String getTopic() { + return topic; + } + public void setTopic(String topic) { + this.topic = topic; + } + public PropertiesBean withTopic(String topic) { + this.topic = topic; + return this; + } + public String getTimeout() { + return timeout; + } + public void setTimeout(String timeout) { + this.timeout = timeout; + } + public PropertiesBean withTimeout(String timeout) { + this.timeout = timeout; + return this; + } + + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java new file mode 100644 index 0000000000..ff199e2373 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap.rest; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.Properties; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.UriBuilder; + +import org.openecomp.mso.client.dmaap.Consumer; +import org.openecomp.mso.client.policy.RestClient; + +public class RestConsumer implements Consumer { + + private final RestClient client; + public RestConsumer(Properties properties) { + PropertiesBean bean = new PropertiesBean(properties); + client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword()); + } + + private URL createURL(PropertiesBean properties) { + try { + return UriBuilder.fromUri("http://" + properties.getHost()) + .path("events").path(properties.getTopic()) + .path(properties.getPartition()) + .path("consumer1") + .queryParam("timeout", properties.getTimeout()).build().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + @Override + public Iterable<String> fetch() { + + return client.get(new GenericType<List<String>>() {}); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java new file mode 100644 index 0000000000..e8e685932a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.dmaap.rest; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; + +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriBuilderException; + +import org.openecomp.mso.client.dmaap.Publisher; +import org.openecomp.mso.client.policy.RestClient; + +public class RestPublisher implements Publisher { + + private final RestClient client; + + public RestPublisher(Properties properties) { + PropertiesBean bean = new PropertiesBean(properties); + client = new DMaaPRestClient(this.createURL(bean), bean.getContentType(), bean.getUsername(), bean.getPassword()); + } + + private URL createURL(PropertiesBean properties) { + try { + return UriBuilder.fromUri("http://" + properties.getHost()) + .path("events").path(properties.getTopic()) + .queryParam("timeout", properties.getTimeout()).build().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + @Override + public void send(String json) { + client.post(json); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java index 665b9052eb..e02941944a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java @@ -1,130 +1,138 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.policy;
-
-import java.io.BufferedInputStream;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.logging.Logger;
-import javax.annotation.Priority;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.ext.WriterInterceptor;
-import javax.ws.rs.ext.WriterInterceptorContext;
-
-@Priority(Integer.MIN_VALUE)
-public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
-
- private static final Logger logger = Logger.getLogger(LoggingFilter.class.getName());
- private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
- private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
- private final int maxEntitySize = 1024 * 8;
-
- private void log(StringBuilder sb) {
- logger.info(sb.toString());
- }
-
- private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
- throws IOException {
- InputStream inputStream = stream;
- if (!inputStream.markSupported()) {
- inputStream = new BufferedInputStream(inputStream);
- }
- inputStream.mark(maxEntitySize + 1);
- final byte[] entity = new byte[maxEntitySize + 1];
- final int entitySize = inputStream.read(entity);
- b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
- if (entitySize > maxEntitySize) {
- b.append("...more...");
- }
- b.append('\n');
- inputStream.reset();
- return inputStream;
- }
-
- @Override
- public void filter(ClientRequestContext requestContext) throws IOException {
- if (requestContext.hasEntity()) {
- final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
- requestContext.setEntityStream(stream);
- requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
- }
- }
-
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- final StringBuilder sb = new StringBuilder();
- if (responseContext.hasEntity()) {
- responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
- log(sb);
- }
-
- }
-
- @Override
- public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
- final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
- context.proceed();
- if (stream != null) {
- log(stream.getStringBuilder(DEFAULT_CHARSET));
- }
- }
-
- private class LoggingStream extends FilterOutputStream {
-
- private final StringBuilder sb = new StringBuilder();
- private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- LoggingStream(OutputStream out) {
- super(out);
- }
-
- StringBuilder getStringBuilder(Charset charset) {
- // write entity to the builder
- final byte[] entity = baos.toByteArray();
-
- sb.append(new String(entity, 0, entity.length, charset));
- if (entity.length > maxEntitySize) {
- sb.append("...more...");
- }
- sb.append('\n');
-
- return sb;
- }
-
- @Override
- public void write(final int i) throws IOException {
- if (baos.size() <= maxEntitySize) {
- baos.write(i);
- }
- out.write(i);
- }
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.policy; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.logging.Logger; + +import javax.annotation.Priority; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientRequestFilter; +import javax.ws.rs.client.ClientResponseContext; +import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.ext.WriterInterceptor; +import javax.ws.rs.ext.WriterInterceptorContext; + +@Priority(Integer.MIN_VALUE) +public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor { + + private static final Logger logger = Logger.getLogger(LoggingFilter.class.getName()); + private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream"; + private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; + private final int maxEntitySize; + + public LoggingFilter() { + maxEntitySize = 1024 * 1024; + } + + public LoggingFilter(int maxPayloadSize) { + this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024); + } + + private void log(StringBuilder sb) { + logger.info(sb.toString()); + } + + private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset) + throws IOException { + if (!stream.markSupported()) { + stream = new BufferedInputStream(stream); + } + stream.mark(maxEntitySize + 1); + final byte[] entity = new byte[maxEntitySize + 1]; + final int entitySize = stream.read(entity); + if (entitySize != -1) { + b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset)); + } + if (entitySize > maxEntitySize) { + b.append("...more..."); + } + b.append('\n'); + stream.reset(); + return stream; + } + + @Override + public void filter(ClientRequestContext requestContext) throws IOException { + if (requestContext.hasEntity()) { + final OutputStream stream = new LoggingStream(requestContext.getEntityStream()); + requestContext.setEntityStream(stream); + requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream); + } + } + + @Override + public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { + final StringBuilder sb = new StringBuilder(); + if (responseContext.hasEntity()) { + responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET)); + log(sb); + } + } + + @Override + public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { + final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY); + context.proceed(); + if (stream != null) { + log(stream.getStringBuilder(DEFAULT_CHARSET)); + } + } + + private class LoggingStream extends FilterOutputStream { + + private final StringBuilder sb = new StringBuilder(); + private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + LoggingStream(OutputStream out) { + super(out); + } + + StringBuilder getStringBuilder(Charset charset) { + // write entity to the builder + final byte[] entity = baos.toByteArray(); + + sb.append(new String(entity, 0, entity.length, charset)); + if (entity.length > maxEntitySize) { + sb.append("...more..."); + } + sb.append('\n'); + + return sb; + } + + @Override + public void write(final int i) throws IOException { + if (baos.size() <= maxEntitySize) { + baos.write(i); + } + out.write(i); + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java index 71ae56f55b..4ed2a887ef 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ONAP - SO + * OPENECOMP - MSO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -20,50 +20,47 @@ package org.openecomp.mso.client.policy; +import java.net.MalformedURLException; import java.util.Map; +import java.util.Optional; import java.util.UUID; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; +import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriBuilderException; +import org.openecomp.mso.client.ResponseExceptionMapperImpl; +import org.openecomp.mso.client.RestProperties; +import org.openecomp.mso.client.policy.entities.PolicyServiceType; import org.springframework.stereotype.Service; @Service public class PolicyRestClient extends RestClient { - private static final String ENDPOINT_KEY = "policy.endpoint"; private static final String X_ECOMP_REQUESTID = String.valueOf(UUID.randomUUID()); - - public PolicyRestClient() { - super(ENDPOINT_KEY); + private final PolicyRestProperties properties; + public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) { + super(props, Optional.of(UriBuilder.fromPath(serviceType.toString()).build())); + this.properties = props; + this.getClient(); } @Override protected void initializeHeaderMap(Map<String, String> headerMap) { - headerMap.put("ClientAuth", properties.get("policy.client.auth")); - headerMap.put("Authorization", properties.get("policy.auth")); - headerMap.put("Environment", properties.get("policy.environment")); - headerMap.put("X-ECOMP-RequestID", X_ECOMP_REQUESTID); + headerMap.put("ClientAuth", properties.getClientAuth()); + headerMap.put("Authorization", properties.getAuth()); + headerMap.put("Environment", properties.getEnvironment()); + this.addRequestId(X_ECOMP_REQUESTID); } - public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep, - String errorCode) { - DecisionAttributes decisionAttributes = new DecisionAttributes(); - decisionAttributes.setServiceType(serviceType); - decisionAttributes.setVNFType(vnfType); - decisionAttributes.setBBID(bbID); - decisionAttributes.setWorkStep(workStep); - decisionAttributes.setErrorCode(errorCode); - - return this.getDecision(decisionAttributes); + @Override + protected Optional<ClientResponseFilter> addResponseFilter() { + return Optional.of(new ResponseExceptionMapperImpl()); } - private PolicyDecision getDecision(DecisionAttributes decisionAttributes) { - PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest(); - decisionRequest.setDecisionAttributes(decisionAttributes); - decisionRequest.setEcompcomponentName(ECOMP_COMPONENT_NAME); - - return this.getBuilder().accept(MediaType.APPLICATION_JSON_TYPE) - .post(Entity.entity(decisionRequest, MediaType.APPLICATION_JSON)).readEntity(PolicyDecision.class); + @Override + public RestClient addRequestId(String requestId) { + this.headerMap.put("X-ECOMP-RequestID", requestId); + return this; } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java new file mode 100644 index 0000000000..d9336768fc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.policy; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map; + +import org.openecomp.mso.bpmn.core.PropertyConfiguration; +import org.openecomp.mso.client.RestProperties; + +public class PolicyRestProperties implements RestProperties { + + + final Map<String, String> props; + public PolicyRestProperties() { + this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + + } + @Override + public URL getEndpoint() { + try { + return new URL(props.getOrDefault("policy.endpoint", "")); + } catch (MalformedURLException e) { + return null; + } + } + + @Override + public String getSystemName() { + return "MSO"; + } + + public String getClientAuth() { + return props.get("policy.client.auth"); + } + + public String getAuth() { + return props.get("policy.auth"); + } + + public String getEnvironment() { + return props.get("policy.environment"); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java index 81c072ff33..74b1c3f802 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java @@ -20,51 +20,104 @@ package org.openecomp.mso.client.policy; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import java.util.logging.Logger; +import java.util.Optional; +import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.ext.ContextResolver; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; +import org.apache.log4j.Logger; +import org.openecomp.mso.client.RestProperties; import org.openecomp.mso.logger.MsoLogger; import org.springframework.stereotype.Service; +import com.fasterxml.jackson.databind.ObjectMapper; + @Service public abstract class RestClient { protected static final String ECOMP_COMPONENT_NAME = "MSO"; - + + private static final int MAX_PAYLOAD_SIZE = 1024 * 1024; private WebTarget webTarget; protected final Map<String, String> headerMap; protected final MsoLogger msoLogger; - protected Map<String, String> properties; - protected String host; + protected URL host; + protected Optional<URI> path; + protected Logger logger; + protected String accept; + protected String contentType; - protected RestClient(String endpointKey) { - Logger logger = Logger.getLogger(getClass().getName()); + protected RestClient(RestProperties props, Optional<URI> path) { + logger = Logger.getLogger(getClass().getName()); msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - - properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + headerMap = new HashMap<>(); - initializeHeaderMap(headerMap); + try { + host = props.getEndpoint(); + } catch (MalformedURLException e) { + logger.error("url not valid", e); + throw new RuntimeException(e); + } + + this.path = path; + initializeClient(getClient()); + } - host = this.getHost(endpointKey); + protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) { + this(props, path); + this.accept = accept; + this.contentType = contentType; - webTarget = ClientBuilder.newClient().register(logger).register(new LoggingFilter()) - .register(new CommonObjectMapperProvider()).target(host); } - private String getHost(String key) { - return properties.get(key); + protected RestClient(URL host, String contentType) { + headerMap = new HashMap<>(); + logger = Logger.getLogger(getClass().getName()); + msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + this.path = Optional.empty(); + this.host = host; + this.contentType = contentType; + initializeClient(getClient()); + } + + /** + * Override method to return false to disable logging. + * + * @return true - to enable logging, false otherwise + */ + protected boolean enableLogging() { + return true; + } + + /** + * Override method to return custom value for max payload size. + * + * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024 + */ + protected int getMaxPayloadSize() + { + return MAX_PAYLOAD_SIZE; } protected Builder getBuilder() { + Builder builder = webTarget.request(); + initializeHeaderMap(headerMap); for (Entry<String, String> entry : headerMap.entrySet()) { builder.header(entry.getKey(), entry.getValue()); @@ -73,4 +126,100 @@ public abstract class RestClient { } protected abstract void initializeHeaderMap(Map<String, String> headerMap); + + protected abstract Optional<ClientResponseFilter> addResponseFilter(); + + public abstract RestClient addRequestId(String requestId); + + protected ContextResolver<ObjectMapper> getMapper() { + return new CommonObjectMapperProvider(); + } + + protected String getAccept() { + return accept; + } + + protected String getContentType() { + return contentType; + } + + protected String getMergeContentType() { + return "application/merge-patch+json"; + } + + protected Client getClient() { + return ClientBuilder.newBuilder().build(); + } + + protected void initializeClient(Client client) { + if (this.enableLogging()) { + client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize())); + } + client.register(this.getMapper()); + Optional<ClientResponseFilter> responseFilter = this.addResponseFilter(); + if (responseFilter.isPresent()) { + client.register(responseFilter.get()); + } + if (!path.isPresent()) { + webTarget = client.target(host.toString()); + } else { + webTarget = client.target(UriBuilder.fromUri(host + path.get().toString())); + } + this.accept = MediaType.APPLICATION_JSON; + this.contentType = MediaType.APPLICATION_JSON; + } + + public Response get() { + return this.getBuilder().accept(this.getAccept()).get(); + } + + public Response post(Object obj) { + return this.getBuilder().accept(this.getAccept()).post(Entity.entity(obj, this.getContentType())); + } + + public Response patch(Object obj) { + return this.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.getAccept()) + .post(Entity.entity(obj, this.getMergeContentType())); + } + + public Response put(Object obj) { + return this.getBuilder().accept(this.getAccept()).put(Entity.entity(obj, this.getContentType())); + } + + public Response delete() { + return this.getBuilder().accept(this.getAccept()).delete(); + } + + public Response delete(Object obj) { + return this.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.getAccept()) + .put(Entity.entity(obj, this.getContentType())); + } + + public <T> T get(Class<T> resultClass) { + return this.get().readEntity(resultClass); + } + + public <T> T get(GenericType<T> resultClass) { + return this.get().readEntity(resultClass); + } + + public <T> T post(Object obj, Class<T> resultClass) { + return this.post(obj).readEntity(resultClass); + } + + public <T> T patch(Object obj, Class<T> resultClass) { + return this.patch(obj).readEntity(resultClass); + } + + public <T> T put(Object obj, Class<T> resultClass) { + return this.put(obj).readEntity(resultClass); + } + + public <T> T delete(Class<T> resultClass) { + return this.delete().readEntity(resultClass); + } + + public <T> T delete(Object obj, Class<T> resultClass) { + return this.delete(obj).readEntity(resultClass); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java new file mode 100644 index 0000000000..b5ab63ce35 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.policy.entities; + +public enum PolicyServiceType { + GET_CONFIG("getConfig"), + SEND_EVENT("sendEvent"), + PUSH_POLICY("pushPolicy"), + CREATE_POLICY("createPolicy"), + UPDATE_POLICY("updatePolicy"), + GET_DECISION("getDecision"), + GET_METRICS("getMetrics"), + DELETE_POLICY("deletePolicy"), + LIST_CONFIG("listConfig"), + CREATE_DICTIONARY_ITEM("createDictionaryItem"), + UPDATE_DICTIONARY_ITEM("updateDictionaryItem"), + GET_DICTIONARY_ITEMS("getDictionaryItems"); + + private final String name; + + private PolicyServiceType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java index eb18e10bc3..c746c0d448 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java @@ -32,6 +32,6 @@ public interface SDNOValidator { * @throws IOException * @throws Exception */ - public void healthDiagnostic(String vnfName, String uuid) throws IOException, Exception; + public void healthDiagnostic(String vnfId, String requestingUserId) throws IOException, Exception; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java index 92a00eee65..bdb4aa94ee 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java @@ -30,7 +30,7 @@ import org.openecomp.mso.client.dmaap.DmaapPublisher; import org.openecomp.mso.client.exceptions.SDNOException; import org.openecomp.mso.jsonpath.JsonPathUtil; -public class SDNOValidatorImpl implements SDNOValidator, Consumer { +public class SDNOValidatorImpl implements SDNOValidator { private final static String aafUserName = "something"; private final static String clientName = "MSO"; @@ -51,103 +51,4 @@ public class SDNOValidatorImpl implements SDNOValidator, Consumer { //block and continue to poll waiting for response } - protected SDNO buildRequestDiagnostic(String vnfName, String uuid, String oamIp) { - - Input input = new Input(); - SDNO parentRequest = new SDNO(); - Body body = new Body(); - parentRequest.setBody(body); - parentRequest.setNodeType("vPE"); - parentRequest.setOperation("health-diagnostic"); - - body.setInput(input); - - RequestHealthDiagnostic request = new RequestHealthDiagnostic(); - request.setRequestClientName(clientName); - request.setRequestNodeName(vnfName); - request.setRequestNodeIp(oamIp); //generic-vnf oam ip - request.setRequestUserId(aafUserName); //mech id? - request.setRequestId(uuid); //something to identify this request by for polling - - input.setRequestHealthDiagnostic(request); - - return parentRequest; - } - protected void submitRequest(String json) throws FileNotFoundException, IOException, InterruptedException { - DmaapPublisher publisher = new DmaapPublisher(this.producerFilePath); - publisher.send(json); - } - protected boolean pollForResponse(DmaapConsumer consumer, String uuid) throws Exception { - this.uuid = uuid; - return consumer.consume(this); - } - - @Override - public boolean continuePolling() { - return continuePolling; - } - - @Override - public void stopProcessingMessages() { - continuePolling = false; - } - @Override - public void processMessage(String message) throws Exception { - if (isHealthDiagnostic(message, this.getRequestId())) { - if (!healthDiagnosticSuccessful(message)) { - Optional<String> statusMessage = this.getStatusMessage(message); - if (statusMessage.isPresent()) { - throw new SDNOException(statusMessage.get()); - } else { - throw new SDNOException(); - } - } else { - stopProcessingMessages(); - } - } - } - - @Override - public boolean isAccepted(String message) { - if (isResultInfo(message)) { - Optional<String> code = isAccepted(message, this.getRequestId()); - if (code.isPresent()) { - if ("202".equals(code.get())) { - return true; - } else { - //TODO check other statuses 400 and 500 - } - } else { - //TODO throw error - } - } - - return false; - } - - @Override - public String getRequestId() { - return uuid; - } - - protected Optional<String> isAccepted(String json, String uuid) { - return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid)); - } - - protected boolean isResultInfo(String json) { - return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]"); - } - - protected boolean isHealthDiagnostic(String json, String uuid) { - return JsonPathUtil.getInstance().pathExists(json, String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath)); - } - - protected boolean healthDiagnosticSuccessful(String json) { - return JsonPathUtil.getInstance().pathExists(json, "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]"); - } - - protected Optional<String> getStatusMessage(String json) { - return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".response-details-json"); - } - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java index 2db4dea069..cc8ce81dec 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdno; +package org.openecomp.mso.client.sdno.beans; import java.io.Serializable; import java.util.HashMap; @@ -41,7 +41,7 @@ public class Body implements Serializable @JsonProperty("input") private Input input; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); private final static long serialVersionUID = 9101706044452851559L; @JsonProperty("input") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java index 25eb2ed270..7b9bf6f2c7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdno; +package org.openecomp.mso.client.sdno.beans; import java.io.Serializable; import java.util.HashMap; @@ -33,15 +33,17 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "request-healthdiagnostic" + "request-healthdiagnostic", + "request-hd-custom" }) public class Input implements Serializable { @JsonProperty("request-healthdiagnostic") private RequestHealthDiagnostic RequestHealthDiagnostic; + @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); private final static long serialVersionUID = 7155546785389227528L; @JsonProperty("request-healthdiagnostic") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java index b1ed77b513..104dbb7ee6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdno; +package org.openecomp.mso.client.sdno.beans; import java.io.Serializable; import java.util.HashMap; @@ -59,7 +59,7 @@ public class RequestHealthDiagnostic implements Serializable @JsonProperty("health-diagnostic-code") private String healthDiagnosticCode; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); private final static long serialVersionUID = 1166788526178388021L; @JsonProperty("request-client-name") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java index 0997b2df90..4d029cb8cb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdno; +package org.openecomp.mso.client.sdno.beans; import java.util.HashMap; import java.util.Map; @@ -51,7 +51,7 @@ private String requestId; @JsonProperty("status") private String status; @JsonIgnore -private Map<String, Object> additionalProperties = new HashMap<>(); +private Map<String, Object> additionalProperties = new HashMap<String, Object>(); @JsonProperty("client-name") public String getClientName() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java index caa3ff58e9..4edd54ca09 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdno; +package org.openecomp.mso.client.sdno.beans; import java.io.Serializable; import java.util.HashMap; @@ -34,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "operation", + "nodeLoc", "nodeType", "body" }) @@ -42,12 +43,14 @@ public class SDNO implements Serializable @JsonProperty("operation") private String operation; + @JsonProperty("nodeLoc") + private String nodeLoc; @JsonProperty("nodeType") private String nodeType; @JsonProperty("body") private Body body; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<>(); + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); private final static long serialVersionUID = -5303297382564282650L; @JsonProperty("operation") @@ -59,8 +62,23 @@ public class SDNO implements Serializable public void setOperation(String operation) { this.operation = operation; } + + @JsonProperty("nodeLoc") + public String getNodeLoc() { + return nodeLoc; + } + + @JsonProperty("nodeLoc") + public void setNodeLoc(String nodeLoc) { + this.nodeLoc = nodeLoc; + } + + public SDNO withNodeLoc(String nodeLoc) { + this.nodeLoc = nodeLoc; + return this; + } - public SDNO withOperation(String operation) { + public SDNO withOperation(String operation) { this.operation = operation; return this; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java new file mode 100644 index 0000000000..f23d882b53 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java @@ -0,0 +1,156 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.sdno.dmaap; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Optional; + +import org.openecomp.mso.client.dmaap.DmaapConsumer; +import org.openecomp.mso.client.exceptions.SDNOException; +import org.openecomp.mso.jsonpath.JsonPathUtil; + +public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer { + + private final String uuid; + private boolean continuePolling = true; + private final static String healthDiagnosticPath = "body.output.*"; + + public SDNOHealthCheckDmaapConsumer() throws FileNotFoundException, IOException { + this("none"); + } + + public SDNOHealthCheckDmaapConsumer(String uuid) throws FileNotFoundException, IOException { + super(); + this.uuid = uuid; + } + + @Override + public String getUserName() { + return msoProperties.get("sdno.health-check.dmaap.username"); + } + + @Override + public String getPassword() { + return msoProperties.get("sdno.health-check.dmaap.password"); + } + + @Override + public String getTopic() { + return msoProperties.get("sdno.health-check.dmaap.subscriber.topic"); + } + + @Override + public boolean continuePolling() { + return continuePolling; + } + + @Override + public void stopProcessingMessages() { + continuePolling = false; + } + @Override + public void processMessage(String message) throws Exception { + if (isHealthDiagnostic(message, this.getRequestId())) { + if (!healthDiagnosticSuccessful(message)) { + Optional<String> statusMessage = this.getStatusMessage(message); + if (statusMessage.isPresent()) { + throw new SDNOException("failed with message " + statusMessage.get()); + } else { + throw new SDNOException("failed with no status message"); + } + } else { + auditLogger.info("successful health diagnostic found for request: " + this.getRequestId()); + stopProcessingMessages(); + } + } + } + + @Override + public boolean isAccepted(String message) { + if (isResultInfo(message)) { + Optional<String> code = isAccepted(message, this.getRequestId()); + if (code.isPresent()) { + if ("202".equals(code.get())) { + return true; + } else { + //TODO check other statuses 400 and 500 + } + } else { + //TODO throw error + } + } + + return false; + } + + @Override + public boolean isFailure(String message) { + if (isResultInfo(message)) { + Optional<String> code = isFailure(message, this.getRequestId()); + if (code.isPresent()) { + if ("500".equals(code.get())) { + return true; + } else { + //TODO check other statuses 400 and 500 + } + } else { + //TODO throw error + } + } + + return false; + } + + @Override + public String getRequestId() { + return uuid; + } + + protected Optional<String> isAccepted(String json, String uuid) { + return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='ACCEPTED' && @.request-id=='%s')].code", uuid)); + } + + protected Optional<String> isFailure(String json, String uuid) { + return JsonPathUtil.getInstance().locateResult(json, String.format("$.result-info[?(@.status=='FAILURE' && @.request-id=='%s')].code", uuid)); + } + + protected boolean isResultInfo(String json) { + return JsonPathUtil.getInstance().pathExists(json, "$[?(@.result-info)]"); + } + + protected boolean isHealthDiagnostic(String json, String uuid) { + return JsonPathUtil.getInstance().pathExists(json, String.format("$[?(@.result-info.request-id=='%s')].%s", uuid, healthDiagnosticPath)); + } + + protected boolean healthDiagnosticSuccessful(String json) { + return JsonPathUtil.getInstance().pathExists(json, "$." + healthDiagnosticPath + "[?(@.response-status=='Success')]"); + } + + protected Optional<String> getStatusMessage(String json) { + return JsonPathUtil.getInstance().locateResult(json, "$." + healthDiagnosticPath + ".error-message"); + } + + @Override + public int getMaximumElapsedTime() { + return 300000; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java new file mode 100644 index 0000000000..73f06b8e58 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.sdno.dmaap; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.openecomp.mso.client.dmaap.DmaapPublisher; + +public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher { + + public SDNOHealthCheckDmaapPublisher() throws FileNotFoundException, IOException { + super(); + } + + @Override + public String getUserName() { + return msoProperties.get("sdno.health-check.dmaap.username"); + } + + @Override + public String getPassword() { + return msoProperties.get("sdno.health-check.dmaap.password"); + } + + @Override + public String getTopic() { + return msoProperties.get("sdno.health-check.dmaap.publisher.topic"); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml index d328246b2c..772867d3f2 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml @@ -22,7 +22,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <process-archive name="MSOCommonBPMN"> - <process-engine>infrastructure</process-engine> + <process-engine>default</process-engine> <properties> <property name="isDeleteUponUndeploy">false</property> <property name="isScanForProcessDefinitions">true</property> diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index 6f61c8fbf4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,8 +0,0 @@ -<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <!-- Spring bean to be invoked through the ApplicationContextElResolver -->
-
-</beans>
diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index b68ebd943c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,38 +0,0 @@ -<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
- -->
-
-<jboss-deployment-structure>
- <deployment>
- <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
- <exclusions>
- <module name="org.apache.log4j" />
- <module name="org.slf4j" />
- <module name="org.slf4j.impl" />
- <module name="org.jboss.resteasy.resteasy-jackson-provider" />
- <module name="org.jboss.resteasy.resteasy-jettison-provider" />
- </exclusions>
- <dependencies>
- <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />
- <!-- This module contain the ProviderBase class: -->
- <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" export="true"/>
- </dependencies>
- </deployment>
-</jboss-deployment-structure>
-
diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml deleted file mode 100644 index a9a263b684..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
- -->
-
-<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
-<jboss-web>
- <security-domain>other</security-domain>
- <context-root>/mso/common</context-root>
-</jboss-web>
diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 3a42877715..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
- -->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
- <display-name>MSO Common BPMN Workflow Servlet</display-name>
- <servlet>
- <servlet-name>resteasy-servlet</servlet-name>
- <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
- <init-param>
- <param-name>javax.ws.rs.Application</param-name>
- <param-value>org.openecomp.mso.bpmn.common.workflow.service.WorkflowResourceApplication</param-value>
- </init-param>
- </servlet>
- <servlet-mapping>
- <servlet-name>resteasy-servlet</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/applicationContext.xml</param-value>
- </context-param>
- <context-param>
- <param-name>mso.configuration</param-name>
- <param-value>MSO_PROP_TOPOLOGY=topology.properties</param-value>
- </context-param>
- <context-param>
- <param-name>log.configuration</param-name>
- <param-value>logback.bpmn.xml</param-value>
- </context-param>
- <context-param>
- <param-name>resteasy.resources</param-name>
- <param-value>org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler</param-value>
- </context-param>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <filter>
- <filter-name>LogFilter</filter-name>
- <filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>LogFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>HTTPBasicAuth</web-resource-name>
- <description>Authentication for Client Apps</description>
- <url-pattern>/workflow/*</url-pattern>
- <http-method>GET</http-method>
- <http-method>POST</http-method>
- </web-resource-collection>
- <auth-constraint>
- <role-name>BPMN-Client</role-name>
- </auth-constraint>
- </security-constraint>
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>ApplicationRealm</realm-name>
- </login-config>
- <security-role>
- <role-name>BPMN-Client</role-name>
- </security-role>
-</web-app>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java index f60d984a6d..eef9ed8ee0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java @@ -42,7 +42,6 @@ import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.jboss.resteasy.spi.AsynchronousResponse;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
@@ -201,7 +200,7 @@ public class BPMNUtil { * @param variables
*/
private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, AsynchronousResponse asyncResponse, Map<String,String> variables) {
- WorkflowAsyncResource workflowResource = new WorkflowAsyncCommonResource();
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
VariableMapImpl variableMap = new VariableMapImpl();
Map<String, Object> variableValueType = new HashMap<String, Object>();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java index 51a1484cf9..426bceef4b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java @@ -31,7 +31,7 @@ import org.camunda.bpm.engine.test.Deployment; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.jboss.resteasy.spi.AsynchronousResponse; import org.junit.Test; -import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; public class WorkflowAsyncResourceTest extends WorkflowTest { @@ -53,7 +53,7 @@ public class WorkflowAsyncResourceTest extends WorkflowTest { } private void executeWorkflow(String request, String requestId, AsynchronousResponse asyncResponse, String processKey) { - WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + WorkflowAsyncResource workflowResource = new WorkflowAsyncResource(); VariableMapImpl variableMap = new VariableMapImpl(); Map<String, Object> variableValueType = new HashMap<String, Object>(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java index 63403f40ce..15dc4f4609 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java @@ -75,7 +75,6 @@ import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification; import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
import org.openecomp.mso.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
@@ -273,7 +272,7 @@ public class WorkflowTest { VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
System.out.println("Sending " + request + " to " + processKey + " process");
- WorkflowAsyncResource workflowResource = new WorkflowAsyncCommonResource();
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
workflowResource.setProcessEngineServices4junit(processEngineRule);
TestAsyncResponse asyncResponse = new TestAsyncResponse();
@@ -306,7 +305,7 @@ public class WorkflowTest { VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
System.out.println("Sending " + request + " to " + processKey + " process");
- WorkflowAsyncResource workflowResource = new WorkflowAsyncCommonResource();
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
workflowResource.setProcessEngineServices4junit(processEngineRule);
TestAsyncResponse asyncResponse = new TestAsyncResponse();
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java index 2ebb44a644..2ebb44a644 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java index fc97e69c5c..fc97e69c5c 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java index ebbfea5cd1..ebbfea5cd1 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java index 9c4e7936b1..9c4e7936b1 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index e59e3b67d2..e59e3b67d2 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java index 32f2641ddb..f9a6543387 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java @@ -1,1069 +1,1069 @@ -/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.bpmn.mock;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
-
-/**
- * Reusable Mock StubResponses for AAI Endpoints
- *
- */
-public class StubResponseAAI {
-
- public static void setupAllMocks() {
-
- }
-
-
- /**
- * Tunnel-XConnect Mock Stub Response
- */
- public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
- /**
- * Allotted Resource Mock StubResponses below
- */
- public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
- stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
-
- /**
- * Service Instance Mock StubResponses below
- */
- public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- /**
- * Service-Subscription Mock StubResponses below
- */
- public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /**
- * Customer Mock StubResponses below
- */
- public static void MockGetCustomer(String globalCustId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteCustomer(String globalCustId) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer(String globalCustId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutCustomer_500(String globalCustId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
-
- /**
- * Generic-Vnf Mock StubResponses below
- */
-
- public static void MockGetGenericVnfById(String vnfId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .atPriority(1)
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .atPriority(priority)
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfById_404(String vnfId){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockGetGenericVnfById_500(String vnfId){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockGetGenericVnfByName(String vnfName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfByName_404(String vnfName){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(204)));
- }
-
- public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockPutGenericVnf(String vnfId){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .withRequestBody(containing(requestBodyContaining))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf(String vnfId, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPatchGenericVnf(String vnfId){
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- /**
- * Vce Mock StubResponses below
- */
- public static void MockGetVceById(String vnfId, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVceByName(String vnfName, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockPutVce(String vnfId){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){
- stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Tenant Mock StubResponses below
- */
- public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetTenant(String tenantId, String responseFile) {
- stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Network Mock StubResponses below
- */
- public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName(String networkName, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkByName_404(String responseFile, String networkName) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkCloudRegion_404(String cloudRegion) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(String responseFile, String policy) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkTableReference(String responseFile, String tableReference) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth ))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- /////////////
-
- public static void MockVNFAdapterRestVfModule() {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDBUpdateVfModule(){
- stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/DBUpdateResponse.xml")));
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockSDNCAdapterVfModule() {
- // simplified the implementation to return "success" for all requests
- stubFor(post(urlEqualTo("/SDNCAdapter"))
-// .withRequestBody(containing("SvcInstanceId><"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
-
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModule() {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
- .atPriority(1)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-supercool.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
- .atPriority(2)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-lukewarm.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .atPriority(5)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-new.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/GenericVnf.xml")));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
-// .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
-// .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(200)));
- // HTTP PUT stub still used by DoCreateVfModuleTest
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MODULELABEL"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VolumeGroup.xml")));
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));
- stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))
- .withRequestBody(containing("NEWvBNGModuleId"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
-
- //////////////
-
- /**
- * Cloud infrastructure below
- */
-
- public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- /**
- * Volume Group StubResponse below
- */
- public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) {
- stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- /**
- * VF-Module StubResponse below
- * @param statusCode TODO
- */
- public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")));
- }
-
- public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
- .willReturn(aResponse()
- .withStatus(returnCode)));
- }
-
- public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
- .willReturn(aResponse()
- .withStatus(returnCode)));
- }
-
- public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {
- stubFor(patch(urlMatching(endpoint))
- .willReturn(aResponse()
- .withStatus(statusCode)));
- }
-
- /* AAI Pserver Queries */
- public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(put(urlMatching("/v10/query.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {
- stubFor(get(urlMatching("/v10/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- .withHeader("Content-Type", "application/json; charset=utf-8")
- .withBodyFile(responseFile)));
- }
-
- public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {
- stubFor(patch(urlMatching("/v10/network/generic-vnfs/.*"))
- .willReturn(aResponse()
- .withStatus(statusCode)
- ));
- }
-
- //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
- @Deprecated
- public static void MockGetVceById(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getVceResponse.xml")));
- }
- @Deprecated
- public static void MockGetVceByName(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
- }
- @Deprecated
- public static void MockPutVce(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockDeleteVce(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteVce_404(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
-
- @Deprecated
- public static void MockDeleteServiceSubscription(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockGetServiceSubscription(){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getServiceSubscription.xml")));
- }
- @Deprecated
- public static void MockGetServiceSubscription_200Empty(){
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(" ")));
- }
- @Deprecated
- public static void MockGetServiceSubscription_404() {
- stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockGENPSIPutServiceInstance(){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
- }
-
- @Deprecated
- public static void MockGENPSIPutServiceSubscription(){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
- }
- @Deprecated
- public static void MockGENPSIPutServiceInstance_get500(){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
- }
-
- @Deprecated
- public static void MockGetGenericVnfById(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_404(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_hasRelationships(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_hasRelationships(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- }
- @Deprecated
- public static void MockGetGenericVnfById_500(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockGetGenericVnfByName_404(){
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockPutGenericVnf(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
- @Deprecated
- public static void MockPutGenericVnf_400(){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
- .willReturn(aResponse()
- .withStatus(400)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(204)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_404(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(404)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_500(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
- @Deprecated
- public static void MockDeleteGenericVnf_412(){
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
- .willReturn(aResponse()
- .withStatus(412)));
- }
-
-}
+/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.openecomp.mso.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + + +/** + * Reusable Mock StubResponses for AAI Endpoints + * + */ +public class StubResponseAAI { + + public static void setupAllMocks() { + + } + + + /** + * Tunnel-XConnect Mock Stub Response + */ + public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId)) + .willReturn(aResponse() + .withStatus(200))); + } + + + /** + * Allotted Resource Mock StubResponses below + */ + public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + + /** + * Service Instance Mock StubResponses below + */ + public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + /** + * Service-Subscription Mock StubResponses below + */ + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + /** + * Customer Mock StubResponses below + */ + public static void MockGetCustomer(String globalCustId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteCustomer(String globalCustId) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutCustomer(String globalCustId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutCustomer_500(String globalCustId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(500))); + } + + + /** + * Generic-Vnf Mock StubResponses below + */ + + public static void MockGetGenericVnfById(String vnfId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .atPriority(1) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .atPriority(priority) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfById_404(String vnfId){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockGetGenericVnfById_500(String vnfId){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetGenericVnfByName(String vnfName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByName_404(String vnfName){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockPutGenericVnf(String vnfId){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .withRequestBody(containing(requestBodyContaining)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutGenericVnf(String vnfId, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPatchGenericVnf(String vnfId){ + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + /** + * Vce Mock StubResponses below + */ + public static void MockGetVceById(String vnfId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVceByName(String vnfName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutVce(String vnfId){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Tenant Mock StubResponses below + */ + public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetTenant(String tenantId, String responseFile) { + stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Network Mock StubResponses below + */ + public static void MockGetNetwork(String networkId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkByName(String networkName, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkByName_404(String responseFile, String networkName) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkCloudRegion_404(String cloudRegion) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockPutNetwork(String networkId, int statusCode, String responseFile) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicy(String responseFile, String policy) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkTableReference(String responseFile, String tableReference) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPatchVfModuleId(String vnfId, String vfModuleId) { + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(200))); + } + + ///////////// + + public static void MockVNFAdapterRestVfModule() { + stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + } + + public static void MockDBUpdateVfModule(){ + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/DBUpdateResponse.xml"))); + } + + // start of mocks used locally and by other VF Module unit tests + public static void MockSDNCAdapterVfModule() { + // simplified the implementation to return "success" for all requests + stubFor(post(urlEqualTo("/SDNCAdapter")) +// .withRequestBody(containing("SvcInstanceId><")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); + + } + + // start of mocks used locally and by other VF Module unit tests + public static void MockAAIVfModule() { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) + .atPriority(1) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VfModule-supercool.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) + .atPriority(2) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VfModule-lukewarm.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + .atPriority(5) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VfModule-new.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/GenericVnf.xml"))); + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) +// .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) +// .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(200))); + // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(200))); + // HTTP PUT stub still used by DoCreateVfModuleTest + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + .withRequestBody(containing("MODULELABEL")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VolumeGroup.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/VolumeGroup.xml"))); + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml"))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml"))); + stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId")) + .withRequestBody(containing("NEWvBNGModuleId")) + .willReturn(aResponse() + .withStatus(200))); + } + + + + ////////////// + + /** + * Cloud infrastructure below + */ + + public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Volume Group StubResponse below + */ + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) { + stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(200))); + } + + /** + * VF-Module StubResponse below + * @param statusCode TODO + */ + public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutVfModuleId(String vnfId, String vfModuleId) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(returnCode))); + } + + public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(returnCode))); + } + + public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) { + stubFor(patch(urlMatching(endpoint)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + /* AAI Pserver Queries */ + public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/v10/query.*")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/v10/network/generic-vnfs/.*")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/json; charset=utf-8") + .withBodyFile(responseFile))); + } + + public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) { + stubFor(patch(urlMatching("/v10/network/generic-vnfs/.*")) + .willReturn(aResponse() + .withStatus(statusCode) + )); + } + + //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// + @Deprecated + public static void MockGetVceById(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getVceResponse.xml"))); + } + @Deprecated + public static void MockGetVceByName(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getVceByNameResponse.xml"))); + } + @Deprecated + public static void MockPutVce(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")) + .willReturn(aResponse() + .withStatus(200))); + } + @Deprecated + public static void MockDeleteVce(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockDeleteVce_404(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(404))); + } + + @Deprecated + public static void MockDeleteServiceSubscription(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockGetServiceSubscription(){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getServiceSubscription.xml"))); + } + @Deprecated + public static void MockGetServiceSubscription_200Empty(){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(" "))); + } + @Deprecated + public static void MockGetServiceSubscription_404() { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockGENPSIPutServiceInstance(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); + } + + @Deprecated + public static void MockGENPSIPutServiceSubscription(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); + } + @Deprecated + public static void MockGENPSIPutServiceInstance_get500(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/aaiFault.xml"))); + } + + @Deprecated + public static void MockGetGenericVnfById(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_404(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockGetGenericVnfByName(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); + } + @Deprecated + public static void MockGetGenericVnfByName_hasRelationships(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_hasRelationships(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_500(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(500))); + } + @Deprecated + public static void MockGetGenericVnfByName_404(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockPutGenericVnf(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200))); + } + @Deprecated + public static void MockPutGenericVnf_400(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(400))); + } + @Deprecated + public static void MockDeleteGenericVnf(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockDeleteGenericVnf_404(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockDeleteGenericVnf_500(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(500))); + } + @Deprecated + public static void MockDeleteGenericVnf_412(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(412))); + } + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java index c9f64d9b26..c9f64d9b26 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java index 8baeb1b137..8baeb1b137 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java index 38b81c54c6..fdaede1b39 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponsePolicy.java @@ -1,94 +1,94 @@ -/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.bpmn.mock;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
-/**
- * Reusable Mock StubResponses for Policy
- *
- */
-public class StubResponsePolicy {
-
- public static void setupAllMocks() {
-
- }
-
- // start of Policy mocks
- public static void MockPolicyAbort() {
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("policyAbortResponse.json")));
-
-
- }
-
- public static void MockPolicySkip() {
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("BB1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("UPDVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
- stubFor(post(urlEqualTo("/pdp/api/getDecision"))
- .withRequestBody(containing("RPLVnfI"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/json")
- .withBodyFile("Policy/policySkipResponse.json")));
-
-
- }
-
-
-}
+/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.openecomp.mso.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +/** + * Reusable Mock StubResponses for Policy + * + */ +public class StubResponsePolicy { + + public static void setupAllMocks() { + + } + + // start of Policy mocks + public static void MockPolicyAbort() { + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("BB1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("UPDVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("RPLVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("policyAbortResponse.json"))); + + + } + + public static void MockPolicySkip() { + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("BB1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("UPDVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + stubFor(post(urlEqualTo("/pdp/api/getDecision")) + .withRequestBody(containing("RPLVnfI")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile("Policy/policySkipResponse.json"))); + + + } + + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java index f41d6d7dba..f41d6d7dba 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java index a8f4db80aa..c16ac43d41 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseSNIRO.java @@ -1,69 +1,69 @@ -/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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=========================================================
- */
-
-/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
-package org.openecomp.mso.bpmn.mock;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-
-/**
- * Please describe the StubResponseSNIRO.java class
- *
- * @author cb645j
- */
-public class StubResponseSNIRO {
-
- public static void setupAllMocks() {
-
- }
-
- public static void mockSNIRO() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSNIRO(String responseFile) {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSNIRO_400() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(400)
- .withHeader("Content-Type", "application/json")));
- }
-
- public static void mockSNIRO_500() {
- stubFor(post(urlEqualTo("/sniro/api/v2/placement"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/json")));
- }
-
-}
+/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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========================================================= + */ + +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Please describe the StubResponseSNIRO.java class + * + * @author cb645j + */ +public class StubResponseSNIRO { + + public static void setupAllMocks() { + + } + + public static void mockSNIRO() { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSNIRO(String responseFile) { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void mockSNIRO_400() { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(400) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSNIRO_500() { + stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java index b4aca5081e..b4aca5081e 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java index 23921da8d8..23921da8d8 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java index ee6972e46e..ee6972e46e 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java index 1582071d3a..1582071d3a 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 186fd35b6f..186fd35b6f 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java index 7808b47d24..7808b47d24 100644 --- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/PolicyDecisionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/PolicyDecisionTest.java deleted file mode 100644 index 8370f74851..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/PolicyDecisionTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.client.policy; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.util.Map; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -public class PolicyDecisionTest { - - @BeforeClass - public static void setUp() { - System.setProperty("mso.config.path", "src/test/resources"); - } - @Test - public void successReadProperties() throws IOException, Exception { - PolicyRestClient client = new PolicyRestClient(); - Map<String, String> headerMap = client.headerMap; - - assertEquals("Found expected Client Auth", headerMap.get("ClientAuth"), "Basic bTAzNzQzOnBvbGljeVIwY2sk"); - assertEquals("Found expected Authorization", headerMap.get("Authorization"), "Basic dGVzdHBkcDphbHBoYTEyMw=="); - assertEquals("Found expected Environment", headerMap.get("Environment"), "TEST"); - assertEquals("Has X-ECOMP-RequestID", headerMap.containsKey("X-ECOMP-RequestID"), true); - } - - @Test - @Ignore // IGNORED FOR 1710 MERGE TO ONAP - public void restEndpointCall() throws IOException, Exception { - PolicyRestClient client = new PolicyRestClient(); - PolicyDecision decision = client.getDecision("X", "Y", "BB1", "1", "123"); - assertEquals("Decision is correct", decision.getDecision(), "PERMIT"); - assertEquals("Decision details is correct", decision.getDetails(), "Abort"); - } -/* - @Test - public void failure() throws IOException, Exception { - when(dmaapConsumer.getMRConsumer()).thenReturn(mrConsumer); - when(mrConsumer.fetch()) - .thenReturn(Arrays.asList(new String[] { getJson("response.json"), getJson("output-failure.json") })); - - SDNOValidatorImpl validator = new SDNOValidatorImpl(); - thrown.expect(SDNOException.class); - thrown.expectMessage("my message"); - boolean result = validator.pollForResponse(dmaapConsumer, "xyz123"); - - }*/ -} diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml index 5ba7c3aae2..53888dd23e 100644 --- a/bpmn/MSOInfrastructureBPMN/pom.xml +++ b/bpmn/MSOInfrastructureBPMN/pom.xml @@ -329,13 +329,6 @@ <version>4.3.2.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.openecomp.so</groupId>
- <artifactId>MSOMockServer</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <classifier>classes</classifier>
- </dependency>
- <dependency>
<groupId>org.openecomp.so</groupId>
<artifactId>MSORESTClient</artifactId>
<version>${project.version}</version>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index d74174dcee..862c46ad19 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -63,9 +63,9 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { * @param - execution */ public void preProcessRequest(Execution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules PreProcessRequest Process*** ", isDebugEnabled) + utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules PreProcessRequest Process*** ", isDebugLogEnabled) setBasicDBAuthHeader(execution, isDebugLogEnabled) try{ @@ -78,21 +78,21 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("msoRequestId") execution.setVariable("requestId", requestId) execution.setVariable("mso-request-id", requestId) - utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) + utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugLogEnabled) String serviceInstanceId = execution.getVariable("serviceInstanceId") - utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugLogEnabled) String vnfName = execution.getVariable("vnfName") execution.setVariable("CREVI_vnfName", vnfName) - utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled) + utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugLogEnabled) String productFamilyId = execution.getVariable("productFamilyId") - utils.log("DEBUG", "Incoming Product Family Id is: " + productFamilyId, isDebugEnabled) + utils.log("DEBUG", "Incoming Product Family Id is: " + productFamilyId, isDebugLogEnabled) String source = "VID" execution.setVariable("source", source) - utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) + utils.log("DEBUG", "Incoming Source is: " + source, isDebugLogEnabled) String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId") utils.log("DEBUG", "Incoming LCP Cloud Region Id is: " + lcpCloudRegionId) @@ -101,17 +101,17 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId) String disableRollback = execution.getVariable("disableRollback") - utils.log("DEBUG", "Incoming Disable Rollback is: " + disableRollback, isDebugEnabled) + utils.log("DEBUG", "Incoming Disable Rollback is: " + disableRollback, isDebugLogEnabled) String asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") - utils.log("DEBUG", "Incoming asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugEnabled) + utils.log("DEBUG", "Incoming asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) String vnfId = execution.getVariable("testVnfId") // for junits if(isBlank(vnfId)){ vnfId = execution.getVariable("vnfId") if (isBlank(vnfId)) { vnfId = UUID.randomUUID().toString() - utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled) + utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugLogEnabled) } } execution.setVariable("vnfId", vnfId) @@ -135,50 +135,50 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { }catch(BpmnError b){ - utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled) throw b }catch(Exception e){ - utils.log("DEBUG", " Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugEnabled) + utils.log("DEBUG", " Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugLogEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") } - utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules PreProcessRequest Process ***", isDebugEnabled) + utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules PreProcessRequest Process ***", isDebugLogEnabled) } public void queryCatalogDB (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules QueryCatalogDB Process *** ", isDebugEnabled) + utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules QueryCatalogDB Process *** ", isDebugLogEnabled) try { VnfResource vnf = null ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") // if serviceDecomposition is specified, get info from serviceDecomposition if (serviceDecomposition != null) { - utils.log("DEBUG", "Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString(), isDebugEnabled) + utils.log("DEBUG", "Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString(), isDebugLogEnabled) List<VnfResource> vnfs = serviceDecomposition.getServiceVnfs() - utils.log("DEBUG", "Read vnfs", isDebugEnabled) + utils.log("DEBUG", "Read vnfs", isDebugLogEnabled) if (vnfs == null) { - utils.log("DEBUG", "Error - vnfs are empty in serviceDecomposition object", isDebugEnabled) + utils.log("DEBUG", "Error - vnfs are empty in serviceDecomposition object", isDebugLogEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnfs are empty") } vnf = vnfs[0] String serviceModelName = serviceDecomposition.getModelInfo().getModelName() vnf.constructVnfType(serviceModelName) String vnfType = vnf.getVnfType() - utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled) + utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugLogEnabled) execution.setVariable("vnfType", vnfType) } else { //Get Vnf Info String vnfModelInfo = execution.getVariable("vnfModelInfo") - utils.log("DEBUG", "vnfModelInfo: " + vnfModelInfo, isDebugEnabled) + utils.log("DEBUG", "vnfModelInfo: " + vnfModelInfo, isDebugLogEnabled) String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid") if (vnfModelCustomizationUuid == null) { vnfModelCustomizationUuid = "" } - utils.log("DEBUG", "querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugEnabled) + utils.log("DEBUG", "querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugLogEnabled) JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid) @@ -187,24 +187,24 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { JSONObject vnfObject = vnfs[0] vnf = decomposeJsonUtil.JsonToVnfResource(vnfObject.toString()) } - utils.log("DEBUG", "Read vnfResource", isDebugEnabled) + utils.log("DEBUG", "Read vnfResource", isDebugLogEnabled) if (vnf == null) { - utils.log("DEBUG", "Error - vnf is empty in serviceDecomposition object", isDebugEnabled) + utils.log("DEBUG", "Error - vnf is empty in serviceDecomposition object", isDebugLogEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnf is null") } execution.setVariable("vnfResourceDecomposition", vnf) List<ModuleResource> vfModules = vnf.getAllVfModuleObjects() - utils.log("DEBUG", "Read vfModules", isDebugEnabled) + utils.log("DEBUG", "Read vfModules", isDebugLogEnabled) if (vfModules == null) { - utils.log("DEBUG", "Error - vfModules are empty in serviceDecomposition object", isDebugEnabled) + utils.log("DEBUG", "Error - vfModules are empty in serviceDecomposition object", isDebugLogEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vf modules are empty") } ModuleResource baseVfModule = null for (int i = 0; i < vfModules.size; i++) { - utils.log("DEBUG", "handling VF Module ", isDebugEnabled) + utils.log("DEBUG", "handling VF Module ", isDebugLogEnabled) ModuleResource vfModule = vfModules[i] boolean isBase = vfModule.getIsBase() if (isBase) { @@ -236,7 +236,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("addOnModulesDeployed", 0) }catch(Exception ex) { - utils.log("DEBUG", "Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage(), isDebugEnabled) + utils.log("DEBUG", "Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage(), isDebugLogEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModules QueryCatalogDB Process") } @@ -249,7 +249,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("vnfId", "skask") } - utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules QueryCatalogDB Process ***", isDebugEnabled) + utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules QueryCatalogDB Process ***", isDebugLogEnabled) } public void preProcessAddOnModule(Execution execution){ @@ -364,45 +364,45 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } public void preProcessRollback (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugLogEnabled) try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugLogEnabled) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugLogEnabled) } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + utils.log("DEBUG", msg, isDebugLogEnabled) } - utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) + utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugLogEnabled) } public void postProcessRollback (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugLogEnabled) String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugLogEnabled) execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugLogEnabled) throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + utils.log("DEBUG", msg, isDebugLogEnabled) } - utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) + utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugLogEnabled) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 8c158db1da..3f7ffbf28c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -230,19 +230,10 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { utils.logAudit("AAI endPoint: " + endPoint) try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() utils.logAudit("createVfModule - invoking httpGet() to AAI") + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) - responseData = response.getResponseBodyAsString() + def responseData = response.getResponseBodyAsString() if (responseData != null) { logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 85ff43946d..703ea8be6d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -40,6 +40,7 @@ import org.json.JSONArray; import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils;
+import static org.apache.commons.lang3.StringUtils.*
/**
* This groovy class supports the <class>CreateVcpeResCustService.bpmn</class> process.
@@ -93,6 +94,16 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // initialize flow variables
InitializeProcessVariables(execution)
+ //Config Inputs
+ String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')
+ if (isBlank(aaiDistDelay)) {
+ msg = "URN_mso_workflow_aai_distribution_delay is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("aaiDistDelay", aaiDistDelay)
+ utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled)
+
// check for incoming json message/input
String createVcpeServiceRequest = execution.getVariable("bpmnRequest")
utils.logAudit(createVcpeServiceRequest)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 04eb4c7d7e..77ef3f6fe0 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -135,10 +135,13 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)
// extract cloud configuration
- String lcpCloudRegionId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
+ String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration")
+ execution.setVariable("cloudConfiguration", cloudConfiguration)
+ utils.log("DEBUG","cloudConfiguration: "+ cloudConfiguration, isDebugEnabled)
+ String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)
- String tenantId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration.tenantId")
+ String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
execution.setVariable("tenantId", tenantId)
utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index b46721c88e..997757aa2c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -45,6 +45,8 @@ import static org.apache.commons.lang3.StringUtils.* * @param - disableRollback * @param - failExists - O * @param - serviceInstanceId + * @param - globalCustomerId - O + * @param - subscriptionServiceType - O * @param - parentServiceInstanceId * @param - allottedReourceId - O * @param - allottedResourceModelInfo @@ -89,6 +91,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + String sdncReplDelay = execution.getVariable('URN_mso_workflow_sdnc_replication_delay') + if (isBlank(sdncReplDelay)) { + msg = "URN_mso_workflow_sdnc_replication_delay is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncReplDelay", sdncReplDelay) + utils.log("DEBUG","SDNC replication delay: " + sdncReplDelay, isDebugEnabled) + //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" @@ -312,6 +323,8 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String allottedResourceId = execution.getVariable("allottedResourceId") String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalCustomerId = execution.getVariable("globalCustomerId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String callbackUrl = execution.getVariable("sdncCallbackUrl") String requestId = execution.getVariable("msoRequestId") @@ -365,11 +378,11 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ </request-information> <service-information> <service-id></service-id> - <subscription-service-type></subscription-service-type> + <subscription-service-type>${subscriptionServiceType}</subscription-service-type> <onap-model-information></onap-model-information> - <service-instance-id>${parentServiceInstanceId}</service-instance-id> + <service-instance-id>${serviceInstanceId}</service-instance-id> <subscriber-name/> - <global-customer-id></global-customer-id> + <global-customer-id>${globalCustomerId}</global-customer-id> </service-information> <allotted-resource-information> <allotted-resource-id>${allottedResourceId}</allotted-resource-id> @@ -562,11 +575,6 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String sdncRequestId = UUID.randomUUID().toString() - - String tsleep = execution.getVariable("junitSleepMs") - - //workaround for sdnc replication issue - sleep(tsleep == null ? 5000 : tsleep as Long) //neeed the same url as used by vfmodules String SDNCGetRequest = diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index c721ae833b..602df6bc1f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -45,6 +45,8 @@ import static org.apache.commons.lang3.StringUtils.* * @param - disableRollback * @param - failExists - O * @param - serviceInstanceId + * @param - globalCustomerId - O + * @param - subscriptionServiceType - O * @param - parentServiceInstanceId * @param - allottedReourceId - O * @param - allottedResourceModelInfo @@ -80,18 +82,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ try { String msoRequestId = execution.getVariable("msoRequestId") utils.log("DEBUG", " msoRequestId = " + msoRequestId, isDebugEnabled) - - if ((msoRequestId == null) || ("testRequestId".equals(msoRequestId)) || ("testRequestId123".equals(msoRequestId))) - { - utils.log("DEBUG"," ***** NOT sleeping 30 seconds for Junit *****", isDebugEnabled) - } - else - { - utils.log("DEBUG"," ***** sleeping 30 seconds for AAI replication *****", isDebugEnabled) - sleep(30000); - utils.log("DEBUG"," ***** sleep over *****", isDebugEnabled) - } - + execution.setVariable("prefix", Prefix) //Config Inputs @@ -104,6 +95,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + String sdncReplDelay = execution.getVariable('URN_mso_workflow_sdnc_replication_delay') + if (isBlank(sdncReplDelay)) { + msg = "URN_mso_workflow_sdnc_replication_delay is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncReplDelay", sdncReplDelay) + utils.log("DEBUG","SDNC replication delay: " + sdncReplDelay, isDebugEnabled) + //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" @@ -318,6 +318,8 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String allottedResourceId = execution.getVariable("allottedResourceId") String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalCustomerId = execution.getVariable("globalCustomerId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId") String callbackUrl = execution.getVariable("sdncCallbackUrl") @@ -370,11 +372,11 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ </request-information> <service-information> <service-id></service-id> - <subscription-service-type></subscription-service-type> + <subscription-service-type>${subscriptionServiceType}</subscription-service-type> <onap-model-information></onap-model-information> - <service-instance-id>${parentServiceInstanceId}</service-instance-id> + <service-instance-id>${serviceInstanceId}</service-instance-id> <subscriber-name/> - <global-customer-id></global-customer-id> + <global-customer-id>${globalCustomerId}</global-customer-id> </service-information> <allotted-resource-information> <allotted-resource-id>${allottedResourceId}</allotted-resource-id> @@ -565,11 +567,6 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String sdncRequestId = UUID.randomUUID().toString() - - String tsleep = execution.getVariable("junitSleepMs") - - //workaround for sdnc replication issue - sleep(tsleep == null ? 5000 : tsleep as Long) //neeed the same url as used by vfmodules String SDNCGetRequest = @@ -617,8 +614,8 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String txca = utils.getNodeXml(arData, "tunnelxconn-assignments") execution.setVariable("vni", utils.getNodeText1(txca, "vni")) - execution.setVariable("vgmuxBearerIP", utils.getNodeText1(txca, "vgmux_bearer_ip")) - execution.setVariable("vgmuxLanIP", utils.getNodeText1(txca, "vgmux_lan_ip")) + execution.setVariable("vgmuxBearerIP", utils.getNodeText1(txca, "vgmux-bearer-ip")) + execution.setVariable("vgmuxLanIP", utils.getNodeText1(txca, "vgmux-lan-ip")) String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") execution.setVariable("allotedResourceName", utils.getNodeText1(ari, "allotted-resource-name")) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java deleted file mode 100644 index 33b40b7bf0..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java +++ /dev/null @@ -1,46 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.bpmn.infrastructure.workflow.service;
-
-import javax.ws.rs.Path;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
-
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
-public class WorkflowAsyncInfrastructureResource extends WorkflowAsyncResource {
-
- protected ProcessEngineServices getProcessEngineServices() {
- return pes4junit.orElse(ProcessEngines.getProcessEngine("infrastructure"));
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java index 16811979c1..80b11bbdf5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java @@ -26,14 +26,10 @@ import java.util.Set; import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
-/**
- * @version 1.0
- * RESTeasy workflow application which wires synchronous and asynchronous response
- *
- */
@ApplicationPath("/")
public class WorkflowResourceApplication extends Application {
private Set<Object> singletons = new HashSet<Object>();
@@ -41,7 +37,7 @@ public class WorkflowResourceApplication extends Application { public WorkflowResourceApplication() {
singletons.add(new WorkflowResource());
- singletons.add(new WorkflowAsyncInfrastructureResource());
+ singletons.add(new WorkflowAsyncResource());
singletons.add(new WorkflowMessageResource());
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml index 4053de8e28..3e81a6a136 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml @@ -23,7 +23,7 @@ <process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <process-engine name="infrastructure">
+ <process-engine name="default">
<configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
<datasource>java:jboss/datasources/ProcessEngine</datasource>
<properties>
@@ -71,7 +71,7 @@ <process-archive name="MSOInfrastructureBPMN">
- <process-engine>infrastructure</process-engine>
+ <process-engine>default</process-engine>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">true</property>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn index 02f7f4815a..9fe6815570 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -366,9 +366,8 @@ CreateVcpeResCustService.prepareCreateServiceInstance(execution)]]></bpmn2:scrip </camunda:connector> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0vj46ej</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13uceka</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0sjpja4</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_13uceka" sourceRef="updateInfraRequest" targetRef="IntermediateThrowEvent_1as6hoa" /> <bpmn2:scriptTask id="ScriptTask_1qd3uwb" name="Post Process Create Service " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1ky2sv9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0vj46ej</bpmn2:outgoing> @@ -431,7 +430,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <bpmn2:linkEventDefinition name="StartService" /> </bpmn2:intermediateCatchEvent> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1as6hoa" name="GoToCreateAllottedResourcesTXC"> - <bpmn2:incoming>SequenceFlow_13uceka</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1db0ri1</bpmn2:incoming> <bpmn2:linkEventDefinition name="CreateAllottedResourcesTXC" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_15odbkz" sourceRef="IntermediateCatchEvent_1i1nwfx" targetRef="prepareCreateService_scriptTask" /> @@ -471,36 +470,11 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <bpmn2:incoming>SequenceFlow_0e9e6fo</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0hwsm6n</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:callActivity id="CallActivity_0xt1l8t" name="Call Create BRG Allotted Resource " calledElement="DoCreateAllottedResourceBRG"> - <bpmn2:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="disableRollback" target="disableRollback" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:in source="failExists" target="failExists" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - <camunda:in source="parentServiceInstanceIdBRG" target="parentServiceInstanceId" /> - <camunda:in source="allottedResourceIdBRG" target="allottedResourceId" /> - <camunda:in source="allottedResourceModelInfoBRG" target="allottedResourceModelInfo" /> - <camunda:in source="allottedResourceRoleBRG" target="allottedResourceRole" /> - <camunda:out source="rollbackData" target="DCARBRG_rollbackData" /> - <camunda:out source="rolledBack" target="rolledBack" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="allottedResourceId" target="DCARBRG_allottedResourceId" /> - <camunda:out source="allottedResourceName" target="DCARBRG_allottedResourceName" /> - <camunda:in source="allottedResourceTypeBRG" target="allottedResourceType" /> - <camunda:in source="vni" target="vni" /> - <camunda:in source="vgmuxBearerIP" target="vgmuxBearerIP" /> - <camunda:in source="brgWanMacAddress" target="brgWanMacAddress" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0b5ztoe</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0e9e6fo</bpmn2:outgoing> - </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_0hwsm6n" sourceRef="ExclusiveGateway_0jqgskx" targetRef="IntermediateThrowEvent_0lt5ltv" /> <bpmn2:sequenceFlow id="SequenceFlow_0loks1u" name="No" sourceRef="ExclusiveGateway_1xwfgxs" targetRef="ExclusiveGateway_0jqgskx" /> <bpmn2:sequenceFlow id="SequenceFlow_0b5ztoe" name="Yes" sourceRef="ExclusiveGateway_1xwfgxs" targetRef="CallActivity_0xt1l8t"> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("createBRGAR") != null && execution.getVariable("createBRGAR") == true }]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_0e9e6fo" sourceRef="CallActivity_0xt1l8t" targetRef="ExclusiveGateway_0jqgskx" /> <bpmn2:scriptTask id="ScriptTask_05epj75" name="Prepare to create Allotted Resources BRG" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_15vce9o</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0yecpl2</bpmn2:outgoing> @@ -595,6 +569,8 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script> <camunda:out source="vgmuxLanIP" target="vgmuxLanIP" /> <camunda:in source="allottedResourceTypeTXC" target="allottedResourceType" /> <camunda:in source="brgWanMacAddress" target="brgWanMacAddress" /> + <camunda:in source="globalCustomerId" target="globalCustomerId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_16qob4p</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1cgpklo</bpmn2:outgoing> @@ -616,6 +592,42 @@ def CreateVcpeResCustService= new CreateVcpeResCustService() CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0k5vcuu" sourceRef="ScriptTask_18w0jud" targetRef="ExclusiveGateway_1hlbkue" /> + <bpmn2:callActivity id="CallActivity_0xt1l8t" name="Call Create BRG Allotted Resource " calledElement="DoCreateAllottedResourceBRG"> + <bpmn2:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:in source="failExists" target="failExists" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="parentServiceInstanceIdBRG" target="parentServiceInstanceId" /> + <camunda:in source="allottedResourceIdBRG" target="allottedResourceId" /> + <camunda:in source="allottedResourceModelInfoBRG" target="allottedResourceModelInfo" /> + <camunda:in source="allottedResourceRoleBRG" target="allottedResourceRole" /> + <camunda:out source="rollbackData" target="DCARBRG_rollbackData" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="allottedResourceId" target="DCARBRG_allottedResourceId" /> + <camunda:out source="allottedResourceName" target="DCARBRG_allottedResourceName" /> + <camunda:in source="allottedResourceTypeBRG" target="allottedResourceType" /> + <camunda:in source="vni" target="vni" /> + <camunda:in source="vgmuxBearerIP" target="vgmuxBearerIP" /> + <camunda:in source="brgWanMacAddress" target="brgWanMacAddress" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="globalCustomerId" target="globalCustomerId" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0b5ztoe</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0e9e6fo</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0e9e6fo" sourceRef="CallActivity_0xt1l8t" targetRef="ExclusiveGateway_0jqgskx" /> + <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1x88t9v" name="Await AAI Distribution "> + <bpmn2:incoming>SequenceFlow_0sjpja4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1db0ri1</bpmn2:outgoing> + <bpmn2:timerEventDefinition> + <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${aaiDistDelay}</bpmn2:timeDuration> + </bpmn2:timerEventDefinition> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0sjpja4" sourceRef="updateInfraRequest" targetRef="IntermediateCatchEvent_1x88t9v" /> + <bpmn2:sequenceFlow id="SequenceFlow_1db0ri1" sourceRef="IntermediateCatchEvent_1x88t9v" targetRef="IntermediateThrowEvent_1as6hoa" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -913,13 +925,6 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ServiceTask_16yhzej_di" bpmnElement="updateInfraRequest"> <dc:Bounds x="794" y="543" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_13uceka_di" bpmnElement="SequenceFlow_13uceka"> - <di:waypoint xsi:type="dc:Point" x="894" y="583" /> - <di:waypoint xsi:type="dc:Point" x="1053" y="583" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="974" y="568" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1qd3uwb_di" bpmnElement="ScriptTask_1qd3uwb"> <dc:Bounds x="623" y="543" width="100" height="80" /> </bpmndi:BPMNShape> @@ -1143,9 +1148,9 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1as6hoa_di" bpmnElement="IntermediateThrowEvent_1as6hoa"> - <dc:Bounds x="1056" y="565" width="36" height="36" /> + <dc:Bounds x="1027" y="666" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1037" y="606" width="72" height="24" /> + <dc:Bounds x="1002" y="707" width="85" height="36" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15odbkz_di" bpmnElement="SequenceFlow_15odbkz"> @@ -1261,9 +1266,6 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> <dc:Bounds x="515" y="1317" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0xt1l8t_di" bpmnElement="CallActivity_0xt1l8t"> - <dc:Bounds x="400" y="1151" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0hwsm6n_di" bpmnElement="SequenceFlow_0hwsm6n"> <di:waypoint xsi:type="dc:Point" x="585" y="1292" /> <di:waypoint xsi:type="dc:Point" x="628" y="1292" /> @@ -1287,15 +1289,7 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> <di:waypoint xsi:type="dc:Point" x="337" y="1191" /> <di:waypoint xsi:type="dc:Point" x="395" y="1191" /> <bpmndi:BPMNLabel> - <dc:Bounds x="353" y="1216.4242424242425" width="21" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0e9e6fo_di" bpmnElement="SequenceFlow_0e9e6fo"> - <di:waypoint xsi:type="dc:Point" x="500" y="1191" /> - <di:waypoint xsi:type="dc:Point" x="560" y="1191" /> - <di:waypoint xsi:type="dc:Point" x="560" y="1267" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="485" y="1166" width="0" height="12" /> + <dc:Bounds x="354" y="1216" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_05epj75_di" bpmnElement="ScriptTask_05epj75"> @@ -1500,6 +1494,37 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> <dc:Bounds x="883" y="961" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0xt1l8t_di" bpmnElement="CallActivity_0xt1l8t"> + <dc:Bounds x="400" y="1151" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0e9e6fo_di" bpmnElement="SequenceFlow_0e9e6fo"> + <di:waypoint xsi:type="dc:Point" x="500" y="1191" /> + <di:waypoint xsi:type="dc:Point" x="560" y="1191" /> + <di:waypoint xsi:type="dc:Point" x="560" y="1267" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="440" y="1166" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1x88t9v_di" bpmnElement="IntermediateCatchEvent_1x88t9v"> + <dc:Bounds x="1027" y="565" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1018" y="530" width="54" height="48" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0sjpja4_di" bpmnElement="SequenceFlow_0sjpja4"> + <di:waypoint xsi:type="dc:Point" x="894" y="583" /> + <di:waypoint xsi:type="dc:Point" x="1027" y="583" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="960.5" y="562" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1db0ri1_di" bpmnElement="SequenceFlow_1db0ri1"> + <di:waypoint xsi:type="dc:Point" x="1045" y="601" /> + <di:waypoint xsi:type="dc:Point" x="1045" y="666" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1060" y="627.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn index 38e1d43910..88c45afda2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn @@ -253,6 +253,7 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script> <camunda:out source="rolledBack" target="rolledBack" /> <camunda:in source="lcpCloudRegionId" target="lcpCloudRegionId" /> <camunda:in source="tenantId" target="tenantId" /> + <camunda:in source="cloudConfiguration" target="cloudConfiguration" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_128485i</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_04fys47</bpmn2:outgoing> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn index a35371e97c..b925b007cd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateAllottedResourceBRG" name="DoCreateAllottedResourceBRG" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -180,7 +180,7 @@ dcar.validateSDNCResp(execution, response, "activate" )]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0q1hz2p</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1iy3cqb" sourceRef="postProcessSDNCGetResponse" targetRef="generateOutputs" /> - <bpmn2:sequenceFlow id="SequenceFlow_1dgzhsm" sourceRef="UpdateAAIARActive" targetRef="PreProcessSDNCGet" /> + <bpmn2:sequenceFlow id="SequenceFlow_1dgzhsm" sourceRef="UpdateAAIARActive" targetRef="IntermediateCatchEvent_1f4tse6" /> <bpmn2:callActivity id="GetAAIParentSI" name="Get AAI Parent ServiceInstance " calledElement="GenericGetService"> <bpmn2:extensionElements> <camunda:in source="parentServiceInstanceId" target="GENGS_serviceInstanceId" /> @@ -277,8 +277,8 @@ DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() dcar.updateAaiAROrchStatus(execution, "Created")]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="PreProcessSDNCGet" name="PreProcess SDNC Get" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1dgzhsm</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_0z8luou</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0ec9eiq</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_030mhcm</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() @@ -326,6 +326,14 @@ DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() dcar.generateOutputs(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_09xwplc" sourceRef="generateOutputs" targetRef="EndEvent_3" /> + <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1f4tse6" name="Await SDNC Replication "> + <bpmn2:incoming>SequenceFlow_1dgzhsm</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ec9eiq</bpmn2:outgoing> + <bpmn2:timerEventDefinition> + <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${sdncReplDelay}</bpmn2:timeDuration> + </bpmn2:timerEventDefinition> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0ec9eiq" sourceRef="IntermediateCatchEvent_1f4tse6" targetRef="PreProcessSDNCGet" /> </bpmn2:process> <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -532,10 +540,9 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1dgzhsm_di" bpmnElement="SequenceFlow_1dgzhsm"> <di:waypoint xsi:type="dc:Point" x="964" y="624" /> - <di:waypoint xsi:type="dc:Point" x="964" y="545" /> - <di:waypoint xsi:type="dc:Point" x="1140" y="545" /> + <di:waypoint xsi:type="dc:Point" x="964" y="563" /> <bpmndi:BPMNLabel> - <dc:Bounds x="979" y="584.5" width="0" height="0" /> + <dc:Bounds x="934" y="593.5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0e73um9_di" bpmnElement="GetAAIParentSI"> @@ -730,6 +737,19 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="575" y="980" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1f4tse6_di" bpmnElement="IntermediateCatchEvent_1f4tse6"> + <dc:Bounds x="946" y="527" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="933" y="492" width="61" height="48" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ec9eiq_di" bpmnElement="SequenceFlow_0ec9eiq"> + <di:waypoint xsi:type="dc:Point" x="982" y="545" /> + <di:waypoint xsi:type="dc:Point" x="1140" y="545" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1061" y="524" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn index 178534f797..a240bb5ffa 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateAllottedResourceTXC" name="DoCreateAllottedResourceTXC" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -180,7 +180,6 @@ dcar.validateSDNCResp(execution, response, "activate" )]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0q1hz2p</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1iy3cqb" sourceRef="postProcessSDNCGetResponse" targetRef="generateOutputs" /> - <bpmn2:sequenceFlow id="SequenceFlow_1dgzhsm" sourceRef="UpdateAAIARActive" targetRef="PreProcessSDNCGet" /> <bpmn2:callActivity id="GetAAIParentSI" name="Get AAI Parent ServiceInstance " calledElement="GenericGetService"> <bpmn2:extensionElements> <camunda:in source="parentServiceInstanceId" target="GENGS_serviceInstanceId" /> @@ -262,7 +261,7 @@ dcar.postProcessRollback(execution)]]></bpmn2:script> </bpmn2:subProcess> <bpmn2:scriptTask id="UpdateAAIARActive" name="Update AAI AR Active" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_00i7x43</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1dgzhsm</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_07kxd8t</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() @@ -277,8 +276,8 @@ DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() dcar.updateAaiAROrchStatus(execution, "Created")]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="PreProcessSDNCGet" name="PreProcess SDNC Get" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1dgzhsm</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_0z8luou</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_08hhqb2</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_030mhcm</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.* DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() @@ -326,6 +325,15 @@ DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() dcar.generateOutputs(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_09xwplc" sourceRef="generateOutputs" targetRef="EndEvent_3" /> + <bpmn2:sequenceFlow id="SequenceFlow_07kxd8t" sourceRef="UpdateAAIARActive" targetRef="IntermediateThrowEvent_0ti2fv8" /> + <bpmn2:intermediateCatchEvent id="IntermediateThrowEvent_0ti2fv8" name="Await SDNC Replication "> + <bpmn2:incoming>SequenceFlow_07kxd8t</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_08hhqb2</bpmn2:outgoing> + <bpmn2:timerEventDefinition> + <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${sdncReplDelay}</bpmn2:timeDuration> + </bpmn2:timerEventDefinition> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_08hhqb2" sourceRef="IntermediateThrowEvent_0ti2fv8" targetRef="PreProcessSDNCGet" /> </bpmn2:process> <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -530,14 +538,6 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="1277" y="779" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1dgzhsm_di" bpmnElement="SequenceFlow_1dgzhsm"> - <di:waypoint xsi:type="dc:Point" x="964" y="624" /> - <di:waypoint xsi:type="dc:Point" x="964" y="545" /> - <di:waypoint xsi:type="dc:Point" x="1140" y="545" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="979" y="584.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0e73um9_di" bpmnElement="GetAAIParentSI"> <dc:Bounds x="843" y="199" width="100" height="80" /> </bpmndi:BPMNShape> @@ -730,6 +730,26 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="575" y="980" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07kxd8t_di" bpmnElement="SequenceFlow_07kxd8t"> + <di:waypoint xsi:type="dc:Point" x="964" y="624" /> + <di:waypoint xsi:type="dc:Point" x="964" y="563" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="979" y="587.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_038xgwf_di" bpmnElement="IntermediateThrowEvent_0ti2fv8"> + <dc:Bounds x="946" y="527" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="933" y="492" width="61" height="48" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_08hhqb2_di" bpmnElement="SequenceFlow_08hhqb2"> + <di:waypoint xsi:type="dc:Point" x="982" y="545" /> + <di:waypoint xsi:type="dc:Point" x="1140" y="545" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1061" y="524" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..8ccb18a625 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy @@ -0,0 +1,160 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.infrastructure.scripts.DeleteCustomE2EServiceInstance +import org.openecomp.mso.bpmn.mock.FileUtil +import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase + +import static org.junit.Assert.assertTrue +import static org.junit.Assert.assertTrue +import static org.junit.Assert.assertTrue +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when + +class DeleteCustomE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + String RbType = "DCRENI_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + public DeleteCustomE2EServiceInstanceTest(){ + super("DeleteCustomE2EServiceInstance") + } + @Test + public void preProcessRequestTest () { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + mex.setVariable("isDebugLogEnabled","true") + instance.preProcessRequest(mex); + + verify(mex).getVariable(GroovyTestBase.DBGFLAG) + + verify(mex).setVariable("globalSubscriberId", "38829939920000") + verify(mex).setVariable("operationId", "59960003992") + verify(mex).setVariable("URN_mso_adapters_openecomp_db_endpoint", "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + } + + @Test + public void sendSyncResponseTest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.sendSyncResponse(mex) + verify(mex).setVariable("DeleteCustomE2EServiceInstanceWorkflowResponseSent", "true") + } + + @Test + public void prepareCompletionRequestTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.prepareCompletionRequest(mex) + String msoComplitionRequest = FileUtil.readResourceFile("__files/GenericFlows/MsoCompletionRequest.xml") + //verify(mex).setVariable("completionRequest", msoComplitionRequest) + } + + @Test + public void sendSyncErrorTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.sendSyncError(mex) + + } + + @Test + public void prepareFalloutRequest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.prepareFalloutRequest(mex) + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>null</request-id> + <action>DELETE</action> + <source>null</source> + </request-info>""" + //verify(mex).setVariable("falloutRequest", requestInfo) + } + + @Test + public void processJavaExceptionTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DeleteCustomE2EServiceInstance instance = new DeleteCustomE2EServiceInstance() + instance.processJavaException() + } + + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("requestAction")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..2cf09fe144 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy @@ -0,0 +1,143 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Ignore +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.openecomp.mso.bpmn.infrastructure.scripts.DoCustomDeleteE2EServiceInstance +import org.openecomp.mso.bpmn.mock.FileUtil +import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase + +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when +import static org.mockito.Mockito.when + +class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + String RbType = "DCRENI_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + public DoCustomDeleteE2EServiceInstanceTest(){ + super("DoCustomDeleteE2EServiceInstance") + } + + @Test + public void preProcessRequestTest(){ + + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.preProcessRequest(mex) + verify(mex).setVariable("sdncCallbackUrl", "/mso/sdncadapter/") + verify(mex).setVariable("siParamsXml", "") + } + + @Ignore + @Test + public void postProcessAAIGETTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(true) + + String aaiGetResponse = FileUtil.readResourceFile("__files/GenericFlows/aaiGetResponse.xml") + when(mex.getVariable("GENGS_service")).thenReturn(aaiGetResponse) + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.postProcessAAIGET(mex) + // TODO: what to test here? +// verify(mex).setVariable("subscriptionServiceType", "e2eserviceInstance/delete") + } + + @Ignore + @Test + public void preInitResourcesOperStatusTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.preInitResourcesOperStatus(mex) + // TODO: what to test here? +// verify(mex).setVariable("CVFMI_dbAdapterEndpoint", "http://localhost:8080/mso") + } + + @Test + public void preResourceDeleteTest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.preResourceDelete(mex,"overlay") + verify(mex).setVariable("resourceType", "overlay") + } + + @Ignore + @Test + public void postProcessSDNCDeleteTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn("true") + when(mex.getVariable("DDELSI_sdncResponseSuccess")).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn("DDELSI_") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + String response = FileUtil.readResourceFile("__files/GenericFlows/SDNCDeleteResponse.xml") + String method = "deleteE2E"; + instance.postProcessSDNCDelete(mex, response, method) + // TODO: what to test here? +// verify(mex).setVariable("DDELSI_sdncRequestDataResponseCode", "0") + } + + @Test + public void postProcessAAIDELTest() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("GENDS_SuccessIndicator")).thenReturn("true") + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + instance.postProcessAAIDEL(mex) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("mso-request-id")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") + when(mex.getVariable("requestAction")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("/mso/sdncadapter/") + when(mex.getVariable("GENGS_FoundIndicator")).thenReturn("true") + when(mex.getVariable("GENGS_siResourceLink")).thenReturn("/service-subscription/e2eserviceInstance/delete/service-instances/") + when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") + when(mex.getVariable("GENGS_service")).thenReturn("test3434") + when(mex.getVariable("URN_mso_openecomp_adapters_db_endpoint")).thenReturn("http://localhost:8080/mso") + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index 0b29219dd8..f0645b2bc7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -85,7 +85,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** preProcessRequest *****
@Test
-// @Ignore
+ // @Ignore
public void preProcessRequest() {
ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -96,6 +96,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).getVariable(DBGFLAG)
verify(mex).setVariable("prefix", Prefix) + verify(mex).setVariable("aaiDistDelay", "aaidelay") verify(mex).setVariable("createVcpeServiceRequest", request) verify(mex).setVariable("msoRequestId", "mri") assertEquals("sii", map.get("serviceInstanceId")) @@ -118,7 +119,21 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore + public void preProcessRequest_MissingAaiDistDelay() { + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(null) + + CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() + + assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) })) + } + + @Test + // @Ignore public void preProcessRequest_EmptyParts() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -160,7 +175,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRequest_MissingSubscriberId() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -178,7 +193,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRequest_BpmnError() { ExecutionEntity mex = setupMock() initPreProcess(mex) @@ -191,7 +206,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRequest_Ex() { ExecutionEntity mex = setupMock() initPreProcess(mex) @@ -206,7 +221,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** sendSyncResponse ***** @Test -// @Ignore + // @Ignore public void sendSyncResponse() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -229,7 +244,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void sendSyncResponse_Ex() { ExecutionEntity mex = setupMock() initSendSyncResponse(mex) @@ -245,7 +260,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** prepareDecomposeService ***** @Test -// @Ignore + // @Ignore public void prepareDecomposeService() { ExecutionEntity mex = setupMock() initPrepareDecomposeService(mex) @@ -258,7 +273,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareDecomposeService_Ex() { ExecutionEntity mex = setupMock() initPrepareDecomposeService(mex) @@ -274,7 +289,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** prepareCreateServiceInstance ***** @Test - @Ignore + // @Ignore public void prepareCreateServiceInstance() { ExecutionEntity mex = setupMock() initPrepareCreateServiceInstance(mex) @@ -288,7 +303,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareCreateServiceInstance_Ex() { ExecutionEntity mex = setupMock() initPrepareCreateServiceInstance(mex) @@ -304,7 +319,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** postProcessServiceInstanceCreate ***** @Test -// @Ignore + // @Ignore public void postProcessServiceInstanceCreate() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -323,7 +338,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessServiceInstanceCreate_BpmnError() { ExecutionEntity mex = setupMock() initPostProcessServiceInstanceCreate(mex) @@ -336,7 +351,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessServiceInstanceCreate_Ex() { ExecutionEntity mex = setupMock() initPostProcessServiceInstanceCreate(mex) @@ -352,7 +367,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** processDecomposition ***** @Test -// @Ignore + // @Ignore public void processDecomposition() { ExecutionEntity mex = setupMock() def svcdecomp = initProcessDecomposition(mex, true, true) @@ -371,7 +386,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void processDecomposition_EmptyNet_EmptyVnf() { ExecutionEntity mex = setupMock() def svcdecomp = initProcessDecomposition(mex, true, true) @@ -392,7 +407,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void processDecomposition_Ex() { ExecutionEntity mex = setupMock() def svcdecomp = initProcessDecomposition(mex, true, true) @@ -408,7 +423,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** prepareCreateAllottedResourceTXC ***** @Test - @Ignore + // @Ignore public void prepareCreateAllottedResourceTXC() { ExecutionEntity mex = setupMock() initPrepareCreateAllottedResourceTXC(mex) @@ -426,7 +441,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareCreateAllottedResourceTXC_NullArList() { ExecutionEntity mex = setupMock() def svcdecomp = initPrepareCreateAllottedResourceTXC(mex) @@ -446,7 +461,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareCreateAllottedResourceTXC_Ex() { ExecutionEntity mex = setupMock() initPrepareCreateAllottedResourceTXC(mex) @@ -462,7 +477,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** prepareCreateAllottedResourceBRG ***** @Test - @Ignore + // @Ignore public void prepareCreateAllottedResourceBRG() { ExecutionEntity mex = setupMock() initPrepareCreateAllottedResourceBRG(mex) @@ -480,7 +495,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareCreateAllottedResourceBRG_NullArList() { ExecutionEntity mex = setupMock() def svcdecomp = initPrepareCreateAllottedResourceBRG(mex) @@ -500,7 +515,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareCreateAllottedResourceBRG_Ex() { ExecutionEntity mex = setupMock() initPrepareCreateAllottedResourceBRG(mex) @@ -516,7 +531,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** prepareVnfAndModulesCreate ***** @Test -// @Ignore + // @Ignore public void prepareVnfAndModulesCreate() { ExecutionEntity mex = setupMock() initPrepareVnfAndModulesCreate(mex) @@ -532,7 +547,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareVnfAndModulesCreate_EmptyList() { ExecutionEntity mex = setupMock() initPrepareVnfAndModulesCreate(mex) @@ -550,7 +565,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareVnfAndModulesCreate_NullList() { ExecutionEntity mex = setupMock() initPrepareVnfAndModulesCreate(mex) @@ -568,7 +583,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareVnfAndModulesCreate_Ex() { ExecutionEntity mex = setupMock() initPrepareVnfAndModulesCreate(mex) @@ -584,7 +599,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** validateVnfCreate ***** @Test -// @Ignore + // @Ignore public void validateVnfCreate() { ExecutionEntity mex = setupMock() initValidateVnfCreate(mex) @@ -598,7 +613,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void validateVnfCreate_Ex() { ExecutionEntity mex = setupMock() initValidateVnfCreate(mex) @@ -614,7 +629,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** postProcessResponse ***** @Test -// @Ignore + // @Ignore public void postProcessResponse() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -635,7 +650,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessResponse_BpmnError() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -649,7 +664,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessResponse_Ex() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -666,7 +681,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** preProcessRollback ***** @Test -// @Ignore + // @Ignore public void preProcessRollback() { ExecutionEntity mex = setupMock() def wfe = initPreProcessRollback(mex) @@ -680,7 +695,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRollback_NullWfe() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -697,7 +712,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRollback_BpmnError() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -714,7 +729,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRollback_Ex() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -734,7 +749,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** postProcessRollback ***** @Test -// @Ignore + // @Ignore public void postProcessRollback() { ExecutionEntity mex = setupMock() def wfe = initPostProcessRollback(mex) @@ -748,7 +763,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessRollback_NullWfe() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -765,7 +780,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessRollback_BpmnError() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -778,7 +793,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessRollback_Ex() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -798,7 +813,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** prepareFalloutRequest ***** @Test -// @Ignore + // @Ignore public void prepareFalloutRequest() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -817,7 +832,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void prepareFalloutRequest_Ex() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -833,7 +848,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** sendSyncError ***** @Test -// @Ignore + // @Ignore public void sendSyncError() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -857,7 +872,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void sendSyncError_NotWfe() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -883,7 +898,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void sendSyncError_NullWfe() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -909,7 +924,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void sendSyncError_Ex() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -928,7 +943,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** processJavaException ***** @Test -// @Ignore + // @Ignore public void processJavaException() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -948,7 +963,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void processJavaException_BpmnError() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -964,7 +979,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void processJavaException_Ex() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -985,6 +1000,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { private void initPreProcess(ExecutionEntity mex) { when(mex.getVariable(DBGFLAG)).thenReturn("true") when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("aaidelay") when(mex.getVariable("mso-request-id")).thenReturn("mri") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("requestAction")).thenReturn("ra") @@ -1008,7 +1024,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp) - when(svcdecomp.toJsonString()).thenReturn("mydecomp") + when(svcdecomp.toJsonStringNoRootName()).thenReturn("mydecomp") } private void initPostProcessServiceInstanceCreate(ExecutionEntity mex) { @@ -1037,6 +1053,10 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { return svcdecomp } + private initAwaitAaiDistribution(ExecutionEntity mex) { + when(mex.getVariable(DBGFLAG)).thenReturn("true") + } + private ServiceDecomposition initPrepareCreateAllottedResourceTXC(ExecutionEntity mex) { ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class) List<AllottedResource> arlst = new LinkedList<>() @@ -1078,13 +1098,13 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { ModelInfo mod = mock(ModelInfo.class) HomingSolution home = mock(HomingSolution.class) - when(ar.toJsonString()).thenReturn("json"+id) + when(ar.toJsonStringNoRootName()).thenReturn("json"+id) when(ar.getAllottedResourceType()).thenReturn("TunnelXConn") when(ar.getModelInfo()).thenReturn(mod) when(ar.getAllottedResourceRole()).thenReturn("TXCr") when(ar.getHomingSolution()).thenReturn(home) - when(mod.toJsonString()).thenReturn("model"+id) + when(mod.toJsonStringNoRootName()).thenReturn("model"+id) when(home.getServiceInstanceId()).thenReturn("home"+id) @@ -1096,13 +1116,13 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { ModelInfo mod = mock(ModelInfo.class) HomingSolution home = mock(HomingSolution.class) - when(ar.toJsonString()).thenReturn("json"+id) + when(ar.toJsonStringNoRootName()).thenReturn("json"+id) when(ar.getAllottedResourceType()).thenReturn("BRG") when(ar.getModelInfo()).thenReturn(mod) when(ar.getAllottedResourceRole()).thenReturn("BRGr") when(ar.getHomingSolution()).thenReturn(home) - when(mod.toJsonString()).thenReturn("model"+id) + when(mod.toJsonStringNoRootName()).thenReturn("model"+id) when(home.getServiceInstanceId()).thenReturn("home"+id) diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy index df7c0cff97..fc53744b8b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy @@ -108,6 +108,7 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase { verify(mex).setVariable("lcpCloudRegionId", "mdt1") verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration")) verify(mex).setVariable("sdncVersion", "1702") verify(mex).setVariable("GENGS_type", "service-instance") assertTrue(map.containsKey(Prefix+"requestInfo")) @@ -146,6 +147,7 @@ class DeleteVcpeResCustServiceTest extends GroovyTestBase { verify(mex).setVariable("lcpCloudRegionId", "mdt1") verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba") + assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration")) verify(mex).setVariable("sdncVersion", "1702") verify(mex).setVariable("GENGS_type", "service-instance") assertTrue(map.containsKey(Prefix+"requestInfo")) diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy index 1d4d3ea5a3..89c13f179c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -89,6 +89,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { verify(mex).setVariable("prefix", Prefix)
assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) + assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdnc_replication_delay")) assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) @@ -296,8 +297,10 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0) assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0) assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0) - assertTrue(result.indexOf("<service-instance-id>psii</") >= 0) + assertTrue(result.indexOf("<service-instance-id>sii</") >= 0) assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0) + assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0) + assertTrue(result.indexOf("<global-customer-id>gci</") >= 0) assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0) assertTrue(result.indexOf("<request-id>mri</") >= 0) assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0) @@ -326,8 +329,10 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0) assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0) assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0) - assertTrue(result.indexOf("<service-instance-id>psii</") >= 0) + assertTrue(result.indexOf("<service-instance-id>sii</") >= 0) assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0) + assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0) + assertTrue(result.indexOf("<global-customer-id>gci</") >= 0) assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0) assertTrue(result.indexOf("<request-id>mri</") >= 0) assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0) @@ -886,6 +891,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { private void initPreProcess(ExecutionEntity mex) { when(mex.getVariable(DBGFLAG)).thenReturn("true") when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") + when(mex.getVariable("URN_mso_workflow_sdnc_replication_delay")).thenReturn("sdncdelay") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") @@ -931,6 +937,8 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("allottedResourceId")).thenReturn("ari") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") + when(mex.getVariable("globalCustomerId")).thenReturn("gci") when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") when(mex.getVariable("msoRequestId")).thenReturn("mri") when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") @@ -963,7 +971,6 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>") when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data><object-path>assignlink</object-path></response-data>") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("junitSleepMs")).thenReturn("5") when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy index 2b6d4ba6a0..b27e368316 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy @@ -83,7 +83,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** preProcessRequest *****
@Test
-// @Ignore
+ // @Ignore
public void preProcessRequest() {
ExecutionEntity mex = setupMock() initPreProcess(mex) @@ -95,6 +95,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { verify(mex).setVariable("prefix", Prefix)
assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) + assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdnc_replication_delay")) assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) @@ -107,7 +108,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** getAaiAR ***** @Test -// @Ignore + // @Ignore public void getAaiAR() { MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") @@ -121,7 +122,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void getAaiAR_Duplicate() { MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") @@ -137,7 +138,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void getAaiAR_NotActive() { MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") @@ -153,7 +154,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void getAaiAR_NoStatus() { MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") @@ -172,7 +173,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** createAaiAR ***** @Test -// @Ignore + // @Ignore public void createAaiAR() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -196,7 +197,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void createAaiAR_NoArid_NoModelUuids() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -226,7 +227,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void createAaiAR_MissingPsiLink() { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) @@ -241,7 +242,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void createAaiAR_HttpFailed() { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) @@ -254,7 +255,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void createAaiAR_BpmnError() { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) @@ -269,7 +270,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void createAaiAR_Ex() { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) @@ -287,7 +288,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** buildSDNCRequest ***** @Test -// @Ignore + // @Ignore public void buildSDNCRequest() { ExecutionEntity mex = setupMock() initBuildSDNCRequest(mex) @@ -300,8 +301,10 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0) assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0) assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0) - assertTrue(result.indexOf("<service-instance-id>psii</") >= 0) + assertTrue(result.indexOf("<service-instance-id>sii</") >= 0) assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0) + assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0) + assertTrue(result.indexOf("<global-customer-id>gci</") >= 0) assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0) assertTrue(result.indexOf("<request-id>mri</") >= 0) assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0) @@ -312,7 +315,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void buildSDNCRequest_Ex() { ExecutionEntity mex = setupMock() initBuildSDNCRequest(mex) @@ -328,7 +331,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** preProcessSDNCAssign ***** @Test -// @Ignore + // @Ignore public void preProcessSDNCAssign() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -354,7 +357,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCAssign_BpmnError() { ExecutionEntity mex = setupMock() initPreProcessSDNC(mex) @@ -367,7 +370,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCAssign_Ex() { ExecutionEntity mex = setupMock() initPreProcessSDNC(mex) @@ -383,7 +386,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** preProcessSDNCCreate ***** @Test -// @Ignore + // @Ignore public void preProcessSDNCCreate() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -410,7 +413,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCCreate_BpmnError() { ExecutionEntity mex = setupMock() initPreProcessSDNC(mex) @@ -423,7 +426,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCCreate_Ex() { ExecutionEntity mex = setupMock() initPreProcessSDNC(mex) @@ -439,7 +442,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** preProcessSDNCActivate ***** @Test -// @Ignore + // @Ignore public void preProcessSDNCActivate() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -466,7 +469,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCActivate_BpmnError() { ExecutionEntity mex = setupMock() initPreProcessSDNC(mex) @@ -479,7 +482,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCActivate_Ex() { ExecutionEntity mex = setupMock() initPreProcessSDNC(mex) @@ -495,7 +498,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** validateSDNCResp ***** @Test -// @Ignore + // @Ignore public void validateSDNCResp() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -519,7 +522,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void validateSDNCResp_Get() { ExecutionEntity mex = setupMock() def data = initValidateSDNCResp(mex) @@ -538,7 +541,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void validateSDNCResp_Unsuccessful() { ExecutionEntity mex = setupMock() initValidateSDNCResp(mex) @@ -553,7 +556,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void validateSDNCResp_BpmnError() { ExecutionEntity mex = setupMock() initValidateSDNCResp(mex) @@ -567,7 +570,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void validateSDNCResp_Ex() { ExecutionEntity mex = setupMock() initValidateSDNCResp(mex) @@ -584,7 +587,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** preProcessSDNCGet ***** @Test -// @Ignore + // @Ignore public void preProcessSDNCGet_FoundAR() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -603,7 +606,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCGet_NotFoundAR() { ExecutionEntity mex = setupMock() def map = setupMap(mex) @@ -624,7 +627,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessSDNCGet_Ex() { ExecutionEntity mex = setupMock() initPreProcessSDNCGet(mex) @@ -640,7 +643,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** updateAaiAROrchStatus ***** @Test -// @Ignore + // @Ignore public void updateAaiAROrchStatus() { MockPatchAllottedResource(CUST, SVC, INST, ARID) @@ -655,7 +658,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** generateOutputs ***** @Test -// @Ignore + // @Ignore public void generateOutputs() { ExecutionEntity mex = setupMock() def txctop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml") @@ -674,7 +677,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void generateOutputs_BadXml() { ExecutionEntity mex = setupMock() @@ -689,7 +692,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void generateOutputs_BpmnError() { ExecutionEntity mex = setupMock() @@ -704,7 +707,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void generateOutputs_Ex() { ExecutionEntity mex = setupMock() @@ -722,7 +725,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** preProcessRollback ***** @Test -// @Ignore + // @Ignore public void preProcessRollback() { ExecutionEntity mex = setupMock() WorkflowException wfe = mock(WorkflowException.class) @@ -738,7 +741,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRollback_NotWFE() { ExecutionEntity mex = setupMock() @@ -753,7 +756,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRollback_BpmnError() { ExecutionEntity mex = setupMock() @@ -767,7 +770,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void preProcessRollback_Ex() { ExecutionEntity mex = setupMock() @@ -784,7 +787,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { // ***** postProcessRollback ***** @Test -// @Ignore + // @Ignore public void postProcessRollback() { ExecutionEntity mex = setupMock() WorkflowException wfe = mock(WorkflowException.class) @@ -801,7 +804,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessRollback_NotWFE() { ExecutionEntity mex = setupMock() @@ -817,7 +820,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessRollback_BpmnError() { ExecutionEntity mex = setupMock() @@ -832,7 +835,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { } @Test -// @Ignore + // @Ignore public void postProcessRollback_Ex() { ExecutionEntity mex = setupMock() @@ -860,6 +863,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { private void initPreProcess(ExecutionEntity mex) { when(mex.getVariable(DBGFLAG)).thenReturn("true") when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") + when(mex.getVariable("URN_mso_workflow_sdnc_replication_delay")).thenReturn("sdncdelay") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") @@ -903,6 +907,8 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("allottedResourceId")).thenReturn("ari") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("subscriptionServiceType")).thenReturn("sst") + when(mex.getVariable("globalCustomerId")).thenReturn("gci") when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") when(mex.getVariable("msoRequestId")).thenReturn("mri") } @@ -923,7 +929,6 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>") when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data><object-path>assignlink</object-path></response-data>") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") - when(mex.getVariable("junitSleepMs")).thenReturn("5") when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java index 38461de5a0..0af43a2c42 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java @@ -371,7 +371,6 @@ public class CreateVcpeResCustServiceTest extends AbstractTestBase { variables.put("request-id", "testRequestId"); variables.put("serviceInstanceId", DEC_INST); variables.put("allottedResourceId", ARID); - variables.put("junitSleepMs", "5"); return variables; } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java index 5b6f74fc7d..0373266ce1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java @@ -277,7 +277,6 @@ public class DoCreateAllottedResourceBRGTest extends AbstractTestBase { variables.put("vni", "BRG"); variables.put("vgmuxBearerIP", "bearerip"); variables.put("brgWanMacAddress", "wanmac"); - variables.put("junitSleepMs", "5"); variables.put("serviceInstanceId", DEC_INST); variables.put("parentServiceInstanceId", DEC_PARENT_INST); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java index 4323ccae1a..9cf059c24c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java @@ -283,7 +283,6 @@ public class DoCreateAllottedResourceTXCTest extends AbstractTestBase { variables.put("allottedResourceType", "TXC"); variables.put("allottedResourceId", ARID); variables.put("brgWanMacAddress", "wanmac"); - variables.put("junitSleepMs", "5"); variables.put("serviceInstanceId", DEC_INST); variables.put("parentServiceInstanceId", DEC_PARENT_INST); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml index 9b201d9808..05583cd7aa 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml @@ -16,8 +16,8 @@ </allotted-resource-identifiers>
<tunnelxconn-assignments>
<vni>my-vni</vni>
- <vgmux_bearer_ip>my-bearer-ip</vgmux_bearer_ip>
- <vgmux_lan_ip>my-lan-ip</vgmux_lan_ip>
+ <vgmux-bearer-ip>my-bearer-ip</vgmux-bearer-ip>
+ <vgmux-lan-ip>my-lan-ip</vgmux-lan-ip>
</tunnelxconn-assignments>
</tunnelxconn-topology>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml index 9b201d9808..05583cd7aa 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml @@ -16,8 +16,8 @@ </allotted-resource-identifiers>
<tunnelxconn-assignments>
<vni>my-vni</vni>
- <vgmux_bearer_ip>my-bearer-ip</vgmux_bearer_ip>
- <vgmux_lan_ip>my-lan-ip</vgmux_lan_ip>
+ <vgmux-bearer-ip>my-bearer-ip</vgmux-bearer-ip>
+ <vgmux-lan-ip>my-lan-ip</vgmux-lan-ip>
</tunnelxconn-assignments>
</tunnelxconn-topology>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties index aad79b00f0..325ee3ce97 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties @@ -40,6 +40,8 @@ mso.sdnc.timeout.ucpe.async.hours=120 mso.sdnc.timeout.ucpe.async.minutes=5
mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage
mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService
+mso.workflow.sdnc.replication.delay=PT0.01S
+mso.workflow.aai.distribution.delay=PT0.01S
mso.catalog.db.endpoint=http://localhost:28090
diff --git a/bpmn/MSOMockServer/.gitignore b/bpmn/MSOMockServer/.gitignore deleted file mode 100644 index f6c8fbcdef..0000000000 --- a/bpmn/MSOMockServer/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/bin -/target -/target -/target diff --git a/bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF b/bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 254272e1c0..0000000000 --- a/bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/bpmn/MSOMockServer/WebContent/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOMockServer/WebContent/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index fb268917f2..0000000000 --- a/bpmn/MSOMockServer/WebContent/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,21 +0,0 @@ -<jboss-deployment-structure>
- <deployment>
- <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
- <exclusions>
- <module name="org.apache.log4j" />
- <module name="org.slf4j" />
- <module name="org.slf4j.impl" />
- <module name="org.jboss.resteasy.resteasy-jackson-provider" />
- <module name="org.jboss.resteasy.resteasy-jettison-provider" />
- </exclusions>
- <dependencies>
- <module name="org.jboss.jandex" slot="main" />
- <module name="org.javassist" slot="main" />
- <module name="org.antlr" slot="main" />
- <module name="org.dom4j" slot="main" />
- <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />
- <!-- This module contain the ProviderBase class: -->
- <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" export="true" />
- </dependencies>
- </deployment>
-</jboss-deployment-structure>
diff --git a/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml b/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml deleted file mode 100644 index 1aa8cdb8d7..0000000000 --- a/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> -</web-app>
\ No newline at end of file diff --git a/bpmn/MSOMockServer/pom.xml b/bpmn/MSOMockServer/pom.xml deleted file mode 100644 index 500535d740..0000000000 --- a/bpmn/MSOMockServer/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ -<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> - <groupId>org.openecomp.so</groupId> - <artifactId>bpmn</artifactId> - <version>1.1.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>org.openecomp.so</groupId> - <artifactId>MSOMockServer</artifactId> - <packaging>war</packaging> - - <build> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <version>2.4</version> - <configuration> - <attachClasses>true</attachClasses> - <archiveClasses>true</archiveClasses> - <failOnMissingWebXml>false</failOnMissingWebXml> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - - <dependency> - <groupId>com.github.tomakehurst</groupId> - <artifactId>wiremock</artifactId> - <version>1.56</version> - <classifier>standalone</classifier> - <exclusions> - <exclusion> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty</artifactId> - </exclusion> - <exclusion> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </exclusion> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </exclusion> - <exclusion> - <groupId>org.skyscreamer</groupId> - <artifactId>jsonassert</artifactId> - </exclusion> - <exclusion> - <groupId>xmlunit</groupId> - <artifactId>xmlunit</artifactId> - </exclusion> - <exclusion> - <groupId>com.jayway.jsonpath</groupId> - <artifactId>json-path</artifactId> - </exclusion> - <exclusion> - <groupId>net.sf.jopt-simple</groupId> - <artifactId>jopt-simple</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.so</groupId> - <artifactId>common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-client</artifactId> - <version>3.0.8.Final</version> - <exclusions> - <exclusion> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml b/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml deleted file mode 100644 index bef293dfde..0000000000 --- a/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:v1="http://domain2.openecomp.org/workflow/sdnc/adapter/schema/v1">
- <soapenv:Header />
- <soapenv:Body>
- <SDNCAdapterCallbackRequest
- xmlns="http://domain2.openecomp.org/workflow/sdnc/adapter/schema/v1">
- <CallbackHeader>
- <RequestId>d325c9a7-84c0-4081-b979-9cc773a0976d</RequestId>
- <ResponseCode>200</ResponseCode>
- <ResponseMessage>OK</ResponseMessage>
- </CallbackHeader>
- <RequestData xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><layer3-service-list
- xmlns="com:att:sdnctl:l3api"><service-instance-id>0XX/VXXX/003717//Shakeout</service-instance-id><service-status><rpc-name>svc-topology-operation</rpc-name><rpc-action>delete</rpc-action><request-status>synccomplete</request-status><final-indicator>Y</final-indicator><l3sdn-action>DisconnectLayer3ServiceRequest</l3sdn-action><response-timestamp>2015-10-22T02:11:52.010Z</response-timestamp></service-status><service-data><svc-config-additional-data/></service-data></layer3-service-list>
- </RequestData>
- </SDNCAdapterCallbackRequest>
- </soapenv:Body>
-</soapenv:Envelope>
diff --git a/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml deleted file mode 100644 index cca27bb062..0000000000 --- a/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"> -<jboss-web> - <security-domain>other</security-domain> - <context-root>/msomock</context-root> -</jboss-web>
\ No newline at end of file diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 4f96cc1ffe..a83e85f148 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -31,7 +31,6 @@ <modules> <module>MSOCoreBPMN</module> - <module>MSOMockServer</module> <module>MSORESTClient</module> <module>MSOCommonBPMN</module> <module>MSOInfrastructureBPMN</module> |