summaryrefslogtreecommitdiffstats
path: root/controlloop/common/simulators/src/main/java
diff options
context:
space:
mode:
authorTemoc Rodriguez <cr056n@att.com>2017-12-14 15:58:32 -0800
committerTemoc Rodriguez <cr056n@att.com>2017-12-15 09:09:12 -0800
commit4c8000e91a9dee0738e55e2bda930b94af474157 (patch)
tree578fdc9102ea43ad4765ba2d2dbb1322b24a37a2 /controlloop/common/simulators/src/main/java
parent5cfd3b7066e6a6305e140fa59b1fccb8e3c5f81b (diff)
Add guard junits
Added a few junit files which test most functionality in the guard submodule. Some minor bugs were found by the junits and fixed those newly found bugs. Added persistence.xml for use by junits in guard. Issue-ID: POLICY-490 Change-Id: Ied7e276cfd417e1f396b5a6685a2e9acc9efd109 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
Diffstat (limited to 'controlloop/common/simulators/src/main/java')
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
index 7415130ea..4551cf246 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,14 +30,15 @@ import org.json.JSONObject;
@Path("/pdp/api")
public class GuardSimulatorJaxRs {
+ public static final String DENY_CLNAME = "denyGuard";
@POST
@Path("/getDecision")
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
- public String getGuardDecision(String req){
+ public String getGuardDecision(String req){
String clName = new JSONObject(req).getJSONObject("decisionAttributes").getString("clname");
- if ("denyGuard".equals(clName))
+ if (DENY_CLNAME.equals(clName))
{
return "{\"decision\": \"DENY\", \"details\": \"Decision Deny. You asked for it\"}";
}