aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java5
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java112
-rw-r--r--vid-app-common/src/test/resources/WEB-INF/conf/system.properties4
-rw-r--r--vid-app-common/src/test/resources/mso.properties17
8 files changed, 97 insertions, 71 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index 4d0d4ee74..3d980dce8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -140,7 +140,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
public MsoResponseWrapper createSvcInstance(RequestDetails msoRequest) {
logInvocationInDebug("createSvcInstance");
- String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String endpoint = validateEndpointPath(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
return msoClientInterface.createSvcInstance(msoRequest, endpoint);
}
@@ -260,7 +260,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
logInvocationInDebug("deleteSvcInstance");
String endpoint;
- endpoint = validateEndpointPath(MsoProperties.MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE);
+ endpoint = validateEndpointPath(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
if (shouldUnassignService(serviceStatus)){
logger.debug(EELFLoggerDelegate.debugLogger, "unassign service");
String svcEndpoint = endpoint + "/" + serviceInstanceId + "/unassign";
@@ -470,7 +470,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
String methodName = "activateServiceInstance";
logInvocationInDebug(methodName);
try {
- String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
String activateServicePath = serviceEndpoint + "/" + serviceInstanceId + ACTIVATE;
RestObject<String> restObjStr = new RestObject<>();
@@ -534,7 +534,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
@Override
public String getActivateFabricConfigurationPath(String serviceInstanceId) {
- String path = validateEndpointPath(MsoProperties.MSO_REST_API_SERVICE_INSTANCE_CREATE);
+ String path = validateEndpointPath(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
path += "/" + serviceInstanceId + ACTIVATE_FABRIC_CONFIGURATION;
return path;
@@ -684,7 +684,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
logInvocationInDebug("setServiceInstanceStatus");
String methodName = "setServiceInstanceStatus";
try {
- String serviceEndpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String serviceEndpoint = validateEndpointPath(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
String endpoint = serviceEndpoint + "/" + serviceInstanceId;
String isActivateState = (isActivate ? ACTIVATE : DEACTIVATE);
@@ -822,7 +822,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String serviceInstanceId) {
logInvocationInDebug("removeRelationshipFromServiceInstance");
- String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
String removeRelationshipsPath = serviceEndpoint + "/" + serviceInstanceId + "/removeRelationships";
return msoClientInterface.removeRelationshipFromServiceInstance(requestDetails, removeRelationshipsPath);
@@ -832,7 +832,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String serviceInstanceId) {
logInvocationInDebug("addRelationshipToServiceInstance");
- String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
String addRelationshipsPath = serviceEndpoint + "/" + serviceInstanceId + "/addRelationships";
return msoClientInterface.addRelationshipToServiceInstance(requestDetails, addRelationshipsPath);
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
index 4e6258c16..81566aae1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
@@ -69,10 +69,7 @@ public class MsoProperties extends SystemProperties {
public static final String MSO_REST_API_E2E_SVC_INSTANCE = "mso.restapi.svc.e2einstance"; // /e2eServiceInstances/v3
/** The Constant MSO_REST_API_SVC_INSTANCE. */
- public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2
-
- /** The Constant MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE. */
- public static final String MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance.deleteAndUnassign";
+ public static final String MSO_RESTAPI_SERVICE_INSTANCE = "mso.restapi.service.instance"; // /serviceInstances/v2
/** The Constant MSO_REST_API_VNF_INSTANCE. */
public static final String MSO_REST_API_VNF_INSTANCE = "mso.restapi.vnf.instance";
@@ -120,9 +117,6 @@ public class MsoProperties extends SystemProperties {
/** The Constant MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS */
public static final String MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS = "mso.restapi.operationalEnvironment.cloudResourcesRequests.status";
- /** The Constant MSO_REST_API_SERVICE_INSTANCE_CREATE */
- public static final String MSO_REST_API_SERVICE_INSTANCE_CREATE = "mso.restapi.serviceInstanceCreate";
-
/** The Constant MSO_REST_API_SERVICE_INSTANCE_ASSIGN */
public static final String MSO_REST_API_SERVICE_INSTANCE_ASSIGN = "mso.restapi.serviceInstanceAssign";
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java
index d7b3ac602..c77eb8230 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AsyncInstantiationBusinessLogicImpl.java
@@ -247,13 +247,13 @@ public class AsyncInstantiationBusinessLogicImpl implements
//in case pause flag is true - use assign , else - use create.
return MsoBusinessLogicImpl.validateEndpointPath(
serviceInstantiationRequest.isPause() ?
- MsoProperties.MSO_REST_API_SERVICE_INSTANCE_ASSIGN : MsoProperties.MSO_REST_API_SERVICE_INSTANCE_CREATE
+ MsoProperties.MSO_REST_API_SERVICE_INSTANCE_ASSIGN : MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE
);
}
@Override
public String getServiceDeletionPath(String serviceInstanceId) {
- return MsoBusinessLogicImpl.validateEndpointPath( MsoProperties.MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE) + "/" + serviceInstanceId;
+ return MsoBusinessLogicImpl.validateEndpointPath( MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE) + "/" + serviceInstanceId;
}
@Override
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
index 63cd62cf5..94a7cf9f0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
@@ -184,7 +184,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
public void shouldProperlyCreateSvcInstanceWithProperParameters() {
MsoResponseWrapper expectedResponse = createOkResponse();
- String svcEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String svcEndpoint = SystemProperties.getProperty(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
given(msoInterface.createSvcInstance(msoRequest, svcEndpoint)).willReturn(expectedResponse);
MsoResponseWrapper response = msoBusinessLogic.createSvcInstance(msoRequest);
@@ -833,7 +833,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
public void shouldProperlyGetActivateFabricConfigurationPathWithProperParameters() {
// given
String serviceInstanceId = "testServiceId";
- String path = validateEndpointPath(MsoProperties.MSO_REST_API_SERVICE_INSTANCE_CREATE);
+ String path = validateEndpointPath(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
path += "/" + serviceInstanceId + "/activateFabricConfiguration";
// when
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
index c47e7ce4e..0217204d0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
@@ -46,7 +46,6 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.onap.portalsdk.core.util.SystemProperties;
-import org.onap.vid.aai.HttpResponseWithRequestInfo;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.controller.MsoController;
import org.onap.vid.controller.WebConfig;
@@ -196,7 +195,7 @@ public class MsoRestClientNewTest {
@Ignore
@Test
public void testDeleteSvcInstance() throws Exception {
- String endpoint = props.getString(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
@@ -432,7 +431,7 @@ public class MsoRestClientNewTest {
@Test
public void testRemoveRelationshipFromServiceInstance() throws Exception {
- String serviceEndpoint = props.getString(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String serviceEndpoint = props.getString(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
String removeRelationshipsPath = serviceEndpoint + "/" + SERVICE_INSTANCE_ID + "/removeRelationships";
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
index e2d182c06..2b4f4be62 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
@@ -20,9 +20,80 @@
package org.onap.vid.services;
+import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
+import static net.javacrumbs.jsonunit.JsonAssert.whenIgnoringPaths;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.matchesPattern;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.nullValue;
+import static org.hamcrest.core.Every.everyItem;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.job.Job.JobStatus.COMPLETED;
+import static org.onap.vid.job.Job.JobStatus.COMPLETED_WITH_ERRORS;
+import static org.onap.vid.job.Job.JobStatus.COMPLETED_WITH_NO_ACTION;
+import static org.onap.vid.job.Job.JobStatus.FAILED;
+import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS;
+import static org.onap.vid.job.Job.JobStatus.PAUSE;
+import static org.onap.vid.job.Job.JobStatus.PENDING;
+import static org.onap.vid.job.Job.JobStatus.STOPPED;
+import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import javax.inject.Inject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.SessionFactory;
@@ -54,7 +125,11 @@ import org.onap.vid.job.command.MsoRequestBuilder;
import org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator;
import org.onap.vid.job.impl.JobDaoImpl;
import org.onap.vid.job.impl.JobSharedData;
-import org.onap.vid.model.*;
+import org.onap.vid.model.Action;
+import org.onap.vid.model.JobAuditStatus;
+import org.onap.vid.model.NameCounter;
+import org.onap.vid.model.ResourceInfo;
+import org.onap.vid.model.ServiceInfo;
import org.onap.vid.model.serviceInstantiation.BaseResource;
import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.model.serviceInstantiation.Vnf;
@@ -71,34 +146,11 @@ import org.onap.vid.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
-import org.testng.annotations.*;
-
-import javax.inject.Inject;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.time.*;
-import java.util.Optional;
-import java.util.*;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
-import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
-import static net.javacrumbs.jsonunit.JsonAssert.whenIgnoringPaths;
-import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
-import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-import static org.hamcrest.core.Every.everyItem;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-import static org.onap.vid.job.Job.JobStatus.*;
-import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric;
-import static org.testng.Assert.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
@ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class})
public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseTest {
@@ -665,7 +717,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT
public static Object[][] isPauseAndPropertyDataProvider() {
return new Object[][]{
{true, "mso.restapi.serviceInstanceAssign"},
- {false, "mso.restapi.serviceInstanceCreate"},
+ {false, "mso.restapi.service.instance"},
};
}
diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
index 33778babb..f2f29f172 100644
--- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
+++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
@@ -155,8 +155,7 @@ mso.polling.interval.msecs=10000
mso.max.polls=10
mso.user.name=infraportal
mso.password.x=OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz
-mso.restapi.svc.instance=/serviceInstances/v7
-mso.restapi.svc.instance.deleteAndUnassign=/serviceInstantiation/v7/serviceInstances
+mso.restapi.service.instance=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances
mso.restapi.vnf.instance=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/<service_instance_id>/vnfs
mso.restapi.vnf.changemanagement.instance=/serviceInstances/v7/<service_instance_id>/vnfs/<vnf_instance_id>/<request_type>
mso.restapi.network.instance=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/<service_instance_id>/networks
@@ -174,7 +173,6 @@ mso.restapi.configuration.instance=${mso.restapi.configurations}<configuration_i
mso.restapi.changeManagement.workflowSpecifications=/workflowSpecifications/v1/workflows?vnfModelVersionId=<model_version_id>
mso.restapi.serviceInstantiationApiRoot=/serviceInstantiation/v7
-mso.restapi.serviceInstanceCreate=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances
mso.restapi.serviceInstanceAssign=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/assign
mso.restapi.cloudResourcesApiRoot=/cloudResources/v1
diff --git a/vid-app-common/src/test/resources/mso.properties b/vid-app-common/src/test/resources/mso.properties
deleted file mode 100644
index d021ffde1..000000000
--- a/vid-app-common/src/test/resources/mso.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-mso.server.url=http://mtanjv9moah01-eth0.aic.cip.att.com:8080/ecomp/mso/infra
-mso.polling.interval.msecs=2000
-mso.max.polls=3
-mso.user.name=infraportal
-mso.password.x=OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz
-mso.restapi.svc.instance=/serviceInstances/v3
-mso.restapi.vnf.instance=/serviceInstances/v3/<service_instance_id>/vnfs
-mso.restapi.network.instance=/serviceInstances/v3/<service_instance_id>/networks
-mso.restapi.vf.module.instance=/serviceInstantiation/v7/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules/scaleOut
-mso.restapi.volume.group.instance=/serviceInstances/v3/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
-mso.restapi.configurations=/serviceInstances/v6/<service_instance_id>/configurations
-mso.restapi.get.orc.req=/orchestrationRequests/v3
-mso.restapi.get.orc.reqs=/orchestrationRequests/v3?
-mso.restapi.get.man.tasks=/tasks/v1
-mso.dme2.client.timeout=30000
-mso.dme2.client.read.timeout=120000
-mso.dme2.server.url=http://mso-api-handler-anap-v1.mso.ecomp.att.com/services/ecomp/mso?version=1607&envContext=TEST&routeOffer=st_mtsnj \ No newline at end of file