diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-09-21 20:08:11 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2018-09-24 15:30:14 -0400 |
commit | a24a985d328b97f50a41d3448d235866af625ca9 (patch) | |
tree | 06c95950000fc2b512ec1e4da5aded2c5bc84e78 /controlloop/templates/template.demo.clc/src | |
parent | 3c52de0725c942fe1f2fdeb05c8960645bc66f01 (diff) |
Fix checkstyle declarations
I fixed what I thought would be tolerable for this release.
Same issue as policy/common I had to defined the checkstyle
in each repo where the suppressions were needed.
Issue-ID: POLICY-1135
Change-Id: I8f30bee7e9cddc692ddad3cf88acedb2e6b4781b
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/templates/template.demo.clc/src')
5 files changed, 22 insertions, 30 deletions
diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java index aaa2a0a83..7abf38620 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java @@ -20,6 +20,8 @@ package org.onap.policy.guard; +import com.att.research.xacml.api.DataTypeException; +import com.att.research.xacml.std.annotations.RequestParser; import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -27,8 +29,6 @@ import java.util.function.Supplier; import org.drools.core.WorkingMemory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.att.research.xacml.api.DataTypeException; -import com.att.research.xacml.std.annotations.RequestParser; public class CallGuardTaskEmbedded implements Runnable { @@ -36,14 +36,14 @@ public class CallGuardTaskEmbedded implements Runnable { /** * Actor/recipe pairs whose guard requests need a VF Module count. Each element is of - * the form "<actor>:<recipe>". + * the form "<actor>:<recipe>". */ private static final Set<String> NEEDS_VF_COUNT = new HashSet<>(); /** * Actor/recipe pairs whose guard requests need the VF Module count to be incremented * (i.e., because a module is being added). Each element is of the form - * "<actor>:<recipe>". + * "<actor>:<recipe>". */ private static final Set<String> INCR_VF_COUNT = new HashSet<>(); @@ -69,7 +69,8 @@ public class CallGuardTaskEmbedded implements Runnable { /** * Guard url is grabbed from PolicyEngine.manager properties */ - public CallGuardTaskEmbedded(WorkingMemory wm, String cl, String act, String rec, String tar, String reqId, Supplier<Integer> vfcnt) { + public CallGuardTaskEmbedded(WorkingMemory wm, String cl, String act, String rec, + String tar, String reqId, Supplier<Integer> vfcnt) { workingMemory = wm; clname = cl; actor = act; diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java index 947b187e4..e14946274 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java @@ -25,12 +25,8 @@ import com.att.research.xacml.api.AttributeCategory; import com.att.research.xacml.api.AttributeValue; import com.att.research.xacml.api.Result; import com.att.research.xacml.api.pdp.PDPEngine; -import com.att.research.xacml.api.pdp.PDPException; -import com.att.research.xacml.api.pdp.PDPEngineFactory; -import com.att.research.xacmlatt.pdp.ATTPDPEngineFactory; import com.att.research.xacml.std.annotations.RequestParser; - -import com.google.gson.Gson; +import com.att.research.xacmlatt.pdp.ATTPDPEngineFactory; import java.io.BufferedReader; import java.io.ByteArrayInputStream; @@ -52,8 +48,8 @@ import org.apache.commons.io.IOUtils; import org.apache.http.entity.ContentType; import org.json.JSONObject; import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes; import org.onap.policy.guard.PolicyGuardResponse; +import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes; import org.onap.policy.guard.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -152,7 +148,7 @@ public class PolicyGuardXacmlHelperEmbedded { * @param environment the Environment * @return response from guard which contains "Permit" or "Deny" */ - private String callRestfulPdp(InputStream is, URL restURL, String authorization, String clientauth, + private String callRestfulPdp(InputStream is, URL restUrl, String authorization, String clientauth, String environment) { HttpURLConnection connection = null; @@ -160,7 +156,7 @@ public class PolicyGuardXacmlHelperEmbedded { // // Open up the connection // - connection = (HttpURLConnection) restURL.openConnection(); + connection = (HttpURLConnection) restUrl.openConnection(); connection.setRequestProperty("Content-Type", "application/json"); // // Setup our method and headers @@ -202,7 +198,7 @@ public class PolicyGuardXacmlHelperEmbedded { connection.connect(); if (connection.getResponseCode() != 200) { - logger.error(connection.getResponseCode() + " " + connection.getResponseMessage()); + logger.error("{} {}", connection.getResponseCode(), connection.getResponseMessage()); return Util.INDETERMINATE; } } catch (Exception e) { @@ -266,7 +262,7 @@ public class PolicyGuardXacmlHelperEmbedded { // // Embedded call to PDP // - long lTimeStart = System.currentTimeMillis(); + long timeStart = System.currentTimeMillis(); if (xacmlReq.getVfCount() == null ) { xacmlReq.setVfCount(1); } @@ -275,8 +271,8 @@ public class PolicyGuardXacmlHelperEmbedded { } catch (Exception e) { logger.error(e.getMessage(), e); } - long lTimeEnd = System.currentTimeMillis(); - logger.debug("Elapsed Time: {} ms", (lTimeEnd - lTimeStart)); + long timeEnd = System.currentTimeMillis(); + logger.debug("Elapsed Time: {} ms", (timeEnd - timeStart)); // // Convert response to string // diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl index 3981f0def..15de89850 100644 --- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl @@ -32,7 +32,7 @@ import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager; import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS; import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager; -import org.onap.policy.controlloop.actor.so.SOActorServiceProvider; +import org.onap.policy.controlloop.actor.so.SoActorServiceProvider; import org.onap.policy.aai.AaiNqResponseWrapper; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; @@ -577,12 +577,13 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" } break; case "SO": - // at this point the AAI named query request should have already been made, the response recieved and used - // in the construction of the SO Request which is stored in operationRequest + // at this point the AAI named query request should have already been made, the response received + // and used in the construction of the SO Request which is stored in operationRequest if(request instanceof SORequest) { // Call SO. The response will be inserted into memory once it's received - SOActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request); + SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), + request); } break; case "VFC": diff --git a/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/ControlLoopCoordinationTest.java b/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/ControlLoopCoordinationTest.java index 2d6279f32..1d8779999 100644 --- a/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/ControlLoopCoordinationTest.java +++ b/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/ControlLoopCoordinationTest.java @@ -25,8 +25,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import com.att.research.xacml.util.XACMLProperties; - import com.google.gson.Gson; import java.io.IOException; @@ -218,7 +216,6 @@ public class ControlLoopCoordinationTest implements TopicListener { String target, KieSession kieSession, String expectedDecision) { - int waitMillis = 5000; // // if onset, set expected decision // @@ -233,7 +230,7 @@ public class ControlLoopCoordinationTest implements TopicListener { // // get dump of database entries and log // - List entries = Util.dumpDb(); + List<?> entries = Util.dumpDb(); assertNotNull(entries); logger.debug("dumpDB, {} entries", entries.size()); for (Object entry : entries) { diff --git a/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/Util.java b/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/Util.java index 5b5aa2d9c..6001331de 100644 --- a/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/Util.java +++ b/controlloop/templates/template.demo.clc/src/test/java/org/onap/policy/template/demo/clc/Util.java @@ -24,7 +24,6 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; @@ -34,7 +33,6 @@ import java.nio.file.Paths; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; @@ -55,7 +53,6 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.controlloop.policy.ControlLoopPolicy; import org.onap.policy.controlloop.policy.guard.ControlLoopGuard; import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.guard.PolicyGuardYamlToXacml; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; @@ -261,7 +258,7 @@ public final class Util { * * @return a list of the database entries */ - public static List dumpDb() { + public static List<?> dumpDb() { // // Connect to in-mem db // @@ -272,7 +269,7 @@ public final class Util { // String sql = "select * from operationshistory10"; Query nq = em.createNativeQuery(sql); - List results = null; + List<?> results = null; // // Execute query // |