From cd68fc9bae7d6258f77ff59c1431e4f925f61a4c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 13 Sep 2018 23:48:50 +0100 Subject: Address sonar/Checkstyle Issues Sweep through Apex codebase to fix most ceheckstyle and straightforward sonar issues. Issue-ID: POLICY-1034 Change-Id: I149d9a94ad893affc93573e8de5e3304b6bdde2d Signed-off-by: liamfallon --- .../policymodel/handling/PolicyLogicReader.java | 12 ++++++------ .../policymodel/handling/TestPolicyLogicReader.java | 8 ++++---- ...LogicParentLocalNameLogicInstanceName.funkylogic | 21 +++++++++++++++++++++ ...ogicParentLocalName_LogicInstanceName.funkylogic | 21 --------------------- 4 files changed, 31 insertions(+), 31 deletions(-) create mode 100644 model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParentLogicParentLocalNameLogicInstanceName.funkylogic delete mode 100644 model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic (limited to 'model') diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java index aa57be552..a40a8100f 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java @@ -107,11 +107,11 @@ public class PolicyLogicReader implements AxLogicReader { } else { // Return the java class name for the logic if (axLogic.getKey().getParentLocalName().equals(AxKey.NULL_KEY_NAME)) { - return logicPackage + DOT_JAVA + axLogic.getKey().getParentKeyName() + '_' + return logicPackage + DOT_JAVA + axLogic.getKey().getParentKeyName() + axLogic.getKey().getLocalName(); } else { - return logicPackage + DOT_JAVA + axLogic.getKey().getParentKeyName() + '_' - + axLogic.getKey().getParentLocalName() + '_' + axLogic.getKey().getLocalName(); + return logicPackage + DOT_JAVA + axLogic.getKey().getParentKeyName() + + axLogic.getKey().getParentLocalName() + axLogic.getKey().getLocalName(); } } } @@ -129,10 +129,10 @@ public class PolicyLogicReader implements AxLogicReader { fullLogicFilePath += "/" + defaultLogic; } else { if (axLogic.getKey().getParentLocalName().equals(AxKey.NULL_KEY_NAME)) { - fullLogicFilePath += "/" + axLogic.getKey().getParentKeyName() + "_" + axLogic.getKey().getLocalName(); + fullLogicFilePath += "/" + axLogic.getKey().getParentKeyName() + axLogic.getKey().getLocalName(); } else { - fullLogicFilePath += "/" + axLogic.getKey().getParentKeyName() + "_" - + axLogic.getKey().getParentLocalName() + "_" + axLogic.getKey().getLocalName(); + fullLogicFilePath += "/" + axLogic.getKey().getParentKeyName() + + axLogic.getKey().getParentLocalName() + axLogic.getKey().getLocalName(); } } diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java index bb16c90d1..528898d30 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/TestPolicyLogicReader.java @@ -63,7 +63,7 @@ public class TestPolicyLogicReader { fail("test should throw an exception here"); } catch (final Exception e) { assertEquals("logic not found for logic " - + "\"somewhere/over/the/rainbow/funkylogic/LogicParent_LogicInstanceName.funkylogic\"", + + "\"somewhere/over/the/rainbow/funkylogic/LogicParentLogicInstanceName.funkylogic\"", e.getMessage()); } @@ -73,7 +73,7 @@ public class TestPolicyLogicReader { fail("test should throw an exception here"); } catch (final Exception e) { assertEquals("logic not found for logic " + "\"somewhere/over/the/rainbow/funkylogic/" - + "LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic\"", e.getMessage()); + + "LogicParentLogicParentLocalNameLogicInstanceName.funkylogic\"", e.getMessage()); } plReader.setLogicPackage("path.to.apex.logic"); @@ -97,7 +97,7 @@ public class TestPolicyLogicReader { plReader.setDefaultLogic(null); try { final AxLogic logic = new AxLogic(logicKey, "JAVA", plReader); - assertEquals("somewhere.over.the.rainbow.java.LogicParent_LogicParentLocalName_LogicInstanceName", + assertEquals("somewhere.over.the.rainbow.java.LogicParentLogicParentLocalNameLogicInstanceName", logic.getLogic()); } catch (final Exception e) { fail("test should not throw an exception"); @@ -106,7 +106,7 @@ public class TestPolicyLogicReader { logicKey.setParentLocalName(AxKey.NULL_KEY_NAME); try { final AxLogic logic = new AxLogic(logicKey, "JAVA", plReader); - assertEquals("somewhere.over.the.rainbow.java.LogicParent_LogicInstanceName", logic.getLogic()); + assertEquals("somewhere.over.the.rainbow.java.LogicParentLogicInstanceName", logic.getLogic()); } catch (final Exception e) { fail("test should not throw an exception"); } diff --git a/model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParentLogicParentLocalNameLogicInstanceName.funkylogic b/model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParentLogicParentLocalNameLogicInstanceName.funkylogic new file mode 100644 index 000000000..7ccf3da88 --- /dev/null +++ b/model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParentLogicParentLocalNameLogicInstanceName.funkylogic @@ -0,0 +1,21 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START======================================================= +# Copyright (C) 2016-2018 Ericsson. 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 +# +# 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========================================================= +#------------------------------------------------------------------------------- + +Way out man, this is funky logic! \ No newline at end of file diff --git a/model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic b/model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic deleted file mode 100644 index 7ccf3da88..000000000 --- a/model/policy-model/src/test/resources/path/to/apex/logic/funkylogic/LogicParent_LogicParentLocalName_LogicInstanceName.funkylogic +++ /dev/null @@ -1,21 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START======================================================= -# Copyright (C) 2016-2018 Ericsson. 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 -# -# 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========================================================= -#------------------------------------------------------------------------------- - -Way out man, this is funky logic! \ No newline at end of file -- cgit 1.2.3-korg