summaryrefslogtreecommitdiffstats
path: root/rulemgt/src
diff options
context:
space:
mode:
authorGuangrong Fu <fu.guangrong@zte.com.cn>2022-01-20 15:24:56 +0800
committerGuangrong Fu <fu.guangrong@zte.com.cn>2022-01-20 15:24:56 +0800
commitb47f0129455748b68929a09d88510adc5a5f65ed (patch)
tree965c555e15c068b220c7d036b0bdea54ceaa1c65 /rulemgt/src
parent58e113734959922ec70516f9be1d7ebcc3fd5dc3 (diff)
bugfix - rule deployment failure due to existed rule name
Issue-ID: HOLMES-488 Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn> Change-Id: I4b941b2fc813b1a4638c67e3317e35b98a6914f0
Diffstat (limited to 'rulemgt/src')
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java3
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTaskTest.java3
2 files changed, 2 insertions, 4 deletions
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java
index 574432c..8423f3d 100644
--- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java
@@ -41,7 +41,6 @@ public class ConfigFileScanningTask implements Runnable {
final public static long POLLING_PERIOD = 30L;
final private static Logger LOGGER = LoggerFactory.getLogger(ConfigFileScanningTask.class);
final private static long FILE_SIZE_LMT = 1024 * 1024 * 10; // 10MB
- final private Map<String, String> configInEffect = new HashMap(); // Contents for configInEffect are <closedControlLoop>:<ruleContents> pairs.
private String configFile = "/opt/hrmrules/index.json";
private ConfigFileScanner configFileScanner;
private String url;
@@ -69,6 +68,8 @@ public class ConfigFileScanningTask implements Runnable {
return;
}
+ // Contents for configInEffect are <closedControlLoop>:<ruleContents> pairs.
+ Map<String, String> configInEffect = new HashMap();
for (RuleResult4API ruleResult4API : deployedRules) {
configInEffect.put(ruleResult4API.getLoopControlName(), ruleResult4API.getContent());
}
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTaskTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTaskTest.java
index 75f60b6..0f0f81a 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTaskTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTaskTest.java
@@ -105,12 +105,9 @@ public class ConfigFileScanningTaskTest {
String clName = "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b";
String indexPath = getFilePath("index-add.json");
String contents = FileUtils.readTextFile(indexPath);
- Map<String, String> configInEffect = new HashMap<>();
- configInEffect.put(clName, contents);
ConfigFileScanningTask cfst = new ConfigFileScanningTask(new ConfigFileScanner());
Whitebox.setInternalState(cfst, "configFile", getFilePath("index-empty.json"));
- Whitebox.setInternalState(cfst, "configInEffect", configInEffect);
// mock for getExistingRules
JerseyClient jcMock = PowerMock.createMock(JerseyClient.class);