summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Marszalek <s.marszalek2@partner.samsung.com>2021-09-15 18:52:34 +0200
committerStanislav Marszalek <s.marszalek2@partner.samsung.com>2021-09-15 18:52:34 +0200
commit3ac3f212d7127e887625a344c3e4846269a01df0 (patch)
tree989bbfd3c38b8738b62431adf7a5a0f8a790530a
parentbada18be8dcc91fca5e31f9c0eea60f86f6e7b61 (diff)
O1 PM Bulk support in DataCollector RAPP - removing trafficModelistanbul
Issue-ID: INT-1947 Signed-off-by: Stanislav Marszalek <s.marszalek2@partner.samsung.com> Change-Id: I02d3684c98d563d7f386de2fdf032e984ac74b3f
-rw-r--r--datacollector/src/main/java/org/onap/rapp/datacollector/entity/ves/MeasurementFields.java2
-rw-r--r--datacollector/src/main/java/org/onap/rapp/datacollector/service/PMService.java5
-rw-r--r--datacollector/src/main/java/org/onap/rapp/datacollector/service/VesRetrievalService.java9
-rw-r--r--datacollector/src/test/java/org/onap/rapp/datacollector/entity/ves/MeasurementFieldsTest.java9
4 files changed, 19 insertions, 6 deletions
diff --git a/datacollector/src/main/java/org/onap/rapp/datacollector/entity/ves/MeasurementFields.java b/datacollector/src/main/java/org/onap/rapp/datacollector/entity/ves/MeasurementFields.java
index c11c490..7ed10b1 100644
--- a/datacollector/src/main/java/org/onap/rapp/datacollector/entity/ves/MeasurementFields.java
+++ b/datacollector/src/main/java/org/onap/rapp/datacollector/entity/ves/MeasurementFields.java
@@ -41,7 +41,7 @@ public class MeasurementFields {
private MeasurementFields(Long eventId, long measurementInterval, List<AdditionalMeasurements> additionalMeasurements) {
this.eventId = eventId;
this.measurementInterval = measurementInterval;
- this.additionalMeasurements = Collections.unmodifiableList(additionalMeasurements);
+ this.additionalMeasurements = additionalMeasurements;
}
public static MeasurementFields of(Long eventId) {
diff --git a/datacollector/src/main/java/org/onap/rapp/datacollector/service/PMService.java b/datacollector/src/main/java/org/onap/rapp/datacollector/service/PMService.java
index 1e2931c..bd0b439 100644
--- a/datacollector/src/main/java/org/onap/rapp/datacollector/service/PMService.java
+++ b/datacollector/src/main/java/org/onap/rapp/datacollector/service/PMService.java
@@ -13,6 +13,7 @@
package org.onap.rapp.datacollector.service;
+import java.math.BigInteger;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
@@ -67,8 +68,8 @@ public class PMService {
}
private long getTimeIntervalEndTime(int slot, int count, long startDate) {
- int timeIntervalMicrosec = slot * count * MICRO_SECONDS_OF_SECOND;
- return startDate + timeIntervalMicrosec;
+ BigInteger timeIntervalMicrosec = BigInteger.valueOf(slot).multiply(BigInteger.valueOf(count)).multiply(BigInteger.valueOf(MICRO_SECONDS_OF_SECOND));
+ return startDate + timeIntervalMicrosec.longValue();
}
private Map<String, List<Event>> groupByCell(List<EventAPI> events) {
diff --git a/datacollector/src/main/java/org/onap/rapp/datacollector/service/VesRetrievalService.java b/datacollector/src/main/java/org/onap/rapp/datacollector/service/VesRetrievalService.java
index a3825f6..1cdacd8 100644
--- a/datacollector/src/main/java/org/onap/rapp/datacollector/service/VesRetrievalService.java
+++ b/datacollector/src/main/java/org/onap/rapp/datacollector/service/VesRetrievalService.java
@@ -95,8 +95,8 @@ public class VesRetrievalService implements DmaapRestReader {
}
private void saveAllEvents(List<Event> events) {
- persister.persistAll(events);
saveUesOfVes(events);
+ persister.persistAll(removeTrafficModelFromEvents(events));
}
private void saveUesOfVes(List<Event> events) {
@@ -113,6 +113,13 @@ public class VesRetrievalService implements DmaapRestReader {
.collect(Collectors.toSet())).orElse(Collections.emptySet());
}
+ private List<Event> removeTrafficModelFromEvents(List<Event> events) {
+ return events.stream().map(event -> {
+ event.getMeasurementFields().getAdditionalMeasurements()
+ .removeIf(additionalMeasurements -> UE_FIELD_NAME.equalsIgnoreCase(additionalMeasurements.getName()));
+ return event;
+ }).collect(Collectors.toList());
+ }
}
diff --git a/datacollector/src/test/java/org/onap/rapp/datacollector/entity/ves/MeasurementFieldsTest.java b/datacollector/src/test/java/org/onap/rapp/datacollector/entity/ves/MeasurementFieldsTest.java
index 1283bd5..9844694 100644
--- a/datacollector/src/test/java/org/onap/rapp/datacollector/entity/ves/MeasurementFieldsTest.java
+++ b/datacollector/src/test/java/org/onap/rapp/datacollector/entity/ves/MeasurementFieldsTest.java
@@ -15,8 +15,13 @@
package org.onap.rapp.datacollector.entity.ves;
import static org.junit.Assert.assertEquals;
+import static org.onap.rapp.datacollector.entity.ves.MeasurementFields.MEASUREMENT_FIELDS_VERSION;
+
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
+
import org.junit.Test;
public class MeasurementFieldsTest {
@@ -37,7 +42,7 @@ public class MeasurementFieldsTest {
static MeasurementFields createDummy(AdditionalMeasurements v) {
return MeasurementFields.builder()
.measurementInterval(1234567L)
- .additionalMeasurements(List.of(v))
+ .additionalMeasurements(new ArrayList<>(Arrays.asList(v)))
.build();
}
@@ -48,7 +53,7 @@ public class MeasurementFieldsTest {
MeasurementFields actual = createDummy(v);
assertEquals(1234567L, actual.measurementInterval);
- assertEquals("4.0", actual.MEASUREMENT_FIELDS_VERSION);
+ assertEquals("4.0", MEASUREMENT_FIELDS_VERSION);
assertEquals(List.of(v), actual.additionalMeasurements);
}
}