diff options
author | Kuleshov, Elena <evn@att.com> | 2020-05-20 11:23:22 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-05-20 11:23:23 -0400 |
commit | 570c4324718b7563911c4e180ab13908cf20d738 (patch) | |
tree | 49ca8cd04a2049aca7179f9d89131111165640a6 /mso-api-handlers/mso-api-handler-infra/src/test/java | |
parent | 5dd30849655e5a218c63d6c3855e8916399e49e7 (diff) |
Add Spring Component markup to rest validator
Add Spring Component markup to rest validator classes.
Do not invoke serviceInstanceDeleteValidator for macro deletes.
Issue-ID: SO-2945
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I0eb501bccb016d5d5fed43c3f5d1bd39c7d4fd72
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java | 28 |
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 |