Issue-ID: HOLMES-488
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Change-Id: I9d4a219b55b909217413dd615013b0d1026e257d
import com.google.gson.JsonParser;
import org.apache.commons.lang.StringUtils;
import org.onap.holmes.common.ConfigFileScanner;
import com.google.gson.JsonParser;
import org.apache.commons.lang.StringUtils;
import org.onap.holmes.common.ConfigFileScanner;
+import org.onap.holmes.common.utils.CommonUtils;
import org.onap.holmes.common.utils.FileUtils;
import org.onap.holmes.common.utils.JerseyClient;
import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;
import org.onap.holmes.common.utils.FileUtils;
import org.onap.holmes.common.utils.JerseyClient;
import org.onap.holmes.rulemgt.bean.request.RuleCreateRequest;
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;
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 = "https://127.0.0.1:9101/api/holmes-rule-mgmt/v1/rule";
public ConfigFileScanningTask(ConfigFileScanner configFileScanner) {
this.configFileScanner = configFileScanner;
public ConfigFileScanningTask(ConfigFileScanner configFileScanner) {
this.configFileScanner = configFileScanner;
+ this.url = getRequestPref() + "://127.0.0.1:9101/api/holmes-rule-mgmt/v1/rule";
+
+ private String getRequestPref() {
+ return CommonUtils.isHttpsEnabled() ? JerseyClient.PROTOCOL_HTTPS : JerseyClient.PROTOCOL_HTTP;
+ }
@Test
public void run_add_rules() throws Exception {
@Test
public void run_add_rules() throws Exception {
+ System.setProperty("ENABLE_ENCRYPT", "true");
+
String clName = "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b";
String indexPath = getFilePath("index-add.json");
String contents = FileUtils.readTextFile(indexPath);
String clName = "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b";
String indexPath = getFilePath("index-add.json");
String contents = FileUtils.readTextFile(indexPath);
Map<String, String> config = Whitebox.getInternalState(cfst, "configInEffect");
assertThat(config.size(), is(1));
Map<String, String> config = Whitebox.getInternalState(cfst, "configInEffect");
assertThat(config.size(), is(1));
+
+ System.clearProperty("ENABLE_ENCRYPT");
}
@Test
public void run_remove_rules_normal() throws Exception {
}
@Test
public void run_remove_rules_normal() throws Exception {
+ System.setProperty("ENABLE_ENCRYPT", "false");
+
String clName = "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b";
String indexPath = getFilePath("index-add.json");
String contents = FileUtils.readTextFile(indexPath);
String clName = "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b";
String indexPath = getFilePath("index-add.json");
String contents = FileUtils.readTextFile(indexPath);
Map<String, String> config = Whitebox.getInternalState(cfst, "configInEffect");
assertThat(config.size(), is(0));
Map<String, String> config = Whitebox.getInternalState(cfst, "configInEffect");
assertThat(config.size(), is(0));
+
+ System.clearProperty("ENABLE_ENCRYPT");
ruleResult4API.setEnabled(1);
return ruleResult4API;
}
ruleResult4API.setEnabled(1);
return ruleResult4API;
}
}
\ No newline at end of file
}
\ No newline at end of file