summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-06-24 12:14:27 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-07-05 09:56:45 +0000
commit6d95c7cfb45cebed0de5e31fae5874ffaa0fb577 (patch)
treed12008d75d4200431155b262928dde6b099a1913
parent3d6e3667d00c45585421dade93b00de174144cca (diff)
Fix sonar issues
Fix sonar/checkstyle issues in sdc code Issue-ID: SDC-3158 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ib6ee78fd5756d615c2a103ac0d7d26070fd24206
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java68
1 files changed, 25 insertions, 43 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
index 236f819063..cad059cd01 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/RemoveUtils.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,45 +27,27 @@ import org.openecomp.sdc.asdctool.impl.ProductLogic;
*/
public class RemoveUtils {
- public static void main(String[] args) {
-
- if (args == null || args.length < 1) {
- removeUsage();
- }else {
- String operation = args[0];
- if(operation.equalsIgnoreCase("remove-products")) {
- boolean isValid = verifyParamsLength(args, 5);
- if (!isValid) {
- removeUsage();
- System.exit(1);
- }
- ProductLogic productLogic = new ProductLogic();
- boolean result = productLogic.deleteAllProducts(args[1], args[2], args[3], args[4]);
-
- if (!result) {
- System.exit(2);
- }
- }else {
- removeUsage();
- }
- }
- }
-
- private static void removeUsage() {
- System.out.println("Usage: remove-products <janusgraph.properties> <BE host> <BE port> <admin user>");
- }
-
- private static boolean verifyParamsLength(String[] args, int i) {
- if (args == null) {
- if (i > 0) {
- return false;
- }
- return true;
- }
-
- if (args.length >= i) {
- return true;
- }
- return false;
- }
+ public static void main(String[] args) {
+ if (args == null || args.length == 0) {
+ showRemoveUsage();
+ System.exit(1);
+ } else if (args[0].equalsIgnoreCase("remove-products") && verifyParamsLength(args, 5)) {
+ if (!new ProductLogic().deleteAllProducts(args[1], args[2], args[3], args[4])) {
+ System.exit(2);
+ }
+ } else {
+ showRemoveUsage();
+ }
+ }
+
+ private static void showRemoveUsage() {
+ System.out.println("Usage: remove-products <janusgraph.properties> <BE host> <BE port> <admin user>");
+ }
+
+ private static boolean verifyParamsLength(String[] args, int nbOfArgumentsMin) {
+ if (args == null) {
+ return nbOfArgumentsMin == 0;
+ }
+ return args.length >= nbOfArgumentsMin;
+ }
}