summaryrefslogtreecommitdiffstats
path: root/controlloop/templates
diff options
context:
space:
mode:
authorTemoc Rodriguez <cr056n@att.com>2017-09-26 10:28:40 -0700
committerTemoc Rodriguez <cr056n@att.com>2017-09-26 10:38:45 -0700
commit0a5a9ed45639d56554ecb751de105105fac5da95 (patch)
tree76d7bd499a5df1c16dfb5409ac5e6c01825ba0e2 /controlloop/templates
parent742270864ddc3f89320b815fa9cd85caf83fca46 (diff)
Fix TestSO properties
TestSO was missing the environment properties for AAI and SO url, user, and pass. Set SO and AAI properties in TestSO.java. If this is not set, then the response will be null and the junit will fail. Moved setting properties to Util.java to promote code reuse. Issue-ID: POLICY-259 Change-Id: Id73611abab900675a1f2b543f71566baa05318b2 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
Diffstat (limited to 'controlloop/templates')
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java6
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java12
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java9
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java4
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java4
5 files changed, 22 insertions, 13 deletions
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
index 08f73f4bc..249c76d43 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
@@ -66,6 +66,12 @@ public class TestSO {
private static final Logger log = LoggerFactory.getLogger(TestSO.class);
+ static{
+ /* Set environment properties */
+ Util.setAAIProps();
+ Util.setSOProps();
+ }
+
@BeforeClass
public static void setUpSimulator() {
try {
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
index 715b8f795..f8f906867 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
@@ -50,6 +50,7 @@ import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
+import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.guard.PolicyGuardYamlToXacml;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -264,5 +265,16 @@ public final class Util {
}
return kieSession;
}
+
+ public static void setAAIProps(){
+ PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
+ PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
+ PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
+ }
+ public static void setSOProps(){
+ PolicyEngine.manager.setEnvironmentProperty("so.url", "http://localhost:6667");
+ PolicyEngine.manager.setEnvironmentProperty("so.username", "SO");
+ PolicyEngine.manager.setEnvironmentProperty("so.password", "SO");
+ }
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
index 419ab63a0..b350570ba 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
@@ -61,13 +61,8 @@ public class VDNSControlLoopTest {
static {
/* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
-
- PolicyEngine.manager.setEnvironmentProperty("so.url", "http://localhost:6667");
- PolicyEngine.manager.setEnvironmentProperty("so.username", "SO");
- PolicyEngine.manager.setEnvironmentProperty("so.password", "SO");
+ Util.setAAIProps();
+ Util.setSOProps();
}
@BeforeClass
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
index 29fdc195a..bdcf4bc7d 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
@@ -72,9 +72,7 @@ public class VFCControlLoopTest {
static {
/* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
+ Util.setAAIProps();
PolicyEngine.manager.setEnvironmentProperty("vfc.url", "http://localhost:6668");
PolicyEngine.manager.setEnvironmentProperty("vfc.username", "VFC");
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
index 453354dba..dc2047d35 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java
@@ -59,9 +59,7 @@ public class VFWControlLoopTest {
static {
/* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
+ Util.setAAIProps();
}
@BeforeClass