aboutsummaryrefslogtreecommitdiffstats
path: root/models/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2024-07-24 09:56:46 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2024-07-24 09:06:26 +0000
commita2f6493f89eff78a78d8ba2aa34f6080d6ab8830 (patch)
tree62acfbf410ce9986d9d3b2d7d3115fd073bf1d5b /models/src
parentb2bc0f63a484abe5b77b1e921d820ae80481602b (diff)
Fix sonar issue for ACM
Issue-ID: POLICY-5065 Change-Id: Id95e8dbd4be14db36eb2fa4ddfc852d37572f25a Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java30
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java18
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java15
4 files changed, 16 insertions, 49 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
deleted file mode 100644
index 3e39e970d..000000000
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/GenericNameVersion.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * ============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.models.acm.messages.rest;
-
-import lombok.Data;
-
-@Data
-public class GenericNameVersion {
-
- private String name;
-
- private String version;
-}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
index fd8b63582..7bffdd966 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java
@@ -42,8 +42,6 @@ public class AcInstanceStateResolver {
private static final String DELETING = DeployState.DELETING.name();
private static final String MIGRATING = DeployState.MIGRATING.name();
private static final String MIGRATION_PRECHECKING = SubState.MIGRATION_PRECHECKING.name();
- private static final String PREPARING = SubState.PREPARING.name();
- private static final String REVIEWING = SubState.REVIEWING.name();
private static final String SUB_STATE_NONE = SubState.NONE.name();
private static final String LOCKED = LockState.LOCKED.name();
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java
index 72e4efb49..2535c375a 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java
@@ -32,7 +32,6 @@ import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
class ParticipantAckMessageTest {
- private ParticipantAckMessage message;
@Test
void testCopyConstructor() throws CoderException {
@@ -40,8 +39,8 @@ class ParticipantAckMessageTest {
.isInstanceOf(NullPointerException.class);
// verify with null values
- message = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
- ParticipantAckMessage newmsg = new ParticipantAckMessage(message);
+ var message = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
+ var newmsg = new ParticipantAckMessage(message);
newmsg.setResponseTo(message.getResponseTo());
assertEquals(message.toString(), newmsg.toString());
@@ -56,14 +55,15 @@ class ParticipantAckMessageTest {
@Test
void testAppliesTo_NullParticipantId() {
- message = makeMessage();
- assertThatThrownBy(() -> message.appliesTo(UUID.randomUUID(), null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> message.appliesTo(null, UUID.randomUUID())).isInstanceOf(NullPointerException.class);
+ var message = makeMessage();
+ var participantId = CommonTestData.getRndParticipantId();
+ assertThatThrownBy(() -> message.appliesTo(participantId, null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> message.appliesTo(null, participantId)).isInstanceOf(NullPointerException.class);
}
@Test
void testAppliesTo_ParticipantIdMatches() {
- message = makeMessage();
+ var message = makeMessage();
// ParticipantId matches
assertTrue(message.appliesTo(CommonTestData.getParticipantId(), CommonTestData.getReplicaId()));
@@ -72,7 +72,7 @@ class ParticipantAckMessageTest {
@Test
void testAppliesTo_ParticipantIdNoMatch() {
- message = makeMessage();
+ var message = makeMessage();
// ParticipantId does not match
assertFalse(message.appliesTo(CommonTestData.getRndParticipantId(), CommonTestData.getReplicaId()));
@@ -80,7 +80,7 @@ class ParticipantAckMessageTest {
}
private ParticipantAckMessage makeMessage() {
- ParticipantAckMessage msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK);
+ var msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK);
msg.setParticipantId(CommonTestData.getParticipantId());
msg.setMessage("Successfull Ack");
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java
index db31d0f01..c6386a571 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java
@@ -33,7 +33,6 @@ import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
class ParticipantMessageTest {
- private ParticipantMessage message;
@Test
void testCopyConstructor() throws CoderException {
@@ -41,7 +40,7 @@ class ParticipantMessageTest {
.isInstanceOf(NullPointerException.class);
// verify with null values
- message = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
+ var message = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE);
var newmsg = new ParticipantMessage(message);
newmsg.setMessageId(message.getMessageId());
newmsg.setTimestamp(message.getTimestamp());
@@ -59,15 +58,15 @@ class ParticipantMessageTest {
@Test
void testAppliesTo_NullParticipantId() {
- message = makeMessage();
-
- assertThatThrownBy(() -> message.appliesTo(UUID.randomUUID(), null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> message.appliesTo(null, UUID.randomUUID())).isInstanceOf(NullPointerException.class);
+ var message = makeMessage();
+ var participantId = CommonTestData.getParticipantId();
+ assertThatThrownBy(() -> message.appliesTo(participantId, null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> message.appliesTo(null, participantId)).isInstanceOf(NullPointerException.class);
}
@Test
void testAppliesTo_ParticipantIdMatches() {
- message = makeMessage();
+ var message = makeMessage();
// ParticipantId matches
assertTrue(message.appliesTo(CommonTestData.getParticipantId(), CommonTestData.getReplicaId()));
@@ -76,7 +75,7 @@ class ParticipantMessageTest {
@Test
void testAppliesTo_ParticipantIdNoMatch() {
- message = makeMessage();
+ var message = makeMessage();
assertFalse(message.appliesTo(CommonTestData.getRndParticipantId(), CommonTestData.getReplicaId()));
assertTrue(message.appliesTo(CommonTestData.getParticipantId(), CommonTestData.getReplicaId()));
}