diff options
author | Temoc Rodriguez <cr056n@att.com> | 2017-12-14 15:58:32 -0800 |
---|---|---|
committer | Temoc Rodriguez <cr056n@att.com> | 2017-12-15 09:09:12 -0800 |
commit | 4c8000e91a9dee0738e55e2bda930b94af474157 (patch) | |
tree | 578fdc9102ea43ad4765ba2d2dbb1322b24a37a2 /controlloop/common/simulators/src | |
parent | 5cfd3b7066e6a6305e140fa59b1fccb8e3c5f81b (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')
-rw-r--r-- | controlloop/common/simulators/src/main/java/org/onap/policy/simulators/GuardSimulatorJaxRs.java | 9 |
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\"}"; } |