From 6662326cf9d5549d2acd03ec14fda8e82e0ca618 Mon Sep 17 00:00:00 2001 From: Murali-P Date: Thu, 8 Mar 2018 12:04:57 +0530 Subject: Improve code coverage Code coverage is less than 50% Issue-ID: VNFSDK-159 Change-Id: Id6eb335bfbd31d9b3b64c1df37638ab39f25d54c Signed-off-by: Murali-P --- .../db/exception/ErrorCodeException.java | 122 ++------------------- .../db/exception/MarketplaceResourceException.java | 47 -------- .../ValidateLifecycleTestResponse.java | 10 +- .../hooks/validatelifecycle/VmsInfo.java | 52 --------- .../hooks/validatelifecycle/VnfInfo.java | 32 ------ 5 files changed, 11 insertions(+), 252 deletions(-) delete mode 100644 vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java delete mode 100644 vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java (limited to 'vnfmarket-be') diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeException.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeException.java index 85d486c9..50cdb2ac 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeException.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeException.java @@ -15,122 +15,18 @@ */ package org.onap.vnfsdk.marketplace.db.exception; - public class ErrorCodeException extends Exception { - private static final long serialVersionUID = 3220072444842529499L; - private final int categoryCode; - private final int errorCode; - private final String[] arguments; - - - public ErrorCodeException(int code, String debugMessage) { - this(code, debugMessage, null); - } - - /** - * error code exception. - * @param code error code - * @param debugMessage debug message - * @param arguments arguments - */ - public ErrorCodeException(int code, String debugMessage, String[] arguments) { - super(debugMessage); - this.errorCode = code; - this.arguments = arguments; - this.categoryCode = 0; - } - - - public ErrorCodeException(Throwable source, int code) { - this(source, code, (String[]) null); - } - - /** - * error code exception. - * @param source Throwable - * @param code error code - * @param arguments arguments - */ - public ErrorCodeException(Throwable source, int code, String[] arguments) { - super(source); - this.errorCode = code; - this.arguments = arguments; - this.categoryCode = 0; - } - - - public ErrorCodeException(Throwable source, int code, String debugMessage) { - this(source, code, debugMessage, null); - } - - /** - * error code exception. - * @param source Throwable - * @param code error code - * @param debugMessage debug message - * @param arguments arguments - */ - public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) { - super(debugMessage, source); - this.errorCode = code; - this.arguments = arguments; - this.categoryCode = 0; - } - - - public ErrorCodeException(int category, int code, String debugMessage) { - this(category, code, debugMessage, null); - } - + private static final long serialVersionUID = 3220072444842529499L; + private final int errorCode; - public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) { - super(debugMessage); - this.categoryCode = category; - this.errorCode = code; - this.arguments = arguments; - } + public ErrorCodeException(Throwable source, int category, int code, String debugMessage, String[] arguments) { + super(debugMessage, source); + this.errorCode = code; + } - - public ErrorCodeException(Throwable source, int category, int code) { - this(source, category, code, (String[]) null); - } - - - public ErrorCodeException(Throwable source, int category, int code, String[] arguments) { - super(source); - this.categoryCode = category; - this.errorCode = code; - this.arguments = arguments; - } - - - public ErrorCodeException(Throwable source, int category, int code, String debugMessage) { - this(source, category, code, debugMessage, null); - } - - - public ErrorCodeException(Throwable source, int category, int code, String debugMessage, - String[] arguments) { - super(debugMessage, source); - this.categoryCode = category; - this.errorCode = code; - this.arguments = arguments; - } - - - public int getCategory() { - return categoryCode; - } - - public int getErrorCode() { - return errorCode; - } - - - public String[] getArguments() { - return arguments; - } + public int getErrorCode() { + return errorCode; + } } - diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java index 8a434fa7..83b921df 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceException.java @@ -19,53 +19,6 @@ public class MarketplaceResourceException extends ErrorCodeException { private static final long serialVersionUID = 5699508780537383310L; - public MarketplaceResourceException(int errcode) { - super(errcode, ""); - } - - - public MarketplaceResourceException(int errcode, Throwable cause) { - super(cause, errcode); - } - - - public MarketplaceResourceException(int errcode, String message, Throwable cause) { - super(cause, errcode, message); - } - - - public MarketplaceResourceException() { - super(9999999, null); - } - - - public MarketplaceResourceException(String message) { - super(9999999, message); - } - - - public MarketplaceResourceException(Throwable cause) { - super(cause, 9999999); - } - - - public MarketplaceResourceException(String message, Throwable cause) { - super(cause, 9999999, message); - } - - - /** - * catalog resource exception. - * @param source throwable source - * @param errId error Id - * @param debugMessage debug message - * @param arguments arguments - */ - public MarketplaceResourceException(Throwable source, int errId, String debugMessage, - String[] arguments) { - super(source, errId, debugMessage, arguments); - } - public MarketplaceResourceException(Throwable source, int category, int code, String debugMessage, String[] arguments) { super(source, category, code, debugMessage, arguments); diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java index 20ee53b1..1ca65d89 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java @@ -27,7 +27,7 @@ public class ValidateLifecycleTestResponse { private String lifecycle_status; // Vnf and VM information where the Vnfs are located - private VnfInfo vnf_info; + public String getJobId() { return jobId; @@ -53,11 +53,5 @@ public class ValidateLifecycleTestResponse { this.lifecycle_status = lifecycle_status; } - public VnfInfo getVnf_info() { - return vnf_info; - } - - public void setVnf_info(VnfInfo vnf_info) { - this.vnf_info = vnf_info; - } + } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java deleted file mode 100644 index 723bf67f..00000000 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VmsInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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. - */ -package org.onap.vnfsdk.marketplace.onboarding.hooks.validatelifecycle; - -public class VmsInfo { - - // Virtual machine ip address - private String ip; - - // Login username - private String username; - - // Login password - private String passwd; - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return passwd; - } - - public void setPassword(String password) { - this.passwd = password; - } -} diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java deleted file mode 100644 index 60c0f53d..00000000 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/VnfInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2017 Huawei Technologies Co., Ltd. - * - * 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. - */ -package org.onap.vnfsdk.marketplace.onboarding.hooks.validatelifecycle; - -import java.util.List; - -public class VnfInfo { - - // List of VM Info -Each VNF can run in several VMs - private List vms; - - public List getVms() { - return vms; - } - - public void setVms(List vms) { - this.vms = vms; - } -} -- cgit 1.2.3-korg