summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-06-20 09:39:59 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-06-20 09:39:59 +0000
commit0fbf039020488215008a2c1fef8a7801bade9177 (patch)
tree04187de83d54715d49d8fc4ba24bb92fc7e55523
parent7b945416da394a3ae3e53a1a9ae8d21f6a4e761e (diff)
Enable maven-checkstyle-plugin in apex-pdp
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>
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java13
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java21
-rw-r--r--core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DummyDeploymentClient.java11
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java3
-rw-r--r--core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java5
-rw-r--r--examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java3
-rw-r--r--examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java29
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java13
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java4
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java28
-rw-r--r--pom.xml36
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java32
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java1
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckRestControllerV1.java12
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java2
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterHandler.java2
-rw-r--r--testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java4
18 files changed, 123 insertions, 102 deletions
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
index 5a9d5bf0b..7c0d795bc 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
@@ -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();
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
index 44993ef1e..c865215a5 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
@@ -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
diff --git a/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DummyDeploymentClient.java b/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DummyDeploymentClient.java
index 9a05406e5..88d65afac 100644
--- a/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DummyDeploymentClient.java
+++ b/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DummyDeploymentClient.java
@@ -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())) {
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java
index 880eb848a..71b5e455e 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java
@@ -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)
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
index e0bf0ea6b..ca51a9e33 100644
--- a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
+++ b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
@@ -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();
diff --git a/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java b/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
index 09b3fc47b..58f07b9da 100644
--- a/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
+++ b/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
@@ -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;
diff --git a/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java b/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
index b447803ef..8012c1e30 100644
--- a/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
+++ b/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
@@ -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.
@@ -20,32 +21,30 @@
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);
}
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java
index 23968c9aa..e540646d9 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/package-info.java
@@ -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;
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
index e27bf78e8..7dddc4099 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
@@ -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;
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
index b2139f893..17980ed65 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
@@ -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
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
index 1b2b44382..b34f29ef1 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
@@ -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 22ab27bac..1ce1b73af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -481,6 +481,42 @@
</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>
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
index e08b5b344..e48d75eb7 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
@@ -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
}
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
index 8cb3ae13e..699f26c66 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
@@ -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;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckRestControllerV1.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckRestControllerV1.java
index 53efa5940..b58a3db24 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckRestControllerV1.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckRestControllerV1.java
@@ -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 {
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
index c5c0fc483..31c994cda 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/TestApexStarterMain.java
@@ -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);
}
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterHandler.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterHandler.java
index f91baeb45..67ffcf22d 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterHandler.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterHandler.java
@@ -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);
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java
index 321cd28e2..60732972a 100644
--- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java
+++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java
@@ -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