summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2019-04-02 12:24:11 +0000
committerLathish <lathishbabu.ganesan@est.tech>2019-04-02 12:24:11 +0000
commit3b0c3e9ea3412cebd18ba74adaaa4fc69ff0eb17 (patch)
treed772a6533c2f21ea6f989e980e59a4da72bc064e /bpmn/so-bpmn-tasks
parent3690db02a3035306d6be5fae7529a2f27b90ee71 (diff)
Added instatntiation job monitoring
Issue-ID: SO-1630 Change-Id: I2e921f0f86553b804ea119cd640b8c4e1b1195b9 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java154
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java178
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java241
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java12
9 files changed, 554 insertions, 92 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
index 0153b4b3f9..59f8be50c8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -20,6 +20,11 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+import static com.google.common.collect.Sets.newHashSet;
+import java.util.Set;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
+
/**
* @author waqas.ikram@est.tech
*/
@@ -30,6 +35,7 @@ public class Constants {
public static final String INPUT_PARAMETER = "inputParameter";
public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse";
+
public static final String DOT = ".";
public static final String UNDERSCORE = "_";
public static final String SPACE = "\\s+";
@@ -40,5 +46,14 @@ public class Constants {
public static final String FORWARD_SLASH = "/";
public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
+
+ public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
+ newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
+
+ public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
+ OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+
+ public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
+
private Constants() {}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
new file mode 100644
index 0000000000..f89931063c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_FINISHED_STATES;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_RETRIEVAL_STATES;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+@Component
+public class MonitorVnfmCreateJobTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
+ private final ExceptionBuilder exceptionUtil;
+ private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+
+ @Autowired
+ public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ this.exceptionUtil = exceptionUtil;
+ }
+
+ /**
+ * Get the current operation status of instantiation job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
+
+ /**
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @return boolean to indicate whether job has competed or not
+ */
+ public boolean hasOperationFinished(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing hasOperationFinished ...");
+
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ }
+ LOGGER.debug("OperationStatus is not present yet... ");
+ LOGGER.debug("Finished executing hasOperationFinished ...");
+ return false;
+
+ }
+
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Instantiation operation time out";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1205, message);
+ }
+
+ /**
+ * Check the final status of instantiation throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message = "Unable to instantiate jobId: "
+ + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null")
+ + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1206, message);
+ }
+ if (operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message = "Unable to instantiate jobId: "
+ + (vnfInstantiateResponse != null ? vnfInstantiateResponse.getJobId() : "null") + " OperationStatus: "
+ + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1207, message);
+ }
+ LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
+ }
+ }
+
+ private Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
+ final CreateVnfResponse vnfInstantiateResponse) {
+
+ final Optional<QueryJobResponse> instantiateOperationJobStatus =
+ vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(vnfInstantiateResponse.getJobId());
+
+ if (instantiateOperationJobStatus.isPresent()) {
+ final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
+
+ if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
+ final String message =
+ "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
+ }
+
+ if (queryJobResponse.getOperationState() != null) {
+ final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
+ LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
+ operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
+ return Optional.of(queryJobResponse.getOperationState());
+ }
+
+ LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
+ queryJobResponse.getOperationStatusRetrievalStatus());
+
+ }
+ return Optional.absent();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
index a76a4bf3c1..1e785074f3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import com.google.common.base.Optional;
@@ -37,4 +38,6 @@ public interface VnfmAdapterServiceProvider {
Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId);
+ Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId);
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
index f727423e85..e8f4c08f38 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -26,6 +26,7 @@ import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -121,4 +122,30 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
return Optional.absent();
}
}
+
+ @Override
+ public Optional<QueryJobResponse> getInstantiateOperationJobStatus(final String jobId) {
+ try {
+ final String url = urlProvider.getJobStatusUrl(jobId);
+
+ final ResponseEntity<QueryJobResponse> response =
+ httpServiceProvider.getHttpResponse(url, QueryJobResponse.class);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: ", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+ return Optional.of(response.getBody());
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing job request", httpInvocationException);
+ return Optional.absent();
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
index 61063fe90e..97a7197373 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
@@ -64,5 +64,14 @@ public class VnfmAdapterUrlProvider {
return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
}
+ /**
+ * Get job status URL
+ *
+ * @param jobId The instantiation job identifier
+ * @return job status URL
+ */
+ public String getJobStatusUrl(final String jobId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("jobs").pathSegment(jobId).build().toString();
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java
new file mode 100644
index 0000000000..ed5fa94100
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTaskTest.java
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.UUID;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import com.google.common.base.Optional;
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+public class MonitorVnfmCreateJobTaskTest extends BaseTaskTest {
+
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Test
+ public void testGetCurrentOperationStatus() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.COMPLETED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusFailed() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
+ queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.FAILED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusEmpty() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusException() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testHasOperationFinished() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testHasOperationPending() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1205),
+ eq("Instantiation operation time out"));
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessful() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ MonitorVnfmCreateJobTask objUnderTest = Mockito.spy(getEtsiVnfMonitorJobTask());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(objUnderTest, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
+ final MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1207), anyString());
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
+ MonitorVnfmCreateJobTask objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.CREATE_VNF_RESPONSE_PARAM_NAME, getCreateVnfResponse());
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1206), anyString());
+ }
+
+ private CreateVnfResponse getCreateVnfResponse() {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(JOB_ID);
+ return response;
+ }
+
+ private Optional<QueryJobResponse> getQueryJobResponse() {
+ final QueryJobResponse queryJobResponse = new QueryJobResponse();
+ queryJobResponse.setId(JOB_ID);
+ return Optional.of(queryJobResponse);
+ }
+
+ private MonitorVnfmCreateJobTask getEtsiVnfMonitorJobTask() {
+ return new MonitorVnfmCreateJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
index 5451d4442f..c4f19d6d1a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
@@ -20,6 +20,10 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_URL;
+
+import java.util.UUID;
+
import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmBasicHttpConfigProvider;
/**
@@ -32,6 +36,9 @@ public class TestConstants {
public static final String DUMMY_BASIC_AUTH = "Basic 123abc";
public static final String DUMMY_URL = "http://localhost:30406/so/vnfm-adapter/v1/";
public static final String EXPECTED_URL = DUMMY_URL + "vnfs/" + DUMMY_GENERIC_VND_ID;
+
+ public static final String DUMMY_JOB_ID = UUID.randomUUID().toString();
+ public static final String JOB_STATUS_EXPECTED_URL = DUMMY_URL + "jobs/" + DUMMY_JOB_ID;
public static VnfmBasicHttpConfigProvider getVnfmBasicHttpConfigProvider() {
return getVnfmBasicHttpConfigProvider(DUMMY_URL, DUMMY_BASIC_AUTH);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
index 79894d513d..6f1b6f0bd2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
@@ -22,13 +22,14 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_JOB_ID;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
-import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -38,6 +39,8 @@ import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import com.google.common.base.Optional;
@@ -49,74 +52,70 @@ import com.google.common.base.Optional;
@RunWith(MockitoJUnitRunner.class)
public class VnfmAdapterServiceProviderImplTest {
- private static final String EMPTY_JOB_ID = "";
+ private static final String EMPTY_JOB_ID = "";
- private static final CreateVnfRequest CREATE_VNF_REQUEST = new CreateVnfRequest();
+ private static final CreateVnfRequest CREATE_VNF_REQUEST = new CreateVnfRequest();
- private static final String DUMMY_JOB_ID = UUID.randomUUID().toString();
+ @Mock
+ private HttpRestServiceProvider mockedHttpServiceProvider;
- @Mock
- private HttpRestServiceProvider mockedHttpServiceProvider;
+ @Mock
+ private ResponseEntity<CreateVnfResponse> mockedResponseEntity;
- @Mock
- private ResponseEntity<CreateVnfResponse> mockedResponseEntity;
+ @Mock
+ private ResponseEntity<DeleteVnfResponse> deleteVnfResponse;
+ @Mock
+ private ResponseEntity<QueryJobResponse> mockedQueryJobResponseResponseEntity;
- @Mock
- private ResponseEntity<DeleteVnfResponse> deleteVnfResponse;
-
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBody_validResponse() {
-
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
- eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
- when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(mockedResponseEntity.hasBody()).thenReturn(true);
- final CreateVnfResponse response = getCreateVnfResponse(DUMMY_JOB_ID);
- when(mockedResponseEntity.getBody()).thenReturn(response);
-
-
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
-
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertTrue(actual.isPresent());
- assertEquals(actual.get(), response);
-
- }
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBody_validResponse() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
+ .thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(DUMMY_JOB_ID);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertTrue(actual.isPresent());
+ assertEquals(actual.get(), response);
+ }
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithNoBody_noResponse() {
- assertWithStatuCode(HttpStatus.ACCEPTED);
- }
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.ACCEPTED);
+ }
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusNotOkWithNoBody_noResponse() {
- assertWithStatuCode(HttpStatus.UNAUTHORIZED);
- }
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusNotOkWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.UNAUTHORIZED);
+ }
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBodyWithInvalidJobId_noResponse() {
- assertWithJobId(null);
- assertWithJobId(EMPTY_JOB_ID);
- }
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBodyWithInvalidJobId_noResponse() {
+ assertWithJobId(null);
+ assertWithJobId(EMPTY_JOB_ID);
+ }
- @Test
- public void testInvokeCreateInstantiationRequest_httpServiceProviderThrowException_httpRestServiceProviderNotNull() {
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderThrowException_httpRestServiceProviderNotNull() {
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
- eq(CreateVnfResponse.class))).thenThrow(RestProcessingException.class);
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
+ .thenThrow(RestProcessingException.class);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertFalse(actual.isPresent());
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
- }
+ }
@Test
public void testInvokeDeleteRequest() {
@@ -179,54 +178,116 @@ public class VnfmAdapterServiceProviderImplTest {
assertFalse(actual.isPresent());
}
+ @Test
+ public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusOkWithBody_validResponse() {
+
+ when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockedQueryJobResponseResponseEntity.hasBody()).thenReturn(true);
+ when(mockedQueryJobResponseResponseEntity.getBody()).thenReturn(getQueryJobResponse());
+
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertTrue(actual.isPresent());
+ final QueryJobResponse actualQueryJobResponse = actual.get();
+ assertNotNull(actualQueryJobResponse);
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusOkWithOutBody_invalidResponse() {
+
+ when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockedQueryJobResponseResponseEntity.hasBody()).thenReturn(false);
+
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_httpServiceProviderReturnsStatusNotOkWithOutBody_invalidResponse() {
- private void assertWithJobId(final String jobId) {
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
- eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
- when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
- when(mockedResponseEntity.hasBody()).thenReturn(true);
- final CreateVnfResponse response = getCreateVnfResponse(jobId);
- when(mockedResponseEntity.getBody()).thenReturn(response);
+ when(mockedQueryJobResponseResponseEntity.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenReturn(mockedQueryJobResponseResponseEntity);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertFalse(actual.isPresent());
- }
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertFalse(actual.isPresent());
+ }
+
+ @Test
+ public void testGetInstantiateOperationJobStatus_Exception() {
- private void assertWithStatuCode(final HttpStatus status) {
- when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
- eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
- when(mockedResponseEntity.getStatusCode()).thenReturn(status);
- when(mockedResponseEntity.hasBody()).thenReturn(false);
+ when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
+ eq(QueryJobResponse.class))).thenThrow(RestProcessingException.class);
- final VnfmAdapterServiceProvider objUnderTest =
- new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<CreateVnfResponse> actual =
- objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
- assertFalse(actual.isPresent());
- }
+ final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
+ assertFalse(actual.isPresent());
+ }
+ private QueryJobResponse getQueryJobResponse() {
+ return new QueryJobResponse().id(DUMMY_JOB_ID).operationState(OperationStateEnum.COMPLETED);
+
+ }
+
+ private void assertWithJobId(final String jobId) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
+ .thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(jobId);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
- private CreateVnfResponse getCreateVnfResponse(final String jobId) {
- final CreateVnfResponse response = new CreateVnfResponse();
- response.setJobId(jobId);
- return response;
- }
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- private DeleteVnfResponse getDeleteVnfResponse(final String jobId) {
- final DeleteVnfResponse response = new DeleteVnfResponse();
- response.setJobId(jobId);
- return response;
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
}
+ private void assertWithStatuCode(final HttpStatus status) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(), eq(CreateVnfResponse.class)))
+ .thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(status);
+ when(mockedResponseEntity.hasBody()).thenReturn(false);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- private VnfmAdapterUrlProvider getVnfmAdapterUrlProvider() {
- return new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
- }
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
+
+ private CreateVnfResponse getCreateVnfResponse(final String jobId) {
+ return new CreateVnfResponse().jobId(jobId);
+ }
+
+ private DeleteVnfResponse getDeleteVnfResponse(final String jobId) {
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(jobId);
+ return response;
+ }
+
+ private VnfmAdapterUrlProvider getVnfmAdapterUrlProvider() {
+ return new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
index cb93adca69..133f24bbe1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
@@ -22,11 +22,12 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_JOB_ID;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXPECTED_URL;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.JOB_STATUS_EXPECTED_URL;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
import org.junit.Test;
-import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterUrlProvider;
/**
@@ -41,9 +42,16 @@ public class VnfmAdapterUrlProviderTest {
final VnfmAdapterUrlProvider objUnderTest = new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
final String actual = objUnderTest.getCreateInstantiateUrl(DUMMY_GENERIC_VND_ID);
-
assertEquals(EXPECTED_URL, actual);
}
+ @Test
+ public void testGetJobStatuUrl_returnValidCreationInstantiationRequest() {
+ final VnfmAdapterUrlProvider objUnderTest = new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+
+ final String actual = objUnderTest.getJobStatusUrl(DUMMY_JOB_ID);
+ assertEquals(JOB_STATUS_EXPECTED_URL, actual);
+
+ }
}