aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-26 09:20:28 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-26 09:42:13 -0500
commitaaddce96286465f72b659acd4d0a83101089e61d (patch)
tree396ccb2618f5fb4e0cc4a572dd6d7adbf03d606d
parentee8a94ff58552675b37161885ed36fb94caac4e0 (diff)
Do not validate certain BBs
changed resource type from CUSTOM to NO_VALIDATE when building block detail is CUSTOM skip validation Change-Id: Ie00fad1f96071703a35b96cc5fe83ce5dc2092bb Issue-ID: SO-1243 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java45
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java2
5 files changed, 53 insertions, 2 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql
new file mode 100644
index 0000000000..bded179395
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.19__RenameCustomToNoValidate.sql
@@ -0,0 +1,2 @@
+update building_block_detail set RESOURCE_TYPE = "NO_VALIDATE" where RESOURCE_TYPE = "CUSTOM";
+update orchestration_status_state_transition_directive set RESOURCE_TYPE = "NO_VALIDATE" where RESOURCE_TYPE = "CUSTOM"; \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index b0063c1da1..2065dfb71e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -105,6 +105,10 @@ public class OrchestrationStatusValidator {
org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
orchestrationStatus = configuration.getOrchestrationStatus();
break;
+ case NO_VALIDATE:
+ //short circuit and exit method
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
+ return;
default:
// can't currently get here, so not tested. Added in case enum is expanded without a change to this code
throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
new file mode 100644
index 0000000000..4ace2727be
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorUnitTest.java
@@ -0,0 +1,45 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.db.catalog.beans.BuildingBlockDetail;
+import org.onap.so.db.catalog.beans.OrchestrationAction;
+import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
+import org.onap.so.db.catalog.beans.ResourceType;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OrchestrationStatusValidatorUnitTest {
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @InjectMocks
+ private OrchestrationStatusValidator validator;
+ @Test
+ public void skipValidationTest() {
+ BuildingBlockDetail bbDetail = new BuildingBlockDetail();
+ bbDetail.setBuildingBlockName("customBB");
+ bbDetail.setResourceType(ResourceType.NO_VALIDATE);
+ bbDetail.setTargetAction(OrchestrationAction.CUSTOM);
+ when(catalogDbClient.getBuildingBlockDetail("customBB")).thenReturn(bbDetail);
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ execution.setVariable("flowToBeCalled", "customBB");
+ execution.setVariable("aLaCarte", false);
+ validator.validateOrchestrationStatus(execution);
+
+
+ assertThat(execution.getVariable("orchestrationStatusValidationResult"), equalTo(OrchestrationStatusValidationDirective.VALIDATION_SKIPPED));
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java
index 544e1cbf08..f92aadf7a7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java
@@ -22,7 +22,7 @@ package org.onap.so.db.catalog.beans;
//TODO find this file a new location?
public enum OrchestrationStatusValidationDirective {
- SILENT_SUCCESS("SilentSuccess"), CONTINUE("Continue"), FAIL("Fail");
+ SILENT_SUCCESS("SilentSuccess"), CONTINUE("Continue"), FAIL("Fail"), VALIDATION_SKIPPED("ValidationSkiPped");
private final String name;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
index 8e1d498e42..64eff56f97 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
@@ -28,7 +28,7 @@ public enum ResourceType {
NETWORK("Network"),
NETWORK_COLLECTION("NetworkCollection"),
CONFIGURATION("Configuration"),
- CUSTOM("Custom");
+ NO_VALIDATE("NoValidate");
private final String name;