summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomek Osinski <tomasz.osinski2@orange.com>2018-10-17 13:13:18 +0200
committerTomek Osinski <tomasz.osinski2@orange.com>2018-10-17 13:30:21 +0200
commitcf87390b00bb7aa3968f31e92a24737270006e00 (patch)
tree395c91041f1554ecc8825c275e16ac9c7546f4c0
parent80bb680c6ac93d8007630b5070cb58138a551711 (diff)
Make validation of DistributeTraffic less strict.
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>
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/DistributeTrafficService.java9
-rw-r--r--appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/DistributeTrafficServiceTest.java13
2 files changed, 1 insertions, 21 deletions
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/DistributeTrafficService.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/DistributeTrafficService.java
index 367135265..49b245b8a 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/DistributeTrafficService.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/DistributeTrafficService.java
@@ -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());
diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/DistributeTrafficServiceTest.java b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/DistributeTrafficServiceTest.java
index e0c06f774..671459dd3 100644
--- a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/DistributeTrafficServiceTest.java
+++ b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/lcm/service/DistributeTrafficServiceTest.java
@@ -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());
- }
-
-
-
}