Enable maven-checkstyle-plugin in apex-pdp 72/90172/3
authora.sreekumar <ajith.sreekumar@est.tech>
Thu, 20 Jun 2019 09:39:59 +0000 (09:39 +0000)
committera.sreekumar <ajith.sreekumar@est.tech>
Thu, 20 Jun 2019 09:39:59 +0000 (09:39 +0000)
Enable maven-checkstyle-plugin in apex-pdp/pom.xml to fail the build at warning level.
Fix all the existing check style issues in the component.

Change-Id: I4de9c1bd9ca5a2876de9086d2d3526cbdc25c080
Issue-ID: POLICY-1732
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
18 files changed:
client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DummyDeploymentClient.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java
model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
pom.xml
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckRestControllerV1.java
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterHandler.java
testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java

index 5a9d5bf..7c0d795 100644 (file)
@@ -1,19 +1,20 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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=========================================================
  */
@@ -21,7 +22,6 @@
 package org.onap.policy.apex.client.editor.rest.handling;
 
 import java.util.Map.Entry;
-
 import org.onap.policy.apex.client.editor.rest.handling.bean.BeanEvent;
 import org.onap.policy.apex.client.editor.rest.handling.bean.BeanField;
 import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
@@ -124,11 +124,10 @@ public class EventHandler implements RestCommandHandler {
 
     /**
      * Create the parameters on an event.
-     * 
+     *
      * @param session the Apex editor session
      * @param jsonbean the JSON bean holding the parameters
-     * @param result the result of the parameter creation operation
-     * @return
+     * @return result the result of the parameter creation operation
      */
     private ApexApiResult createEventParameters(final RestSession session, final BeanEvent jsonbean) {
         ApexApiResult result = new ApexApiResult();
index 44993ef..c865215 100644 (file)
@@ -1,19 +1,20 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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=========================================================
  */
@@ -23,10 +24,8 @@ package org.onap.policy.apex.client.editor.rest.handling;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonObject;
-
 import java.util.ArrayList;
 import java.util.List;
-
 import org.onap.policy.apex.client.editor.rest.handling.bean.BeanModel;
 import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
@@ -321,7 +320,7 @@ public class ModelHandler implements RestCommandHandler {
 
     /**
      * Augment a message with key information.
-     * 
+     *
      * @param session the Apex model editing session
      * @param message The message to augment
      * @return the augmented message
@@ -357,7 +356,7 @@ public class ModelHandler implements RestCommandHandler {
 
     /**
      * Get an embedded JSON object for the given JSON object.
-     * 
+     *
      * @param jsonObject the input JSON object
      * @return the embedded JSON object
      */
@@ -371,11 +370,11 @@ public class ModelHandler implements RestCommandHandler {
 
     /**
      * Condition a field so its key information can be looked up.
-     * 
+     *
      * @param jsonObject the object to query
      * @param fieldTag the tag of the field to condition
      * @param fieldValue the value of the field to condition
-     * @return
+     * @return field read from the json
      */
     private String readFieldFromJsonObject(final JsonObject jsonObject, final String fieldTag, final String value) {
         String lookedupValue = value;
@@ -392,7 +391,7 @@ public class ModelHandler implements RestCommandHandler {
 
     /**
      * Look up the UUID and description in the key information for a concept.
-     * 
+     *
      * @param session the Apex editor session
      * @param jsonObject the JSON object to place the fields in
      * @param name the concept name to look up
@@ -425,7 +424,7 @@ public class ModelHandler implements RestCommandHandler {
 
     /**
      * Look up the key information for the given concept name and value.
-     * 
+     *
      * @param session the Apex editor session
      * @param name the concept name to look up
      * @param version the concept version to look up
index 9a05406..88d65af 100644 (file)
@@ -1,19 +1,20 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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=========================================================
  */
@@ -136,10 +137,10 @@ public class DummyDeploymentClient extends DeploymentClient implements Runnable
 
     /**
      * Handle and return the response to the engine status message.
-     * 
+     *
      * @param message the incoming status message
      * @param successFlag true if the result should be successful
-     * @return
+     * @return engine status success or not
      */
     private boolean handleAndReturnEngineStatus(Message message, boolean successFlag) {
         if ("DoNotRespond".equals(message.getTarget().getName())) {
index 880eb84..71b5e45 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,7 +26,7 @@
  * task logic, task selection logic, and state finalizer logic respectively when that logic is
  * executing in an executor plugin under the control of an APEX engine.
  *
- * The AxStateFacade and AxTaskFacade classes provide facades and convenience
+ * <p>The AxStateFacade and AxTaskFacade classes provide facades and convenience
  * methods for state and task definition information for logic at execution time.
  *
  * @author Liam Fallon (liam.fallon@ericsson.com)
index e0bf0ea..ca51a9e 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,7 +22,6 @@
 package org.onap.policy.apex.core.infrastructure.messaging.impl.ws;
 
 import com.google.common.eventbus.Subscribe;
-
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -30,7 +30,6 @@ import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.TimeUnit;
-
 import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder;
 import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
 import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock;
@@ -93,7 +92,7 @@ public class RawMessageHandler<M> implements WebSocketMessageListener<M>, Runnab
         // processing thread
 
         try (final ByteArrayInputStream stream = new ByteArrayInputStream(dataByteBuffer.array());
-                        final ObjectInputStream ois = new ObjectInputStream(stream);) {
+                        final ObjectInputStream ois = new ObjectInputStream(stream)) {
             @SuppressWarnings("unchecked")
             final MessageHolder<M> messageHolder = (MessageHolder<M>) ois.readObject();
 
index 09b3fc4..58f07b9 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Huawei. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,11 +32,11 @@ import java.io.StringWriter;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
+import java.security.cert.X509Certificate;
 import java.util.Base64;
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
-import java.security.cert.X509Certificate;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
index b447803..8012c1e 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 huawei. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.policy.apex.examples.bbs;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import javax.net.ssl.HttpsURLConnection;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public class WebClientTest {
-    HttpsURLConnection mockedHttpsURLConnection;
+    HttpsURLConnection mockedHttpsUrlConnection;
     String sampleString = "Response Code :200";
     /**
      * Set up the mocked REST manager.
+     * @throws IOException
      */
     @Before
-    public void setupMockedRest() {
-        mockedHttpsURLConnection   = mock(HttpsURLConnection.class);
-        InputStream iStream = new ByteArrayInputStream(sampleString.getBytes());
-        try {
-            when(mockedHttpsURLConnection.getInputStream()).thenReturn(iStream);
-            Mockito.doNothing().when(mockedHttpsURLConnection).connect();
-        }catch (Exception e) {
-        }
-
+    public void setupMockedRest() throws IOException {
+        mockedHttpsUrlConnection   = mock(HttpsURLConnection.class);
+        InputStream inputStream = new ByteArrayInputStream(sampleString.getBytes());
+        when(mockedHttpsUrlConnection.getInputStream()).thenReturn(inputStream);
+        Mockito.doNothing().when(mockedHttpsUrlConnection).connect();
     }
 
     @Test
@@ -66,8 +65,8 @@ public class WebClientTest {
 
     @Test
     public void toPrettyString() {
-        String xmlSample = "<input xmlns=\"org:onap:sdnc:northbound:generic-resource\">" +
-                "<sdnc-request-header> <svc-action>update</svc-action> </sdnc-request-header></input>";
+        String xmlSample = "<input xmlns=\"org:onap:sdnc:northbound:generic-resource\">"
+                "<sdnc-request-header> <svc-action>update</svc-action> </sdnc-request-header></input>";
         WebClient cl = new WebClient();
         cl.toPrettyString(xmlSample, 4);
     }
index 23968c9..e540646 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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=========================================================
  */
@@ -22,9 +23,9 @@
  * Provides the base definition of an APEX model. It also defines the Model Service, the mechanism that allows access to
  * the model for APEX concepts anywhere in the system.
  *
- * It also provides handling support to models, allowing them to be read and written to file and databases in JSON and
- * XML format.
- * 
+ * <p>It also provides handling support to models, allowing them to be read and written to file and databases in JSON
+ * and XML format.
+ *
  * @author Liam Fallon (liam.fallon@ericsson.com)
  */
 package org.onap.policy.apex.model.basicmodel;
index e27bf78..7dddc40 100644 (file)
@@ -22,7 +22,6 @@
 package org.onap.policy.apex.model.contextmodel.concepts;
 
 import java.util.List;
-
 import javax.persistence.AttributeOverride;
 import javax.persistence.AttributeOverrides;
 import javax.persistence.Column;
@@ -35,7 +34,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
 import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
@@ -106,7 +104,7 @@ public class AxContextAlbum extends AxConcept {
     @AttributeOverrides({
         @AttributeOverride(name = "name", column = @Column(name = "itemSchemaName")),
         @AttributeOverride(name = "version", column = @Column(name = "itemSchemaVersion"))
-    })
+        })
     @Column(name = "itemSchema")
     @XmlElement(name = "itemSchema", required = true)
     private AxArtifactKey itemSchema;
index b2139f8..17980ed 100644 (file)
@@ -22,7 +22,6 @@
 package org.onap.policy.apex.model.contextmodel.concepts;
 
 import java.util.List;
-
 import javax.persistence.CascadeType;
 import javax.persistence.Entity;
 import javax.persistence.JoinColumn;
@@ -34,7 +33,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
 import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
@@ -69,7 +67,7 @@ public class AxContextModel extends AxModel {
     @JoinColumns({
         @JoinColumn(name = "schemasName", referencedColumnName = "name"),
         @JoinColumn(name = "schemasVersion", referencedColumnName = "version")
-    })
+        })
     @XmlElement(name = "schemas", required = true)
     private AxContextSchemas schemas;
 
@@ -77,7 +75,7 @@ public class AxContextModel extends AxModel {
     @JoinColumns({
         @JoinColumn(name = "albumsName", referencedColumnName = "name"),
         @JoinColumn(name = "albumsVersion", referencedColumnName = "version")
-    })
+        })
     @XmlElement(name = "albums", required = true)
     private AxContextAlbums albums;
     // @formatter:on
index 1b2b443..b34f29e 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,16 +23,15 @@ package org.onap.policy.apex.plugins.event.carrier.jms;
 
 import java.util.Base64;
 import java.util.Properties;
-
 import javax.naming.Context;
-
+import org.apache.commons.lang3.StringUtils;
 import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
 import org.onap.policy.common.parameters.GroupValidationResult;
 import org.onap.policy.common.parameters.ValidationStatus;
 
 /**
  * Apex parameters for JMS as an event carrier technology.
- * 
+ *
  * <p>The parameters for this plugin are:
  * <ol>
  * <li>initialContextFactory: JMS uses a naming {@link Context} object to look up the locations of JMS servers and JMS
@@ -329,38 +329,38 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
     public GroupValidationResult validate() {
         final GroupValidationResult result = super.validate();
 
-        if (isNullOrBlank(initialContextFactory)) {
+        if (StringUtils.isBlank(initialContextFactory)) {
             result.setResult("initialContextFactory", ValidationStatus.INVALID,
                             "initialContextFactory must be specified as a string that is a class that implements the "
                                             + "interface org.jboss.naming.remote.client.InitialContextFactory");
         }
 
-        if (isNullOrBlank(providerUrl)) {
+        if (StringUtils.isBlank(providerUrl)) {
             result.setResult("providerUrl", ValidationStatus.INVALID,
                             "providerUrl must be specified as a URL string that specifies the location of "
                                             + "configuration information for the service provider to use "
                                             + "such as remote://localhost:4447");
         }
 
-        if (isNullOrBlank(securityPrincipal)) {
+        if (StringUtils.isBlank(securityPrincipal)) {
             result.setResult("securityPrincipal", ValidationStatus.INVALID,
                             "securityPrincipal must be specified the identity of the principal for authenticating "
                                             + "the caller to the service");
         }
 
-        if (isNullOrBlank(securityCredentials)) {
+        if (StringUtils.isBlank(securityCredentials)) {
             result.setResult("securityCredentials", ValidationStatus.INVALID,
                             "  securityCredentials must be specified as the credentials of the "
                                             + "principal for authenticating the caller to the service");
         }
 
-        if (isNullOrBlank(producerTopic)) {
+        if (StringUtils.isBlank(producerTopic)) {
             result.setResult("producerTopic", ValidationStatus.INVALID,
                             "  producerTopic must be a string that identifies the JMS topic "
                                             + "on which Apex will send events");
         }
 
-        if (isNullOrBlank(consumerTopic)) {
+        if (StringUtils.isBlank(consumerTopic)) {
             result.setResult("consumerTopic", ValidationStatus.INVALID,
                             "  consumerTopic must be a string that identifies the JMS topic "
                                             + "on which Apex will recieve events");
@@ -374,16 +374,6 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
         return result;
     }
 
-    /**
-     * Check if the string is null or blank.
-     * 
-     * @param stringValue the string value 
-     * @return
-     */
-    private boolean isNullOrBlank(final String stringValue) {
-        return stringValue == null || stringValue.trim().length() == 0;
-    }
-    
     private String getDefaultCredential() {
         return new String(Base64.getDecoder().decode(DEFAULT_SECURITY_CREDENTIALS.getBytes()));
     }
diff --git a/pom.xml b/pom.xml
index 22ab27b..1ce1b73 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                             </execution>
                         </executions>
                     </plugin>
+
+                    <plugin>
+                        <artifactId>maven-checkstyle-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>onap-java-style</id>
+                                <goals>
+                                    <goal>check</goal>
+                                </goals>
+                                <phase>process-sources</phase>
+                                <configuration>
+                                    <!-- Use Google Java Style Guide: https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
+                                        with minor changes -->
+                                    <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+                                    <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
+                                    <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+                                    <includeResources>true</includeResources>
+                                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                                    <includeTestResources>true</includeTestResources>
+                                    <excludes>
+                                    </excludes>
+                                    <consoleOutput>true</consoleOutput>
+                                    <failOnViolation>true</failOnViolation>
+                                    <violationSeverity>warning</violationSeverity>
+                                </configuration>
+                            </execution>
+                        </executions>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.onap.oparent</groupId>
+                                <artifactId>checkstyle</artifactId>
+                                <version>${oparent.version}</version>
+                                <scope>compile</scope>
+                            </dependency>
+                        </dependencies>
+                    </plugin>
                 </plugins>
             </build>
 
index e08b5b3..e48d75e 100644 (file)
@@ -105,40 +105,40 @@ public class ApexStarterActivator {
         // @formatter:off
         this.manager = new ServiceManager()
                 .addAction("topics",
-                        () -> TopicEndpoint.manager.start(),
-                        () -> TopicEndpoint.manager.shutdown())
+                    () -> TopicEndpoint.manager.start(),
+                    () -> TopicEndpoint.manager.shutdown())
                 .addAction("set alive",
-                        () -> setAlive(true),
-                        () -> setAlive(false))
+                    () -> setAlive(true),
+                    () -> setAlive(false))
                 .addAction("register pdp status context object",
-                        () -> Registry.register(ApexStarterConstants.REG_PDP_STATUS_OBJECT,
+                    () -> Registry.register(ApexStarterConstants.REG_PDP_STATUS_OBJECT,
                                 new PdpMessageHandler().createPdpStatusFromParameters(instanceId,
                                         apexStarterParameterGroup.getPdpStatusParameters())),
-                        () -> Registry.unregister(ApexStarterConstants.REG_PDP_STATUS_OBJECT))
+                    () -> Registry.unregister(ApexStarterConstants.REG_PDP_STATUS_OBJECT))
                 .addAction("topic sinks",
-                        () -> Registry.register(ApexStarterConstants.REG_APEX_PDP_TOPIC_SINKS, topicSinks),
-                        () -> Registry.unregister(ApexStarterConstants.REG_APEX_PDP_TOPIC_SINKS))
+                    () -> Registry.register(ApexStarterConstants.REG_APEX_PDP_TOPIC_SINKS, topicSinks),
+                    () -> Registry.unregister(ApexStarterConstants.REG_APEX_PDP_TOPIC_SINKS))
                 .addAction("Pdp Status publisher",
-                        () -> Registry.register(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER,
+                    () -> Registry.register(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER,
                                 new PdpStatusPublisher(topicSinks,
                                         apexStarterParameterGroup.getPdpStatusParameters().getTimeIntervalMs())),
-                        () -> stopAndRemovePdpStatusPublisher())
+                    () -> stopAndRemovePdpStatusPublisher())
                 .addAction("Register pdp update listener",
                     () -> msgDispatcher.register(PdpMessageType.PDP_UPDATE.name(), pdpUpdateListener),
                     () -> msgDispatcher.unregister(PdpMessageType.PDP_UPDATE.name()))
                 .addAction("Register pdp state change request dispatcher",
-                        () -> msgDispatcher.register(PdpMessageType.PDP_STATE_CHANGE.name(), pdpStateChangeListener),
-                        () -> msgDispatcher.unregister(PdpMessageType.PDP_STATE_CHANGE.name()))
+                    () -> msgDispatcher.register(PdpMessageType.PDP_STATE_CHANGE.name(), pdpStateChangeListener),
+                    () -> msgDispatcher.unregister(PdpMessageType.PDP_STATE_CHANGE.name()))
                 .addAction("Message Dispatcher",
                     () -> registerMsgDispatcher(),
                     () -> unregisterMsgDispatcher())
                 .addAction("Create REST server",
-                        () -> restServer =
+                    () -> restServer =
                                     new ApexStarterRestServer(apexStarterParameterGroup.getRestServerParameters()),
-                        () -> restServer = null)
+                    () -> restServer = null)
                 .addAction("Rest Server",
-                        () -> restServer.start(),
-                        () -> restServer.stop());
+                    () -> restServer.start(),
+                    () -> restServer.stop());
 
         // @formatter:on
     }
index 8cb3ae1..699f26c 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.apex.services.onappf.handler;
 import com.google.gson.JsonObject;
 
 import java.io.IOException;
-import java.io.StringReader;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
index 53efa59..b58a3db 100644 (file)
@@ -51,15 +51,15 @@ import org.onap.policy.common.endpoints.report.HealthCheckReport;
 @Api(value = "PDP-A API")
 @Produces(MediaType.APPLICATION_JSON)
 @SwaggerDefinition(
- info = @Info(description =
   info = @Info(description =
                  "PDP-A is responsible for making policy decisions and for managing the administrative"
                          + " state of the PDPs as directed by PolicyAdministration", version = "v1.0",
                  title = "PDP-A"),
- consumes = {MediaType.APPLICATION_JSON},
- produces = {MediaType.APPLICATION_JSON},
- schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
- tags = {@Tag(name = "PDP-A", description = "PDP-A Operations")},
- securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
   consumes = {MediaType.APPLICATION_JSON},
   produces = {MediaType.APPLICATION_JSON},
   schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
   tags = {@Tag(name = "PDP-A", description = "PDP-A Operations")},
   securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
 //@formatter:on
 public class HealthCheckRestControllerV1 {
 
index c5c0fc4..31c994c 100644 (file)
@@ -102,7 +102,7 @@ public class TestApexStarterMain {
     @Test
     public void testApexStarter_InvalidParameters() {
         final String[] apexStarterConfigParameters =
-                { "-c", "src/test/resources/ApexStarterConfigParameters_InvalidName.json" };
+        { "-c", "src/test/resources/ApexStarterConfigParameters_InvalidName.json" };
         apexStarter = new ApexStarterMain(apexStarterConfigParameters);
         assertTrue(apexStarter.getParameters() == null);
     }
index f91baeb..67ffcf2 100644 (file)
@@ -116,7 +116,7 @@ public class TestApexStarterParameterHandler {
     @Test
     public void testApexStarterParameterGroup_InvalidName() throws ApexStarterException {
         final String[] apexStarterConfigParameters =
-                { "-c", "src/test/resources/ApexStarterConfigParameters_InvalidName.json" };
+        { "-c", "src/test/resources/ApexStarterConfigParameters_InvalidName.json" };
 
         final ApexStarterCommandLineArguments arguments = new ApexStarterCommandLineArguments();
         arguments.parse(apexStarterConfigParameters);
index 321cd28..6073297 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,7 +22,6 @@
 package org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator;
 
 import java.util.List;
-
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.Pair;
 import org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator.events.OutputEvent;
@@ -145,7 +145,7 @@ public class EventBatchStats {
      * Calculate statistics for a single event.
      * @param eventBatch the event batch for the event
      * @param eventNo the event number of the event
-     * @return
+     * @return event timings
      */
     private Pair<Long, Long> calculateEventTimings(EventBatch eventBatch, int eventNo) {
         // If an event is in a batch, it has been sent