TCA:Support for string & decimal policy FieldPath
[dcaegen2/analytics/tca.git] / dcae-analytics-tca / src / test / java / org / openecomp / dcae / apod / analytics / tca / utils / TCAUtilsTest.java
index 853ac54..426bd1e 100644 (file)
@@ -53,6 +53,7 @@ import org.quartz.Scheduler;
 import org.quartz.SimpleTrigger;\r
 import org.quartz.impl.StdSchedulerFactory;\r
 \r
+import java.math.BigDecimal;\r
 import java.util.Arrays;\r
 import java.util.HashMap;\r
 import java.util.List;\r
@@ -147,8 +148,9 @@ public class TCAUtilsTest extends BaseAnalyticsTCAUnitTest {
         final String jsonPath =\r
                 "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated";\r
         final ImmutableSet<String> fieldPaths = ImmutableSet.of(jsonPath);\r
-        final Map<String, List<Long>> jsonPathValueMap = TCAUtils.getJsonPathValue(cefMessageString, fieldPaths);\r
-        assertThat("Json Path value must match", jsonPathValueMap.get(jsonPath).get(0), is(5000L));\r
+        final Map<String, List<BigDecimal>> jsonPathValueMap = TCAUtils.getJsonPathValue(cefMessageString, fieldPaths);\r
+        assertThat("Json Path value must match",\r
+                jsonPathValueMap.get(jsonPath).get(0), is(new BigDecimal(5000)));\r
 \r
     }\r
 \r
@@ -157,7 +159,7 @@ public class TCAUtilsTest extends BaseAnalyticsTCAUnitTest {
         final String cefMessageString = fromStream(CEF_MESSAGE_JSON_FILE_LOCATION);\r
         final String jsonPath = "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].invalid";\r
         final ImmutableSet<String> fieldPaths = ImmutableSet.of(jsonPath);\r
-        final Map<String, List<Long>> jsonPathValueMap = TCAUtils.getJsonPathValue(cefMessageString, fieldPaths);\r
+        final Map<String, List<BigDecimal>> jsonPathValueMap = TCAUtils.getJsonPathValue(cefMessageString, fieldPaths);\r
         assertThat("Json path value must be empty", jsonPathValueMap.size(), is(0));\r
 \r
     }\r
@@ -400,7 +402,7 @@ public class TCAUtilsTest extends BaseAnalyticsTCAUnitTest {
         violatedThreshold.setSeverity(severity);\r
         violatedThreshold.setDirection(Direction.GREATER);\r
         violatedThreshold.setClosedLoopControlName("violatedThresholdClosedLoopName");\r
-        violatedThreshold.setActualFieldValue(100L);\r
+        violatedThreshold.setActualFieldValue(new BigDecimal(100L));\r
         violatedThreshold.setFieldPath("violatedThresholdFieldPath");\r
         violatedThreshold.setVersion("violatedThresholdVersion");\r
         violatedThreshold.setClosedLoopEventStatus(ClosedLoopEventStatus.ONSET);\r