aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-06 15:15:35 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-06 15:15:35 +0000
commit2c9a77e893d414b8af81668dc9945691f4466528 (patch)
treefb1acd7bdfb2bdf34962c3f4b5d43e95d0239908 /bpmn/MSOCommonBPMN
parent89f384164a2712f7515497fe16b55e585266c79b (diff)
parentfb6ab40a64e74876ba1f08c4d3bdb6a040c21b94 (diff)
Merge "Bug fixes November 5th" into casablanca
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml31
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy39
3 files changed, 60 insertions, 32 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
index e4bc5f8fa2..c337a21987 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
@@ -137,7 +137,7 @@ class AllottedResourceUtils {
try {
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
- AaiUtil aaiUtil = new AaiUtil()
+ AaiUtil aaiUtil = new AaiUtil(taskProcessor)
arLink = aaiUtil.createAaiUri(uri)
} catch (NotFoundException e) {
msoLogger.debug("GET AR received a Not Found (404) Response")
@@ -323,5 +323,25 @@ class AllottedResourceUtils {
msoLogger.trace("Exit BuildAAIErrorResponse Process")
throw new BpmnError("MSOWorkflowException")
}
+
+ public String createARUrl(DelegateExecution execution, AAIResourceUri uri, String allottedResourceId) {
+ AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
+ AAIResourceUri siResourceLink= uri
+
+ String siUri = ""
+
+ if(siResourceLink != null) {
+ msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink.build().toString())
+ }
+ else
+ {
+ String msg = "Parent Service Link in AAI is null"
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ AAIResourceUri arUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+
+ return aaiUriUtil.createAaiUri(arUri)
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml
deleted file mode 100644
index 33c8cb1ac0..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- ============LICENSE_START=======================================================
- ONAP SO
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<process-application
- xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
- <process-archive name="MSOCommonBPMN">
- <properties>
- <property name="isDeleteUponUndeploy">false</property>
- <property name="isScanForProcessDefinitions">true</property>
- </properties>
- </process-archive>
-
-</process-application>
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy
new file mode 100644
index 0000000000..5058961992
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy
@@ -0,0 +1,39 @@
+package org.onap.so.bpmn.common.scripts
+
+import static org.junit.Assert.assertEquals
+import static org.mockito.Matchers.eq
+import static org.mockito.Mockito.mock
+import static org.mockito.Mockito.when
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake
+import org.junit.Test
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.springframework.core.env.Environment
+
+class AllottedResourceUtilsTest {
+
+
+ @Test
+ public void createARUrlTest() {
+ AllottedResourceUtils utils = new AllottedResourceUtils(mock(AbstractServiceTaskProcessor.class))
+ DelegateExecution execution = new DelegateExecutionFake()
+ String allottedResourceId = "my-id"
+ UrnPropertiesReader reader = new UrnPropertiesReader()
+ Environment env = mock(Environment.class);
+
+ when(env.getProperty(eq("mso.workflow.global.default.aai.version"))).thenReturn("14")
+ when(env.getProperty(eq("aai.endpoint"))).thenReturn("http://localhost:8080")
+
+
+ reader.setEnvironment(env)
+
+
+ AAIResourceUri uri = mock(AAIResourceUri.class)
+ when(uri.build()).thenReturn(new URI("/business/customers/customer/1/service-subscriptions/service-subscription/2/service-instances/service-instance/3"))
+ String actual = utils.createARUrl(execution, uri, allottedResourceId)
+
+ assertEquals("http://localhost:8080/aai/v14/business/customers/customer/1/service-subscriptions/service-subscription/2/service-instances/service-instance/3/allotted-resources/allotted-resource/my-id", actual)
+ }
+}