From ba8c00de6520f97e72c3a4376cd0e78bba7e0311 Mon Sep 17 00:00:00 2001 From: Hailong Zhang Date: Sat, 31 Aug 2019 10:43:02 +0800 Subject: modify Sonar Issue Issue-ID: VNFSDK-462 Signed-off-by: Hailong Zhang Change-Id: Icfa60df4c1f658fe28ccf5dee01ec7d6449c2b5e --- .../onap/vnfsdk/marketplace/common/CommonConstant.java | 4 ++-- .../org/onap/vnfsdk/marketplace/common/FileUtil.java | 2 +- .../org/onap/vnfsdk/marketplace/common/ToolUtil.java | 7 ++----- .../onap/vnfsdk/marketplace/db/common/Parameters.java | 6 +++--- .../vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java | 14 ++++++++------ .../vnfsdk/marketplace/db/resource/PackageManager.java | 16 ++++++++-------- .../onap/vnfsdk/marketplace/entity/EnumOnboardState.java | 2 +- .../vnfsdk/marketplace/entity/EnumOperationalState.java | 2 +- .../onap/vnfsdk/marketplace/entity/EnumProcessState.java | 2 +- .../onap/vnfsdk/marketplace/entity/EnumUsageState.java | 2 +- .../org/onap/vnfsdk/marketplace/entity/VnfPackage.java | 4 ++-- .../marketplace/entity/request/PackageBasicInfo.java | 14 ++++++++------ .../marketplace/entity/response/CsarFileUriResponse.java | 7 ++++--- .../marketplace/filemanage/FileManagerFactory.java | 12 ++++++------ .../vnfsdk/marketplace/filemanage/FileManagerType.java | 2 +- .../java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java | 2 +- .../hooks/functiontest/FunctionTestExceutor.java | 16 ++++++++-------- .../onboarding/hooks/functiontest/FunctionTestHook.java | 16 ++++++++-------- .../hooks/validatelifecycle/LifecycleTestExceutor.java | 10 +++++----- .../onap/vnfsdk/marketplace/wrapper/PackageWrapper.java | 2 +- 20 files changed, 72 insertions(+), 70 deletions(-) (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main') diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java index c9ea1945..60d2a22a 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java @@ -81,7 +81,7 @@ public class CommonConstant { // Cannot create instance of the class } - public static class functionTest { + public static class FunctionTest { public static final String FUNCTEST_URL = "/onapapi/vnfsdk/v1/functest/"; @@ -93,7 +93,7 @@ public class CommonConstant { public static final String FUNCTEST_EXEC = "functestexec"; - private functionTest() { + private FunctionTest() { } } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java index 7789e55c..a080cb03 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java @@ -220,7 +220,7 @@ public final class FileUtil { } try { - if (false == ifs.getFD().valid()) { + if (!ifs.getFD().valid()) { logger.error("File descriptor is not valid"); return false; } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java index 55b02f7a..13a53c33 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java @@ -29,7 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; -import com.google.gson.JsonElement; + /** * common utility class. @@ -180,10 +180,7 @@ public class ToolUtil { * @return boolean */ public static boolean isYamlFile(File file) { - if(!file.isDirectory() && file.getName().indexOf(".yaml") != -1) { - return true; - } - return false; + return !file.isDirectory() && file.getName().indexOf(".yaml") != -1; } /** diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/common/Parameters.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/common/Parameters.java index 3567f495..b6d9b9a8 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/common/Parameters.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/common/Parameters.java @@ -16,7 +16,7 @@ package org.onap.vnfsdk.marketplace.db.common; public enum Parameters { - oid, name, provider, version, deletionPending, - type, status, csarId, vendor, serviceTemplateId, - nodeTemplateId, mappingId, nodeType; + OID, NAME, PROVIDER, VERSION, DELETIONPENDING, + TYPE, STATUS, CSARID, VENDOR, SERVICETEMPLATEID, + NODETEMPLATEID, MAPPINGID, NODETYPE; } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java index 79b08afd..f275cf91 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java @@ -43,6 +43,8 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { private SqlSessionFactory sqlSessionFactory = null; + private static final String EXCEPTION = "Exception caught {}"; + /** * * Constructor
@@ -71,7 +73,7 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { csars = mapper.getAllPackageData(); session.commit(); } catch(PersistenceException e) { - LOGGER.error("Exception caught {}", e); + LOGGER.error(EXCEPTION, e); } finally { session.close(); } @@ -87,7 +89,7 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { csars = mapper.getPackageDataSubset(paramsMap); session.commit(); } catch(PersistenceException e) { - LOGGER.error("Exception caught {}", e); + LOGGER.error(EXCEPTION, e); } finally { session.close(); } @@ -109,7 +111,7 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { mapper.savePackageData(lPackageData); session.commit(); } catch(PersistenceException e) { - LOGGER.error("Exception caught {}", e); + LOGGER.error(EXCEPTION, e); } finally { session.close(); } @@ -125,7 +127,7 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { csars = mapper.getPackageData(csarId); session.commit(); } catch(PersistenceException e) { - LOGGER.error("Exception caught {}", e); + LOGGER.error(EXCEPTION, e); } finally { session.close(); } @@ -140,7 +142,7 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { mapper.deletePackageData(csarId); session.commit(); } catch(PersistenceException e) { - LOGGER.error("Exception caught {}", e);; + LOGGER.error(EXCEPTION, e);; } finally { session.close(); } @@ -155,7 +157,7 @@ public class MarketplaceDaoImpl implements IMarketplaceDao { mapper.updatePackageData(oPackageData); session.commit(); } catch(PersistenceException e) { - LOGGER.error("Exception caught {}", e); + LOGGER.error(EXCEPTION, e); } finally { session.close(); } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/resource/PackageManager.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/resource/PackageManager.java index b7496d83..f1f9e2d4 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/resource/PackageManager.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/resource/PackageManager.java @@ -15,7 +15,7 @@ */ package org.onap.vnfsdk.marketplace.db.resource; -import java.util.ArrayList; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -44,9 +44,9 @@ public class PackageManager { return manager; } - private PackageManager() {} - /** + * private PackageManager() {} + * add package. * @param packageData package data * @return PackageData @@ -90,19 +90,19 @@ public class PackageManager { + version + " type:" + type); Map queryParam = new HashMap<>(); if (MarketplaceDbUtil.isNotEmpty(name)) { - queryParam.put(Parameters.name.name(), name); + queryParam.put(Parameters.NAME.name(), name); } if (MarketplaceDbUtil.isNotEmpty(version)) { - queryParam.put(Parameters.version.name(), version); + queryParam.put(Parameters.VERSION.name(), version); } if (MarketplaceDbUtil.isNotEmpty(deletionPending)) { - queryParam.put(Parameters.deletionPending.name(), deletionPending); + queryParam.put(Parameters.DELETIONPENDING.name(), deletionPending); } if (MarketplaceDbUtil.isNotEmpty(type)) { - queryParam.put(Parameters.type.name(), type); + queryParam.put(Parameters.TYPE.name(), type); } if (MarketplaceDbUtil.isNotEmpty(provider)) { - queryParam.put(Parameters.provider.name(), provider); + queryParam.put(Parameters.PROVIDER.name(), provider); } List data = handler.query(queryParam); LOGGER.info("query package info end.size:" + data.size() + "detail:" diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOnboardState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOnboardState.java index a90a254d..2748f20b 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOnboardState.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOnboardState.java @@ -16,7 +16,7 @@ package org.onap.vnfsdk.marketplace.entity; public enum EnumOnboardState { - onBoarded("onBoarded"), nonOnBoarded("non-onBoarded"); + ONBOARDED("onBoarded"), NONONBOARDED("non-onBoarded"); String value; diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOperationalState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOperationalState.java index f2c4c5f2..6c907e09 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOperationalState.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOperationalState.java @@ -16,5 +16,5 @@ package org.onap.vnfsdk.marketplace.entity; public enum EnumOperationalState { - Enabled, Disabled + ENABLED, DISABLED } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumProcessState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumProcessState.java index 1281dab3..c22db779 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumProcessState.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumProcessState.java @@ -16,5 +16,5 @@ package org.onap.vnfsdk.marketplace.entity; public enum EnumProcessState { - normal, onBoarding, onBoardFailed, deleting, deleteFailed + NORMAL, ONBOARDING, ONBOARDFAILED, DELETING, DELETEFAILED } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumUsageState.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumUsageState.java index 6d85093f..5338b2f9 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumUsageState.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumUsageState.java @@ -16,5 +16,5 @@ package org.onap.vnfsdk.marketplace.entity; public enum EnumUsageState { - InUse, NotInUse + INUSE, NOTINUSE } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/VnfPackage.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/VnfPackage.java index b6666461..06641a37 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/VnfPackage.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/VnfPackage.java @@ -21,8 +21,8 @@ public class VnfPackage { private String version; private String provider; private String vnfd; - private EnumOperationalState operationalState = EnumOperationalState.Disabled; - private EnumUsageState usageState = EnumUsageState.InUse; + private EnumOperationalState operationalState = EnumOperationalState.DISABLED; + private EnumUsageState usageState = EnumUsageState.INUSE; private String deletionPending; private String vnfPackageUrl; diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/request/PackageBasicInfo.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/request/PackageBasicInfo.java index ed07d3f5..032ab46f 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/request/PackageBasicInfo.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/request/PackageBasicInfo.java @@ -20,6 +20,14 @@ import org.onap.vnfsdk.marketplace.entity.EnumType; public class PackageBasicInfo { + private String provider; + + private EnumType type; + + private String version; + + private String format; + public String getProvider() { return provider; } @@ -52,12 +60,6 @@ public class PackageBasicInfo { this.format = format; } - private String provider; - - private EnumType type; - private String version; - - private String format; } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java index 7a5b6bae..8328ab2e 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java @@ -18,6 +18,10 @@ package org.onap.vnfsdk.marketplace.entity.response; public class CsarFileUriResponse { + private String downloadUri; + + private String localPath; + public String getDownloadUri() { return downloadUri; } @@ -34,7 +38,4 @@ public class CsarFileUriResponse { this.localPath = localPath; } - private String downloadUri; - - private String localPath; } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerFactory.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerFactory.java index e35e0fe0..91b64cb7 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerFactory.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerFactory.java @@ -21,11 +21,11 @@ import org.slf4j.LoggerFactory; public class FileManagerFactory { + private static final Logger logger = LoggerFactory.getLogger(FileManagerFactory.class); + private FileManagerFactory() { } - private static final Logger logger = LoggerFactory.getLogger(FileManagerFactory.class); - private static FileManager getHttpFileManager() { return new HttpFileManagerImpl(); } @@ -36,9 +36,9 @@ public class FileManagerFactory { */ public static FileManager createFileManager() { switch (getType()) { - case http: + case HTTP: return getHttpFileManager(); - case ftp: + case FTP: return null; default: return getHttpFileManager(); @@ -49,9 +49,9 @@ public class FileManagerFactory { String type = System.getenv("useFtp"); logger.info("read environment varibale uesFtp:" + type); if ((type != null) && "true".equals(type)) { - return FileManagerType.ftp; + return FileManagerType.FTP; } else { - return FileManagerType.http; + return FileManagerType.HTTP; } } } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerType.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerType.java index 9745d51d..8d537ba5 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerType.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerType.java @@ -16,7 +16,7 @@ package org.onap.vnfsdk.marketplace.filemanage; public enum FileManagerType { - ftp, http; + FTP, HTTP; public static FileManagerType getType(String type) { return valueOf(type); } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java index 96dc3ba7..9c769480 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java @@ -18,7 +18,7 @@ package org.onap.vnfsdk.marketplace.msb; public class MsbDetails { private MsbServer defaultServer; - private String ConnectTimeout; + private String connectTimeout; private String thread; private String idletimeout; private String timeout; diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java index 710736ff..4d7f0162 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java @@ -57,7 +57,7 @@ public class FunctionTestExceutor { logger.info("Package file path Function test:" + packagePath); // Validate package path - if (false == FileUtil.validatePath(packagePath)) { + if (!FileUtil.validatePath(packagePath)) { logger.error("Failed to validate path"); return funcTestId; } @@ -72,7 +72,7 @@ public class FunctionTestExceutor { InputStream inStream = new BufferedInputStream(ifs);) { // Validate input stream - if (false == FileUtil.validateStream(ifs)) { + if (!FileUtil.validateStream(ifs)) { logger.error("Failed to validate file stream"); return funcTestId; } @@ -80,7 +80,7 @@ public class FunctionTestExceutor { // IP and Port needs to be configured !!! RestResponse rsp = RestfulClient.post(oMsbDetails.getDefaultServer().getHost(), Integer.parseInt(oMsbDetails.getDefaultServer().getPort()), - CommonConstant.functionTest.FUNCTEST_URL, buildRequest(inStream)); + CommonConstant.FunctionTest.FUNCTEST_URL, buildRequest(inStream)); if (!checkValidResponse(rsp)) { logger.error("Failed to validate response"); return funcTestId; @@ -122,8 +122,8 @@ public class FunctionTestExceutor { logger.info("GetTestResultsByFuncTestKey for Function Test Results for :" + key); RestResponse rspGet = RestfulClient.get(oMsbDetails.getDefaultServer().getHost(), Integer.parseInt(oMsbDetails.getDefaultServer().getPort()), - CommonConstant.functionTest.FUNCTEST_RESULT_URL + key); - if (false == checkValidResponse(rspGet)) { + CommonConstant.FunctionTest.FUNCTEST_RESULT_URL + key); + if (!checkValidResponse(rspGet)) { logger.error("Failed to convert String Json Response to TestResults list:" + rspGet.getResult()); return result; } @@ -157,9 +157,9 @@ public class FunctionTestExceutor { logger.info("GetTestResultsByFuncTestKey for Function Test Results for :" + strJsonRequest); RestResponse rspGet = RestfulClient.sendPostRequest(oMsbDetails.getDefaultServer().getHost(), - oMsbDetails.getDefaultServer().getPort(), CommonConstant.functionTest.FUNCTEST_RESULT_URL, + oMsbDetails.getDefaultServer().getPort(), CommonConstant.FunctionTest.FUNCTEST_RESULT_URL, strJsonRequest); - if (false == checkValidResponse(rspGet)) { + if (!checkValidResponse(rspGet)) { logger.error("Failed to convert String Json Response to TestResults list:" + rspGet.getResult()); return result; } @@ -184,7 +184,7 @@ public class FunctionTestExceutor { return true; } - private static HttpEntity buildRequest(InputStream inputStream) throws FileNotFoundException { + private static HttpEntity buildRequest(InputStream inputStream) { MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addBinaryBody("file", inputStream); return builder.build(); diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java index d40a7c16..234892b2 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java @@ -64,13 +64,13 @@ public class FunctionTestHook { + onBoradingReq.getCsarId()); oFuncTestResult.setOperFinished(true); oFuncTestResult.setOperStatus(EnumResult.FAIL.getIndex()); - buildFuncTestResponse(oFuncTestResult, CommonConstant.functionTest.FUNCTEST_PACKAGE_EXISTS, + buildFuncTestResponse(oFuncTestResult, CommonConstant.FunctionTest.FUNCTEST_PACKAGE_EXISTS, EnumOperationStatus.FAILED.getIndex()); updateResult(oFuncTestResult); return EnumResult.FAIL.getIndex(); } - buildFuncTestResponse(oFuncTestResult, CommonConstant.functionTest.FUNCTEST_PACKAGE_EXISTS, + buildFuncTestResponse(oFuncTestResult, CommonConstant.FunctionTest.FUNCTEST_PACKAGE_EXISTS, EnumOperationStatus.SUCCESS.getIndex()); updateResult(oFuncTestResult); @@ -80,7 +80,7 @@ public class FunctionTestHook { if (null == functestResultKey) { oFuncTestResult.setOperFinished(true); oFuncTestResult.setOperStatus(EnumResult.FAIL.getIndex()); - buildFuncTestResponse(oFuncTestResult, CommonConstant.functionTest.FUNCTEST_EXEC, + buildFuncTestResponse(oFuncTestResult, CommonConstant.FunctionTest.FUNCTEST_EXEC, EnumOperationStatus.FAILED.getIndex()); updateResult(oFuncTestResult); return EnumResult.FAIL.getIndex(); @@ -88,7 +88,7 @@ public class FunctionTestHook { oFuncTestResult.setOperFinished(true); oFuncTestResult.setOperStatus(EnumResult.SUCCESS.getIndex()); - buildFuncTestResponse(oFuncTestResult, CommonConstant.functionTest.FUNCTEST_EXEC, + buildFuncTestResponse(oFuncTestResult, CommonConstant.FunctionTest.FUNCTEST_EXEC, EnumOperationStatus.SUCCESS.getIndex()); updateResult(oFuncTestResult); @@ -152,7 +152,7 @@ public class FunctionTestHook { ResultKey oResultKey = new ResultKey(); oResultKey.setCsarId(onBoradingReq.getCsarId()); - oResultKey.setOperTypeId(CommonConstant.functionTest.FUNCTEST_OPERTYPE_ID); + oResultKey.setOperTypeId(CommonConstant.FunctionTest.FUNCTEST_OPERTYPE_ID); oResultKey.setKey(resultKey); FileUtil.writeJsonDatatoFile(filePath.toString(), oResultKey); @@ -188,14 +188,14 @@ public class FunctionTestHook { private void buildFunctResponse(OnBoradingRequest onBoradingReq, OnBoardingResult oFuncTestResult) { oFuncTestResult.setOperFinished(false); oFuncTestResult.setCsarId(onBoradingReq.getCsarId()); - oFuncTestResult.setOperTypeId(CommonConstant.functionTest.FUNCTEST_OPERTYPE_ID); + oFuncTestResult.setOperTypeId(CommonConstant.FunctionTest.FUNCTEST_OPERTYPE_ID); OnBoardingOperResult oPackageExists = new OnBoardingOperResult(); - oPackageExists.setOperId(CommonConstant.functionTest.FUNCTEST_PACKAGE_EXISTS); + oPackageExists.setOperId(CommonConstant.FunctionTest.FUNCTEST_PACKAGE_EXISTS); oPackageExists.setStatus(EnumOperationStatus.NOTSTARTED.getIndex()); OnBoardingOperResult functTesExec = new OnBoardingOperResult(); - functTesExec.setOperId(CommonConstant.functionTest.FUNCTEST_EXEC); + functTesExec.setOperId(CommonConstant.FunctionTest.FUNCTEST_EXEC); functTesExec.setStatus(EnumOperationStatus.NOTSTARTED.getIndex()); List operResult = new ArrayList<>(); diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java index 0311c6b0..2d57fe21 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java @@ -62,7 +62,7 @@ public class LifecycleTestExceutor { String catalougeCsarId = null; // Validate package path - if (false == FileUtil.validatePath(packagePath)) { + if (!FileUtil.validatePath(packagePath)) { logger.error("Failed to validate package path"); return catalougeCsarId; } @@ -76,7 +76,7 @@ public class LifecycleTestExceutor { File fileData = new File(packagePath); // Validate file - if (false == FileUtil.validateFile(fileData)) { + if (!FileUtil.validateFile(fileData)) { logger.error("Failed to validate file information"); return catalougeCsarId; } @@ -88,7 +88,7 @@ public class LifecycleTestExceutor { RestResponse rsp = RestfulClient.post(oMsbDetails.getDefaultServer().getHost(), Integer.parseInt(oMsbDetails.getDefaultServer().getPort()), CommonConstant.CATALOUGE_UPLOAD_URL, builder.build()); - if (false == checkValidResponse(rsp)) { + if (!checkValidResponse(rsp)) { logger.error("Failed to upload package to catalouge:" + rsp.getStatusCode()); return catalougeCsarId; } @@ -119,7 +119,7 @@ public class LifecycleTestExceutor { logger.info("Package file path Function test:" + packagePath); // Validate package path - if (false == FileUtil.validatePath(packagePath)) { + if (!FileUtil.validatePath(packagePath)) { logger.error("Failed to validate path"); return result; } @@ -139,7 +139,7 @@ public class LifecycleTestExceutor { RestResponse oResponse = RestfulClient.sendPostRequest(oMsbDetails.getDefaultServer().getHost(), oMsbDetails.getDefaultServer().getPort(), CommonConstant.LifeCycleTest.LIFECYCLE_TEST_URL, rawDataJson); - if (false == checkValidResponse(oResponse)) { + if (!checkValidResponse(oResponse)) { logger.error("execlifecycleTest response is faliure :" + oResponse.getStatusCode()); return result; } diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java index cc79ca10..6aee857b 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java @@ -608,7 +608,7 @@ public class PackageWrapper { } private void handleDelayExec(String operId) { - if(0 == operId.compareToIgnoreCase(CommonConstant.functionTest.FUNCTEST_EXEC)) { + if(0 == operId.compareToIgnoreCase(CommonConstant.FunctionTest.FUNCTEST_EXEC)) { try { Thread.sleep(8000); } catch(InterruptedException e) { -- cgit 1.2.3-korg