bugfix - rule deployment failure due to existed rule name 55/126655/1
authorGuangrong Fu <fu.guangrong@zte.com.cn>
Thu, 20 Jan 2022 07:24:56 +0000 (15:24 +0800)
committerGuangrong Fu <fu.guangrong@zte.com.cn>
Thu, 20 Jan 2022 07:24:56 +0000 (15:24 +0800)
Issue-ID: HOLMES-488
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Change-Id: I4b941b2fc813b1a4638c67e3317e35b98a6914f0

rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java
rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTaskTest.java

index 574432c..8423f3d 100644 (file)
@@ -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());
         }
index 75f60b6..0f0f81a 100644 (file)
@@ -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);