diff options
Diffstat (limited to 'bpmn')
77 files changed, 812 insertions, 567 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 60a689c04a..c051aac9b8 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -10,7 +10,6 @@ <artifactId>MSOCommonBPMN</artifactId> <name>MSOCommonBPMN</name> <packaging>jar</packaging> - <build> <plugins> <plugin> @@ -19,7 +18,6 @@ <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> - <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> @@ -33,11 +31,9 @@ </dependency> </dependencies> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.0.2</version> <executions> <execution> <goals> @@ -139,29 +135,15 @@ </plugins> </pluginManagement> </build> - <dependencyManagement> - <dependencies> - <dependency> - <!-- Import dependency management from camunda --> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifactId>camunda-bpm-spring-boot-starter</artifactId> - <version>${camunda.springboot.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -172,7 +154,6 @@ <dependency> <groupId>org.camunda.bpm.extension.mockito</groupId> <artifactId>camunda-bpm-mockito</artifactId> - <version>3.2.1</version> <scope>test</scope> </dependency> <dependency> @@ -182,15 +163,7 @@ <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> + </dependency> <dependency> <!-- Needed for InMemoryH2Test --> <groupId>com.h2database</groupId> @@ -199,10 +172,6 @@ </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-xml</artifactId> </dependency> <dependency> @@ -234,39 +203,16 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.so</groupId> - <artifactId>common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapters-rest-interface</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> - <groupId>com.jayway.jsonpath</groupId> - <artifactId>json-path</artifactId> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>${jax.ws.rs}</version> - </dependency> - - <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> <version>${appc.client.version}</version> @@ -297,18 +243,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjrt</artifactId> - </dependency> - <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-common</artifactId> - </dependency> - <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-client</artifactId> </dependency> @@ -334,18 +268,11 @@ <dependency> <groupId>pl.pragmatists</groupId> <artifactId>JUnitParams</artifactId> - <version>1.1.0</version> + <scope>test</scope> </dependency> <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java index c02afc3327..054cc378ef 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java @@ -41,13 +41,18 @@ public class FlowManipulatorListenerRunner extends ListenerRunner { private static Logger logger = LoggerFactory.getLogger(FlowManipulatorListenerRunner.class); - protected List<FlowManipulator> flowManipulators; + protected List<PreFlowManipulator> flowManipulators; + + protected List<PostFlowManipulator> postflowManipulators; @PostConstruct protected void init() { flowManipulators = new ArrayList<>( - Optional.ofNullable(context.getBeansOfType(FlowManipulator.class)).orElse(new HashMap<>()).values()); + Optional.ofNullable(context.getBeansOfType(PreFlowManipulator.class)).orElse(new HashMap<>()).values()); + + postflowManipulators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PostFlowManipulator.class)) + .orElse(new HashMap<>()).values()); } @@ -56,11 +61,26 @@ public class FlowManipulatorListenerRunner extends ListenerRunner { do { sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence()); - List<FlowManipulator> filtered = filterListeners(flowManipulators, + List<PreFlowManipulator> filtered = filterListeners(flowManipulators, + (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(), + execution.getCurrentSequence() == 0, execution))); + + logger.info("Running pre flow manipulators:\n{}", + filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n"))); + filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution)); + } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution)); + } + + public void postModifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) { + int sequenceBeforeFlowManipulator; + do { + sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); + ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence() - 1); + List<PostFlowManipulator> filtered = filterListeners(postflowManipulators, (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(), execution.getCurrentSequence() == 0, execution))); - logger.info("Running flow manipulators:\n{}", + logger.info("Running post flow manipulators:\n{}", filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n"))); filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution)); } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution)); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java new file mode 100644 index 0000000000..b0e259b801 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PostFlowManipulator.java @@ -0,0 +1,5 @@ +package org.onap.so.bpmn.common.listener.flowmanipulator; + +public interface PostFlowManipulator extends FlowManipulator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java new file mode 100644 index 0000000000..1020f65695 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/PreFlowManipulator.java @@ -0,0 +1,5 @@ +package org.onap.so.bpmn.common.listener.flowmanipulator; + +public interface PreFlowManipulator extends FlowManipulator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index f40948fc49..7113386052 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -207,7 +207,8 @@ public class ExceptionBuilder { } } - public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) + throws BpmnError { buildWorkflowException(execution, errorCode, errorMessage); logger.info("Throwing MSOWorkflowException"); @@ -372,8 +373,18 @@ public class ExceptionBuilder { } buildWorkflowException(execution, 500, workflowExceptionMessage.toString(), Components.OPENSTACK); throw new BpmnError("MSOWorkflowException"); + } - + public void processSDNCException(DelegateExecution execution) { + logger.debug("Processing SDNC Exception"); + String errorMessage = ""; + try { + errorMessage = (String) execution.getVariable("errorMessage"); + } catch (Exception e) { + logger.debug("Error while Processing SDNC Exception", e); + } + buildWorkflowException(execution, 500, errorMessage, ONAPComponents.SDNC); + throw new BpmnError("MSOWorkflowException"); } public void processInventoryException(DelegateExecution execution) { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml index d63a5ecbaf..b579e54659 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfAdapterCallback.xml @@ -1,6 +1,3 @@ - - -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <createVfModuleResponse> <messageId>255ca199-7f53-4800-8ab0-c55954b3ff0f</messageId> <rollback> diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 34790bb496..b6aead393f 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -9,7 +9,6 @@ <modelVersion>4.0.0</modelVersion> <artifactId>MSOCoreBPMN</artifactId> <packaging>jar</packaging> - <build> <plugins> <plugin> @@ -28,11 +27,9 @@ </execution> </executions> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.0.2</version> <executions> <execution> <id>tests-jar</id> @@ -48,32 +45,19 @@ </plugin> </plugins> </build> - <dependencies> - <!-- latest commons-fileupload --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.4</version> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - </dependency> - <dependency> - <groupId>org.camunda.connect</groupId> - <artifactId>camunda-connect-connectors-all</artifactId> - <version>1.0.5</version> - </dependency> - <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine-plugin-connect</artifactId> - <version>${camunda.version}</version> </dependency> <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine</artifactId> - <version>${camunda.version}</version> </dependency> <dependency> <groupId>com.h2database</groupId> @@ -104,18 +88,5 @@ <artifactId>json-schema-validator</artifactId> <version>2.2.6</version> </dependency> - <dependency> - <groupId>com.github.fge</groupId> - <artifactId>json-schema-core</artifactId> - <version>1.2.4</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - </dependency> - <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - </dependency> </dependencies> </project> diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 1df4a26246..aa76782aef 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -138,7 +138,6 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>${springboot.version}</version> <configuration> <mainClass>org.onap.so.bpmn.infrastructure.MSOInfrastructureApplication</mainClass> </configuration> @@ -201,13 +200,6 @@ <type>pom</type> <scope>import</scope> </dependency> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> </dependencies> </dependencyManagement> <dependencies> @@ -275,13 +267,11 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -299,15 +289,13 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> + <groupId>org.camunda.bpm.assert</groupId> <artifactId>camunda-bpm-assert</artifactId> - <version>2.0-alpha2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>1.7.0</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index 2d41eb4e26..15064e501d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -46,8 +46,9 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.core.env.Environment; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; /** @@ -61,7 +62,7 @@ import io.swagger.annotations.ApiOperation; * further on executing the process */ @Path("/async") -@Api(value = "/async", description = "Provides asynchronous starting of a bpmn process") +@OpenAPIDefinition(info = @Info(title = "/async", description = "Provides asynchronous starting of a bpmn process")) @Provider @Component public class WorkflowAsyncResource extends ProcessEngineAwareService { @@ -97,8 +98,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { @POST @Path("/services/{processKey}") - @ApiOperation(value = "Starts a new process with the appropriate process Key", - notes = "Aysnc fall outs are only logged") + @Operation(description = "Starts a new process with the appropriate process Key. Aysnc fall outs are only logged") @Produces("application/json") @Consumes("application/json") public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, VariableMapImpl variableMap) { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index 2eb9d175f2..9547017e64 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -41,8 +41,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; /** * Generalized REST interface that injects a message event into a waiting BPMN process. Examples: @@ -53,7 +54,8 @@ import io.swagger.annotations.ApiOperation; * </pre> */ @Path("/") -@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess") +@OpenAPIDefinition(info = @Info(title = "/", + description = "Provides a generic service to inject messages into a waiting BPMN Proccess")) @Component public class WorkflowMessageResource { private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class); @@ -64,7 +66,7 @@ public class WorkflowMessageResource { @POST @Path("/WorkflowMessage/{messageType}/{correlator}") - @ApiOperation(value = "Workflow message correlator", notes = "") + @Operation(description = "Workflow message correlator") @Consumes("*/*") @Produces(MediaType.TEXT_PLAIN) public Response deliver(@HeaderParam("Content-Type") String contentType, diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index 731e9d8703..0f2aee7837 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -55,11 +55,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.stereotype.Component; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.info.Info; @Path("/workflow") -@Api(value = "/workflow", description = "Root of workflow services") +@OpenAPIDefinition(info = @Info(title = "/workflow", description = "Root of workflow services")) @Component public class WorkflowResource extends ProcessEngineAwareService { @@ -83,7 +84,7 @@ public class WorkflowResource extends ProcessEngineAwareService { */ @POST @Path("/services/{processKey}") - @ApiOperation(value = "Starts a new process with the appropriate process synchronously", notes = "d") + @Operation(description = "Starts a new process with the appropriate process synchronously") @Produces("application/json") @Consumes("application/json") public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, VariableMapImpl variableMap) { @@ -549,7 +550,7 @@ public class WorkflowResource extends ProcessEngineAwareService { @Path("/services/{processKey}/{processInstanceId}") @Produces("application/json") @Consumes("application/json") - @ApiOperation(value = "Allows for retrieval of the variables for a given process", notes = "") + @Operation(description = "Allows for retrieval of the variables for a given process") public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) { // TODO filter only set of variables diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 03feda6d0f..3923c6ffb6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -23,12 +23,13 @@ package org.onap.so.bpmn.infrastructure; import java.util.Arrays; +import java.util.HashSet; import javax.xml.ws.Endpoint; import org.apache.cxf.Bus; import org.apache.cxf.endpoint.Server; import org.apache.cxf.feature.LoggingFeature; import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; -import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.apache.cxf.jaxrs.openapi.OpenApiFeature; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; @@ -112,14 +113,15 @@ public class CXFConfiguration { } @Bean - public Swagger2Feature createSwaggerFeature() { - Swagger2Feature swagger2Feature = new Swagger2Feature(); + public OpenApiFeature createSwaggerFeature() { + OpenApiFeature swagger2Feature = new OpenApiFeature(); swagger2Feature.setPrettyPrint(true); swagger2Feature.setTitle("SO Orchestration Application"); - swagger2Feature.setContact("The ONAP SO team"); + swagger2Feature.setContactName("The ONAP SO team"); swagger2Feature.setDescription("This project is the SO Orchestration Engine"); swagger2Feature.setVersion("1.0.0"); - swagger2Feature.setResourcePackage("org.onap.so.bpmn.common.workflow.service"); + swagger2Feature + .setResourcePackages(new HashSet<String>(Arrays.asList("org.onap.so.bpmn.common.workflow.service"))); swagger2Feature.setScan(true); return swagger2Feature; } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 0161422b64..179d3e84aa 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -729,78 +729,6 @@ public abstract class WorkflowTest { } } - /** - * Runs a program to inject VNF callback data into the test environment. A program is essentially just a list of - * keys that identify callback data to be injected, in sequence. An example program: - * - * <pre> - * createVnf, deleteVnf - * </pre> - * - * Errors are handled with junit assertions and will cause the test to fail. - * - * @param callbacks an object containing callback data for the program - * @param program the program to execute - */ - protected void injectVNFCallbacks(CallbackSet callbacks, String program) { - - String[] cmds = program.replaceAll("\\s+", "").split(","); - - for (String cmd : cmds) { - String action = cmd; - String modifier = "STD"; - - if (cmd.contains(":")) { - String[] parts = cmd.split(":"); - action = parts[0]; - modifier = parts[1]; - } - - String content = null; - - if ("STD".equals(modifier)) { - CallbackData callbackData = callbacks.get(action); - - if (callbackData == null) { - String msg = "No callback defined for '" + action + "' VNF request"; - logger.debug(msg); - fail(msg); - } - - content = callbackData.getContent(); - } else if ("ERR".equals(modifier)) { - String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; - logger.debug(msg); - fail(msg); - } else { - String msg = "Invalid VNF program modifier: '" + modifier + "'"; - logger.debug(msg); - fail(msg); - } - - boolean injected = false; - - if (content.contains("createVnfNotification")) { - injected = injectCreateVNFCallback(content, 10000); - } else if (content.contains("deleteVnfNotification")) { - injected = injectDeleteVNFCallback(content, 10000); - } else if (content.contains("updateVnfNotification")) { - injected = injectUpdateVNFCallback(content, 10000); - } - - if (!injected) { - String msg = "Failed to inject VNF '" + action + "' callback"; - logger.debug(msg); - fail(msg); - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - fail("Interrupted after injection of VNF '" + action + "' callback"); - } - } - } /** * Waits for the number of running processes with the specified process definition key to equal a particular count. @@ -1179,112 +1107,6 @@ public abstract class WorkflowTest { return true; } - /** - * Injects a Update VNF adapter callback request. The specified callback data may contain the placeholder string - * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string - * ((REQUEST-ID)) which is replaced request ID of the original MSO request. - * - * @param content the content of the callback - * @param timeout the timeout in milliseconds - * @return true if the callback could be injected, false otherwise - * @throws JAXBException if the content does not adhere to the schema - */ - protected boolean injectUpdateVNFCallback(String content, long timeout) { - - String messageId = (String) getProcessVariable("vnfAdapterUpdate", "VNFU_messageId", timeout); - - if (messageId == null) { - return false; - } - - content = content.replace("((MESSAGE-ID))", messageId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{MESSAGE-ID}}", messageId); - - content = content.replace("((REQUEST-ID))", msoRequestId); - // Deprecated usage. All test code should switch to the (( ... )) syntax. - content = content.replace("{{REQUEST-ID}}", msoRequestId); - - logger.debug("Injecting VNF adapter callback"); - - // Is it possible to unmarshal this with JAXB? I couldn't. - - UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification(); - XPathTool xpathTool = new VnfNotifyXPathTool(); - xpathTool.setXML(content); - - try { - String completed = xpathTool.evaluate("/tns:updateVnfNotification/tns:completed/text()"); - updateVnfNotification.setCompleted("true".equals(completed)); - - NodeList entries = (NodeList) xpathTool.evaluate("/tns:updateVnfNotification/tns:outputs/tns:entry", - XPathConstants.NODESET); - - UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs(); - - for (int i = 0; i < entries.getLength(); i++) { - Node node = entries.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element entry = (Element) node; - String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); - String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); - outputs.add(key, value); - } - } - - updateVnfNotification.setOutputs(outputs); - - VnfRollback rollback = new VnfRollback(); - - String cloudSiteId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); - rollback.setCloudSiteId(cloudSiteId); - - String cloudOwner = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()"); - rollback.setCloudOwner(cloudOwner); - - String requestId = - xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); - String serviceInstanceId = xpathTool - .evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); - - if (requestId != null || serviceInstanceId != null) { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId(requestId); - msoRequest.setServiceInstanceId(serviceInstanceId); - rollback.setMsoRequest(msoRequest); - } - - String tenantCreated = - xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()"); - rollback.setTenantCreated("true".equals(tenantCreated)); - - String tenantId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()"); - rollback.setTenantId(tenantId); - - String vnfCreated = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()"); - rollback.setVnfCreated("true".equals(vnfCreated)); - - String rollbackVnfId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()"); - rollback.setVnfId(rollbackVnfId); - - updateVnfNotification.setRollback(rollback); - - } catch (Exception e) { - logger.debug("Failed to unmarshal VNF callback content:"); - logger.debug(content); - return false; - } - - VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); - - - notifyService.updateVnfNotification(messageId, updateVnfNotification.isCompleted(), - updateVnfNotification.getException(), updateVnfNotification.getErrorMessage(), - updateVnfNotification.getOutputs(), updateVnfNotification.getRollback()); - - return true; - } /** * Runs a program to inject workflow messages into the test environment. A program is essentially just a list of diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index 91cfa93a34..0c001b1192 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import java.util.HashMap; diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 9d2231f936..7b7135fafc 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -2,22 +2,17 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> <version>1.8.0-SNAPSHOT</version> </parent> - <artifactId>bpmn</artifactId> <name>BPMN Subsystem</name> <description>BPMN Subsystem for MSO</description> <packaging>pom</packaging> - <properties> - <camunda.version>7.14.0</camunda.version> <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> - <camunda.bpm.webapp.artifact>camunda-webapp-jboss-standalone</camunda.bpm.webapp.artifact> <h2.version>1.4.196</h2.version> <groovy.version>2.5.3</groovy.version> <saxon.version>9.5.1-8</saxon.version> @@ -26,10 +21,8 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <sdnc.northbound.version>1.5.2</sdnc.northbound.version> </properties> - <modules> <module>MSOCoreBPMN</module> - <module>MSOCommonBPMN</module> <module>so-bpmn-infrastructure-common</module> <module>so-bpmn-tasks</module> @@ -37,7 +30,6 @@ <module>so-bpmn-infrastructure-flows</module> <module>mso-infrastructure-bpmn</module> </modules> - <!-- Define artifact versions for child modules --> <dependencyManagement> <dependencies> diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index dbd954ca64..a08fc61cfd 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -79,17 +79,6 @@ </plugins> </pluginManagement> </build> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm</groupId> @@ -111,15 +100,13 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> + <groupId>org.camunda.bpm.assert</groupId> <artifactId>camunda-bpm-assert</artifactId> - <version>2.0-alpha2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>1.7.0</version> <scope>test</scope> </dependency> <dependency> @@ -155,8 +142,11 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-contract-wiremock</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index 874e3415b2..9103c567ae 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -19,7 +19,7 @@ */ package org.onap.so.bpmn; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java index 11e6d7798d..49e05bfc69 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java index 64aa06cd20..af3455f301 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java index c67db438d9..8036dc9111 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java index ed1fb3fd91..74412fd672 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.common; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java index bd29e5570a..f492326b0c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.process; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java index affe1857bd..b4eab2cc13 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java index 558e785e94..05665a0da8 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.io.IOException; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java index a036f6713e..d0114f3858 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java @@ -20,9 +20,10 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.job; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.execute; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.job; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.execute; +import org.camunda.bpm.engine.runtime.Job; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java index ba9beabce7..1dd1a55b5c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java index dae430e400..15455dce1a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java index 7c18a20604..90e9e9dd62 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java index bca4d3a979..77eb6aac33 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java index 48104017a5..4b35afa78a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java @@ -30,7 +30,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.Job; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; -import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.onap.so.bpmn.BaseBPMNTest; @@ -51,7 +50,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); Task task = taskService.createTaskQuery().active().list().get(0); assertThat(pi).task().isNotNull(); assertNotNull(task); @@ -70,7 +69,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); assertThat(pi).task().isNotNull(); Task task = taskService.createTaskQuery().active().list().get(0); assertNotNull(task); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java index 29d7a80f63..6a87656134 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; @@ -30,7 +30,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.Job; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; -import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; @@ -52,7 +51,7 @@ public class PauseForManualTaskRainyDayTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); Task task = taskService.createTaskQuery().active().list().get(0); assertThat(pi).task().isNotNull(); assertNotNull(task); @@ -71,7 +70,7 @@ public class PauseForManualTaskRainyDayTest extends BaseBPMNTest { variables.put("taskTimeout", TIMEOUT_10_S); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskRainyDay", variables); assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).isWaitingAt("ManualUserTask"); assertThat(pi).task().isNotNull(); Task task = taskService.createTaskQuery().active().list().get(0); assertNotNull(task); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java index 199ada5909..8f48e02afa 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Mockito.doReturn; import java.io.IOException; import java.nio.file.Files; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java index 55d21471fc..ac03cac4f9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java index 6f66df6c0d..7b94865771 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java index 8bfe6c020f..c4fc017c36 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java index 99ee8d9fcb..ac5d0b516d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java index 10040b813c..1d4d383ae1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java index a174bbb90c..20721b4950 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java index b1229cdfdf..36ab790b15 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java index ae61f3c46e..870feb2ab9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java index 0a700c5fa1..31f4c3a78c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java index 89cc13f0f0..340e2a60a4 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java index 0dbde4b62c..935cccbac7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java index a7be9e69c1..6657cd8ce5 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java index 2d4a11c17e..5af5d07921 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java index dfb6bc1d9c..61845c9de1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java index 9854bd8860..9d6d10c118 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java index de999e1074..784c62d003 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import java.util.List; diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 90f9a57191..c6a4ffc01d 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -38,7 +38,6 @@ <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> - <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> @@ -114,19 +113,6 @@ </pluginManagement> <finalName>${project.artifactId}-${project.version}</finalName> </build> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> @@ -146,10 +132,11 @@ <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId> + <version>3.4.2</version> +</dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -254,7 +241,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AAISliceUtil.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AAISliceUtil.groovy new file mode 100644 index 0000000000..b2415e296f --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AAISliceUtil.groovy @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIObjectName +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException + +class AAISliceUtil { + private static final Logger LOGGER = LoggerFactory.getLogger(AAISliceUtil.class); + ExceptionUtil exceptionUtil = new ExceptionUtil() + /** + * Get NSSI Id from AAI + * @param execution + * @param nsiId + * @return + */ + List<String> getNSSIIdList(DelegateExecution execution, String nsiId){ + List<String> nssiIdList = [] + + try + { + String errorMsg = "query nssi from aai failed." + AAIResultWrapper wrapper = queryAAI(execution, AAIFluentTypeBuilder.Types.SERVICE_INSTANCE, nsiId, errorMsg) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) + { + List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) + { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance") + { + String relatedLink = relationship.getRelatedLink()?:"" + String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + AAIResultWrapper wrapper1 = queryAAI(execution, AAIFluentTypeBuilder.Types.SERVICE_INSTANCE, instanceId, errorMsg) + Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class) + def nssiId + if (serviceInstance.isPresent()) { + ServiceInstance instance = serviceInstance.get() + if ("nssi".equalsIgnoreCase(instance.getServiceRole())) { + nssiId = instance.getServiceInstanceId() + nssiIdList.add(nssiId) + } + } + } + } + } + } + catch(BpmnError e){ + throw e + } + catch (Exception ex){ + String msg = "Exception in getNSIFromAAI " + ex.getMessage() + LOGGER.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + return nssiIdList + } + + + /** + * get nssi service from AAI + * prepare list + * @param execution + */ + List<ServiceInstance> getNSSIListFromAAI(DelegateExecution execution, List<String> nssiIdList) + { + LOGGER.trace("***** Start getNSSIListFromAAI *****") + List<ServiceInstance> nssiInstanceList = [] + String errorMsg = "query nssi list from aai failed" + for(String nssiId : nssiIdList){ + AAIResultWrapper wrapper = queryAAI(execution, AAIFluentTypeBuilder.Types.SERVICE_INSTANCE, nssiId, errorMsg) + Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) + if(si.isPresent()){ + nssiInstanceList.add(si.get()) + } + } + LOGGER.trace(" ***** Exit getNSSIListFromAAI *****") + return nssiInstanceList + } + + + /** + * query AAI + * @param execution + * @param aaiObjectName + * @param instanceId + * @return AAIResultWrapper + */ + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) + { + LOGGER.trace(" ***** Start queryAAI *****") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + + org.onap.aaiclient.client.generated.fluentbuilders.ServiceInstance serviceInstanceType = AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId) + def type + if (aaiObjectName == AAIFluentTypeBuilder.Types.ALLOTTED_RESOURCE) { + type = serviceInstanceType.allottedResources() + } else if (aaiObjectName == AAIFluentTypeBuilder.Types.SLICE_PROFILES) { + type = serviceInstanceType.sliceProfiles() + } else { + type = serviceInstanceType + } + def uri = AAIUriFactory.createResourceUri(type) + if (!getAAIClient().exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) + } + AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class) + LOGGER.trace(" *****${PREFIX} Exit queryAAI *****") + return wrapper + } + + AAIResourcesClient getAAIClient(){ + return new AAIResourcesClient() + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy index e2d9c16328..78cafa7be5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy @@ -94,6 +94,9 @@ class AllocateSliceSubnet extends AbstractServiceTaskProcessor { String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name") execution.setVariable("servicename", servicename) + String sST = jsonUtil.getJsonValue(subnetInstanceReq, "sst") + execution.setVariable("sst", sST) + String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId") if (isBlank(nsiId)) { msg = "Input nsiId is null" diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index 059a209336..276b6f0500 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -263,9 +263,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + String sliceProfileName = "an_" + sliceParams.serviceName // create slice profile - ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) @@ -338,10 +339,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String routeId = UUID.randomUUID().toString() route.setRouteId(routeId) route.setType("endpoint") - route.setRole("an") + route.setRole("AN") route.setFunction("3gppTransportEP") route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setLogicalInterfaceId(sliceTaskInfo.sliceProfile.logicInterfaceId) route.setAddressFamily("ipv4") route.setPrefixLength(24) sliceTaskInfo.setEndPointId(routeId) @@ -363,10 +365,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String routeId = UUID.randomUUID().toString() route.setRouteId(routeId) route.setType("endpoint") - route.setRole("cn") + route.setRole("CN") route.setFunction("3gppTransportEP") route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setLogicalInterfaceId(sliceTaskInfo.sliceProfile.logicInterfaceId) route.setAddressFamily("ipv4") route.setPrefixLength(24) @@ -454,9 +457,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + String sliceProfileName = "cn_"+sliceParams.serviceName // create slice profile - ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) @@ -597,10 +601,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String serviceInstanceId = UUID.randomUUID().toString() sliceTaskInfo.setSliceInstanceId(serviceInstanceId) + String sliceProfileName = "tn_" + sliceParams.serviceName //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: // create slice profile - ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, sliceProfileName, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) @@ -701,6 +706,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID serviceInfo.nssiId = sliceTaskInfo.suggestNssiId serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") + serviceInfo.nssiName = "nssi_tn" + execution.getVariable("sliceServiceInstanceName") nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -923,10 +929,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ client.create(sourceInstanceUri, relationship) } - static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String oStatus) { + static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String sliceProfileName, String oStatus) { // create slice profile ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) + rspi.setServiceInstanceName(sliceProfileName) rspi.setServiceType(sliceTaskInfo.sliceProfile.getSST()) rspi.setServiceRole("slice-profile") rspi.setOrchestrationStatus(oStatus) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index ccb04d9440..5476cb5afa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -183,6 +183,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ serviceProfile.setUlThptPerSlice(Integer.parseInt(serviceProfileMap.get("uLThptPerSlice").toString())) serviceProfile.setUlThptPerUE(Integer.parseInt(serviceProfileMap.get("uLThptPerUE").toString())) serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) + serviceProfile.setMaxNumberOfConns(Integer.parseInt(serviceProfileMap.get("maxNumberofConns").toString())) serviceProfile.setJitter(Integer.parseInt(serviceProfileMap.get("jitter").toString())) serviceProfile.setSurvivalTime("0") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index 25a7159264..91a69b3123 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NetworkType import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest @@ -55,6 +56,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ OofUtils oofUtils = new OofUtils() + AAISliceUtil aaiSliceUtil = new AAISliceUtil() + private static final ObjectMapper objectMapper = new ObjectMapper() private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) @@ -70,7 +73,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * prepare the params for decompose nst * @param execution */ - public void prepareDecomposeNST(DelegateExecution execution) { + void prepareDecomposeNST(DelegateExecution execution) { SliceTaskParamsAdapter sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter @@ -131,7 +134,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ "modelVersion":"" }""" execution.setVariable("nsstServiceModelInfo", serviceModelInfo) - } /** @@ -162,7 +164,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } else { execution.setVariable("nsstHandleContinue", true) } - } /** @@ -190,7 +191,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition, - SliceTaskParamsAdapter sliceParams, List<SubnetCapability> subnetCapabilities) { + SliceTaskParamsAdapter sliceParams, List<SubnetCapability> subnetCapabilities) { ModelInfo modelInfo = serviceDecomposition.getModelInfo() String vendor = serviceDecomposition.getServiceRole() SubnetType subnetType = convertServiceCategory(serviceDecomposition.getServiceCategory()) @@ -257,7 +258,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ if(serviceCategory ==~ /CN.*/){ return SubnetType.CN } - if (serviceCategory ==~ /AN.*NF.*/){ + if (serviceCategory ==~ /AN.*/){ return SubnetType.AN } if (serviceCategory ==~ /TN.*BH.*/){ @@ -346,7 +347,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } /** - * todo: need rewrite * process select nsi response * @param execution */ @@ -369,10 +369,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solution = nsiSolutions.get(0) - - //String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - //Boolean isSharable = resourceSharingLevel == "shared" + Map<String, Object> solution = nsiSolutions?.get(0) if (solution != null) { if (execution.getVariable("queryNsiFirst")) { @@ -384,7 +381,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } execution.setVariable("queryNsiFirst", false) } else { - processSharedNSI(solution, sliceTaskParams) + processSharedNSI(solution, sliceTaskParams, execution) execution.setVariable("needQuerySliceProfile", false) } } @@ -393,18 +390,28 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ logger.debug("*** Completed options Call to OOF ***") } - private static void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams, DelegateExecution execution) { Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map String nsiId = sharedNSISolution.get("NSIId") String nsiName = sharedNSISolution.get("NSIName") sliceParams.setSuggestNsiId(nsiId) sliceParams.setSuggestNsiName(nsiName) + List<String> nssiId = aaiSliceUtil.getNSSIIdList(execution,nsiId) + List<ServiceInstance> nssiInstances = aaiSliceUtil.getNSSIListFromAAI(execution, nssiId) + List<Map> sliceProfiles = sharedNSISolution.get("sliceProfiles") as List<Map> handleSliceProfiles(sliceProfiles, sliceParams) + Map<String, Object> nssiSolution = new HashMap<>() + for(ServiceInstance instance: nssiInstances){ + nssiSolution.put("NSSIId", instance.getServiceInstanceId()) + nssiSolution.put("NSSIName", instance.getServiceInstanceName()) + processNssiResult(sliceParams, instance.getEnvironmentContext(), nssiSolution) + } + } - private static void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map> handleSliceProfiles(sliceProfiles, sliceParams) @@ -436,7 +443,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * get NSSI Selection Capability for AN * @param execution */ - public void getNSSISelectionCap4AN(DelegateExecution execution) { + void getNSSISelectionCap4AN(DelegateExecution execution) { def vendor = execution.getVariable("vendor") as String @@ -458,7 +465,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * get NSSI Selection Capability for TN * @param execution */ - public void getNSSISelectionCap4TN(DelegateExecution execution) { + void getNSSISelectionCap4TN(DelegateExecution execution) { def vendor = execution.getVariable("vendor") as String @@ -479,7 +486,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * get NSSI Selection Capability for CN * @param execution */ - public void getNSSISelectionCap4CN(DelegateExecution execution) { + void getNSSISelectionCap4CN(DelegateExecution execution) { def vendor = execution.getVariable("vendor") as String @@ -513,7 +520,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } /** - * if exist nssi need to select? + * if exist nssi need to select * @param execution */ public void handleNssiSelect(DelegateExecution execution) { @@ -526,20 +533,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ boolean needAnNssiSelection = execution.getVariable("NEED_AN_NSSI_SELECTION") as Boolean boolean needTnNssiSelection = execution.getVariable("NEED_TN_NSSI_SELECTION") as Boolean - /** - * [ - * ​ { - * ​ "subType": subtype, - * ​ "nsstInfo": object, - * ​ "sliceProfile": object - * ​ }, - * { - * "subType": subtype, - * "nsstInfo": object, - * "sliceProfile": object - * } - * ] - */ List<Map> nssiNeedHandlerInfos = new ArrayList<>() Map<String, Object> nssiNeedHandlerMap = new HashMap() @@ -676,7 +669,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } private void processNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType, - Map<String, Object> solution) { + Map<String, Object> solution) { switch (subnetType) { case SubnetType.CN: sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index 78c6a084ef..9221067cce 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -111,6 +111,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String serviceType = execution.getVariable("subscriptionServiceType") String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String sliceProfileStr = execution.getVariable("sliceProfile") + String sst = execution.getVariable("sst") try { if (sliceProfileStr == null || sliceProfileStr.isEmpty()) { String msg = "ERROR: createServiceInstance: sliceProfile is null" @@ -126,7 +127,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { sliceInstanceName = ssInstanceId } ss.setServiceInstanceName(sliceInstanceName) - ss.setServiceType(serviceType) + ss.setServiceType(sst) String serviceStatus = "deactivated" ss.setOrchestrationStatus(serviceStatus) String modelInvariantUuid = execution.getVariable("modelInvariantUuid") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy index 019e836514..09bbb81b6b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy @@ -87,6 +87,9 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String sliceServiceInstanceName = execution.getVariable("servicename") execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName) + String sst = execution.getVariable("sst") + execution.setVariable("sst", sst) + //additional properties String sliceProfile = jsonUtil.getJsonValue(additionalPropJsonStr, "sliceProfile") if (isBlank(sliceProfile)) { diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index fa45a415ee..9f78182811 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -9,13 +9,10 @@ <modelVersion>4.0.0</modelVersion> <artifactId>so-bpmn-infrastructure-flows</artifactId> <packaging>jar</packaging> - <properties> - <camunda.bpm.assert.version>2.0-alpha2</camunda.bpm.assert.version> <assertj.core.version>1.7.0</assertj.core.version> <grpc.version>1.17.1</grpc.version> </properties> - <build> <plugins> <plugin> @@ -138,17 +135,6 @@ </pluginManagement> <finalName>${project.artifactId}-${project.version}</finalName> </build> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> <dependencies> <dependency> <groupId>org.camunda.bpm.springboot</groupId> @@ -190,7 +176,8 @@ </dependency> <dependency> <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-service-description-swagger</artifactId> + <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId> + <version>3.4.2</version> </dependency> <dependency> <groupId>com.h2database</groupId> @@ -200,8 +187,6 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>1.10.19</version> - <!-- remove --> <scope>test</scope> </dependency> <dependency> @@ -258,15 +243,13 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> + <groupId>org.camunda.bpm.assert</groupId> <artifactId>camunda-bpm-assert</artifactId> - <version>${camunda.bpm.assert.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>${assertj.core.version}</version> <scope>test</scope> </dependency> <dependency> @@ -277,7 +260,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -286,5 +268,9 @@ <version>${grpc.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-contract-wiremock</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn index 29f024991d..07077a1cab 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn @@ -125,6 +125,7 @@ nss.prepareInitOperationStatus(execution)</bpmn:script> <camunda:in source="sliceParams" target="sliceParams" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="servicename" target="servicename" /> + <camunda:in source="sst" target="sst" /> </bpmn:extensionElements> <bpmn:incoming>Flow_0g7721r</bpmn:incoming> <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn index 82efc97e92..b70569b8ad 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn @@ -136,6 +136,7 @@ css.prepareOofSelection(execution)</bpmn:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="rollbackData" target="rollbackData" /> <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:in source="sst" target="sst" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java index 9521e68e16..7aaf558901 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java @@ -100,4 +100,8 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase { return this.detailedMessages; } + public void resetList() { + detailedMessages.clear(); + } + } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index a03da25248..786ee1e239 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -49,7 +49,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.ok; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; /** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java index b9c5fdf145..cd54c49671 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java @@ -20,11 +20,24 @@ package org.onap.so.bpmn.infrastructure.process; -import com.google.protobuf.Struct; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.assertj.core.api.Assertions; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Before; import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; @@ -32,21 +45,10 @@ import org.onap.so.BaseBPMNTest; import org.onap.so.GrpcNettyServer; import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import com.google.protobuf.Struct; /** * Basic Integration test for GenericPnfSWUPDownloadTest.bpmn workflow. @@ -100,6 +102,7 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { mockCatalogDb(); mockAai(); + grpcNettyServer.resetList(); final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -117,12 +120,12 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao", + assertThat(pi).isStarted().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao", "ExclusiveGateway_1rj84ne", "ServiceTask_0yavde3", "ExclusiveGateway_1ja7grm", "ServiceTask_1wxo7xz", "ExclusiveGateway_08lusga", "download_EndEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 3); + assertEquals(3, detailedMessages.size()); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -138,7 +141,7 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSWUPDownload request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); } private boolean isProcessInstanceEnded() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java index de81f91e66..1c00f3628d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java @@ -46,7 +46,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; /** * Basic Integration test for GenericPnfSoftwareUpgrade.bpmn workflow. @@ -120,13 +123,13 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", + assertThat(pi).isStarted().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 4); + assertEquals(4, detailedMessages.size()); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -142,7 +145,8 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSoftwareUpgrade request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); + grpcNettyServer.resetList(); } private boolean isProcessInstanceEnded() { @@ -159,27 +163,26 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { * the fields of actionIdentifiers should match the one in the * response/GenericPnfSoftwareUpgrade_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_software_upgrade_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); - assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()) - .isEqualTo("demo-sw-ver2.0.0"); + assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); + assertEquals("demo-sw-ver2.0.0", propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java index 2423ad8465..bc364ae736 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java @@ -41,7 +41,9 @@ import java.util.Map; import java.util.UUID; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * Basic Integration test for GenericPnfHealthCheck.bpmn workflow. @@ -118,7 +120,7 @@ public class PnfHealthCheckTest extends BaseBPMNTest { List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); logger.debug("Size of detailedMessage is {}", detailedMessages.size()); - assertThat(detailedMessages.size() == 1).isTrue(); + assertTrue(detailedMessages.size() == 1); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -132,7 +134,7 @@ public class PnfHealthCheckTest extends BaseBPMNTest { e.printStackTrace(); fail("PNFHealthCheck request exception", e); } - assertThat(count == 1).isTrue(); + assertTrue(count == 1); } private boolean isProcessInstanceEnded() { @@ -148,25 +150,25 @@ public class PnfHealthCheckTest extends BaseBPMNTest { /** * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_health_check_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_health_check_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java index 7da3a2c81b..60c7e4e769 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java @@ -26,8 +26,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import com.google.protobuf.Struct; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -47,6 +48,7 @@ import org.onap.so.bpmn.mock.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.google.protobuf.Struct; /** * Basic Integration test for ServiceLevelUpgrade.bpmn workflow. @@ -125,6 +127,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { mockCatalogDb(); mockRequestDb(); mockAai(); + grpcNettyServer.resetList(); final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -148,7 +151,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { "Gateway_1vq11i7", "Activity_0o2rrag", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 5); + assertEquals(10, detailedMessages.size()); int count = 0; String action = ""; try { @@ -164,7 +167,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSoftwareUpgrade request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); } private boolean isProcessInstanceEnded() { @@ -181,25 +184,25 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { /** * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_software_upgrade_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(pnfName); + assertEquals(pnfName, requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(pnfName); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("d88da85c-d9e8-4f73-b837-3a72a431622b"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals(pnfName, propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("d88da85c-d9e8-4f73-b837-3a72a431622b", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 564a117674..881cb30548 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -11,7 +11,6 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <grpc.version>1.17.1</grpc.version> </properties> <build> <plugins> @@ -47,9 +46,9 @@ </configuration> </plugin> <plugin> - <groupId>io.swagger</groupId> + <groupId>io.swagger.codegen.v3</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> - <version>2.3.1</version> + <version>3.0.24</version> <executions> <execution> <goals> @@ -163,11 +162,10 @@ <scope>import</scope> </dependency> <dependency> - <groupId>org.camunda.bpm</groupId> - <artifactId>camunda-bom</artifactId> - <version>${camunda.version}</version> - <scope>import</scope> - <type>pom</type> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <version>1.17.1</version> + <scope>test</scope> </dependency> </dependencies> </dependencyManagement> @@ -180,7 +178,6 @@ <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-contract-wiremock</artifactId> - <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -210,7 +207,6 @@ <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> - <version>2.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -229,11 +225,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> - <dependency> <groupId>nl.jqno.equalsverifier</groupId> <artifactId>equalsverifier</artifactId> <version>2.5.1</version> @@ -242,7 +233,6 @@ <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-testing</artifactId> - <version>${grpc.version}</version> <scope>test</scope> </dependency> <dependency> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java index 3556cc024c..6c6bd61041 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java @@ -104,7 +104,8 @@ public class UserParamsServiceTraversal { if ((vfModuleCustomization.getVfModule() != null) && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null)) - || (vfModuleCustomization.getVfModule().getModelName() != null + || (vfModuleCustomization.getVfModule() != null + && vfModuleCustomization.getVfModule().getModelName() != null && vfModuleCustomization.getVfModule().getModelName() .contains("helm"))) { foundVfModuleOrVG = true; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index b756772188..ec2ca74fa7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -420,15 +420,24 @@ public class WorkflowActionBBTasks { } public void postProcessingExecuteBB(DelegateExecution execution) { - List<ExecuteBuildingBlock> flowsToExecute = - (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - String handlingCode = (String) execution.getVariable(HANDLINGCODE); - final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); - String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); - if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) { - postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); + try { + List<ExecuteBuildingBlock> flowsToExecute = + (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + String handlingCode = (String) execution.getVariable(HANDLINGCODE); + final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + logger.debug("Current Sequence: {}", currentSequence); + ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); + String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); + if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte + && "Success".equalsIgnoreCase(handlingCode)) { + postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); + } + + flowManipulatorListenerRunner.postModifyFlows(flowsToExecute, new DelegateExecutionImpl(execution)); + } catch (Exception ex) { + logger.error("Exception in postProcessingExecuteBB", ex); + workflowAction.buildAndThrowException(execution, "Failed to post process Execute BB"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java index bc32489944..b90844a733 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java @@ -22,12 +22,12 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners; import java.util.List; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.springframework.stereotype.Component; @Component -public class HomingListener implements FlowManipulator { +public class HomingListener implements PreFlowManipulator { @Override diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java index 4cde9c1fc8..08e877956d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java @@ -26,7 +26,7 @@ import java.util.Optional; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.listener.db.PostCompletionRequestsDbListener; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.db.catalog.beans.VnfResourceCustomization; @@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component -public class MultiStageSkipListener implements FlowManipulator, PostCompletionRequestsDbListener { +public class MultiStageSkipListener implements PreFlowManipulator, PostCompletionRequestsDbListener { @Autowired protected BBInputSetupUtils bbInputSetupUtils; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index 564ee91fb2..3af839fbec 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -27,7 +27,7 @@ import java.util.Set; import org.apache.logging.log4j.util.Strings; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; @@ -38,7 +38,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @Component -public class SkipCDSBuildingBlockListener implements FlowManipulator { +public class SkipCDSBuildingBlockListener implements PreFlowManipulator { @Autowired private CatalogDbClient catalogDbClient; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java index 83f61e3a4f..5ffba455b3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java @@ -3,7 +3,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners; import java.util.List; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator; +import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component -public class SkipConfigVnfListener implements FlowManipulator { +public class SkipConfigVnfListener implements PreFlowManipulator { private final CatalogDbClient catalogDbClient; diff --git a/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json b/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json index b86ffbc6b0..c3dc52cc5c 100644 --- a/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json +++ b/bpmn/so-bpmn-tasks/src/main/resources/naming-service/swagger.json @@ -235,7 +235,7 @@ "type": "string", "description": "Naming type of the resource" }, - "${naming-ingredients(zero or more)}": { + "{naming-ingredients(zero or more)}": { "type": "string", "description": "values to subsitute in the naming recipe" } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java index 0ba1e27f5e..5a070aff4a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java @@ -55,16 +55,40 @@ public class PrepareSdncUpgradePreCheckPnfBBTest { } @Test - public void prepare_jsonWithoutActionPayload() { + public void prepareJson_payloadWithoutAction() { String payloadWithoutActionArray = "{\"json name\": \"test1\"}"; ControllerContext<BuildingBlockExecution> controllerContext = - createControllerContext(payloadWithoutActionArray); + createControllerContext(payloadWithoutActionArray, "action1"); testedObject.prepare(controllerContext); assertThat((String) controllerContext.getExecution().getVariable("payload")) .isEqualTo(payloadWithoutActionArray); } + @Test + public void prepareJson_payloadWithActionJsonObject() { + String jsonActionObjectKey = "action1"; + String jsonActionObject = String.format("{\"%s\":\"act1\"}", jsonActionObjectKey); + String payloadWithActionArray = String.format("{\"json name\":\"test1\",\"action\": [%s]}", jsonActionObject); + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext(payloadWithActionArray, jsonActionObjectKey); + + testedObject.prepare(controllerContext); + + assertThat((String) controllerContext.getExecution().getVariable("payload")).isEqualTo(jsonActionObject); + } + + @Test + public void prepareJson_payloadWithActionJsonObjectButDifferentKey() { + String payloadWithActionArray = ("{\"json name\":\"test1\",\"action\": [{\"action1\":\"act1\"}]}"); + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext(payloadWithActionArray, "otherAction"); + + testedObject.prepare(controllerContext); + + assertThat((String) controllerContext.getExecution().getVariable("payload")).isEqualTo(payloadWithActionArray); + } + private ControllerContext<BuildingBlockExecution> createControllerContext(String actor, String action, String scope) { ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>(); @@ -74,9 +98,10 @@ public class PrepareSdncUpgradePreCheckPnfBBTest { return controllerContext; } - private ControllerContext<BuildingBlockExecution> createControllerContext(String payload) { + private ControllerContext<BuildingBlockExecution> createControllerContext(String payload, String action) { ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>(); controllerContext.setExecution(prepareBuildingBlockExecution(payload)); + controllerContext.setControllerAction(action); return controllerContext; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java new file mode 100644 index 0000000000..cfaa4040c7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nokia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.service.level; + +import static org.assertj.core.api.Assertions.assertThat; +import java.util.ArrayList; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Test; +import java.util.List; +import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants; + +public class ServiceLevelTest { + + private static final String EXECUTION_KEY_PNF_NAME_LIST = "pnfNameList"; + private static final String EXECUTION_KEY_PNF_COUNTER = "pnfCounter"; + + @Test + public void pnfCounterExecution_success() { + // given + String pnfName = "pnfName1"; + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable(EXECUTION_KEY_PNF_NAME_LIST, createPnfNameList(pnfName)); + execution.setVariable(EXECUTION_KEY_PNF_COUNTER, 0); + // when + new ServiceLevel().pnfCounterExecution(execution); + // then + assertThat(execution.getVariable(ServiceLevelConstants.PNF_NAME)).isEqualTo(pnfName); + assertThat(execution.getVariable(EXECUTION_KEY_PNF_COUNTER)).isEqualTo(1); + } + + private List<String> createPnfNameList(String pnfName) { + List<String> pnfNameList = new ArrayList<>(); + pnfNameList.add(pnfName); + return pnfNameList; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java new file mode 100644 index 0000000000..99f17a3628 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BBConstants; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; + +public class UserParamsServiceTraversalTest extends BaseTaskTest { + + private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json"; + private static final String MACRO_ASSIGN_PNF_JSON = "Macro/ServiceMacroAssignPnf.json"; + private static final String NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json"; + private static final String serviceInstanceId = "123"; + private DelegateExecution execution; + private CatalogDbClient mockCatalogDbClient; + private UserParamsServiceTraversal userParamsServiceTraversal; + private String requestAction; + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + mockCatalogDbClient = mock(CatalogDbClient.class); + userParamsServiceTraversal = new UserParamsServiceTraversal(mockCatalogDbClient, mock(ExceptionBuilder.class)); + requestAction = "assignInstance"; + } + + @Test + public void getResourceListFromUserParamsForVnfs() throws Exception { + initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false); + Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(), + anyString(), anyString()); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.VNF, WorkflowType.VOLUMEGROUP, + WorkflowType.VFMODULE, WorkflowType.CONFIGURATION); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(5, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + @Test + public void getResourceListFromUserParamsForPnfs() throws Exception { + initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_PNF_JSON), false); + Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(), + anyString(), anyString()); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.PNF); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(2, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + @Test + public void getResourceListFromUserParamsForNetworks() throws Exception { + requestAction = "createInstance"; + initExecution(requestAction, readBpmnRequestFromFile(NETWORK_COLLECTION_JSON), false); + Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(), + anyString(), anyString()); + Mockito.doReturn(getService()).when(mockCatalogDbClient).getServiceByID(anyString()); + Mockito.doReturn(new NetworkCollectionResourceCustomization()).when(mockCatalogDbClient) + .getNetworkCollectionResourceCustomizationByID(anyString()); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.NETWORK, WorkflowType.NETWORK, + WorkflowType.NETWORKCOLLECTION); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(4, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + @Test + public void getResourceListFromUserParamsBuildAndThrowExceptionWhenVfModuleAreEmpty() throws Exception { + initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false); + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setVfModule(null); + Mockito.doReturn(vfModuleCustomization).when(mockCatalogDbClient) + .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + + List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution, + getUserParams(), serviceInstanceId, requestAction); + List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.VNF); + List<WorkflowType> result = + resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList()); + + assertEquals(2, resourceListFromUserParams.size()); + assertThat(expected, is(result)); + } + + private List<Map<String, Object>> getUserParams() throws IOException { + String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST); + ServiceInstancesRequest sIRequest = new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class); + return sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + } + + @Test + public void getResourceListFromUserParamsWhenUserParamsAreNull() throws Exception { + List<Resource> expectedResourceList = new ArrayList<>(); + List<Resource> resultResourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, null, + serviceInstanceId, requestAction); + + assertEquals(expectedResourceList, resultResourceList); + } + + private String readBpmnRequestFromFile(String fileName) throws IOException { + return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName))); + } + + private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) { + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", isAlaCarte); + execution.setVariable("apiVersion", "7"); + } + + private Service getService() { + Service service = new Service(); + List<CollectionResourceCustomization> collectionResourceCustomizations = new ArrayList<>(); + CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization(); + collectionResourceCustomization.setModelCustomizationUUID("123"); + collectionResourceCustomizations.add(collectionResourceCustomization); + service.setCollectionResourceCustomizations(collectionResourceCustomizations); + return service; + } + + private VfModuleCustomization getVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment()); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + VfModule vfModule = new VfModule(); + vfModule.setVolumeHeatTemplate(new HeatTemplate()); + vfModule.setModelName("helm"); + vfModule.setModuleHeatTemplate(new HeatTemplate()); + vfModuleCustomization.setVfModule(vfModule); + return vfModuleCustomization; + } + + private List<CvnfcCustomization> getCvnfcCustomizations() { + ConfigurationResource configurationResource = new ConfigurationResource(); + configurationResource.setToscaNodeType("FabricConfiguration"); + + CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization(); + cvnfcConfigurationCustomization.setConfigurationResource(configurationResource); + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + + List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>(); + cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); + cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations); + + List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<>(); + cvnfcCustomizations.add(cvnfcCustomization); + return cvnfcCustomizations; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignPnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignPnf.json new file mode 100644 index 0000000000..4be44e0c1f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignPnf.json @@ -0,0 +1,72 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "Sample Service Model", + "modelVersion": "10.0" + }, + "cloudConfiguration": { + "cloudOwner" : "my-custom-cloud-owner" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx", + "instanceName": "test" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "Sample Service Model", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "pnfs": [ + { + "modelInfo": { + "modelType": "pnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [] + } + ] + } + } + } + ] + } + } +} |