Make validation of DistributeTraffic less strict. 55/70655/1
authorTomek Osinski <tomasz.osinski2@orange.com>
Wed, 17 Oct 2018 11:13:18 +0000 (13:13 +0200)
committerTomek Osinski <tomasz.osinski2@orange.com>
Wed, 17 Oct 2018 11:30:21 +0000 (13:30 +0200)
In order to pass configuration-parameters we need to make validation less strict.

Issue-ID: APPC-1173
Change-Id: I62e3f0acce8d4b577705dd5fe3b7e6ea7740cae1
Signed-off-by: Tomek Osinski <tomasz.osinski2@orange.com>
appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/DistributeTrafficService.java
appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/DistributeTrafficServiceTest.java

index 3671352..49b245b 100644 (file)
@@ -37,8 +37,6 @@ import java.util.Map;
  */
 public class DistributeTrafficService extends AbstractBaseService {
 
-
-    private static final String CONFIG_FILE_NAME_PARAMETER = "ConfigFileName";
     private static final String PAYLOAD = "payload";
 
     /**
@@ -91,12 +89,7 @@ public class DistributeTrafficService extends AbstractBaseService {
 
         try {
             Map<String, String> payloadMap = JsonUtil.convertJsonStringToFlatMap(payloadString);
-            // ConfigFileName validation
-            final String configFileName = payloadMap.get(CONFIG_FILE_NAME_PARAMETER);
-            if (configFileName == null) {
-                status = buildStatusForParamName(LCMCommandStatus.MISSING_MANDATORY_PARAMETER, CONFIG_FILE_NAME_PARAMETER);
-            }
-
+            validateMustHaveParamValue(payloadMap.get(PAYLOAD), PAYLOAD);
         } catch(IOException e) {
             logger.error(String.format("DistributeTrafficService (%s) got IOException when converting payload", rpcName), e);
             status = buildStatusForErrorMsg(LCMCommandStatus.UNEXPECTED_ERROR, e.getMessage());
index e0c06f7..671459d 100644 (file)
@@ -173,17 +173,4 @@ public class DistributeTrafficServiceTest {
 
     }
 
-    @Test
-    public void testValidateMissingConfigFileName() throws Exception {
-        helpInitializeRequestParameters();
-        String wrongPayload = "{\"test\":\"test\"}";
-        Mockito.doReturn(wrongPayload).when(mockPayload).getValue();
-        distributeTrafficService.validate(mockInput);
-        Status status = (Status) Whitebox.getInternalState(distributeTrafficService, "status");
-        assertEquals("should return status null",
-                Integer.valueOf(LCMCommandStatus.MISSING_MANDATORY_PARAMETER.getResponseCode()), status.getCode());
-    }
-
-
-
 }