Fix TestSO properties 61/15661/1
authorTemoc Rodriguez <cr056n@att.com>
Tue, 26 Sep 2017 17:28:40 +0000 (10:28 -0700)
committerTemoc Rodriguez <cr056n@att.com>
Tue, 26 Sep 2017 17:38:45 +0000 (10:38 -0700)
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>
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/Util.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java

index 08f73f4..249c76d 100644 (file)
@@ -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 {
index 715b8f7..f8f9068 100644 (file)
@@ -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");
+       }
 
 }
index 419ab63..b350570 100644 (file)
@@ -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
index 29fdc19..bdcf4bc 100644 (file)
@@ -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");
index 453354d..dc2047d 100644 (file)
@@ -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