diff options
author | ramverma <ram.krishna.verma@ericsson.com> | 2018-11-29 13:47:30 +0000 |
---|---|---|
committer | ramverma <ram.krishna.verma@ericsson.com> | 2018-11-29 14:46:03 +0000 |
commit | ea736d0c60f042d4e6255136da789724ee178193 (patch) | |
tree | 98d0a8f73f0ff5f822e863ecc245e36e66c2d99f /context/context-test-utils/src/main/java | |
parent | 80540def7348e195ffacfbbc7c23e2e68e154965 (diff) |
Fixing issues in apex documents
Change-Id: Ibc07c20fa8ac1018443a3c061613fdaecc5efb83
Issue-ID: POLICY-1280
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'context/context-test-utils/src/main/java')
5 files changed, 21 insertions, 30 deletions
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java index 50f968997..d3f4d4704 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java @@ -25,8 +25,6 @@ import static org.junit.Assert.assertNotNull; import static org.onap.policy.apex.context.test.utils.Constants.APEX_DISTRIBUTOR; import static org.onap.policy.apex.context.test.utils.Constants.VERSION; -import java.io.IOException; - import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.Distributor; import org.onap.policy.apex.context.impl.distribution.DistributorFactory; @@ -51,7 +49,6 @@ public class ContextAlbumUpdate { * Test context album update. * * @throws ApexModelException the apex model exception - * @throws IOException the IO exception * @throws ApexException the apex exception */ public void testContextAlbumUpdate() throws ApexException { diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java index 65f50d703..b897b83f6 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java @@ -34,7 +34,6 @@ import static org.onap.policy.apex.context.test.utils.Constants.TIME_ZONE; import static org.onap.policy.apex.context.test.utils.Constants.VERSION; import static org.onap.policy.apex.context.test.utils.Constants.getAxArtifactKeyArray; -import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Locale; @@ -74,7 +73,6 @@ public class ContextUpdate { * Test context update. * * @throws ApexModelException the apex model exception - * @throws IOException the IO exception * @throws ApexException the apex exception */ public void testContextUpdate() throws ApexException { @@ -109,7 +107,7 @@ public class ContextUpdate { } catch (final ContextRuntimeException e) { assertEquals( "Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum" - + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"", + + ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"", e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java index ee0a1072c..a673824ea 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java @@ -61,13 +61,12 @@ public class ConcurrentContext { /** * The method tests concurrent use of context. + * * @return the verified context * @throws ApexModelException the exception occurs in model handling - * @throws IOException the IO exception occurs in handling IO * @throws ApexException the Apex exception occurs in handling Apex */ - public Map<String, TestContextLongItem> testConcurrentContext() - throws ApexException { + public Map<String, TestContextLongItem> testConcurrentContext() throws ApexException { try { setupAndVerifyContext(); @@ -154,7 +153,7 @@ public class ConcurrentContext { final Map<String, TestContextLongItem> values = new HashMap<>(); try { - for (Entry<String, Object> entry : ltypeAlbum.entrySet()) { + for (final Entry<String, Object> entry : ltypeAlbum.entrySet()) { values.put(entry.getKey(), (TestContextLongItem) entry.getValue()); } } catch (final Exception exception) { diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java index cd2c2ed1f..c7043bc53 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java @@ -76,6 +76,7 @@ public final class ConcurrentContextJvm { /** * This method executes the test of concurrent use of context in a single JVM. + * * @throws ApexException the Apex exception occurs while running the test */ public void execute() throws ApexException { @@ -145,14 +146,12 @@ public final class ConcurrentContextJvm { for (int p = 7; p < args.length - 1; p += 2) { @SuppressWarnings("rawtypes") final Class parametersClass = Class.forName(args[p]); - final ParameterGroup parameters = - (ParameterGroup) new Gson().fromJson(args[p + 1], parametersClass); + final ParameterGroup parameters = (ParameterGroup) new Gson().fromJson(args[p + 1], parametersClass); ParameterService.register(parameters); } for (final Entry<String, ParameterGroup> parameterEntry : ParameterService.getAll()) { - LOGGER.info("Parameter class " + parameterEntry.getKey() + "=" - + parameterEntry.getValue().toString()); + LOGGER.info("Parameter class " + parameterEntry.getKey() + "=" + parameterEntry.getValue().toString()); } try { @@ -192,7 +191,7 @@ public final class ConcurrentContextJvm { /** * This method sets up any static configuration required by the JVM. * - * @throws Exception on configuration errors + * @throws ApexException on configuration errors */ public static void configure() throws ApexException { System.setProperty("java.net.preferIPv4Stack", "true"); @@ -208,10 +207,10 @@ public final class ConcurrentContextJvm { Enumeration<NetworkInterface> nets; try { nets = NetworkInterface.getNetworkInterfaces(); - } catch (SocketException e) { + } catch (final SocketException e) { throw new ApexException("cound not get network interfaces for test", e); } - + for (final NetworkInterface netint : Collections.list(nets)) { final Enumeration<InetAddress> inetAddresses = netint.getInetAddresses(); for (final InetAddress inetAddress : Collections.list(inetAddresses)) { diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java index 1949769a6..ac9ae68b7 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java @@ -5,15 +5,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========================================================= */ @@ -65,8 +65,8 @@ public class ZooKeeperServerServiceProvider { /** * Start the Zookeeper server. - * @throws IOException the IO exception occurs while setting up Zookeeper server - * @throws InterruptedException the interrupted exception occurs while setting up Zookeeper server + * + * @throws ApexException on configuration errors */ public void startZookeeperServer() throws ApexException { LOGGER.info("Starting up ZooKeeperServer using address: {} and port: {}", addr.getAddress(), addr.getPort()); @@ -76,23 +76,21 @@ public class ZooKeeperServerServiceProvider { server = new ZooKeeperServer(zookeeperDirectory, zookeeperDirectory, 5000); zookeeperFactory = new NIOServerCnxnFactory(); zookeeperFactory.configure(addr, 100); - } - catch (IOException ioe) { - String message = "exception on starting Zookeeper server"; + } catch (final IOException ioe) { + final String message = "exception on starting Zookeeper server"; LOGGER.warn(message, ioe); throw new ApexException(message, ioe); } - + try { zookeeperFactory.startup(server); - } - catch (InterruptedException | IOException ie) { - String message = "Zookeeper server start failed"; + } catch (InterruptedException | IOException ie) { + final String message = "Zookeeper server start failed"; LOGGER.warn(message, ie); Thread.currentThread().interrupt(); throw new ApexException(message, ie); } - + } /** |