diff options
author | 2018-03-28 18:28:37 +0530 | |
---|---|---|
committer | 2018-03-28 18:28:37 +0530 | |
commit | 00a00a68862effd791ce3f127d0ddd5903598b89 (patch) | |
tree | 7249b6f39b17990a2a9c26d6499a9a65ccce8f76 /UniversalVesAdapter/src/main | |
parent | 8297bd0760ff3c46ef36d5a6408a757cf36097fe (diff) |
Added UniversalVesAdapter TestCases in the Mapper
Adding remaining UniversalVesAdapter TestCases in Mapper
Change-Id: Ic49bbbe2b4c4e242b1e91edfe565c7918e4b24e5
Issue-ID: DCAEGEN2-335
Signed-off-by: Pooja03 <PM00501616@techmahindra.com>
Diffstat (limited to 'UniversalVesAdapter/src/main')
-rw-r--r-- | UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java | 36 | ||||
-rw-r--r-- | UniversalVesAdapter/src/main/resources/application.properties | 7 |
2 files changed, 34 insertions, 9 deletions
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java index e94cdf5..4e67ed6 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/utils/MapperConfigUtils.java @@ -237,7 +237,7 @@ public class MapperConfigUtils { } if (null != evaluation.getOperand()) { - if (EnumUtils.isValidEnum(JoinOperator.class, evaluation.getOperand())) { + if (MapperConfigUtils.isValidEnum(JoinOperator.class, evaluation.getOperand())) { // if(JOIN_OPERATOR.contains(evaluation.getOperand())){ switch (JoinOperator.valueOf(evaluation.getOperand())) { case AND: @@ -251,7 +251,7 @@ public class MapperConfigUtils { } } - if (EnumUtils.isValidEnum(ExpressionOperator.class, evaluation.getOperand())) { + if (MapperConfigUtils.isValidEnum(ExpressionOperator.class, evaluation.getOperand())) { // if(EXPR_OPERATOR.contains(evaluation.getOperand())){ // currently it is assumed field being compared is first level @@ -261,7 +261,7 @@ public class MapperConfigUtils { if (null != field && null != evaluation.getDatatype() && actualObj.has(field)) { switch (ExpressionOperator.valueOf(evaluation.getOperand())) { case EQUALS: - if (EnumUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { + if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { switch (DataType.valueOf(evaluation.getDatatype())) { case STRING: if (null != actualObj.get(field)) @@ -276,7 +276,7 @@ public class MapperConfigUtils { } else return false; case STARTSWITH: - if (EnumUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { + if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { switch (DataType.valueOf(evaluation.getDatatype())) { case STRING: if (null != actualObj.get(field)) @@ -287,7 +287,7 @@ public class MapperConfigUtils { } else return false; case ENDSWITH: - if (EnumUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { + if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { switch (DataType.valueOf(evaluation.getDatatype())) { case STRING: if (null != actualObj.get(field)) @@ -298,7 +298,7 @@ public class MapperConfigUtils { } else return false; case CONTAINS: - if (EnumUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { + if (MapperConfigUtils.isValidEnum(DataType.class, evaluation.getDatatype())) { switch (DataType.valueOf(evaluation.getDatatype())) { case STRING: if (null != actualObj.get(field)) @@ -318,5 +318,29 @@ public class MapperConfigUtils { return false; } + /** + * <p>Checks if the specified name is a valid enum for the class.</p> + * + * <p>This method differs from {@link Enum#valueOf} in that checks if the name is + * a valid enum without needing to catch the exception.</p> + * + * @param <E> the type of the enumeration + * @param enumClass the class of the enum to query, not null + * @param enumName the enum name, null returns false + * @return true if the enum name is valid, otherwise false + */ + + public static <E extends Enum<E>> boolean isValidEnum(final Class<E> enumClass, final String enumName) { + if (enumName == null) { + return false; + } + try { + Enum.valueOf(enumClass, enumName); + return true; + } catch (final IllegalArgumentException ex) { + return false; + } + } + } diff --git a/UniversalVesAdapter/src/main/resources/application.properties b/UniversalVesAdapter/src/main/resources/application.properties index a0c32b4..55074d4 100644 --- a/UniversalVesAdapter/src/main/resources/application.properties +++ b/UniversalVesAdapter/src/main/resources/application.properties @@ -1,10 +1,11 @@ logging.level.org.springframework.web=ERROR logging.level.org.onap.universalvesadapter=DEBUG -dmaap.url=http://localhost:8091/greeting +dmaap.url=http://localhost:8080/greeting12 snmpTrap.configFile=snmpTrapToVes.xml universal.configFiles=snmp:snmpTrapToVes.xml,default:defaultConfig.xml fileService.url=http://localhost:8888/fileAsString/ messagesInBatch=1000 +messagesInTimeInterval=5000 +mapperConfig.file=D:/DCAE User Story/Commits/newwww/mapper/UniversalVesAdapter/src/main/resources/MapperConfig.json dmaap.consumer_props=/src/main/resources/dme2/consumer.properties -dmaap.publisher_props=/src/main/resources/dme2/publisher.properties -server.port=8091
\ No newline at end of file +dmaap.publisher_props=/src/main/resources/dme2/publisher.properties
\ No newline at end of file |