summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-03-11 21:29:17 +0000
committerliamfallon <liam.fallon@est.tech>2020-03-11 21:29:21 +0000
commit690495d32c6033741d7a7c2413476f7ba88e2825 (patch)
tree554cc03ef1c832bf8e488d19cd5ffb3021a35a6e /client
parent4e6bd1d02227591d1517245f5bda690ec4eb770e (diff)
Fix minor checkstyle/eclipse warnings
Some minor checkstyle and eclipse warnings have crept into the code in the last few weeks. This review cleams them up. Issue-ID: POLICY-1913 Change-Id: Ib5f103bc28c71a6c4db05ea05719eff41bb38914 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'client')
-rw-r--r--client/client-deployment/src/test/java/org/onap/policy/apex/client/deployment/rest/DeploymentRestMainTest.java83
-rw-r--r--client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java73
-rw-r--r--client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java99
3 files changed, 111 insertions, 144 deletions
diff --git a/client/client-deployment/src/test/java/org/onap/policy/apex/client/deployment/rest/DeploymentRestMainTest.java b/client/client-deployment/src/test/java/org/onap/policy/apex/client/deployment/rest/DeploymentRestMainTest.java
index 245900d7d..91b5480b6 100644
--- a/client/client-deployment/src/test/java/org/onap/policy/apex/client/deployment/rest/DeploymentRestMainTest.java
+++ b/client/client-deployment/src/test/java/org/onap/policy/apex/client/deployment/rest/DeploymentRestMainTest.java
@@ -48,86 +48,78 @@ public class DeploymentRestMainTest {
@Test
public void testDeploymentClientNoOptions() {
- final String[] eventArgs = new String[]
- {};
+ final String[] eventArgs = new String[] {};
assertThat(testApexDeploymentRestMainConstructor(eventArgs)).isEqualTo("*** StdOut ***\n\n*** StdErr ***\n");
}
@Test
public void testDeploymentClientBadOptions() {
- final String[] eventArgs =
- { "-zabbu" };
+ final String[] eventArgs = {"-zabbu"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
- assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
- + "parameter error, invalid command line arguments specified "
- + ": Unrecognized option: -zabbu");
+ assertThat(thrown).isInstanceOf(Exception.class)
+ .hasMessageContaining("Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, invalid command line arguments specified " + ": Unrecognized option: -zabbu");
}
@Test
public void testDeploymentClientHelp() {
- final String[] eventArgs =
- { "-h" };
+ final String[] eventArgs = {"-h"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "usage: org.onap.policy.apex.client.deployment.rest.ApexDeploymentRestMain [options...]");
+ "usage: org.onap.policy.apex.client.deployment.rest.ApexDeploymentRestMain [options...]");
}
@Test
public void testDeploymentClientPortBad() {
- final String[] eventArgs =
- { "-p", "hello" };
+ final String[] eventArgs = {"-p", "hello"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
- assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
- + "parameter error, error parsing argument \"port\" :For input string: \"hello\"");
+ assertThat(thrown).isInstanceOf(Exception.class)
+ .hasMessageContaining("Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, error parsing argument \"port\" :For input string: \"hello\"");
}
@Test
public void testDeploymentClientPortNegative() {
- final String[] eventArgs =
- { "-p", "-1" };
+ final String[] eventArgs = {"-p", "-1"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: "
- + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
- + "port must be greater than 1023 and less than 65536");
+ "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: "
+ + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
+ + "port must be greater than 1023 and less than 65536");
}
@Test
public void testDeploymentClientTtlTooSmall() {
- final String[] eventArgs =
- { "-t", "-2" };
+ final String[] eventArgs = {"-t", "-2"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: "
- + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, "
- + "time to live must be greater than -1 (set to -1 to wait forever)");
+ "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: "
+ + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, "
+ + "time to live must be greater than -1 (set to -1 to wait forever)");
}
@Test
public void testDeploymentClientTooManyPars() {
- final String[] eventArgs =
- { "-t", "10", "-p", "12344", "aaa", "bbb" };
+ final String[] eventArgs = {"-t", "10", "-p", "12344", "aaa", "bbb"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
- assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
- + "parameter error, too many command line arguments specified : [aaa, bbb]");
+ assertThat(thrown).isInstanceOf(Exception.class)
+ .hasMessageContaining("Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, too many command line arguments specified : [aaa, bbb]");
}
@Test
@@ -141,35 +133,31 @@ public class DeploymentRestMainTest {
@Test
public void testDeploymentClientTtlNotNumber() {
- final String[] eventArgs =
- { "-t", "timetolive" };
+ final String[] eventArgs = {"-t", "timetolive"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
- assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
- + "parameter error, error parsing argument \"time-to-live\" :"
- + "For input string: \"timetolive\"");
+ assertThat(thrown).isInstanceOf(Exception.class)
+ .hasMessageContaining("Apex Services REST endpoint (ApexDeploymentRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, error parsing argument \"time-to-live\" :" + "For input string: \"timetolive\"");
}
@Test
public void testDeploymentClientPortTooBig() {
- final String[] eventArgs =
- { "-p", "65536" };
+ final String[] eventArgs = {"-p", "65536"};
Throwable thrown = catchThrowable(() -> new ApexDeploymentRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: "
- + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
- + "port must be greater than 1023 and less than 65536");
+ "Apex Services REST endpoint (ApexDeploymentRestMain: Config=[ApexDeploymentRestParameters: "
+ + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
+ + "port must be greater than 1023 and less than 65536");
}
@Test
public void testDeploymentOneSecStart() {
- final String[] eventArgs =
- { "-t", "1" };
+ final String[] eventArgs = {"-t", "1"};
assertThatCode(() -> {
ApexDeploymentRestMain monRestMain = new ApexDeploymentRestMain(eventArgs, System.out);
@@ -181,8 +169,7 @@ public class DeploymentRestMainTest {
@Test
public void testDeploymentForeverStart() {
- final String[] eventArgs =
- { "-t", "-1" };
+ final String[] eventArgs = {"-t", "-1"};
ApexDeploymentRestMain monRestMain = new ApexDeploymentRestMain(eventArgs, System.out);
@@ -195,8 +182,8 @@ public class DeploymentRestMainTest {
assertThatCode(() -> {
monThread.start();
- await().atMost(2, TimeUnit.SECONDS).until(
- () -> monRestMain.getState().equals(ApexDeploymentRestMain.ServicesState.RUNNING));
+ await().atMost(2, TimeUnit.SECONDS)
+ .until(() -> monRestMain.getState().equals(ApexDeploymentRestMain.ServicesState.RUNNING));
monRestMain.shutdown();
}).doesNotThrowAnyException();
}
diff --git a/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java b/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java
index 3e21ee595..5b01e04fa 100644
--- a/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java
+++ b/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java
@@ -48,98 +48,86 @@ public class ServicesRestMainTest {
@Test
public void testServicesClientNoOptions() {
- final String[] eventArgs = new String[]
- {};
+ final String[] eventArgs = new String[] {};
assertThat(testApexServicesRestMainConstructor(eventArgs)).isEqualTo("*** StdOut ***\n\n*** StdErr ***\n");
-
}
@Test
public void testServicesClientBadOptions() {
- final String[] eventArgs =
- { "-zabbu" };
+ final String[] eventArgs = {"-zabbu"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
- assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
- + "parameter error, invalid command line arguments specified "
- + ": Unrecognized option: -zabbu");
+ assertThat(thrown).isInstanceOf(Exception.class)
+ .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, invalid command line arguments specified " + ": Unrecognized option: -zabbu");
}
@Test
public void testServicesClientHelp() {
- final String[] eventArgs =
- { "-h" };
+ final String[] eventArgs = {"-h"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class)
- .hasMessageContaining("usage: org.onap.policy.apex.client.full.rest.ApexServicesRestMain [options...]");
+ .hasMessageContaining("usage: org.onap.policy.apex.client.full.rest.ApexServicesRestMain [options...]");
}
@Test
public void testServicesClientPortBad() {
- final String[] eventArgs =
- { "-p", "hello" };
+ final String[] eventArgs = {"-p", "hello"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class)
- .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
- + "parameter error, error parsing argument \"port\" :For input string: \"hello\"");
+ .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, error parsing argument \"port\" :For input string: \"hello\"");
}
@Test
public void testServicesClientPortNegative() {
- final String[] eventArgs =
- { "-p", "-1" };
+ final String[] eventArgs = {"-p", "-1"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: "
- + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
- + "port must be greater than 1023 and less than 65536");
+ "Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: "
+ + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
+ + "port must be greater than 1023 and less than 65536");
}
@Test
public void testServicesClientTtlTooSmall() {
- final String[] eventArgs =
- { "-t", "-2" };
+ final String[] eventArgs = {"-t", "-2"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: "
- + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, "
- + "time to live must be greater than -1 (set to -1 to wait forever)");
+ "Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: "
+ + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, "
+ + "time to live must be greater than -1 (set to -1 to wait forever)");
}
@Test
public void testServicesClientTooManyPars() {
- final String[] eventArgs =
- { "-t", "10", "-p", "12344", "aaa", "bbb" };
+ final String[] eventArgs = {"-t", "10", "-p", "12344", "aaa", "bbb"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class)
- .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
- + "parameter error, too many command line arguments specified : [aaa, bbb]");
+ .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, too many command line arguments specified : [aaa, bbb]");
}
-
@Test
public void testServicesClientTtlNotNumber() {
- final String[] eventArgs =
- { "-t", "timetolive" };
+ final String[] eventArgs = {"-t", "timetolive"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class)
- .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
- + "parameter error, error parsing argument \"time-to-live\" :"
- + "For input string: \"timetolive\"");
+ .hasMessageContaining("Apex Editor REST endpoint (ApexServicesRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, error parsing argument \"time-to-live\" :" + "For input string: \"timetolive\"");
}
@Test
@@ -155,14 +143,13 @@ public class ServicesRestMainTest {
@Test
public void testServicesClientPortTooBig() {
- final String[] eventArgs =
- { "-p", "65536" };
+ final String[] eventArgs = {"-p", "65536"};
Throwable thrown = catchThrowable(() -> new ApexServicesRestMain(eventArgs, System.out));
assertThat(thrown).isInstanceOf(Exception.class).hasMessageContaining(
- "Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: "
- + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
- + "port must be greater than 1023 and less than 65536");
+ "Apex Editor REST endpoint (ApexServicesRestMain: Config=[ApexServicesRestParameters: "
+ + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
+ + "port must be greater than 1023 and less than 65536");
}
@Test
@@ -191,8 +178,8 @@ public class ServicesRestMainTest {
assertThatCode(() -> {
monThread.start();
- await().atMost(6, TimeUnit.SECONDS).until(
- () -> monRestMain.getState().equals(ApexServicesRestMain.EditorState.RUNNING));
+ await().atMost(6, TimeUnit.SECONDS)
+ .until(() -> monRestMain.getState().equals(ApexServicesRestMain.EditorState.RUNNING));
monRestMain.shutdown();
}).doesNotThrowAnyException();
}
diff --git a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java
index 71ca21d2e..f27a53adc 100644
--- a/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java
+++ b/client/client-monitoring/src/test/java/org/onap/policy/apex/client/monitoring/rest/MonitoringRestMainTest.java
@@ -6,15 +6,15 @@
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -40,8 +40,7 @@ public class MonitoringRestMainTest {
@Test
public void testMonitoringClientBad() {
try {
- final String[] eventArgs =
- { "-z" };
+ final String[] eventArgs = {"-z"};
ApexMonitoringRestMain.main(eventArgs);
} catch (Exception exc) {
@@ -52,8 +51,7 @@ public class MonitoringRestMainTest {
@Test
public void testMonitoringClientOk() {
try {
- final String[] eventArgs =
- { "-t", "1" };
+ final String[] eventArgs = {"-t", "1"};
ApexMonitoringRestMain.main(eventArgs);
} catch (Exception exc) {
@@ -63,8 +61,7 @@ public class MonitoringRestMainTest {
@Test
public void testMonitoringClientNoOptions() {
- final String[] eventArgs = new String[]
- {};
+ final String[] eventArgs = new String[] {};
final String outputString = testApexMonitoringRestMainConstructor(eventArgs);
@@ -74,121 +71,118 @@ public class MonitoringRestMainTest {
@Test
public void testMonitoringClientBadOptions() {
- final String[] eventArgs =
- { "-zabbu" };
+ final String[] eventArgs = {"-zabbu"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
- assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
- + "parameter error, invalid command line arguments specified "
- + ": Unrecognized option: -zabbu", ex.getMessage().substring(0, 170));
+ assertEquals(
+ "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, invalid command line arguments specified " + ": Unrecognized option: -zabbu",
+ ex.getMessage().substring(0, 170));
}
}
@Test
public void testMonitoringClientHelp() {
- final String[] eventArgs =
- { "-h" };
+ final String[] eventArgs = {"-h"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
assertEquals("usage: org.onap.policy.apex.client.monitoring.rest.ApexMonitoringRestMain [options...]",
- ex.getMessage().substring(0, 86));
+ ex.getMessage().substring(0, 86));
}
}
@Test
public void testMonitoringClientPortBad() {
- final String[] eventArgs =
- { "-p", "hello" };
+ final String[] eventArgs = {"-p", "hello"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
- assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
- + "parameter error, error parsing argument \"port\" :For input string: \"hello\"",
- ex.getMessage().substring(0, 156));
+ assertEquals(
+ "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, error parsing argument \"port\" :For input string: \"hello\"",
+ ex.getMessage().substring(0, 156));
}
}
@Test
public void testMonitoringClientPortNegative() {
- final String[] eventArgs =
- { "-p", "-1" };
+ final String[] eventArgs = {"-p", "-1"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: "
- + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
- + "port must be greater than 1023 and less than 65536", ex.getMessage().substring(0, 227));
+ + "URI=http://localhost:-1/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
+ + "port must be greater than 1023 and less than 65536", ex.getMessage().substring(0, 227));
}
}
@Test
public void testMonitoringClientTtlTooSmall() {
- final String[] eventArgs =
- { "-t", "-2" };
+ final String[] eventArgs = {"-t", "-2"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
- assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: "
- + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, "
- + "time to live must be greater than -1 (set to -1 to wait forever)",
- ex.getMessage().substring(0, 244));
+ assertEquals(
+ "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: "
+ + "URI=http://localhost:18989/apexservices/, TTL=-2sec], State=STOPPED) parameters invalid, "
+ + "time to live must be greater than -1 (set to -1 to wait forever)",
+ ex.getMessage().substring(0, 244));
}
}
@Test
public void testMonitoringClientTooManyPars() {
- final String[] eventArgs =
- { "-t", "10", "-p", "12344", "aaa", "bbb" };
+ final String[] eventArgs = {"-t", "10", "-p", "12344", "aaa", "bbb"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
- assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
- + "parameter error, too many command line arguments specified : [aaa, bbb]",
- ex.getMessage().substring(0, 154));
+ assertEquals(
+ "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, too many command line arguments specified : [aaa, bbb]",
+ ex.getMessage().substring(0, 154));
}
}
@Test
public void testMonitoringClientTtlNotNumber() {
- final String[] eventArgs =
- { "-t", "timetolive" };
+ final String[] eventArgs = {"-t", "timetolive"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
- assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
- + "parameter error, error parsing argument \"time-to-live\" :"
- + "For input string: \"timetolive\"", ex.getMessage().substring(0, 169));
+ assertEquals(
+ "Apex Services REST endpoint (ApexMonitoringRestMain: Config=[null], State=STOPPED) "
+ + "parameter error, error parsing argument \"time-to-live\" :" + "For input string: \"timetolive\"",
+ ex.getMessage().substring(0, 169));
}
}
@Test
public void testMonitoringClientPortTooBig() {
- final String[] eventArgs =
- { "-p", "65536" };
+ final String[] eventArgs = {"-p", "65536"};
try {
new ApexMonitoringRestMain(eventArgs, System.out);
fail("test should throw an exception");
} catch (Exception ex) {
assertEquals("Apex Services REST endpoint (ApexMonitoringRestMain: Config=[ApexMonitoringRestParameters: "
- + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
- + "port must be greater than 1023 and less than 65536", ex.getMessage().substring(0, 230));
+ + "URI=http://localhost:65536/apexservices/, TTL=-1sec], State=STOPPED) parameters invalid, "
+ + "port must be greater than 1023 and less than 65536", ex.getMessage().substring(0, 230));
}
}
@@ -205,8 +199,7 @@ public class MonitoringRestMainTest {
@Test
public void testMonitoringOneSecStart() {
- final String[] eventArgs =
- { "-t", "1" };
+ final String[] eventArgs = {"-t", "1"};
try {
ApexMonitoringRestMain monRestMain = new ApexMonitoringRestMain(eventArgs, System.out);
@@ -220,12 +213,12 @@ public class MonitoringRestMainTest {
@Test
public void testMonitoringForeverStart() {
- final String[] eventArgs =
- { "-t", "-1" };
+ final String[] eventArgs = {"-t", "-1"};
ApexMonitoringRestMain monRestMain = new ApexMonitoringRestMain(eventArgs, System.out);
Thread monThread = new Thread() {
+ @Override
public void run() {
monRestMain.init();
}
@@ -233,8 +226,8 @@ public class MonitoringRestMainTest {
try {
monThread.start();
- await().atMost(6, TimeUnit.SECONDS).until(
- () -> monRestMain.getState().equals(ApexMonitoringRestMain.ServicesState.RUNNING));
+ await().atMost(6, TimeUnit.SECONDS)
+ .until(() -> monRestMain.getState().equals(ApexMonitoringRestMain.ServicesState.RUNNING));
monRestMain.shutdown();
} catch (Exception ex) {
fail("test should not throw an exception");
@@ -243,7 +236,7 @@ public class MonitoringRestMainTest {
/**
* Run the application.
- *
+ *
* @param eventArgs the command arguments
* @return a string containing the command output
*/