From cd68fc9bae7d6258f77ff59c1431e4f925f61a4c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 13 Sep 2018 23:48:50 +0100 Subject: Address sonar/Checkstyle Issues Sweep through Apex codebase to fix most ceheckstyle and straightforward sonar issues. Issue-ID: POLICY-1034 Change-Id: I149d9a94ad893affc93573e8de5e3304b6bdde2d Signed-off-by: liamfallon --- .../apex/client/editor/rest/RestInterfaceTest.java | 16 ++++++++-------- .../apex/client/editor/rest/TestApexEditorStartup.java | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'client/client-editor/src/test') diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java index dc1e1137b..7af4b37c3 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java @@ -102,7 +102,7 @@ public class RestInterfaceTest { // create the client final Client c = ClientBuilder.newClient(); // Create the web target - target = c.target(new ApexEditorParameters().getBaseURI()); + target = c.target(new ApexEditorParameters().getBaseUri()); // load a test model locally localmodel = new ApexModelReader<>(AxPolicyModel.class, false) @@ -149,7 +149,7 @@ public class RestInterfaceTest { */ private static int createNewSession() { final ApexApiResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexApiResult.class); - assertEquals(responseMsg.getResult(), ApexApiResult.Result.SUCCESS); + assertEquals(ApexApiResult.Result.SUCCESS, responseMsg.getResult()); assertTrue(responseMsg.getMessages().size() == 1); return Integer.parseInt(responseMsg.getMessages().get(0)); } @@ -157,11 +157,11 @@ public class RestInterfaceTest { /** * Upload policy. * - * @param sessionID the session ID + * @param sessionId the session ID * @param modelAsJsonString the model as json string */ - private void uploadPolicy(final int sessionID, final String modelAsJsonString) { - final Builder requestbuilder = target.path("editor/" + sessionID + "/Model/Load").request(); + private void uploadPolicy(final int sessionId, final String modelAsJsonString) { + final Builder requestbuilder = target.path("editor/" + sessionId + "/Model/Load").request(); final ApexApiResult responseMsg = requestbuilder.put(Entity.json(modelAsJsonString), ApexApiResult.class); assertTrue(responseMsg.isOk()); } @@ -176,11 +176,11 @@ public class RestInterfaceTest { @Test public void testUploadThenGet() throws ApexException, JAXBException { - final int sessionID = createNewSession(); + final int sessionId = createNewSession(); - uploadPolicy(sessionID, localmodelString); + uploadPolicy(sessionId, localmodelString); - final ApexApiResult responseMsg = target.path("editor/" + sessionID + "/Policy/Get") + final ApexApiResult responseMsg = target.path("editor/" + sessionId + "/Policy/Get") .queryParam("name", "Policy0").queryParam("version", "0.0.1").request().get(ApexApiResult.class); assertTrue(responseMsg.isOk()); diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java index 699505aa8..0fad411a5 100644 --- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java @@ -336,7 +336,7 @@ public class TestApexEditorStartup { * @throws InterruptedException if the test is interrupted */ @Test - public void testTTLArg0() throws IOException, InterruptedException { + public void testTtlArg0() throws IOException, InterruptedException { final String[] args = new String[] { "-t10" }; final String outString = runEditor(args); @@ -359,7 +359,7 @@ public class TestApexEditorStartup { * @throws InterruptedException if the test is interrupted */ @Test - public void testTTLArg1() throws IOException, InterruptedException { + public void testTtlArg1() throws IOException, InterruptedException { final String[] args = new String[] { "-t", "10", "-l", "localhost" }; final String outString = runEditor(args); @@ -382,7 +382,7 @@ public class TestApexEditorStartup { * @throws InterruptedException if the test is interrupted */ @Test - public void testPortTTLArg0() throws IOException, InterruptedException { + public void testPortTtlArg0() throws IOException, InterruptedException { final String[] args = new String[] { "-t", "10", "-p", "12321" }; final String outString = runEditor(args); @@ -406,7 +406,7 @@ public class TestApexEditorStartup { * @throws InterruptedException if the test is interrupted */ @Test - public void testPortTTLArg1() throws IOException, InterruptedException { + public void testPortTtlArg1() throws IOException, InterruptedException { final String[] args = new String[] { "--time-to-live", "10", "--port", "12321", "--listen", "127.0.0.1" }; final String outString = runEditor(args); @@ -430,8 +430,8 @@ public class TestApexEditorStartup { * @throws InterruptedException if the test is interrupted */ private String runEditor(final String[] args) throws InterruptedException { - final ByteArrayOutputStream outBAStream = new ByteArrayOutputStream(); - final PrintStream outStream = new PrintStream(outBAStream); + final ByteArrayOutputStream outBaStream = new ByteArrayOutputStream(); + final PrintStream outStream = new PrintStream(outBaStream); final ApexEditorMain editorMain = new ApexEditorMain(args, outStream); @@ -450,7 +450,7 @@ public class TestApexEditorStartup { } editorMain.shutdown(); - final String outString = outBAStream.toString(); + final String outString = outBaStream.toString(); System.out.println(outString); return outString; } -- cgit 1.2.3-korg