From 9b3ff5f270572a6760ff07dda9577cdadb53b088 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 7 Apr 2020 13:58:09 -0400 Subject: Address sonar issues in models Addressed the following sonar issues: - use RE2 instead of java.util Pattern for "+" and "*" - don't use deprecated methods - for Date(long), sonar appeared not to parse the argument's type correctly. Modified the code slightly to make sonar happy - duplicate blocks of code - either log or throw - missing assert in junit - for SDNR & VFC, eliminated threads, as they are unnecessary - duplicate code block in different branches - useless assignments - redeclaring abstract methods - cyclomatic complexity - used lombok in some cases (e.g., EqualsAndHashCode) - assert argument order - actually deleted ControlLoopTargetType, because it is not needed and sonar complains regardless of which order is used - add private constructor to utility classes - use StandardCharsets instead of literals Also: - added logback-test.xml to SO to eliminate the voluminous output from the junit test Issue-ID: POLICY-2305 Change-Id: I586c331781bedbd54a115a71847d04d293689445 Signed-off-by: Jim Hahn --- .../controlloop/ControlLoopTargetTypeTest.java | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java (limited to 'models-interactions/model-impl/events/src/test/java') diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java deleted file mode 100644 index dcb5d1772..000000000 --- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class ControlLoopTargetTypeTest { - - @Test - public void test() { - assertEquals(ControlLoopTargetType.VM, "VM"); - assertEquals(ControlLoopTargetType.VF, "VF"); - assertEquals(ControlLoopTargetType.VFC, "VFC"); - assertEquals(ControlLoopTargetType.VNF, "VNF"); - assertEquals(ControlLoopTargetType.PNF, "PNF"); - } -} -- cgit 1.2.3-korg