summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy53
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java11
3 files changed, 26 insertions, 40 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index c7fcc5c5d3..35e68bb79f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Intel Corp. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 7c5ffca4ab..8ce633845b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Intel Corp. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -82,20 +82,20 @@ class OofUtils {
//ServiceInstance Info
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId = ""
- def serviceInstanceName = ""
+ def serviceName = ""
serviceInstanceId = execution.getVariable("serviceInstanceId")
- serviceInstanceName = execution.getVariable("serviceInstanceName")
+ serviceName = execution.getVariable("subscriptionServiceType")
if (serviceInstanceId == null || serviceInstanceId == "null") {
utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
- "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null")
+ "obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null")
}
- if (serviceInstanceName == null || serviceInstanceName == "null") {
- utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled)
+ if (serviceName == null || serviceName == "null") {
+ utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
- "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null")
+ "obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null")
}
//Model Info
ModelInfo model = decomposition.getModelInfo()
@@ -144,24 +144,12 @@ class OofUtils {
utils.log("DEBUG", "Allotted Resource: " + resource.toString(),
isDebugEnabled)
def serviceResourceId = resource.getResourceId()
- def resourceModuleName = resource.getNfFunction()
- utils.log("DEBUG", "resourceModuleName: " + resourceModuleName,
- isDebugEnabled)
- def resourceModelInvariantId = "no-resourceModelInvariantId"
- def resourceModelVersionId = "no-resourceModelVersionId"
-
- List modelIdLst = execution.getVariable("homingModelIds")
- utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled)
- for (Map modelId : modelIdLst )
- if (resourceModuleName == modelId.resourceModuleName) {
- resourceModelInvariantId = modelId.resourceModelInvariantId
- resourceModelVersionId = modelId.resourceModelVersionId
- }
-
- def resourceModelName = "" //Optional
- def resourceModelVersion = "" //Optional
- def resourceModelType = "" //Optional
- def tenantId = "" //Optional
+ def resourceModelInvariantId = resource.getModelInfo().getModelInvariantUuid()
+ def resourceModelVersionId = resource.getModelInfo().getModelUuid()
+ def resourceModelName = resource.getModelInfo().getModelName()
+ def resourceModelVersion = resource.getModelInfo().getModelVersion()
+ def resourceModelType = resource.getModelInfo().getModelType()
+ def tenantId = execution.getVariable("tenantId")
def requiredCandidatesJson = ""
requiredCandidatesJson = createCandidateJson(
@@ -171,7 +159,7 @@ class OofUtils {
String demand =
" {\n" +
- " \"resourceModuleName\": \"${resourceModuleName}\",\n" +
+ " \"resourceModuleName\": \"${resourceModelName}\",\n" +
" \"serviceResourceId\": \"${serviceResourceId}\",\n" +
" \"tenantId\": \"${tenantId}\",\n" +
" \"resourceModelInfo\": {\n" +
@@ -191,21 +179,18 @@ class OofUtils {
isDebugEnabled)
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
def serviceResourceId = vnfResource.getResourceId()
- def resourceModuleName = vnfResource.getNfFunction()
- utils.log("DEBUG", "resourceModuleName: " + resourceModuleName,
- isDebugEnabled)
def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid()
def resourceModelName = vnfResourceModelInfo.getModelName()
def resourceModelVersion = vnfResourceModelInfo.getModelVersion()
def resourceModelVersionId = vnfResourceModelInfo.getModelUuid()
def resourceModelType = vnfResourceModelInfo.getModelType()
- def tenantId = "" //Optional
+ def tenantId = execution.getVariable("tenantId")
def requiredCandidatesJson = ""
String placementDemand =
" {\n" +
- " \"resourceModuleName\": \"${resourceModuleName}\",\n" +
+ " \"resourceModuleName\": \"${resourceModelName}\",\n" +
" \"serviceResourceId\": \"${serviceResourceId}\",\n" +
" \"tenantId\": \"${tenantId}\",\n" +
" \"resourceModelInfo\": {\n" +
@@ -297,7 +282,7 @@ class OofUtils {
" },\n" +
" \"serviceInfo\": {\n" +
" \"serviceInstanceId\": \"${serviceInstanceId}\",\n" +
- " \"serviceName\": \"${serviceInstanceName}\",\n" +
+ " \"serviceName\": \"${serviceName}\",\n" +
" \"modelInfo\": {\n" +
" \"modelType\": \"${modelType}\",\n" +
" \"modelInvariantId\": \"${modelInvariantId}\",\n" +
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
index bbdaa94581..17ede2f2ff 100644
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
+++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
@@ -51,7 +51,8 @@ public class RESTClientTest {
private String jsonResponseAsString;
@Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
@Before
public void before() throws Exception {
@@ -62,7 +63,7 @@ public class RESTClientTest {
jsonResponse = new JSONObject();
jsonResponse.put("response", "responseValue");
jsonResponseAsString = jsonResponse.toString();
- restClient = new RESTClient("http://localhost:28090/example", "localhost", 28090);
+ restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example", "localhost", wireMockRule.port());
}
@Test
@@ -79,9 +80,9 @@ public class RESTClientTest {
assertEquals(1, restClient.getParameters().size());
restClient.addAuthorizationHeader("token");
assertEquals("[token]", restClient.getHeaders().get("Authorization").toString());
- assertEquals("http://localhost:28090/example", restClient.getURL());
- restClient = new RESTClient("http://localhost:28090/example1");
- assertEquals("http://localhost:28090/example1", restClient.getURL());
+ assertEquals("http://localhost:" + wireMockRule.port() + "/example", restClient.getURL());
+ restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example1");
+ assertEquals("http://localhost:" + wireMockRule.port() + "/example1", restClient.getURL());
}
@Test