summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
index c334d522b6..f461df3720 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
@@ -5,6 +5,7 @@ import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -14,6 +15,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.apihandlerinfra.infra.rest.validators.ServiceInstanceDeleteValidator;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -30,22 +33,41 @@ public class ServiceInstanceDeleteValidatorTest {
private Map<String, String> instanceIdMap = new HashMap<>();
+ private ServiceInstancesRequest serviceInstancesRequest;
+
+ @Before
+ public void before() {
+ serviceInstancesRequest = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setaLaCarte(true);
+ requestDetails.setRequestParameters(requestParameters);
+ serviceInstancesRequest.setRequestDetails(requestDetails);
+ }
+
@Test
public void validateURIMatchTest() {
- assertEquals(true, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", new ServiceInstancesRequest(),
+ assertEquals(true, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", serviceInstancesRequest,
Action.deleteInstance));
}
@Test
public void validateURINotMatchTest() {
assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
- new ServiceInstancesRequest(), Action.deleteInstance));
+ serviceInstancesRequest, Action.deleteInstance));
}
@Test
public void validateURINotMatch2Test() {
assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/update",
- new ServiceInstancesRequest(), Action.deleteInstance));
+ serviceInstancesRequest, Action.deleteInstance));
+ }
+
+ @Test
+ public void validateNotALaCarteTest() {
+ serviceInstancesRequest.getRequestDetails().getRequestParameters().setaLaCarte(false);
+ assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", serviceInstancesRequest,
+ Action.deleteInstance));
}
@Test