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;
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";
+ private String url;
public ConfigFileScanningTask(ConfigFileScanner configFileScanner) {
this.configFileScanner = configFileScanner;
+ this.url = getRequestPref() + "://127.0.0.1:9101/api/holmes-rule-mgmt/v1/rule";
}
@Override
}
return true;
}
+
+ private String getRequestPref() {
+ return CommonUtils.isHttpsEnabled() ? JerseyClient.PROTOCOL_HTTPS : JerseyClient.PROTOCOL_HTTP;
+ }
}
@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);
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 {
+ 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);
Map<String, String> config = Whitebox.getInternalState(cfst, "configInEffect");
assertThat(config.size(), is(0));
+
+ System.clearProperty("ENABLE_ENCRYPT");
}
@Test
ruleResult4API.setEnabled(1);
return ruleResult4API;
}
+
+
}
\ No newline at end of file