summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authory.busko <y.busko@partner.samsung.com>2021-04-26 14:06:08 +0200
committery.busko <y.busko@partner.samsung.com>2021-04-29 14:49:49 +0200
commit21bd915bac67e586ea4d990e4704f254c0af1d3c (patch)
tree38d9d0f7512a61800630d2f4e33d1dc85c0fa071
parent2f7a1b8783367c6804c6599569c72ad7d88ab267 (diff)
Minor code fixes after CR
Fixed url building (added protocol, setted in env variables) Naming fixes Minor code refactors Issue-ID: INT-1896 Signed-off-by: Yauheni <y.busko@partner.samsung.com> Change-Id: Id8a26d0ebd1ecabd85aaa6cb724c218f4b6f741e
-rw-r--r--sleepingcelldetector/README.md16
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/A1Properties.java3
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/DataCollectorProperties.java5
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorProperties.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/MeasurementConfiguration.java6
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/RicConfiguration.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ServiceRegistrationPayload.java4
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMData.java9
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMEntity.java11
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/A1PolicyEvent.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Resources.java4
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Scope.java4
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ue/UEInfo.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/CellPerformanceVerifierScheduler.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/DataCollectorClient.java5
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/ServiceLifeCycleManager.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorService.java4
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Condition.java11
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionFactory.java12
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionI.java (renamed from sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionEnum.java)11
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Equal.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Less.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/LessOrEqual.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/More.java2
-rw-r--r--sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/MoreOrEqual.java2
-rw-r--r--sleepingcelldetector/src/main/resources/application.yml9
-rw-r--r--sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorConfigurationTest.java17
-rw-r--r--sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/JsonHelperTest.java6
-rw-r--r--sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorServiceTest.java6
29 files changed, 84 insertions, 81 deletions
diff --git a/sleepingcelldetector/README.md b/sleepingcelldetector/README.md
index 1a7b432..b91c15a 100644
--- a/sleepingcelldetector/README.md
+++ b/sleepingcelldetector/README.md
@@ -66,24 +66,26 @@ Set parameters of environment variables:
A1PolicyManagementService URL can be set using environment variables:
+- A1\_PROTOCOL
- A1\_HOST
- A1\_PORT
To customize DataCollector R-APP connectivity you need to set the following:
-- DC_HOST
-- DC_PORT
-- DC_VERSION
+- DATACOLLECTOR_PROTOCOL
+- DATACOLLECTOR_HOST
+- DATACOLLECTOR_PORT
+- DATACOLLECTOR_VERSION
SleepingCellDetector R-APP configuration fields:
-- SCD_PREFIX
-- SCD_SLOT
-- SCD_COUNT
+- SLEEPINGCELLDETECTOR_PREFIX
+- SLEEPINGCELLDETECTOR_SLOT
+- SLEEPINGCELLDETECTOR_COUNT
Prefix of high priority user equipment (policy instances will be created only for user equipments with this prefix),
example:
-`emergency_` - policy instances will be created only for UEs with "emergency\_" prefix Slot of time in seconds,
+`"emergency_"` - policy instances will be created only for UEs with `"emergency_"` prefix Slot of time in seconds,
number of slots for DataCollector R-APP Aggregated Metrics endpoint call. Slot: aggregation period (in seconds) for
which an average performance metrics are calculated Count: number of aggregated performance metrics that should be
returned by the method, one aggregated performance metric per each slot. The first performance metrics is average
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/A1Properties.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/A1Properties.java
index 24981e4..ba7fe57 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/A1Properties.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/A1Properties.java
@@ -21,11 +21,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Setter
@ConfigurationProperties(prefix = "a1")
public class A1Properties {
+ String protocol;
private String host;
private int port;
public String getA1PolicyUrl() {
- return String.format("http://%s:%d", host, port);
+ return String.format("%s://%s:%d", protocol, host, port);
}
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/DataCollectorProperties.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/DataCollectorProperties.java
index 6e6b289..5be6272 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/DataCollectorProperties.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/DataCollectorProperties.java
@@ -19,13 +19,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Getter
@Setter
-@ConfigurationProperties(prefix = "dc")
+@ConfigurationProperties(prefix = "datacollector")
public class DataCollectorProperties {
+ private String protocol;
private String host;
private int port;
private String version;
public String getDataCollectorUrl() {
- return String.format("http://%s:%d/%s", host, port, version);
+ return String.format("%s://%s:%d/%s", protocol, host, port, version);
}
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorProperties.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorProperties.java
index 4e3145f..24c3cee 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorProperties.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorProperties.java
@@ -19,7 +19,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Getter
@Setter
-@ConfigurationProperties(prefix = "scd")
+@ConfigurationProperties(prefix = "sleepingcelldetector")
public class SleepingCellDetectorProperties {
private String prefix;
private int slot;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/MeasurementConfiguration.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/MeasurementConfiguration.java
index 984eb1a..b0feb3f 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/MeasurementConfiguration.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/MeasurementConfiguration.java
@@ -15,17 +15,15 @@ package org.onap.rapp.sleepingcelldetector.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
-import lombok.Getter;
import lombok.NoArgsConstructor;
-import org.onap.rapp.sleepingcelldetector.service.scd.condition.ConditionEnum;
+import org.onap.rapp.sleepingcelldetector.service.scd.condition.Condition;
@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
public class MeasurementConfiguration {
private String name;
- private ConditionEnum condition;
+ private Condition condition;
private int averageThresholdValue;
private int latestThresholdValue;
private int latestSize;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/RicConfiguration.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/RicConfiguration.java
index db09f8a..468d759 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/RicConfiguration.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/RicConfiguration.java
@@ -16,13 +16,11 @@ package org.onap.rapp.sleepingcelldetector.entity;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
-import lombok.Getter;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
public class RicConfiguration {
private String ricName;
private List<String> managedElementIds;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ServiceRegistrationPayload.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ServiceRegistrationPayload.java
index 3cb2777..b73fca1 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ServiceRegistrationPayload.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ServiceRegistrationPayload.java
@@ -13,19 +13,15 @@
package org.onap.rapp.sleepingcelldetector.entity;
-import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
-import lombok.Getter;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
-@Getter
-@JsonInclude(JsonInclude.Include.NON_NULL)
public class ServiceRegistrationPayload {
private String callBackUrl;
private String keepAliveIntervalSeconds;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMData.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMData.java
index 5d26c5f..6975ab4 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMData.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMData.java
@@ -18,11 +18,14 @@ import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Singular;
@Getter
-@NoArgsConstructor
@AllArgsConstructor
+@NoArgsConstructor
public class PMData {
- String cellId;
- List<Map<String, Integer>> performance;
+
+ @Singular
+ private List<Map<String, Integer>> performance;
+ private String cellId;
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMEntity.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMEntity.java
index 805569b..dfb8e7f 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMEntity.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/pm/PMEntity.java
@@ -17,13 +17,16 @@ import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Singular;
import lombok.ToString;
@Getter
-@NoArgsConstructor
-@AllArgsConstructor
@ToString
+@AllArgsConstructor
+@NoArgsConstructor
public class PMEntity {
- List<PMData> pm;
- int totalCell;
+
+ @Singular
+ private List<PMData> pm;
+ private int totalCell;
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/A1PolicyEvent.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/A1PolicyEvent.java
index 7b70c0a..cfd83e3 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/A1PolicyEvent.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/A1PolicyEvent.java
@@ -13,7 +13,6 @@
package org.onap.rapp.sleepingcelldetector.entity.policy;
-import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -24,7 +23,6 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Getter
-@JsonInclude(JsonInclude.Include.NON_NULL)
public class A1PolicyEvent {
private Scope scope;
private List<Resources> resources;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Resources.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Resources.java
index 6214726..80c1e8d 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Resources.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Resources.java
@@ -13,20 +13,16 @@
package org.onap.rapp.sleepingcelldetector.entity.policy;
-import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
-import lombok.Getter;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
@JsonTypeName("resources")
-@JsonInclude(JsonInclude.Include.NON_NULL)
public class Resources {
private List<String> cellIdList;
private Preference preference;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Scope.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Scope.java
index 37e72bd..13513a1 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Scope.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/policy/Scope.java
@@ -13,19 +13,15 @@
package org.onap.rapp.sleepingcelldetector.entity.policy;
-import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AllArgsConstructor;
import lombok.Data;
-import lombok.Getter;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
-@Getter
@JsonTypeName("scope")
-@JsonInclude(JsonInclude.Include.NON_NULL)
public class Scope {
private String ueId;
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ue/UEInfo.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ue/UEInfo.java
index 7f5f997..e566d4c 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ue/UEInfo.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/entity/ue/UEInfo.java
@@ -16,11 +16,13 @@ package org.onap.rapp.sleepingcelldetector.entity.ue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Singular;
import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Getter
public class UEInfo {
+ @Singular
private List<String> ues;
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/CellPerformanceVerifierScheduler.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/CellPerformanceVerifierScheduler.java
index bc2aaaf..db0bc79 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/CellPerformanceVerifierScheduler.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/CellPerformanceVerifierScheduler.java
@@ -35,7 +35,7 @@ public class CellPerformanceVerifierScheduler {
this.cellPerformanceHandler = cellPerformanceHandler;
}
- @Scheduled(fixedRateString = "${scd.slot}000")
+ @Scheduled(fixedRateString = "${sleepingcelldetector.slot}000")
public void handleMeasurements() {
logger.debug("Perform measurements check");
performVesEventsMeasurementVerification();
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/DataCollectorClient.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/DataCollectorClient.java
index 85a5e06..2aef550 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/DataCollectorClient.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/DataCollectorClient.java
@@ -50,7 +50,10 @@ public class DataCollectorClient {
long count = config.getPredictionSlotNumber();
String time = URLEncoder.encode(OffsetDateTime.now().minusSeconds(slot * count).toString(),
StandardCharsets.UTF_8.toString());
- return "?slot=" + slot + "&count=" + count + "&startTime=" + time;
+ return new StringBuffer().append("?slot=").append(slot)
+ .append("&count=").append(count)
+ .append("&startTime=").append(time)
+ .toString();
}
public UEInfo getUserEquipment() {
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/ServiceLifeCycleManager.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/ServiceLifeCycleManager.java
index 70407e8..9c648b4 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/ServiceLifeCycleManager.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/ServiceLifeCycleManager.java
@@ -48,7 +48,7 @@ public class ServiceLifeCycleManager {
@Scheduled(fixedRate = 20000)
private void keepAlive() {
try {
- logger.info("Send keep alive request");
+ logger.debug("Send keep alive request");
policyAPIClient.sendKeepAliveRequest();
} catch (Exception e) {
logger.warn("Error during keep alive request {}", e.getMessage());
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorService.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorService.java
index f942162..cd38be1 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorService.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorService.java
@@ -27,7 +27,7 @@ import javax.annotation.PostConstruct;
import org.onap.rapp.sleepingcelldetector.configuration.SleepingCellDetectorConfiguration;
import org.onap.rapp.sleepingcelldetector.entity.MeasurementConfiguration;
import org.onap.rapp.sleepingcelldetector.service.JsonHelper;
-import org.onap.rapp.sleepingcelldetector.service.scd.condition.Condition;
+import org.onap.rapp.sleepingcelldetector.service.scd.condition.ConditionI;
import org.onap.rapp.sleepingcelldetector.service.scd.condition.ConditionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -118,7 +118,7 @@ public class SleepingCellDetectorService {
}
private Boolean isFailing(List<Integer> values, MeasurementConfiguration measurementConfiguration) {
- Condition condition = ConditionFactory.getCondition(measurementConfiguration.getCondition());
+ ConditionI condition = ConditionFactory.getCondition(measurementConfiguration.getCondition());
Integer totalAverage = CalculationUtil.calculateAverage(values);
Integer latestAverage = CalculationUtil.calculateAverage(values.stream()
.skip(configuration.getPredictionSlotNumber() - measurementConfiguration.getLatestSize())
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Condition.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Condition.java
index d6b6153..8a504cf 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Condition.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Condition.java
@@ -13,6 +13,13 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public interface Condition {
- boolean compare(int value, int toCompare);
+public enum Condition {
+ MORE(),
+ MORE_OR_EQUAL(),
+ LESS(),
+ LESS_OR_EQUAL(),
+ EQUAL();
+
+ private Condition(){
+ }
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionFactory.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionFactory.java
index a2f07c1..5085d81 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionFactory.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionFactory.java
@@ -15,14 +15,14 @@ package org.onap.rapp.sleepingcelldetector.service.scd.condition;
public class ConditionFactory {
- private static final Condition less = new Less();
- private static final Condition more = new More();
- private static final Condition equal = new Equal();
- private static final Condition lessOrEqual = new LessOrEqual();
- private static final Condition moreOrEqual= new MoreOrEqual();
+ private static final ConditionI less = new Less();
+ private static final ConditionI more = new More();
+ private static final ConditionI equal = new Equal();
+ private static final ConditionI lessOrEqual = new LessOrEqual();
+ private static final ConditionI moreOrEqual= new MoreOrEqual();
- public static Condition getCondition(ConditionEnum condition) {
+ public static ConditionI getCondition(Condition condition) {
switch (condition) {
case LESS:
return less;
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionEnum.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionI.java
index e4279ec..8d3360a 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionEnum.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/ConditionI.java
@@ -13,13 +13,6 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public enum ConditionEnum {
- MORE(),
- MORE_OR_EQUAL(),
- LESS(),
- LESS_OR_EQUAL(),
- EQUAL();
-
- private ConditionEnum(){
- }
+public interface ConditionI {
+ boolean compare(int value, int toCompare);
}
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Equal.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Equal.java
index c4d9940..f689a2c 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Equal.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Equal.java
@@ -13,7 +13,7 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public class Equal implements Condition {
+public class Equal implements ConditionI {
@Override
public boolean compare(int value, int toCompare) {
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Less.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Less.java
index 7d6db87..9332b50 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Less.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/Less.java
@@ -13,7 +13,7 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public class Less implements Condition {
+public class Less implements ConditionI {
@Override
public boolean compare(int value, int toCompare) {
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/LessOrEqual.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/LessOrEqual.java
index 2abd5a3..883be24 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/LessOrEqual.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/LessOrEqual.java
@@ -13,7 +13,7 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public class LessOrEqual implements Condition {
+public class LessOrEqual implements ConditionI {
@Override
public boolean compare(int value, int toCompare) {
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/More.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/More.java
index b257e30..2bcb258 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/More.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/More.java
@@ -13,7 +13,7 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public class More implements Condition {
+public class More implements ConditionI {
@Override
public boolean compare(int value, int toCompare) {
diff --git a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/MoreOrEqual.java b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/MoreOrEqual.java
index 37e9496..4305df6 100644
--- a/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/MoreOrEqual.java
+++ b/sleepingcelldetector/src/main/java/org/onap/rapp/sleepingcelldetector/service/scd/condition/MoreOrEqual.java
@@ -13,7 +13,7 @@
package org.onap.rapp.sleepingcelldetector.service.scd.condition;
-public class MoreOrEqual implements Condition {
+public class MoreOrEqual implements ConditionI {
@Override
public boolean compare(int value, int toCompare) {
diff --git a/sleepingcelldetector/src/main/resources/application.yml b/sleepingcelldetector/src/main/resources/application.yml
index bfa3982..81ec89e 100644
--- a/sleepingcelldetector/src/main/resources/application.yml
+++ b/sleepingcelldetector/src/main/resources/application.yml
@@ -1,13 +1,15 @@
server:
port: 8382
a1:
+ protocol: "http"
host: "policy-agent"
port: 8081
-dc:
+datacollector:
+ protocol: "http"
host: "localhost"
port: 8087
version: "v1"
-scd:
+sleepingcelldetector:
prefix: "emergency"
slot: 10
count: 12
@@ -19,3 +21,6 @@ logging:
pattern:
console: "%d %-5level %logger : %msg%n"
file: "%d %-5level [%thread] %logger : %msg%n"
+spring:
+ jackson:
+ default-property-inclusion: non_null
diff --git a/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorConfigurationTest.java b/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorConfigurationTest.java
index dbf59d4..8977a0d 100644
--- a/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorConfigurationTest.java
+++ b/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/configuration/SleepingCellDetectorConfigurationTest.java
@@ -28,13 +28,14 @@ import org.springframework.test.context.junit4.SpringRunner;
@EnableConfigurationProperties({A1Properties.class, DataCollectorProperties.class,
SleepingCellDetectorProperties.class})
@ContextConfiguration(classes = {SleepingCellDetectorConfiguration.class})
-@TestPropertySource(properties = {"a1.host=policy-agent", "a1.port=8081",
- "dc.host=rapp-datacollector",
- "dc.port=8087",
- "dc.version=v1",
- "scd.prefix=emergency",
- "scd.slot=10",
- "scd.count=12"
+@TestPropertySource(properties = {"a1.protocol=http", "a1.host=policy-agent", "a1.port=8081",
+ "datacollector.protocol=http",
+ "datacollector.host=rapp-datacollector",
+ "datacollector.port=8087",
+ "datacollector.version=v1",
+ "sleepingcelldetector.prefix=emergency",
+ "sleepingcelldetector.slot=10",
+ "sleepingcelldetector.count=12"
})
public class SleepingCellDetectorConfigurationTest {
@@ -58,7 +59,7 @@ public class SleepingCellDetectorConfigurationTest {
}
@Test
- public void verifyA1PAPropertiesTest() {
+ public void verifySleepingCellDetectorPropertiesTest() {
Assert.assertEquals(config.getPredictionTimeSlot(), 10);
Assert.assertEquals(config.getPredictionSlotNumber(), 12);
Assert.assertEquals(config.getUeFilteringPrefix(), "emergency");
diff --git a/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/JsonHelperTest.java b/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/JsonHelperTest.java
index e6768e4..767027d 100644
--- a/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/JsonHelperTest.java
+++ b/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/JsonHelperTest.java
@@ -20,7 +20,7 @@ import org.onap.rapp.sleepingcelldetector.entity.policy.PolicyInstance;
import org.onap.rapp.sleepingcelldetector.entity.policy.Preference;
import org.onap.rapp.sleepingcelldetector.entity.policy.Resources;
import org.onap.rapp.sleepingcelldetector.entity.policy.Scope;
-import org.onap.rapp.sleepingcelldetector.service.scd.condition.ConditionEnum;
+import org.onap.rapp.sleepingcelldetector.service.scd.condition.Condition;
import org.junit.Before;
import org.junit.Test;
@@ -94,8 +94,8 @@ public class JsonHelperTest {
}
private MeasurementConfiguration[] prepareTcaConfig() {
- MeasurementConfiguration latencyConfig = new MeasurementConfiguration("latency", ConditionEnum.MORE_OR_EQUAL, 400, 150, 2);
- MeasurementConfiguration throughputConfig = new MeasurementConfiguration("throughput", ConditionEnum.LESS_OR_EQUAL, 10, 10, 2);
+ MeasurementConfiguration latencyConfig = new MeasurementConfiguration("latency", Condition.MORE_OR_EQUAL, 400, 150, 2);
+ MeasurementConfiguration throughputConfig = new MeasurementConfiguration("throughput", Condition.LESS_OR_EQUAL, 10, 10, 2);
return new MeasurementConfiguration[]{latencyConfig, throughputConfig};
}
diff --git a/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorServiceTest.java b/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorServiceTest.java
index 4caa5f1..1062510 100644
--- a/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorServiceTest.java
+++ b/sleepingcelldetector/src/test/java/org/onap/rapp/sleepingcelldetector/service/scd/SleepingCellDetectorServiceTest.java
@@ -17,7 +17,7 @@ import org.onap.rapp.sleepingcelldetector.configuration.SleepingCellDetectorConf
import org.onap.rapp.sleepingcelldetector.entity.MeasurementConfiguration;
import org.onap.rapp.sleepingcelldetector.service.CellPerformanceHandlerTest;
import org.onap.rapp.sleepingcelldetector.service.JsonHelper;
-import org.onap.rapp.sleepingcelldetector.service.scd.condition.ConditionEnum;
+import org.onap.rapp.sleepingcelldetector.service.scd.condition.Condition;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -132,8 +132,8 @@ public class SleepingCellDetectorServiceTest {
}
private Map<String, MeasurementConfiguration> prepareMeasurementConfig() {
- MeasurementConfiguration latencyConfig = new MeasurementConfiguration("latency", ConditionEnum.MORE_OR_EQUAL, 400, 150, 2);
- MeasurementConfiguration throughputConfig = new MeasurementConfiguration("throughput", ConditionEnum.LESS_OR_EQUAL, 10, 10, 2);
+ MeasurementConfiguration latencyConfig = new MeasurementConfiguration("latency", Condition.MORE_OR_EQUAL, 400, 150, 2);
+ MeasurementConfiguration throughputConfig = new MeasurementConfiguration("throughput", Condition.LESS_OR_EQUAL, 10, 10, 2);
Map<String, MeasurementConfiguration> configMap = new HashMap<>();
configMap.put("latency", latencyConfig);