aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/simulators
diff options
context:
space:
mode:
authorTemoc Rodriguez <cr056n@att.com>2017-09-26 16:03:34 -0700
committerTemoc Rodriguez <cr056n@att.com>2017-09-28 08:09:26 -0700
commit1f651c480d4dd3922e1c05461f7d901c47293c4a (patch)
treeb2437d524457d38f3d6ae40ed9194b1ece5547b9 /controlloop/common/simulators
parent060a99c988e622e7c8010bf8519aafbc0cdd6c81 (diff)
Add missing auth headers to guard request
Added guard authentication, client authentication, and environment http headers to the pdp-x guard restful request. Properties are set to PolicyEngine.manager. Property getter, setter, and properties in guard/.../Util.java. Test properties defined in junits themselves. Added code from GuardContext.java to grab the properties and make restful request. PolicyGuardXacmlHelper now closely resembles GuardContext in order to mimic functionality. Guard url no longer is passed into CallGuardTask, it is now a property. Issue-ID: POLICY-260 Change-Id: I5b144764828b6da0e7b738a578e4f6596a0f4f36 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
Diffstat (limited to 'controlloop/common/simulators')
-rw-r--r--controlloop/common/simulators/pom.xml6
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java16
2 files changed, 20 insertions, 2 deletions
diff --git a/controlloop/common/simulators/pom.xml b/controlloop/common/simulators/pom.xml
index 952d9b687..7ee811f0d 100644
--- a/controlloop/common/simulators/pom.xml
+++ b/controlloop/common/simulators/pom.xml
@@ -69,6 +69,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>policy-management</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.5</version>
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
index 41dc28875..696e2a60d 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
@@ -24,9 +24,11 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.LoggerUtil;
import org.onap.policy.guard.PolicyGuardXacmlHelper;
import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes;
+import org.onap.policy.guard.Util;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -38,10 +40,20 @@ public class GuardSimulatorTest {
LoggerUtil.setLevel("ROOT", "INFO");
LoggerUtil.setLevel("org.eclipse.jetty", "WARN");
try {
- Util.buildGuardSim();
+ org.onap.policy.simulators.Util.buildGuardSim();
} catch (Exception e) {
fail(e.getMessage());
}
+ //
+ // Set guard properties
+ //
+ org.onap.policy.guard.Util.setGuardEnvProps("http://localhost:6669/pdp/api/getDecision",
+ "python",
+ "test",
+ "python",
+ "test",
+ "TEST");
+
}
@AfterClass
@@ -52,7 +64,7 @@ public class GuardSimulatorTest {
@Test
public void testGuard() {
PolicyGuardXacmlRequestAttributes request = new PolicyGuardXacmlRequestAttributes("clname_id", "actor_id", "operation_id", "target_id", "request_id");
- String xacmlResponse = PolicyGuardXacmlHelper.callPDP("http://localhost:6669/pdp/api/getDecision", request);
+ String xacmlResponse = new PolicyGuardXacmlHelper().callPDP(request);
assertNotNull(xacmlResponse);
}
}