Make test classes name consitence by adding 'Support' or 'Dummy' at start of util or dummy type of test classes
Issue-ID: POLICY-1258
Change-Id: Idea946375ee46f14512d4c4bc29e65adaa4d2b37
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
actorService = ActorService.getInstance();
assertNotNull(actorService);
- Actor testActor = ActorService.getInstance().actors().get(0);
- assertNotNull(testActor);
+ Actor dummyActor = ActorService.getInstance().actors().get(0);
+ assertNotNull(dummyActor);
- assertEquals("TestActor", testActor.actor());
+ assertEquals("DummyActor", dummyActor.actor());
- assertEquals(2, testActor.recipes().size());
- assertEquals("Dorothy", testActor.recipes().get(0));
- assertEquals("Wizard", testActor.recipes().get(1));
+ assertEquals(2, dummyActor.recipes().size());
+ assertEquals("Dorothy", dummyActor.recipes().get(0));
+ assertEquals("Wizard", dummyActor.recipes().get(1));
- assertEquals(2, testActor.recipeTargets("Dorothy").size());
- assertEquals(2, testActor.recipePayloads("Dorothy").size());
+ assertEquals(2, dummyActor.recipeTargets("Dorothy").size());
+ assertEquals(2, dummyActor.recipePayloads("Dorothy").size());
}
}
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-public class TestActor implements Actor {
+public class DummyActor implements Actor {
@Override
public String actor() {
return this.getClass().getSimpleName();
-org.onap.policy.controlloop.actorserviceprovider.TestActor
\ No newline at end of file
+org.onap.policy.controlloop.actorserviceprovider.DummyActor
\ No newline at end of file
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
-public final class Util {
+public final class SupportUtil {
public static class Pair<A, B> {
public final A key;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.Util;
+import org.onap.policy.controlloop.SupportUtil;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS;
@Test
public void testAaiVnfInfo() {
- final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
+ final SupportUtil.Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
AaiGetVnfResponse response = getQueryByVnfId2(
@Test
public void testAaiVnfInfo2() {
- final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
+ final SupportUtil.Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
AaiGetVnfResponse response = getQueryByVnfName2(
@Test
public void testAaiVserver() {
- final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
+ final SupportUtil.Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
AaiGetVserverResponse response = getQueryByVserverName2(
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.ControlLoopNotificationType;
import org.onap.policy.controlloop.ControlLoopTargetType;
-import org.onap.policy.controlloop.Util;
+import org.onap.policy.controlloop.SupportUtil;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
//
// Load up the policy
//
- final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
+ final SupportUtil.Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
//
//
// Load up the policy
//
- final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
+ final SupportUtil.Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
//
Yaml clYaml = new Yaml(new Constructor(ControlLoopPolicy.class));
String clYamlString = clYaml.dump(clPolicy);
- TextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
+ SupportTextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
Pair<ControlLoopPolicy, String> result = Util.loadYaml(tempYamlFile.getCanonicalPath());
Yaml clYaml = new Yaml(new Constructor(ControlLoopPolicy.class));
String clYamlString = clYaml.dump(clGuardPolicy);
- TextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
+ SupportTextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
ControlLoopGuard result = Util.loadYamlGuard(tempYamlFile.getCanonicalPath());
Yaml clYaml = new Yaml(new Constructor(ControlLoopGuard.class));
String clYamlString = clYaml.dump(clGuard);
- TextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
+ SupportTextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
PolicyGuardYamlToXacml.fromYamlToXacml(tempYamlFile.getCanonicalPath(),
tempXacmlTemplateFile.getCanonicalPath(), tempXacmlOutputFile.getCanonicalPath());
- String result = TextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
+ String result = SupportTextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
// Assert no mote "${}" are left
assertFalse(result.contains("${"));
Yaml clYaml = new Yaml(new Constructor(ControlLoopGuard.class));
String clYamlString = clYaml.dump(clGuard);
- TextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
+ SupportTextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
PolicyGuardYamlToXacml.fromYamlToXacml(tempYamlFile.getCanonicalPath(),
tempXacmlTemplateFile.getCanonicalPath(), tempXacmlOutputFile.getCanonicalPath());
- String result = TextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
+ String result = SupportTextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
// Assert no mote "${}" are left
assertFalse(result.contains("${"));
Yaml clYaml = new Yaml(new Constructor(ControlLoopGuard.class));
String clYamlString = clYaml.dump(clGuard);
- TextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
+ SupportTextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
PolicyGuardYamlToXacml.fromYamlToXacmlBlacklist(tempYamlFile.getCanonicalPath(),
tempXacmlTemplateFile.getCanonicalPath(), tempXacmlOutputFile.getCanonicalPath());
- String result = TextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
+ String result = SupportTextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
System.err.println(result);
// Assert no mote "${}" are left
assertFalse(result.contains("${"));
Yaml clYaml = new Yaml(new Constructor(ControlLoopGuard.class));
String clYamlString = clYaml.dump(clGuard);
- TextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
+ SupportTextFileUtils.putStringAsFile(clYamlString, tempYamlFile);
PolicyGuardYamlToXacml.fromYamlToXacmlBlacklist(tempYamlFile.getCanonicalPath(),
tempXacmlTemplateFile.getCanonicalPath(), tempXacmlOutputFile.getCanonicalPath());
- String result = TextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
+ String result = SupportTextFileUtils.getTextFileAsString(tempXacmlOutputFile.getCanonicalPath());
System.err.println(result);
// Assert no mote "${}" are left
assertFalse(result.contains("${"));
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public abstract class TextFileUtils {
+public abstract class SupportTextFileUtils {
/**
* Method to return the contents of a text file as a string.
*
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setGuardPropsEmbedded();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setGuardPropsEmbedded();
+ SupportUtil.setPuProp();
}
/**
.customJacksonCoder(null)
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
+ SupportUtil.buildAaiSim();
} catch (Exception e) {
fail(e.getMessage());
}
//
// get dump of database entries and log
//
- List<?> entries = Util.dumpDb();
+ List<?> entries = SupportUtil.dumpDb();
assertNotNull(entries);
logger.debug("dumpDB, {} entries", entries.size());
for (Object entry : entries) {
/*
* Load policies from yaml
*/
- Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml(yamlFile);
+ SupportUtil.Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
controlLoopName.toString(),
policyScope,
policyName,
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.logging.LoggerUtil;
-import org.onap.policy.template.demo.clc.Util.Pair;
+import org.onap.policy.template.demo.clc.SupportUtil.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static String saveGuardFlag;
private static KieSession kieSession;
- private static Util.RuleSpec[] specifications;
+ private static SupportUtil.RuleSpec[] specifications;
/**
* Setup the simulator.
saveGuardFlag = PolicyEngine.manager.getEnvironmentProperty(GUARD_DISABLED);
PolicyEngine.manager.getEnvironment().setProperty(GUARD_DISABLED, "true");
- Util.setAaiProps();
+ SupportUtil.setAaiProps();
PolicyEngine.manager.configure(new Properties());
assertTrue(PolicyEngine.manager.start());
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
+ SupportUtil.buildAaiSim();
} catch (Exception e) {
logger.error("Could not create simulator", e);
}
try {
- specifications = new Util.RuleSpec[2];
+ specifications = new SupportUtil.RuleSpec[2];
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
POLICY_VERSION, loadYaml(YAML));
- specifications[1] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
- POLICY_VERSION, loadYaml(YAML_B));
+ specifications[1] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE,
+ POLICY_NAME_B, POLICY_VERSION, loadYaml(YAML_B));
- kieSession = Util.buildContainer(POLICY_VERSION, specifications);
+ kieSession = SupportUtil.buildContainer(POLICY_VERSION, specifications);
} catch (IOException e) {
logger.error("Could not create kieSession", e);
* effect, so then we'll update the second rule set, which should trigger a
* clean-up of both.
*/
- Util.RuleSpec[] specs = new Util.RuleSpec[1];
+ SupportUtil.RuleSpec[] specs = new SupportUtil.RuleSpec[1];
specs[0] = specifications[1];
logger.info("UPDATING VERSION TO v5.0 - DELETED RULE SET");
- Util.updateContainer("v5.0", specs);
+ SupportUtil.updateContainer("v5.0", specs);
- specs[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B, POLICY_VERSION,
- loadYaml(YAML));
+ specs[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
+ POLICY_VERSION, loadYaml(YAML));
logger.info("UPDATING VERSION TO v6.0 - UPDATED SECOND RULE SET");
- Util.updateContainer("v6.0", specs);
+ SupportUtil.updateContainer("v6.0", specs);
kieSession.fireAllRules();
facts = getSessionObjects();
*/
private static void updatePolicy(String yamlFile, String policyVersion) throws IOException {
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
policyVersion, loadYaml(yamlFile));
/*
* Update the policy within the container.
*/
- Util.updateContainer(policyVersion, specifications);
+ SupportUtil.updateContainer(policyVersion, specifications);
}
/**
* @throws UnsupportedEncodingException if an error occurs
*/
private static String loadYaml(String yamlFile) throws UnsupportedEncodingException {
- Pair<ControlLoopPolicy, String> pair = Util.loadYaml(yamlFile);
+ Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
import org.kie.api.runtime.KieSession;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.drools.utils.logging.LoggerUtil;
-import org.onap.policy.template.demo.clc.Util.Pair;
+import org.onap.policy.template.demo.clc.SupportUtil.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final String CONTROL_LOOP_NAME_B = "ControlLoop-Params-Cleanup-Test-B";
private static KieSession kieSession;
- private static Util.RuleSpec[] specifications;
+ private static SupportUtil.RuleSpec[] specifications;
/**
* Setup the simulator.
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
try {
- specifications = new Util.RuleSpec[2];
+ specifications = new SupportUtil.RuleSpec[2];
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
POLICY_VERSION, loadYaml(YAML));
- specifications[1] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
- POLICY_VERSION, loadYaml(YAML_B));
+ specifications[1] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE,
+ POLICY_NAME_B, POLICY_VERSION, loadYaml(YAML_B));
- kieSession = Util.buildContainer(POLICY_VERSION, specifications);
+ kieSession = SupportUtil.buildContainer(POLICY_VERSION, specifications);
} catch (IOException e) {
logger.error("Could not create kieSession", e);
*/
private static void updatePolicy(String yamlFile, String policyVersion) throws IOException {
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
policyVersion, loadYaml(yamlFile));
/*
* Update the policy within the container.
*/
- Util.updateContainer(policyVersion, specifications);
+ SupportUtil.updateContainer(policyVersion, specifications);
}
/**
* @throws UnsupportedEncodingException if an error occurs
*/
private static String loadYaml(String yamlFile) throws UnsupportedEncodingException {
- Pair<ControlLoopPolicy, String> pair = Util.loadYaml(yamlFile);
+ Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
import org.yaml.snakeyaml.constructor.Constructor;
-public final class Util {
+public final class SupportUtil {
private static final String OPSHISTPUPROP = "OperationsHistoryPU";
- private static final Logger logger = LoggerFactory.getLogger(Util.class);
+ private static final Logger logger = LoggerFactory.getLogger(SupportUtil.class);
// values from the last call to buildContainer()
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setSdncProps();
+ SupportUtil.setAaiProps();
+ SupportUtil.setSdncProps();
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
}
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildSdncSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildSdncSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(),
policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8"));
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.logging.LoggerUtil;
-import org.onap.policy.template.demo.Util.Pair;
+import org.onap.policy.template.demo.SupportUtil.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static String saveGuardFlag;
private static KieSession kieSession;
- private static Util.RuleSpec[] specifications;
+ private static SupportUtil.RuleSpec[] specifications;
/**
* Setup the simulator.
saveGuardFlag = PolicyEngine.manager.getEnvironmentProperty(GUARD_DISABLED);
PolicyEngine.manager.getEnvironment().setProperty(GUARD_DISABLED, "true");
- Util.setAaiProps();
+ SupportUtil.setAaiProps();
PolicyEngine.manager.configure(new Properties());
assertTrue(PolicyEngine.manager.start());
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
+ SupportUtil.buildAaiSim();
} catch (Exception e) {
logger.error("Could not create simulator", e);
}
try {
- specifications = new Util.RuleSpec[2];
+ specifications = new SupportUtil.RuleSpec[2];
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
POLICY_VERSION, loadYaml(YAML));
- specifications[1] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
- POLICY_VERSION, loadYaml(YAML_B));
+ specifications[1] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE,
+ POLICY_NAME_B, POLICY_VERSION, loadYaml(YAML_B));
- kieSession = Util.buildContainer(POLICY_VERSION, specifications);
+ kieSession = SupportUtil.buildContainer(POLICY_VERSION, specifications);
} catch (IOException e) {
logger.error("Could not create kieSession", e);
* effect, so then we'll update the second rule set, which should trigger a
* clean-up of both.
*/
- Util.RuleSpec[] specs = new Util.RuleSpec[1];
+ SupportUtil.RuleSpec[] specs = new SupportUtil.RuleSpec[1];
specs[0] = specifications[1];
logger.info("UPDATING VERSION TO v5.0 - DELETED RULE SET");
- Util.updateContainer("v5.0", specs);
+ SupportUtil.updateContainer("v5.0", specs);
- specs[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B, POLICY_VERSION,
- loadYaml(YAML));
+ specs[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
+ POLICY_VERSION, loadYaml(YAML));
logger.info("UPDATING VERSION TO v6.0 - UPDATED SECOND RULE SET");
- Util.updateContainer("v6.0", specs);
+ SupportUtil.updateContainer("v6.0", specs);
kieSession.fireAllRules();
facts = getSessionObjects();
*/
private static void updatePolicy(String yamlFile, String policyVersion) throws IOException {
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
policyVersion, loadYaml(yamlFile));
/*
* Update the policy within the container.
*/
- Util.updateContainer(policyVersion, specifications);
+ SupportUtil.updateContainer(policyVersion, specifications);
}
/**
* @throws UnsupportedEncodingException if an error occurs
*/
private static String loadYaml(String yamlFile) throws UnsupportedEncodingException {
- Pair<ControlLoopPolicy, String> pair = Util.loadYaml(yamlFile);
+ Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
private UUID requestId;
private UUID requestId2;
private UUID requestId3;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setGuardProps();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setGuardProps();
+ SupportUtil.setPuProp();
}
/**
.customJacksonCoder(null)
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildGuardSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(),
policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8"));
import org.kie.api.runtime.KieSession;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.drools.utils.logging.LoggerUtil;
-import org.onap.policy.template.demo.Util.Pair;
+import org.onap.policy.template.demo.SupportUtil.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final String CONTROL_LOOP_NAME_B = "ControlLoop-Params-Cleanup-Test-B";
private static KieSession kieSession;
- private static Util.RuleSpec[] specifications;
+ private static SupportUtil.RuleSpec[] specifications;
/**
* Setup the simulator.
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
try {
- specifications = new Util.RuleSpec[2];
+ specifications = new SupportUtil.RuleSpec[2];
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
POLICY_VERSION, loadYaml(YAML));
- specifications[1] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
- POLICY_VERSION, loadYaml(YAML_B));
+ specifications[1] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE,
+ POLICY_NAME_B, POLICY_VERSION, loadYaml(YAML_B));
- kieSession = Util.buildContainer(POLICY_VERSION, specifications);
+ kieSession = SupportUtil.buildContainer(POLICY_VERSION, specifications);
} catch (IOException e) {
logger.error("Could not create kieSession", e);
* effect, so then we'll update the second rule set, which should trigger a
* clean-up of both.
*/
- Util.RuleSpec[] specs = new Util.RuleSpec[1];
+ SupportUtil.RuleSpec[] specs = new SupportUtil.RuleSpec[1];
specs[0] = specifications[1];
logger.info("UPDATING VERSION TO v5.0 - DELETED RULE SET");
- Util.updateContainer("v5.0", specs);
+ SupportUtil.updateContainer("v5.0", specs);
- specs[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
+ specs[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME_B, POLICY_SCOPE, POLICY_NAME_B,
POLICY_VERSION, loadYaml(YAML));
logger.info("UPDATING VERSION TO v6.0 - UPDATED SECOND RULE SET");
- Util.updateContainer("v6.0", specs);
+ SupportUtil.updateContainer("v6.0", specs);
kieSession.fireAllRules();
facts = getSessionObjects();
*/
private static void updatePolicy(String yamlFile, String policyVersion) throws IOException {
- specifications[0] = new Util.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
+ specifications[0] = new SupportUtil.RuleSpec(DROOLS_TEMPLATE, CONTROL_LOOP_NAME, POLICY_SCOPE, POLICY_NAME,
policyVersion, loadYaml(yamlFile));
/*
* Update the policy within the container.
*/
- Util.updateContainer(policyVersion, specifications);
+ SupportUtil.updateContainer(policyVersion, specifications);
}
/**
* @throws UnsupportedEncodingException if an error occurs
*/
private static String loadYaml(String yamlFile) throws UnsupportedEncodingException {
- Pair<ControlLoopPolicy, String> pair = Util.loadYaml(yamlFile);
+ Pair<ControlLoopPolicy, String> pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
import org.yaml.snakeyaml.constructor.Constructor;
-public final class Util {
+public final class SupportUtil {
private static final String OPSHISTPUPROP = "OperationsHistoryPU";
- private static final Logger logger = LoggerFactory.getLogger(Util.class);
+ private static final Logger logger = LoggerFactory.getLogger(SupportUtil.class);
public static class Pair<A, B> {
public final A first;
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
private UUID requestId;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setGuardProps();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setGuardProps();
+ SupportUtil.setPuProp();
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
}
.customJacksonCoder(null)
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildGuardSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(),
policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8"));
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
private UUID requestId;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setSoProps();
- Util.setGuardProps();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setSoProps();
+ SupportUtil.setGuardProps();
+ SupportUtil.setPuProp();
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
}
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildSoSim();
- Util.buildGuardSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildSoSim();
+ SupportUtil.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(),
policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8"));
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
private UUID requestId;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setVfcProps();
- Util.setGuardProps();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setVfcProps();
+ SupportUtil.setGuardProps();
+ SupportUtil.setPuProp();
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
}
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildVfcSim();
- Util.buildGuardSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildVfcSim();
+ SupportUtil.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(),
policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8"));
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
private UUID requestId;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setGuardProps();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setGuardProps();
+ SupportUtil.setPuProp();
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "INFO");
}
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildGuardSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(),
policyScope, policyName, policyVersion, URLEncoder.encode(pair.second, "UTF-8"));
private static List<? extends TopicSink> noopTopics;
private static KieSession kieSession;
- private static Util.Pair<ControlLoopPolicy, String> pair;
+ private static SupportUtil.Pair<ControlLoopPolicy, String> pair;
private UUID requestId;
static {
/* Set environment properties */
- Util.setAaiProps();
- Util.setGuardProps();
- Util.setPuProp();
+ SupportUtil.setAaiProps();
+ SupportUtil.setGuardProps();
+ SupportUtil.setPuProp();
LoggerUtil.setLevel(LoggerUtil.ROOT_LOGGER, "DEBUG");
}
.customJacksonCoder(null)
.modelClassLoaderHash(1111));
try {
- Util.buildAaiSim();
- Util.buildGuardSim();
+ SupportUtil.buildAaiSim();
+ SupportUtil.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
/*
* Load policies from yaml
*/
- pair = Util.loadYaml(yamlFile);
+ pair = SupportUtil.loadYaml(yamlFile);
assertNotNull(pair);
assertNotNull(pair.first);
assertNotNull(pair.first.getControlLoop());
/*
* Construct a kie session
*/
- final KieSession kieSession = Util.buildContainer(droolsTemplate,
+ final KieSession kieSession = SupportUtil.buildContainer(droolsTemplate,
pair.first.getControlLoop().getControlLoopName(), policyScope, policyName, policyVersion,
URLEncoder.encode(pair.second, "UTF-8"));