summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java40
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java5
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java3
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java17
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java5
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml6
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java1
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java116
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java54
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java83
-rw-r--r--pom.xml2
-rw-r--r--runtime-controlloop/pom.xml10
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java7
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java4
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java2
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java4
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java8
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java5
-rw-r--r--runtime-controlloop/src/main/resources/application.yaml6
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java91
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java4
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java8
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java45
-rw-r--r--runtime-controlloop/src/test/resources/application_test.properties2
-rw-r--r--runtime/pom.xml5
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java2
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/config/ClampProperties.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponse.java5
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java3
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplate.java6
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/util/LoggingUtils.java4
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/loop/LoopService.java2
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java2
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java4
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/loop/template/PolicyModel.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/policy/microservice/MicroServicePolicy.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java1
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java2
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java3
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java)20
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java)2
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java)6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java)6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java)10
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java16
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java13
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java)17
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java20
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java)6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java)34
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java)8
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java)4
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java)5
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java8
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java)9
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseTestItCase.java)6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItTestCase.java (renamed from runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java)13
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java2
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java8
73 files changed, 486 insertions, 343 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java
new file mode 100644
index 000000000..a5918fe94
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElementAck.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 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=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.models.controlloop.concepts;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@ToString
+public class ControlLoopElementAck {
+
+ // Result: Success/Fail.
+ private Boolean result;
+
+ // Message indicating reason for failure
+ private String message;
+
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
index 71407916d..762b927ab 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -30,7 +32,6 @@ import javax.ws.rs.core.Response;
import lombok.NonNull;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfKey;
@@ -197,7 +198,7 @@ public class ControlLoopProvider extends AbstractModelsProvider {
Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach((key, template) -> {
- JpaToscaNodeTemplate jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
+ var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
getPfDao().create(jpaToscaNodeTemplate);
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
index 55ba7faf5..8e3604916 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAck.java
@@ -27,7 +27,7 @@ import java.util.function.UnaryOperator;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.apache.commons.lang3.tuple.Pair;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -45,7 +45,7 @@ public class ControlLoopAck extends ParticipantAckMessage {
// A map with ControlLoopElementID as its key, and a pair of result and message as value per
// ControlLoopElement.
- private Map<UUID, Pair<Boolean, String>> controlLoopResultMap = new LinkedHashMap<>();
+ private Map<UUID, ControlLoopElementAck> controlLoopResultMap = new LinkedHashMap<>();
/**
* Constructor for instantiating ParticipantRegisterAck class with message name.
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java
index 5943dc5b1..1ddce7840 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -19,7 +21,6 @@
package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
-import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
index d7d7e4327..5fded7341 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopAckTest.java
@@ -22,35 +22,36 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ControlLoopAckTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ControlLoopAck((ControlLoopAck) null))
.isInstanceOf(NullPointerException.class);
- final ControlLoopAck orig = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_UPDATE);
+ final var orig = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_UPDATE);
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ControlLoopAck(orig).toString()));
// verify with all values
- ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
+ var id = new ToscaConceptIdentifier("id", "1.2.3");
orig.setControlLoopId(id);
orig.setParticipantId(id);
orig.setParticipantType(id);
-
- Pair<Boolean, String> clElementResult = Pair.of(true, "ControlLoopElement result");
- final Map<UUID, Pair<Boolean, String>> controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult);
+ var clElementResult = new ControlLoopElementAck(true, "ControlLoopElement result");
+ final var controlLoopResultMap = Map.of(UUID.randomUUID(), clElementResult);
orig.setControlLoopResultMap(controlLoopResultMap);
orig.setResponseTo(UUID.randomUUID());
@@ -59,5 +60,7 @@ class ControlLoopAckTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ControlLoopAck(orig).toString()));
+
+ assertSerializable(orig, ControlLoopAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java
index 3aafe56f1..1b155a12a 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopUpdateTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
@@ -33,6 +34,7 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -40,7 +42,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
*/
class ControlLoopUpdateTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ControlLoopUpdate(null)).isInstanceOf(NullPointerException.class);
ControlLoopUpdate orig = new ControlLoopUpdate();
@@ -71,5 +73,6 @@ class ControlLoopUpdateTest {
ControlLoopUpdate other = new ControlLoopUpdate(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
+ assertSerializable(orig, ControlLoopUpdate.class);
}
}
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
index 0aa3fb782..635b98cb8 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/ClRuntimeParameters.yaml
@@ -50,3 +50,9 @@ runtime:
servers:
- ${topicServer:message-router}
topicCommInfrastructure: dmaap
+
+management:
+ endpoints:
+ web:
+ exposure:
+ include: health, metrics, prometheus
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
index 5cf1b0df9..3d8308bc1 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
@@ -25,7 +25,6 @@ package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
import org.apache.http.HttpStatus;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ClampEndPoints;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
-import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent;
import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
import org.springframework.stereotype.Component;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
index 680acd276..e11c883b4 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
@@ -25,52 +25,41 @@ import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
/**
* This class sends messages from participants to CLAMP.
*/
+@Component
public class MessageSender extends TimerTask implements Closeable {
private static final Logger LOGGER = LoggerFactory.getLogger(MessageSender.class);
private final ParticipantHandler participantHandler;
- private final ParticipantMessagePublisher publisher;
private ScheduledExecutorService timerPool;
/**
* Constructor, set the publisher.
*
* @param participantHandler the participant handler to use for gathering information
- * @param publisher the publisher to use for sending messages
- * @param interval time interval to send Participant Status periodic messages
+ * @param parameters the parameters of the participant
*/
- public MessageSender(ParticipantHandler participantHandler, ParticipantMessagePublisher publisher,
- long interval) {
+ public MessageSender(ParticipantHandler participantHandler, ParticipantParameters parameters) {
this.participantHandler = participantHandler;
- this.publisher = publisher;
// Kick off the timer
timerPool = makeTimerPool();
+ var interval = parameters.getIntermediaryParameters().getReportingTimeIntervalMs();
timerPool.scheduleAtFixedRate(this, interval, interval, TimeUnit.MILLISECONDS);
}
@Override
public void run() {
LOGGER.debug("Sent heartbeat to CLAMP");
- this.sendHeartbeat();
+ participantHandler.sendHeartbeat();
}
@Override
@@ -79,97 +68,6 @@ public class MessageSender extends TimerTask implements Closeable {
}
/**
- * Send a response message for this participant.
- *
- * @param ackMessage the details to include in the response message
- */
- public void sendAckResponse(ControlLoopAck ackMessage) {
- sendAckResponse(null, ackMessage);
- }
-
- /**
- * Dispatch a response message for this participant.
- *
- * @param controlLoopId the control loop to which this message is a response
- * @param ackMessage the details to include in the response message
- */
- public void sendAckResponse(ToscaConceptIdentifier controlLoopId, ControlLoopAck ackMessage) {
- // Participant related fields
- ackMessage.setParticipantType(participantHandler.getParticipantType());
- ackMessage.setParticipantId(participantHandler.getParticipantId());
- publisher.sendControlLoopAck(ackMessage);
- }
-
- /**
- * Send a ParticipantRegister message for this participant.
- *
- * @param message the participantRegister message
- */
- public void sendParticipantRegister(ParticipantRegister message) {
- publisher.sendParticipantRegister(message);
- }
-
- /**
- * Send a ParticipantDeregister message for this participant.
- *
- * @param message the participantDeRegister message
- */
- public void sendParticipantDeregister(ParticipantDeregister message) {
- publisher.sendParticipantDeregister(message);
- }
-
- /**
- * Send a ParticipantUpdateAck message for this participant update.
- *
- * @param message the participantUpdateAck message
- */
- public void sendParticipantUpdateAck(ParticipantUpdateAck message) {
- publisher.sendParticipantUpdateAck(message);
- }
-
- /**
- * Send a ParticipantStatus message for this participant.
- *
- * @param participantStatus the ParticipantStatus message
- */
- public void sendParticipantStatus(ParticipantStatus participantStatus) {
- var controlLoops = participantHandler.getControlLoopHandler().getControlLoops();
- for (ControlLoopElementListener clElementListener :
- participantHandler.getControlLoopHandler().getListeners()) {
- updateClElementStatistics(controlLoops, clElementListener);
- }
-
- publisher.sendParticipantStatus(participantStatus);
- }
-
- /**
- * Dispatch a heartbeat for this participant.
- */
- public void sendHeartbeat() {
- publisher.sendHeartbeat(participantHandler.makeHeartbeat(false));
- }
-
- /**
- * Update ControlLoopElement statistics. The control loop elements listening will be
- * notified to retrieve statistics from respective controlloop elements, and controlloopelements
- * data on the handler will be updated.
- *
- * @param controlLoops the control loops
- * @param clElementListener control loop element listener
- */
- public void updateClElementStatistics(ControlLoops controlLoops, ControlLoopElementListener clElementListener) {
- for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
- for (ControlLoopElement element : controlLoop.getElements().values()) {
- try {
- clElementListener.handleStatistics(element.getId());
- } catch (PfModelException e) {
- LOGGER.debug("Getting statistics for Control loop element failed");
- }
- }
- }
- }
-
- /**
* Makes a new timer pool.
*
* @return a new timer pool
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
index 0e276f390..8b4c61dca 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -29,12 +29,11 @@ import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
import lombok.Getter;
-import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementAck;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
@@ -45,24 +44,25 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Contr
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.MessageSender;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
/*
* This class is responsible for managing the state of all control loops in the participant.
*/
-@NoArgsConstructor
+@Component
public class ControlLoopHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopHandler.class);
- private ToscaConceptIdentifier participantType = null;
- private ToscaConceptIdentifier participantId = null;
- private MessageSender messageSender = null;
+ private final ToscaConceptIdentifier participantType;
+ private final ToscaConceptIdentifier participantId;
+ private final ParticipantMessagePublisher publisher;
@Getter
private final Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>();
@@ -77,12 +77,12 @@ public class ControlLoopHandler {
* Constructor, set the participant ID and messageSender.
*
* @param parameters the parameters of the participant
- * @param messageSender the messageSender for sending responses to messages
+ * @param publisher the ParticipantMessage Publisher
*/
- public ControlLoopHandler(ParticipantIntermediaryParameters parameters, MessageSender messageSender) {
- this.participantType = parameters.getParticipantType();
- this.participantId = parameters.getParticipantId();
- this.messageSender = messageSender;
+ public ControlLoopHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
+ this.participantType = parameters.getIntermediaryParameters().getParticipantType();
+ this.participantId = parameters.getIntermediaryParameters().getParticipantId();
+ this.publisher = publisher;
}
public void registerControlLoopElementListener(ControlLoopElementListener listener) {
@@ -104,18 +104,20 @@ public class ControlLoopHandler {
LOGGER.warn("Cannot update Control loop element state, id is null");
}
- var controlLoopStateChangeAck =
- new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
ControlLoopElement clElement = elementsOnThisParticipant.get(id);
if (clElement != null) {
+ var controlLoopStateChangeAck =
+ new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
+ controlLoopStateChangeAck.setParticipantId(participantId);
+ controlLoopStateChangeAck.setParticipantType(participantType);
clElement.setOrderedState(orderedState);
clElement.setState(newState);
controlLoopStateChangeAck.getControlLoopResultMap().put(clElement.getId(),
- Pair.of(true, "Control loop element {} state changed to {}\", id, newState)"));
+ new ControlLoopElementAck(true, "Control loop element {} state changed to {}\", id, newState)"));
LOGGER.debug("Control loop element {} state changed to {}", id, newState);
controlLoopStateChangeAck.setMessage("ControlLoopElement state changed to {} " + newState);
controlLoopStateChangeAck.setResult(true);
- messageSender.sendAckResponse(controlLoopStateChangeAck);
+ publisher.sendControlLoopAck(controlLoopStateChangeAck);
return clElement;
}
return null;
@@ -147,15 +149,17 @@ public class ControlLoopHandler {
}
var controlLoop = controlLoopMap.get(stateChangeMsg.getControlLoopId());
- var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
if (controlLoop == null) {
+ var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ controlLoopAck.setParticipantId(participantId);
+ controlLoopAck.setParticipantType(participantType);
controlLoopAck.setMessage("Control loop " + stateChangeMsg.getControlLoopId()
+ " does not use this participant " + participantId);
controlLoopAck.setResult(false);
controlLoopAck.setResponseTo(stateChangeMsg.getMessageId());
controlLoopAck.setControlLoopId(stateChangeMsg.getControlLoopId());
- messageSender.sendAckResponse(controlLoopAck);
+ publisher.sendControlLoopAck(controlLoopAck);
LOGGER.debug("Control loop {} does not use this participant", stateChangeMsg.getControlLoopId());
return;
}
@@ -200,17 +204,19 @@ public class ControlLoopHandler {
var controlLoop = controlLoopMap.get(updateMsg.getControlLoopId());
- var controlLoopUpdateAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_UPDATE_ACK);
-
// TODO: Updates to existing ControlLoops are not supported yet (Addition/Removal of ControlLoop
// elements to existing ControlLoop has to be supported).
if (controlLoop != null) {
+ var controlLoopUpdateAck = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_UPDATE_ACK);
+ controlLoopUpdateAck.setParticipantId(participantId);
+ controlLoopUpdateAck.setParticipantType(participantType);
+
controlLoopUpdateAck.setMessage("Control loop " + updateMsg.getControlLoopId()
+ " already defined on participant " + participantId);
controlLoopUpdateAck.setResult(false);
controlLoopUpdateAck.setResponseTo(updateMsg.getMessageId());
controlLoopUpdateAck.setControlLoopId(updateMsg.getControlLoopId());
- messageSender.sendAckResponse(controlLoopUpdateAck);
+ publisher.sendControlLoopAck(controlLoopUpdateAck);
return;
}
@@ -319,10 +325,12 @@ public class ControlLoopHandler {
if (orderedState.equals(controlLoop.getOrderedState())) {
var controlLoopAck = new ControlLoopAck(ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
+ controlLoopAck.setParticipantId(participantId);
+ controlLoopAck.setParticipantType(participantType);
controlLoopAck.setMessage("Control loop is already in state" + orderedState);
controlLoopAck.setResult(false);
controlLoopAck.setControlLoopId(controlLoop.getDefinition());
- messageSender.sendAckResponse(controlLoopAck);
+ publisher.sendControlLoopAck(controlLoopAck);
return;
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
index 860df7fa3..be8ef0098 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -22,7 +22,6 @@
package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
-import java.io.Closeable;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@@ -33,9 +32,11 @@ import lombok.Getter;
import lombok.Setter;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatisticsList;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopInfo;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
@@ -53,9 +54,10 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.MessageSender;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher;
import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
@@ -67,14 +69,14 @@ import org.springframework.stereotype.Component;
*/
@Getter
@Component
-public class ParticipantHandler implements Closeable {
+public class ParticipantHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHandler.class);
private final ToscaConceptIdentifier participantType;
private final ToscaConceptIdentifier participantId;
- private final MessageSender sender;
private final ControlLoopHandler controlLoopHandler;
private final ParticipantStatistics participantStatistics;
+ private final ParticipantMessagePublisher publisher;
@Setter
private ParticipantState state = ParticipantState.UNKNOWN;
@@ -82,10 +84,9 @@ public class ParticipantHandler implements Closeable {
@Setter
private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN;
- private List<ControlLoopElementDefinition> clElementDefsOnThisParticipant =
- new ArrayList<>();
+ private final List<ControlLoopElementDefinition> clElementDefsOnThisParticipant = new ArrayList<>();
- public ToscaServiceTemplate toscaServiceTemplate = new ToscaServiceTemplate();
+ private ToscaServiceTemplate toscaServiceTemplate = new ToscaServiceTemplate();
/**
* Constructor, set the participant ID and sender.
@@ -93,13 +94,12 @@ public class ParticipantHandler implements Closeable {
* @param parameters the parameters of the participant
* @param publisher the publisher for sending responses to messages
*/
- public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) {
+ public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher,
+ ControlLoopHandler controlLoopHandler) {
this.participantType = parameters.getIntermediaryParameters().getParticipantType();
this.participantId = parameters.getIntermediaryParameters().getParticipantId();
- this.sender =
- new MessageSender(this, publisher,
- parameters.getIntermediaryParameters().getReportingTimeIntervalMs());
- this.controlLoopHandler = new ControlLoopHandler(parameters.getIntermediaryParameters(), sender);
+ this.publisher = publisher;
+ this.controlLoopHandler = controlLoopHandler;
this.participantStatistics = new ParticipantStatistics();
this.participantStatistics.setParticipantId(participantId);
this.participantStatistics.setState(state);
@@ -107,18 +107,40 @@ public class ParticipantHandler implements Closeable {
this.participantStatistics.setTimeStamp(Instant.now());
}
- @Override
- public void close() {
- sender.close();
- }
-
/**
* Method which handles a participant health check event from clamp.
*
* @param participantStatusReqMsg participant participantStatusReq message
*/
public void handleParticipantStatusReq(final ParticipantStatusReq participantStatusReqMsg) {
- sender.sendParticipantStatus(makeHeartbeat(true));
+ var controlLoops = controlLoopHandler.getControlLoops();
+ for (ControlLoopElementListener clElementListener : controlLoopHandler.getListeners()) {
+ updateClElementStatistics(controlLoops, clElementListener);
+ }
+
+ var participantStatus = makeHeartbeat(true);
+ publisher.sendParticipantStatus(participantStatus);
+ }
+
+ /**
+ * Update ControlLoopElement statistics. The control loop elements listening will be
+ * notified to retrieve statistics from respective controlloop elements, and controlloopelements
+ * data on the handler will be updated.
+ *
+ * @param controlLoops the control loops
+ * @param clElementListener control loop element listener
+ */
+ private void updateClElementStatistics(ControlLoops controlLoops, ControlLoopElementListener clElementListener) {
+ for (ControlLoop controlLoop : controlLoops.getControlLoopList()) {
+ for (ControlLoopElement element : controlLoop.getElements().values()) {
+ try {
+ clElementListener.handleStatistics(element.getId());
+ } catch (PfModelException e) {
+ LOGGER.debug("Getting statistics for Control loop element failed for element ID {}",
+ element.getId(), e);
+ }
+ }
+ }
}
/**
@@ -165,7 +187,7 @@ public class ParticipantHandler implements Closeable {
var participantUpdateAck = new ParticipantUpdateAck();
handleStateChange(participantState, participantUpdateAck);
- sender.sendParticipantUpdateAck(participantUpdateAck);
+ publisher.sendParticipantUpdateAck(participantUpdateAck);
return getParticipant(definition.getName(), definition.getVersion());
}
@@ -215,7 +237,7 @@ public class ParticipantHandler implements Closeable {
participantRegister.setParticipantId(participantId);
participantRegister.setParticipantType(participantType);
- sender.sendParticipantRegister(participantRegister);
+ publisher.sendParticipantRegister(participantRegister);
}
/**
@@ -244,7 +266,7 @@ public class ParticipantHandler implements Closeable {
participantDeregister.setParticipantId(participantId);
participantDeregister.setParticipantType(participantType);
- sender.sendParticipantDeregister(participantDeregister);
+ publisher.sendParticipantDeregister(participantDeregister);
}
/**
@@ -275,7 +297,8 @@ public class ParticipantHandler implements Closeable {
// This message is to commission the controlloop
for (ParticipantDefinition participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantId().equals(participantType)) {
- clElementDefsOnThisParticipant = participantDefinition.getControlLoopElementDefinitionList();
+ clElementDefsOnThisParticipant.clear();
+ clElementDefsOnThisParticipant.addAll(participantDefinition.getControlLoopElementDefinitionList());
break;
}
}
@@ -297,7 +320,14 @@ public class ParticipantHandler implements Closeable {
participantUpdateAck.setParticipantId(participantId);
participantUpdateAck.setParticipantType(participantType);
- sender.sendParticipantUpdateAck(participantUpdateAck);
+ publisher.sendParticipantUpdateAck(participantUpdateAck);
+ }
+
+ /**
+ * Dispatch a heartbeat for this participant.
+ */
+ public void sendHeartbeat() {
+ publisher.sendHeartbeat(makeHeartbeat(false));
}
/**
@@ -330,15 +360,14 @@ public class ParticipantHandler implements Closeable {
private List<ControlLoopInfo> getControlLoopInfoList() {
List<ControlLoopInfo> controlLoopInfoList = new ArrayList<>();
- for (Map.Entry<ToscaConceptIdentifier, ControlLoop> entry :
- controlLoopHandler.getControlLoopMap().entrySet()) {
+ for (Map.Entry<ToscaConceptIdentifier, ControlLoop> entry : controlLoopHandler.getControlLoopMap().entrySet()) {
ControlLoopInfo clInfo = new ControlLoopInfo();
clInfo.setControlLoopId(entry.getKey());
ControlLoopStatistics clStatitistics = new ControlLoopStatistics();
clStatitistics.setControlLoopId(entry.getKey());
ClElementStatisticsList clElementStatisticsList = new ClElementStatisticsList();
- clElementStatisticsList.setClElementStatistics(
- entry.getValue().getControlLoopElementStatisticsList(entry.getValue()));
+ clElementStatisticsList
+ .setClElementStatistics(entry.getValue().getControlLoopElementStatisticsList(entry.getValue()));
clStatitistics.setClElementStatisticsList(clElementStatisticsList);
clInfo.setControlLoopStatistics(clStatitistics);
clInfo.setState(entry.getValue().getState());
diff --git a/pom.xml b/pom.xml
index 61af7c48e..9fdfed004 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.parent</groupId>
<artifactId>integration</artifactId>
- <version>3.4.0-SNAPSHOT</version>
+ <version>3.4.1-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.clamp</groupId>
diff --git a/runtime-controlloop/pom.xml b/runtime-controlloop/pom.xml
index 508f44a80..54405548f 100644
--- a/runtime-controlloop/pom.xml
+++ b/runtime-controlloop/pom.xml
@@ -84,6 +84,16 @@
<version>${version.springfox}</version>
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ <version>${version.springboot}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ <version>${version.io.micrometer}</version>
+ </dependency>
+ <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<scope>runtime</scope>
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java
index ee0461994..b14c675df 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/config/ConverterConfiguration.java
@@ -20,9 +20,12 @@
package org.onap.policy.clamp.controlloop.runtime.config;
+import java.util.Arrays;
import java.util.List;
import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@@ -32,5 +35,9 @@ public class ConverterConfiguration implements WebMvcConfigurer {
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(new CoderHttpMesageConverter<>("yaml"));
converters.add(new CoderHttpMesageConverter<>("json"));
+
+ StringHttpMessageConverter converter = new StringHttpMessageConverter();
+ converter.setSupportedMediaTypes(Arrays.asList(MediaType.TEXT_PLAIN));
+ converters.add(converter);
}
}
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java
index 2dc7a6b8e..ac2dba355 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -83,7 +85,7 @@ public class RuntimeErrorController implements ErrorController {
Map<String, Object> map = this.errorAttributes.getErrorAttributes(new ServletWebRequest(request),
ErrorAttributeOptions.defaults());
- StringBuilder sb = new StringBuilder();
+ var sb = new StringBuilder();
final Object error = map.get("error");
if (error != null) {
sb.append(error.toString()).append(" ");
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
index b39573461..c68b7fd49 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
index a05337991..65149a733 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -204,7 +206,7 @@ public class SupervisionScanner {
return;
}
- boolean completed = true;
+ var completed = true;
for (ControlLoopElement element : controlLoop.getElements().values()) {
if (!element.getState().equals(element.getOrderedState().asState())) {
completed = false;
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
index 35219bb68..6df030d32 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -59,7 +61,7 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
}
controlLoopUpdateMsg.setParticipantUpdatesList(participantUpdates);
- LOGGER.debug("ControlLoopUpdate message sent", controlLoopUpdateMsg);
+ LOGGER.debug("ControlLoopUpdate message sent {}", controlLoopUpdateMsg);
super.send(controlLoopUpdateMsg);
}
@@ -68,7 +70,7 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
if (participantUpdates.isEmpty()) {
participantUpdates.add(getControlLoopElementList(clElement));
} else {
- boolean participantExists = false;
+ var participantExists = false;
for (ParticipantUpdates participantUpdate : participantUpdates) {
if (participantUpdate.getParticipantId().equals(clElement.getParticipantId())) {
participantUpdate.getControlLoopElementList().add(clElement);
@@ -82,7 +84,7 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
}
private ParticipantUpdates getControlLoopElementList(ControlLoopElement clElement) {
- ParticipantUpdates participantUpdate = new ParticipantUpdates();
+ var participantUpdate = new ParticipantUpdates();
List<ControlLoopElement> controlLoopElementList = new ArrayList<>();
participantUpdate.setParticipantId(clElement.getParticipantId());
controlLoopElementList.add(clElement);
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
index d239f38cb..efd262560 100644
--- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -36,7 +38,6 @@ import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplates;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -117,7 +118,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
controlLoopElementDefinitionList));
} else {
- boolean participantExists = false;
+ var participantExists = false;
for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
if (participantDefinitionUpdate.getParticipantId().equals(clParticipantId)) {
participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
diff --git a/runtime-controlloop/src/main/resources/application.yaml b/runtime-controlloop/src/main/resources/application.yaml
index ea98aaa8c..cddb3d0fb 100644
--- a/runtime-controlloop/src/main/resources/application.yaml
+++ b/runtime-controlloop/src/main/resources/application.yaml
@@ -50,3 +50,9 @@ runtime:
servers:
- ${topicServer:localhost}
topicCommInfrastructure: dmaap
+
+management:
+ endpoints:
+ web:
+ exposure:
+ include: health, metrics, prometheus
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java
new file mode 100644
index 000000000..433e914ae
--- /dev/null
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/rest/ActuatorControllerTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 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=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.runtime.main.rest;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.core.Response;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.onap.policy.clamp.controlloop.runtime.util.rest.CommonRestController;
+import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+@AutoConfigureMetrics
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@TestPropertySource(locations = {"classpath:application_test.properties"})
+class ActuatorControllerTest extends CommonRestController {
+
+ private static final String HEALTH_ENDPOINT = "health";
+ private static final String METRICS_ENDPOINT = "metrics";
+ private static final String PROMETHEUS_ENDPOINT = "prometheus";
+
+ @LocalServerPort
+ private int randomServerPort;
+
+ @BeforeEach
+ public void setUpPort() {
+ super.setHttpPrefix(randomServerPort);
+ }
+
+ @Test
+ void testGetHealth_Unauthorized() throws Exception {
+ assertUnauthorizedActGet(HEALTH_ENDPOINT);
+ }
+
+ @Test
+ void testGetMetrics_Unauthorized() throws Exception {
+ assertUnauthorizedActGet(METRICS_ENDPOINT);
+ }
+
+ @Test
+ void testGetPrometheus_Unauthorized() throws Exception {
+ assertUnauthorizedActGet(PROMETHEUS_ENDPOINT);
+ }
+
+ @Test
+ void testGetHealth() throws Exception {
+ Invocation.Builder invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ }
+
+ @Test
+ void testGetMetrics() throws Exception {
+ Invocation.Builder invocationBuilder = super.sendActRequest(METRICS_ENDPOINT);
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ }
+
+ @Test
+ void testGePrometheus() throws Exception {
+ Invocation.Builder invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
+ Response rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ }
+}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java
index 5f885ec97..3ac6b6fa4 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -229,7 +231,7 @@ class TestMonitoringProvider {
var element = new ControlLoopElement();
element.setParticipantId(new ToscaConceptIdentifier("name1", "1.001"));
controlLoop.setElements(Map.of(UUID.randomUUID(), element));
- when(mockClProvider.getControlLoop(eq(new ToscaConceptIdentifier("testName", "1.001"))))
+ when(mockClProvider.getControlLoop(new ToscaConceptIdentifier("testName", "1.001")))
.thenReturn(controlLoop);
ParticipantStatisticsList getResponse = provider.fetchParticipantStatsPerControlLoop("testName", "1.001");
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java
index 30ee9b1b9..b31aa8e4f 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -37,7 +39,7 @@ class SupervisionAspectTest {
var supervisionScanner = spy(mock(SupervisionScanner.class));
try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
supervisionAspect.schedule();
- verify(supervisionScanner, timeout(500)).run(eq(true));
+ verify(supervisionScanner, timeout(500)).run(true);
}
}
@@ -47,7 +49,7 @@ class SupervisionAspectTest {
try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
supervisionAspect.doCheck();
supervisionAspect.doCheck();
- verify(supervisionScanner, timeout(500).times(2)).run(eq(false));
+ verify(supervisionScanner, timeout(500).times(2)).run(false);
}
}
@@ -60,7 +62,7 @@ class SupervisionAspectTest {
try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
supervisionAspect.handleParticipantStatus(participantStatusMessage);
- verify(supervisionScanner, timeout(500)).handleParticipantStatus(eq(identifier));
+ verify(supervisionScanner, timeout(500)).handleParticipantStatus(identifier);
}
}
}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java
index eebaa5281..ccac0c63b 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java
@@ -42,7 +42,9 @@ import org.onap.policy.common.utils.network.NetworkUtil;
public class CommonRestController {
public static final String SELF = NetworkUtil.getHostname();
- public static final String ENDPOINT_PREFIX = "onap/controlloop/v2/";
+ public static final String CONTEXT_PATH = "onap/controlloop";
+ public static final String ENDPOINT_PREFIX = CONTEXT_PATH + "/v2/";
+ public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/";
private static String httpPrefix;
@@ -71,7 +73,18 @@ public class CommonRestController {
}
/**
- * Sends a request to an endpoint, without any authorization header.
+ * Sends a request to an actuator endpoint.
+ *
+ * @param endpoint the target endpoint
+ * @return a request builder
+ * @throws Exception if an error occurs
+ */
+ protected Invocation.Builder sendActRequest(final String endpoint) throws Exception {
+ return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, true);
+ }
+
+ /**
+ * Sends a request to an Rest Api endpoint, without any authorization header.
*
* @param endpoint the target endpoint
* @return a request builder
@@ -82,6 +95,17 @@ public class CommonRestController {
}
/**
+ * Sends a request to an actuator endpoint, without any authorization header.
+ *
+ * @param endpoint the target endpoint
+ * @return a request builder
+ * @throws Exception if an error occurs
+ */
+ protected Invocation.Builder sendNoAuthActRequest(final String endpoint) throws Exception {
+ return sendFqeRequest(httpPrefix + ACTUATOR_ENDPOINT + endpoint, false);
+ }
+
+ /**
* Sends a request to a fully qualified endpoint.
*
* @param fullyQualifiedEndpoint the fully qualified target endpoint
@@ -102,7 +126,7 @@ public class CommonRestController {
final WebTarget webTarget = client.target(fullyQualifiedEndpoint);
- return webTarget.request(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
+ return webTarget.request(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN);
}
/**
@@ -141,6 +165,17 @@ public class CommonRestController {
}
/**
+ * Assert that GET call to actuator endpoint is Unauthorized.
+ *
+ * @param endPoint the endpoint
+ * @throws Exception if an error occurs
+ */
+ protected void assertUnauthorizedActGet(final String endPoint) throws Exception {
+ Response rawresp = sendNoAuthActRequest(endPoint).buildGet().invoke();
+ assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus());
+ }
+
+ /**
* Assert that DELETE call is Unauthorized.
*
* @param endPoint the endpoint
@@ -159,4 +194,8 @@ public class CommonRestController {
protected void setHttpPrefix(int port) {
httpPrefix = "http://" + SELF + ":" + port + "/";
}
+
+ protected String getHttpPrefix() {
+ return httpPrefix;
+ }
}
diff --git a/runtime-controlloop/src/test/resources/application_test.properties b/runtime-controlloop/src/test/resources/application_test.properties
index ad2a4b12c..0074d9f95 100644
--- a/runtime-controlloop/src/test/resources/application_test.properties
+++ b/runtime-controlloop/src/test/resources/application_test.properties
@@ -28,3 +28,5 @@ runtime.topicParameterGroup.topicSources[0].fetchTimeout=15000
runtime.topicParameterGroup.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
runtime.topicParameterGroup.topicSinks[0].servers[0]=localhost
runtime.topicParameterGroup.topicSinks[0].topicCommInfrastructure=dmaap
+
+management.endpoints.web.exposure.include=health,metrics,prometheus
diff --git a/runtime/pom.xml b/runtime/pom.xml
index 3a8ece35b..ef15198dc 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -662,6 +662,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
<forkCount>1C</forkCount>
<reuseForks>true</reuseForks>
<useSystemClassLoader>false</useSystemClassLoader>
@@ -685,7 +688,7 @@
</additionalClasspathElement>
</additionalClasspathElements>
<includes>
- <include>**/*ItCase.java</include>
+ <include>**/*ItTestCase.java</include>
</includes>
<forkCount>1C</forkCount>
<reuseForks>true</reuseForks>
diff --git a/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java b/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java
index 62614e729..cf639a35d 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java
@@ -35,7 +35,6 @@ import org.onap.policy.common.utils.logging.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java b/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java
index 0e520dec1..1e5b003f1 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java
@@ -26,7 +26,6 @@
package org.onap.policy.clamp.clds;
import java.io.IOException;
-import java.security.Principal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -48,7 +47,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
-import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
public class ClampServlet extends CamelHttpTransportServlet {
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java b/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java
index 27f706d77..8f492c761 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java
@@ -34,7 +34,6 @@ import java.util.Date;
import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
-import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.ExchangeBuilder;
import org.onap.policy.clamp.clds.exception.cds.CdsParametersException;
import org.onap.policy.clamp.clds.model.cds.CdsBpWorkFlowListResponse;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/ClampProperties.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/ClampProperties.java
index 34f0662c7..0ac58fc80 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/ClampProperties.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/ClampProperties.java
@@ -24,7 +24,6 @@
package org.onap.policy.clamp.clds.config;
import java.io.IOException;
-import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java b/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java
index eb9de056c..7224493b5 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java
@@ -26,7 +26,6 @@ package org.onap.policy.clamp.clds.filter;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.StandardCopyOption;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponse.java b/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponse.java
index 9f5300a9f..9862728df 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponse.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponse.java
@@ -1,13 +1,10 @@
-
/*-
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Modifications Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
* 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
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java
index 89046afd1..2ca463ede 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java
@@ -24,11 +24,8 @@
package org.onap.policy.clamp.clds.sdc.controller.installer;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.HashMap;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplate.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplate.java
index 5c96f2c4a..8e619969d 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplate.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplate.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -148,9 +148,9 @@ public class JsonTemplate {
* @return a boolean
*/
public boolean checkFields(JsonTemplate jsonTemplate) {
- boolean duplicateFields = false;
+ var duplicateFields = false;
if (jsonTemplate.getJsonTemplateFields().size() == this.getJsonTemplateFields().size()) {
- int countMatchingFields = 0;
+ var countMatchingFields = 0;
//loop each component of first
for (JsonTemplateField jsonTemplateFieldToCheck : jsonTemplate.getJsonTemplateFields()) {
for (JsonTemplateField jsonTemplateField : this.getJsonTemplateFields()) {
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/util/LoggingUtils.java b/runtime/src/main/java/org/onap/policy/clamp/clds/util/LoggingUtils.java
index 5d09c065a..fcd375ad3 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/util/LoggingUtils.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/util/LoggingUtils.java
@@ -292,7 +292,7 @@ public class LoggingUtils {
* @param targetServiceName The target service name
*/
public void invoke(String targetEntity, String targetServiceName) {
- final String invocationId = UUID.randomUUID().toString();
+ final var invocationId = UUID.randomUUID().toString();
invokeContext(targetEntity, targetServiceName, invocationId);
@@ -396,7 +396,7 @@ public class LoggingUtils {
private <T extends URLConnection> T invokeGeneric(final T con, String targetEntity,
String targetServiceName) {
- final String invocationId = UUID.randomUUID().toString();
+ final var invocationId = UUID.randomUUID().toString();
// Set standard HTTP headers on (southbound request) builder.
con.setRequestProperty(OnapLogConstants.Headers.REQUEST_ID,
diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/LoopService.java b/runtime/src/main/java/org/onap/policy/clamp/loop/LoopService.java
index 946edd767..9449c25eb 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/loop/LoopService.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/loop/LoopService.java
@@ -26,13 +26,11 @@
package org.onap.policy.clamp.loop;
import com.google.gson.JsonObject;
-import java.io.IOException;
import java.util.List;
import java.util.Set;
import javax.persistence.EntityNotFoundException;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.loop.template.LoopTemplatesService;
-import org.onap.policy.clamp.loop.template.PolicyModel;
import org.onap.policy.clamp.loop.template.PolicyModelsService;
import org.onap.policy.clamp.policy.microservice.MicroServicePolicy;
import org.onap.policy.clamp.policy.microservice.MicroServicePolicyService;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java b/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java
index 53365806b..10d98e362 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java
@@ -120,7 +120,7 @@ public class CsarServiceInstaller {
* @throws SdcArtifactInstallerException The SdcArtifactInstallerException
*/
public boolean isServiceAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException {
- boolean alreadyInstalled = true;
+ var alreadyInstalled = true;
var serviceDetails = JsonUtils.GSON.fromJson(
JsonUtils.GSON.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class);
alreadyInstalled = serviceRepository.existsById(serviceDetails.get("UUID").getAsString());
diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java b/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java
index cc4e4c2fc..c955d2696 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java
@@ -33,7 +33,6 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.clds.util.JsonUtils;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.slf4j.Logger;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java b/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
index 7477ae31f..e15731fc7 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
@@ -163,8 +163,8 @@ public class LoopElementModel extends AuditEntity implements Serializable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
+ final var prime = 31;
+ var result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/template/PolicyModel.java b/runtime/src/main/java/org/onap/policy/clamp/loop/template/PolicyModel.java
index 0d57caada..741530e99 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/loop/template/PolicyModel.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/loop/template/PolicyModel.java
@@ -37,7 +37,6 @@ import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.policy.clamp.loop.common.AuditEntity;
import org.onap.policy.clamp.util.SemanticVersioning;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/microservice/MicroServicePolicy.java b/runtime/src/main/java/org/onap/policy/clamp/policy/microservice/MicroServicePolicy.java
index 96edfa190..3f0f4e7b9 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/policy/microservice/MicroServicePolicy.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/policy/microservice/MicroServicePolicy.java
@@ -37,7 +37,6 @@ import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.apache.commons.lang3.RandomStringUtils;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.policy.clamp.loop.Loop;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java
index c7d67bd4e..203f2771e 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java
@@ -40,7 +40,6 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.RandomStringUtils;
import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.policy.clamp.loop.Loop;
diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java
index 63df3a7b0..84bf72b62 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java
@@ -32,8 +32,6 @@ import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySuppo
import org.onap.policy.clamp.loop.Loop;
import org.onap.policy.clamp.loop.template.PolicyModelsRepository;
import org.onap.policy.clamp.policy.PolicyService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java
index 605ab99ae..59d9e7320 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java
@@ -6,6 +6,7 @@
* reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,7 +72,7 @@ public class CldsUserJsonDecoderTest {
assertThat(usersArray).hasSize(1);
CldsUser user = usersArray[0];
assertThat(user.getUser()).isEqualTo(user1);
- assertThat(user.getPassword()).isEqualTo(null);
+ assertThat(user.getPassword()).isNull();
assertThat(user.getPermissionsString()).isEmpty();
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
index 7390b65ba..eed3f4edb 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
@@ -74,8 +74,8 @@ public class SdcSingleControllerConfigurationTest {
assertEquals(10, sdcConfig.getPollingInterval());
assertEquals(30, sdcConfig.getPollingTimeout());
- assertThat(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST)
- .hasSameSizeAs(sdcConfig.getRelevantArtifactTypes());
+ assertThat(sdcConfig.getRelevantArtifactTypes())
+ .hasSameSizeAs(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST);
assertEquals("ThePassword", sdcConfig.getKeyStorePassword());
assertTrue(sdcConfig.activateServerTLSAuth());
assertThat(sdcConfig.getMsgBusAddress()).contains("localhost");
@@ -103,6 +103,6 @@ public class SdcSingleControllerConfigurationTest {
public final void testConsumerGroupWithNull() throws IOException {
SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-NULL.json",
"sdc-controller1");
- assertTrue(sdcConfig.getConsumerGroup() == null);
+ assertNull(sdcConfig.getConsumerGroup());
}
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItTestCase.java
index 45d4d64b1..746b8381a 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
@@ -56,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-public class AuthorizationControllerItCase {
+public class AuthorizationControllerItTestCase {
@Autowired
private AuthorizationController auth;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItTestCase.java
index 52da63952..da2007e07 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItTestCase.java
@@ -2,19 +2,19 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * 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
+ *
+ * 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.
* ============LICENSE_END============================================
* ===================================================================
@@ -39,7 +39,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class CldsHealthcheckServiceItCase {
+public class CldsHealthcheckServiceItTestCase {
@Autowired
private CldsHealthcheckService cldsHealthcheckService;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItTestCase.java
index 180c3094d..06f0c1310 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItTestCase.java
@@ -59,7 +59,7 @@ import org.springframework.web.client.RestTemplate;
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
@TestPropertySource(locations = "classpath:https/https-test.properties")
@DirtiesContext
-public class HttpsItCase {
+public class HttpsItTestCase {
@Value("${server.port}")
private String httpsPort;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItTestCase.java
index 66c7f3589..367bd4109 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItTestCase.java
@@ -56,12 +56,12 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource(locations = "classpath:robotframework/robotframework-test.properties")
@DirtiesContext
-public class RobotItCase {
+public class RobotItTestCase {
@Value("${server.port}")
private String httpPort;
private static final int TIMEOUT_S = 150;
- protected static final Logger logger = LoggerFactory.getLogger(RobotItCase.class);
+ protected static final Logger logger = LoggerFactory.getLogger(RobotItTestCase.class);
@Test
public void robotTests() throws Exception {
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
index c8b9932cc..eeed51c12 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class CldsReferencePropertiesItCase {
+public class CldsReferencePropertiesItTestCase {
@Autowired
private ClampProperties refProp;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItTestCase.java
index 70aeccf59..cf4987fa8 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItTestCase.java
@@ -20,8 +20,8 @@
package org.onap.policy.clamp.clds.it.config;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import com.google.gson.JsonSyntaxException;
@@ -44,7 +44,7 @@ import org.springframework.test.util.ReflectionTestUtils;
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class SdcControllersConfigurationItCase {
+public class SdcControllersConfigurationItTestCase {
@Autowired
private SdcControllersConfiguration sdcControllersConfiguration;
@@ -59,7 +59,7 @@ public class SdcControllersConfigurationItCase {
loadFile("classpath:clds/sdc-controllers-config.json");
Map<String, SdcSingleControllerConfiguration> mapResult = sdcControllersConfiguration
.getAllDefinedControllers();
- assertTrue(mapResult.size() == 2);
+ assertThat(mapResult).hasSize(2);
assertEquals("sdc-controller1", mapResult.get("sdc-controller1").getSdcControllerName());
assertEquals("sdc-controller2", mapResult.get("sdc-controller2").getSdcControllerName());
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItTestCase.java
index 787118902..2201d1a2e 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
@@ -58,7 +58,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class SdcSingleControllerItCase {
+public class SdcSingleControllerItTestCase {
private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar";
private static final String SERVICE_UUID = "serviceUUID";
@@ -115,7 +115,7 @@ public class SdcSingleControllerItCase {
// when
sdcSingleController.treatNotification(buildFakeSdcNotification());
// then
- Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isEqualTo(0);
+ Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isZero();
}
@Test
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheItTestCase.java
index f406e5ed2..71d5f2dab 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class DcaeInventoryResponseCacheTestItCase {
+public class DcaeInventoryResponseCacheItTestCase {
public static DcaeInventoryCache inventoryCache = new DcaeInventoryCache();
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java
index a246e0efa..25b3b92c9 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,7 +53,7 @@ public class DcaeInventoryResponseTest {
int value = 0;
for (DcaeInventoryResponse inventoryResponse : responseSet) {
- assertThat(Integer.valueOf(inventoryResponse.getAsdcResourceId()) == value++).isTrue();
+ assertThat(Integer.valueOf(inventoryResponse.getAsdcResourceId())).isSameAs(value++);
}
}
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItTestCase.java
index f70e74cd6..5880bad0b 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,7 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
-public class DictionaryRepositoriesTestItCase {
+public class DictionaryRepositoriesTestItTestCase {
@Autowired
private DictionaryRepository dictionaryRepository;
@@ -76,13 +76,13 @@ public class DictionaryRepositoriesTestItCase {
dictionaryRepository.save(dictionaryTest1);
List<String> res1 = dictionaryRepository.getAllDictionaryNames();
- assertThat(res1.size()).isGreaterThanOrEqualTo(1);
+ assertThat(res1.size()).isPositive();
assertThat(res1).contains("testDictionary1");
dictionaryRepository.save(dictionaryTest2);
List<String> res2 = dictionaryRepository.getAllDictionaryNames();
assertThat(res2.size()).isGreaterThanOrEqualTo(2);
- assertThat(res2).contains("testDictionary1");
- assertThat(res2).contains("testDictionary2");
+ assertThat(res2).contains("testDictionary1")
+ .contains("testDictionary2");
}
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java
index 3eaa0ce51..ad8593787 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,11 +49,11 @@ public class JsonTemplateFieldTest extends TestCase {
* Test equals method.
*/
public void testEqualsMethod() {
- assertTrue(field1.equals(field2));
- assertTrue(field1.equals(field3));
- assertTrue(field1.equals(field4));
- assertTrue(field1.equals(field5));
- assertTrue(field1.equals(field6));
+ assertEquals(field1, field2);
+ assertEquals(field1, field3);
+ assertEquals(field1, field4);
+ assertEquals(field1, field5);
+ assertEquals(field1, field6);
}
/**
@@ -64,6 +64,6 @@ public class JsonTemplateFieldTest extends TestCase {
assertFalse(field1.compareWithField(field3));
assertFalse(field1.compareWithField(field4));
assertFalse(field1.compareWithField(field5));
- assertTrue(field1.equals(field6));
+ assertEquals(field1, field6);
}
-} \ No newline at end of file
+}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java
index dc27d8aaa..63bc36321 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,12 +58,11 @@ public class JsonTemplateTest extends TestCase {
toTest.setVisibility("moreField", true);
toTest.setStatic("moreField", true);
toTest.updateValueField("moreField", "testValue");
-
+
assertTrue(toTest.isVisible("moreField"));
- assertTrue(toTest.getSpecificField("moreField").getValue().equals("testValue"));
+ assertEquals("testValue", toTest.getSpecificField("moreField").getValue());
assertTrue(toTest.fieldStaticStatus("moreField"));
- assertTrue(toTest.toString()
- .equals(" templateFields : [type null null null, description null null null, "
- + "enum null null null, moreField testValue true true]"));
+ assertEquals(" templateFields : [type null null null, description null null null, "
+ + "enum null null null, moreField testValue true true]", toTest.toString());
}
-} \ No newline at end of file
+}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java
index 658419d4c..1d78d6ce1 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
@ActiveProfiles({"clamp-default", "clamp-default-user", "default-dictionary-elements"})
-public class ToscaConverterWithDictionarySupportItCase {
+public class ToscaConverterWithDictionarySupportItTestCase {
@Autowired
private DictionaryService dictionaryService;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItTestCase.java
index b0abf832b..661696e55 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItTestCase.java
@@ -75,7 +75,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class CsarInstallerItCase {
+public class CsarInstallerItTestCase {
private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
private static final String CSAR_ARTIFACT_NAME_NO_CDS = "example/sdc/service_Vloadbalancerms_no_cds.csar";
@@ -312,7 +312,7 @@ public class CsarInstallerItCase {
assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0]))
.getLoopElementModel().getName()).isNotEmpty();
- assertThat(policyModelsRepository.findAll().size()).isGreaterThanOrEqualTo(1);
+ assertThat(policyModelsRepository.findAll().size()).isPositive();
assertThat(policyModelsRepository
.existsById(new PolicyModelId("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"))).isTrue();
assertThat(policyModelsRepository
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowItTestCase.java
index 4d02b10dc..bfd5b0377 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class DeployFlowTestItCase {
+public class DeployFlowItTestCase {
private Gson gson = new Gson();
@Autowired
@@ -159,7 +159,7 @@ public class DeployFlowTestItCase {
camelContext.createProducerTemplate().send("direct:undeploy-loop", myCamelExchange);
Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
- assertThat(loopAfterTest.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
+ assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).contains("/uninstall");
assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
}
@@ -196,9 +196,8 @@ public class DeployFlowTestItCase {
Loop loopAfterTest = loopService.getLoop("ControlLoopTest2");
Set<MicroServicePolicy> policyList = loopAfterTest.getMicroServicePolicies();
for (MicroServicePolicy policy : policyList) {
- assertThat(policy.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
+ assertThat(policy.getDcaeDeploymentStatusUrl()).contains("/uninstall");
assertThat(policy.getDcaeDeploymentId()).isNull();
-
}
assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).isNull();
assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
@@ -224,7 +223,7 @@ public class DeployFlowTestItCase {
"{\"param1\":\"value1\"}", true);
loopTest.addMicroServicePolicy(microServicePolicy);
loopService.saveOrUpdateLoop(loopTest);
- assertThat(loopTest.getComponents().size()).isEqualTo(2);
+ assertThat(loopTest.getComponents()).hasSize(2);
assertThat(loopTest.getComponent("DCAE")).isNotNull();
assertThat(loopTest.getComponent("POLICY")).isNotNull();
Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest)
@@ -235,7 +234,7 @@ public class DeployFlowTestItCase {
assertThat(loopTest.getComponent("DCAE").getState().getStateName()).isEqualTo("BLUEPRINT_DEPLOYED");
Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
- assertThat(loopAfterTest.getComponents().size()).isEqualTo(2);
+ assertThat(loopAfterTest.getComponents()).hasSize(2);
assertThat(loopAfterTest.getComponent("DCAE")).isNotNull();
assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
}
@@ -263,7 +262,7 @@ public class DeployFlowTestItCase {
loopTest.addMicroServicePolicy(microServicePolicy);
loopTest.addMicroServicePolicy(microServicePolicy2);
loopService.saveOrUpdateLoop(loopTest);
- assertThat(loopTest.getComponents().size()).isEqualTo(3);
+ assertThat(loopTest.getComponents()).hasSize(3);
assertThat(loopTest.getComponent("DCAE")).isNull();
assertThat(loopTest.getComponent("DCAE_configPolicyTest")).isNotNull();
assertThat(loopTest.getComponent("DCAE_configPolicyTest2")).isNotNull();
@@ -279,7 +278,7 @@ public class DeployFlowTestItCase {
.isEqualTo("BLUEPRINT_DEPLOYED");
Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
- assertThat(loopAfterTest.getComponents().size()).isEqualTo(3);
+ assertThat(loopAfterTest.getComponents()).hasSize(3);
assertThat(loopAfterTest.getComponent("DCAE")).isNull();
assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
assertThat(loopTest.getComponent("DCAE_configPolicyTest")).isNotNull();
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java b/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java
index a73b2784b..567cad69d 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,34 +34,34 @@ public class ExternalComponentStateTest {
@Test
public void generalTest() {
- assertThat(state.toString()).isEqualTo("NOT_SENT");
+ assertThat(state).hasToString("NOT_SENT");
state.setLevel(70);
assertThat(state.getLevel()).isEqualTo(70);
}
@Test
public void equalsTest() {
- assertThat(state.equals(null)).isEqualTo(false);
+ assertThat(state.equals(null)).isFalse();
ExternalComponentState state2 = new ExternalComponentState("NOT_SENT",
"The policies defined have NOT yet been created on the policy engine", 90);
- assertThat(state.equals(state2)).isEqualTo(true);
+ assertThat(state.equals(state2)).isTrue();
- assertThat(state.equals(12)).isEqualTo(false);
+ assertThat(state.equals(12)).isFalse();
state2.setLevel(70);
- assertThat(state.equals(state2)).isEqualTo(true);
+ assertThat(state.equals(state2)).isTrue();
ExternalComponentState state3 = new ExternalComponentState("SENT",
"The policies defined have NOT yet been created on the policy engine", 90);
- assertThat(state.equals(state3)).isEqualTo(false);
+ assertThat(state.equals(state3)).isFalse();
ExternalComponentState state4 = new ExternalComponentState(null,
"The policies defined have NOT yet been created on the policy engine", 90);
ExternalComponentState state5 = new ExternalComponentState(null,
"The policies defined have NOT yet been", 50);
- assertThat(state4.equals(state3)).isEqualTo(false);
- assertThat(state4.equals(state5)).isEqualTo(true);
+ assertThat(state4.equals(state3)).isFalse();
+ assertThat(state4.equals(state5)).isTrue();
}
@Test
@@ -79,4 +79,4 @@ public class ExternalComponentStateTest {
assertThat(state.compareTo(state4)).isEqualTo(-1);
}
-} \ No newline at end of file
+}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerItTestCase.java
index 54ecaa639..865c83a8b 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerItTestCase.java
@@ -4,7 +4,9 @@
* ================================================================================
* Copyright (C) 2019 Nokia Intellectual Property. All rights
* reserved.
+ * ================================================================================
* Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopControllerTestItCase {
+public class LoopControllerItTestCase {
private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
@@ -161,7 +163,7 @@ public class LoopControllerTestItCase {
Set<OperationalPolicy> opPolicyList = newLoop.getOperationalPolicies();
assertThat(opPolicyList.size()).isEqualTo(1);
for (OperationalPolicy policy : opPolicyList) {
- assertThat(policy.getName().contains("OPERATIONAL_serviceName")).isTrue();
+ assertThat(policy.getName()).contains("OPERATIONAL_serviceName");
Assertions.assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel");
Assertions.assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0");
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceItTestCase.java
index ab256eafb..1dac230fe 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceItTestCase.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 Huawei Technologies Co., Ltd.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -41,7 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopLogServiceTestItCase {
+public class LoopLogServiceItTestCase {
private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItTestCase.java
index e18dd2475..24dd92909 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItTestCase.java
@@ -58,7 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopRepositoriesItCase {
+public class LoopRepositoriesItTestCase {
private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
@@ -177,21 +177,21 @@ public class LoopRepositoriesItCase {
assertThat(loopInDb).isEqualToIgnoringGivenFields(loopTest, "components", "createdDate", "updatedDate",
"createdBy", "updatedBy");
- assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(true);
- assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(true);
- assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
+ assertThat(loopRepository.existsById(loopTest.getName())).isTrue();
+ assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isTrue();
+ assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isTrue();
assertThat(loopLogRepository.existsById(loopLog.getId())).isEqualTo(true);
- assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
- assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
- assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
+ assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+ assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+ assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isTrue();
assertThat(microServiceModelsRepository.existsById(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
- .isEqualTo(true);
+ .isTrue();
assertThat(policyModelsRepository.existsById(new PolicyModelId(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
.first().getPolicyModelType(),
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
- .first().getVersion()))).isEqualTo(true);
+ .first().getVersion()))).isTrue();
// Now attempt to read from database
Loop loopInDbRetrieved = loopRepository.findById(loopTest.getName()).get();
@@ -238,21 +238,21 @@ public class LoopRepositoriesItCase {
// Attempt to delete the object and check it has well been cascaded
loopRepository.delete(loopInDbRetrieved);
- assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(false);
- assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(false);
- assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
- assertThat(loopLogRepository.existsById(loopLog.getId())).isEqualTo(false);
- assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
- assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
+ assertThat(loopRepository.existsById(loopTest.getName())).isFalse();
+ assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isFalse();
+ assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isTrue();
+ assertThat(loopLogRepository.existsById(loopLog.getId())).isFalse();
+ assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+ assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isTrue();
assertThat(microServiceModelsRepository.existsById(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
- .isEqualTo(true);
+ .isTrue();
assertThat(policyModelsRepository.existsById(new PolicyModelId(
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
.first().getPolicyModelType(),
loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
- .first().getVersion()))).isEqualTo(true);
+ .first().getVersion()))).isTrue();
}
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceItTestCase.java
index 74092727c..e38dee552 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceItTestCase.java
@@ -51,7 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopServiceTestItCase {
+public class LoopServiceItTestCase {
private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
@@ -330,10 +330,10 @@ public class LoopServiceTestItCase {
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(microServicePolicy));
// Verify it's there
- assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null)).isNotNull();
+ assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME)).isPresent();
loopService.deleteLoop(EXAMPLE_LOOP_NAME);
// Verify it's well deleted and has been cascaded, except for Microservice
- assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null)).isNull();
+ assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME)).isNotPresent();
assertThat(microServicePolicyService.isExisting("microPolicy")).isTrue();
assertThat(operationalPolicyService.isExisting("opPolicy")).isFalse();
assertThat(loopLogService.isExisting(((LoopLog) loop.getLoopLogs().toArray()[0]).getId())).isFalse();
@@ -378,4 +378,4 @@ public class LoopServiceTestItCase {
private Loop createTestLoop(String loopName, String loopBlueprint) {
return new Loop(loopName);
}
-} \ No newline at end of file
+}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItTestCase.java
index dba7c39a9..26ab9b37c 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,7 +46,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class LoopTemplatesServiceItCase {
+public class LoopTemplatesServiceItTestCase {
@Autowired
LoopTemplatesService loopTemplatesService;
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java b/runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItTestCase.java
index a2563b8d3..c47c55495 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItTestCase.java
@@ -55,7 +55,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class PolicyModelServiceItCase {
+public class PolicyModelServiceItTestCase {
@Autowired
PolicyModelsService policyModelsService;
@@ -98,8 +98,7 @@ public class PolicyModelServiceItCase {
PolicyModel actualPolicyModel = policyModelsService.saveOrUpdatePolicyModel(policyModel);
// then
- assertThat(actualPolicyModel).isNotNull();
- assertThat(actualPolicyModel).isEqualTo(policyModelsRepository
+ assertThat(actualPolicyModel).isNotNull().isEqualTo(policyModelsRepository
.findById(new PolicyModelId(actualPolicyModel.getPolicyModelType(),
actualPolicyModel.getVersion()))
.get());
diff --git a/runtime/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java b/runtime/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java
index 8f28299fd..41fa61152 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,11 +44,11 @@ public class ServiceTest {
Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null, "1.0");
- Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class),
+ Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class),
JsonUtils.GSON.fromJson(resourceStr, JsonObject.class), "1.0");
- assertThat(service1.equals(service2)).isEqualTo(true);
- assertThat(service1.equals(service3)).isEqualTo(false);
+ assertThat(service2).isEqualTo(service1);
+ assertThat(service3).isNotEqualTo(service1);
}
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerItTestCase.java
index 8fbd2712b..81eba487c 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
@@ -48,7 +48,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@ActiveProfiles({"clamp-default", "clamp-policy-controller"})
-public class PolicyEngineControllerTestItCase {
+public class PolicyEngineControllerItTestCase {
@Autowired
PolicyEngineController policyController;
@@ -72,9 +72,8 @@ public class PolicyEngineControllerTestItCase {
List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(5);
assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Drools",
- null, "1.0.0"));
- assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex",
- null, "1.0.0"));
+ null, "1.0.0"))
+ .contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex", null, "1.0.0"));
assertThat(policyModelsList)
.contains(new PolicyModel("onap.policies.controlloop.guard.common.FrequencyLimiter", null, "1.0.0"));
assertThat(policyModelsList)
diff --git a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseTestItCase.java b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java
index f4e171174..7824be460 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseTestItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -36,7 +38,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class RuntimeCommissioningResponseTestItCase {
+public class RuntimeCommissioningResponseItTestCase {
@Autowired
CamelContext camelContext;
@@ -86,7 +88,7 @@ public class RuntimeCommissioningResponseTestItCase {
.withProperty("raiseHttpExceptionFlag", "true")
.build());
- assertThat(exchangeResponse.getIn().getBody().toString()).isEqualTo(SAMPLE_TOSCA_TEMPLATE);
+ assertThat(exchangeResponse.getIn().getBody()).hasToString(SAMPLE_TOSCA_TEMPLATE);
}
@Test
diff --git a/runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java b/runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItTestCase.java
index fdde53a21..382d5cd44 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItTestCase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +24,7 @@
package org.onap.policy.clamp.tosca;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -39,7 +40,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-public class DictionaryServiceItCase {
+public class DictionaryServiceItTestCase {
@Autowired
private DictionaryService dictionaryService;
@@ -124,7 +125,7 @@ public class DictionaryServiceItCase {
assertTrue(updatedDictionary2.getDictionaryElements().contains(dictionaryElement));
updatedDictionary2.getDictionaryElements().forEach(element -> {
if (element.equals(dictionaryElement)) {
- assertTrue(element.getDescription().equals(dictionaryElement.getDescription()));
+ assertEquals(dictionaryElement.getDescription(), element.getDescription());
}
});
@@ -172,7 +173,7 @@ public class DictionaryServiceItCase {
dictionaryService.getDictionary("Test");
} catch (Exception e) {
assertThat(e).isInstanceOf(EntityNotFoundException.class);
- assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Test"));
+ assertEquals("Couldn't find Dictionary named: Test", e.getMessage());
}
}
@@ -189,7 +190,7 @@ public class DictionaryServiceItCase {
try {
dictionaryService.getDictionary("Dictionary1");
} catch (EntityNotFoundException e) {
- assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Dictionary1"));
+ assertEquals("Couldn't find Dictionary named: Dictionary1", e.getMessage());
}
}
@@ -205,7 +206,7 @@ public class DictionaryServiceItCase {
try {
dictionaryService.getDictionary("Dictionary1");
} catch (EntityNotFoundException e) {
- assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Dictionary1"));
+ assertEquals("Couldn't find Dictionary named: Dictionary1", e.getMessage());
}
}
diff --git a/runtime/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java b/runtime/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java
index 7fd0cb91d..eb5e1d522 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java
@@ -47,7 +47,7 @@ public class PassDecoderTest {
@Test
public final void testDecryption() throws Exception {
String decodedPass = PassDecoder.decode(encrypted, "classpath:clds/aaf/org.onap.clamp.keyfile");
- assertEquals(decodedPass, "China in the Spring");
+ assertEquals("China in the Spring", decodedPass);
assertEquals("Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U", PassDecoder
.decode("enc:JPV4p067JlSXt2Fet9bfuI8JpkS4ZGYVcgypcPs98gXjgjCjTze_d3JxqmlKaaakdiOjIcEC_MJh6-5pJTLgdc",
"classpath:clds/aaf/org.onap.clamp.keyfile"));
diff --git a/runtime/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java b/runtime/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java
index 604ce55db..0ef10ae2a 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -61,9 +61,9 @@ public class SemanticVersioningTest {
*/
@Test
public void compareEqualsTest() {
- assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isEqualTo(0);
+ assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isZero();
assertThat(SemanticVersioning.compare("1.0.0.0", "1.0.0")).isEqualTo(1);
- assertThat(SemanticVersioning.compare("1.2.3", "1.2.3")).isEqualTo(0);
+ assertThat(SemanticVersioning.compare("1.2.3", "1.2.3")).isZero();
assertThat(SemanticVersioning.compare("1.2.3", "1.2.3.0")).isEqualTo(-1);
}
@@ -73,7 +73,7 @@ public class SemanticVersioningTest {
*/
@Test
public void compareNullTest() {
- assertThat(SemanticVersioning.compare(null, null)).isEqualTo(0);
+ assertThat(SemanticVersioning.compare(null, null)).isZero();
assertThat(SemanticVersioning.compare(null, "1.0")).isEqualTo(-1);
assertThat(SemanticVersioning.compare("1.0", null)).isEqualTo(1);
}