summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be
diff options
context:
space:
mode:
authorHailong Zhang <zhanghailong22@huawei.com>2019-08-31 10:43:02 +0800
committerHailong Zhang <zhanghailong22@huawei.com>2019-08-31 10:43:02 +0800
commitba8c00de6520f97e72c3a4376cd0e78bba7e0311 (patch)
tree53fab307fb66b6ee22df227cc28f3e4cff365f29 /vnfmarket-be
parent536eab105dd7cb8dd3954fafa8cf7bf4e7dc032b (diff)
modify Sonar Issue
Issue-ID: VNFSDK-462 Signed-off-by: Hailong Zhang <zhanghailong22@huawei.com> Change-Id: Icfa60df4c1f658fe28ccf5dee01ec7d6449c2b5e
Diffstat (limited to 'vnfmarket-be')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/CommonConstant.java4
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/FileUtil.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/common/ToolUtil.java7
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/common/Parameters.java6
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/impl/MarketplaceDaoImpl.java14
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/db/resource/PackageManager.java16
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOnboardState.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumOperationalState.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumProcessState.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/EnumUsageState.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/VnfPackage.java4
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/request/PackageBasicInfo.java14
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/entity/response/CsarFileUriResponse.java7
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerFactory.java12
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/filemanage/FileManagerType.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java16
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java16
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java10
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java6
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java8
22 files changed, 79 insertions, 77 deletions
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<br/>
@@ -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<String, String> 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<PackageData> 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<OnBoardingOperResult> 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) {
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java
index 901251c3..e04af4fa 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/filemanage/FileManageTest.java
@@ -39,7 +39,7 @@ public class FileManageTest {
new MockUp<FileManagerFactory>() {
@Mock
private FileManagerType getType() {
- return FileManagerType.ftp;
+ return FileManagerType.FTP;
}
};
FileManager manager = FileManagerFactory.createFileManager();
@@ -76,7 +76,7 @@ public class FileManageTest {
new MockUp<FileManagerFactory>() {
@Mock
private FileManagerType getType() {
- return FileManagerType.http;
+ return FileManagerType.HTTP;
}
};
new MockUp<ToolUtil>() {
@@ -97,7 +97,7 @@ public class FileManageTest {
new MockUp<FileManagerFactory>() {
@Mock
private FileManagerType getType() {
- return FileManagerType.http;
+ return FileManagerType.HTTP;
}
};
new MockUp<ToolUtil>() {
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java
index 448db014..64df9fa9 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java
@@ -1389,9 +1389,9 @@ public class PackageResourceTest {
vnfPackageObj.setVnfPackageUrl("vnfPackageUrl");
vnfPackageObj.setVnfd("vnfd");
vnfPackageObj.setVersion("1");
- vnfPackageObj.setUsageState(EnumUsageState.NotInUse);
+ vnfPackageObj.setUsageState(EnumUsageState.NOTINUSE);
vnfPackageObj.setProvider("huawei");
- vnfPackageObj.setOperationalState(EnumOperationalState.Enabled);
+ vnfPackageObj.setOperationalState(EnumOperationalState.ENABLED);
vnfPackageObj.setName("vnf");
vnfPackageObj.setDeletionPending("pending");
@@ -1404,11 +1404,11 @@ public class PackageResourceTest {
res = vnfPackageObj.getVersion();
assertEquals(res, "1");
EnumUsageState state = vnfPackageObj.getUsageState();
- assertEquals(state, EnumUsageState.NotInUse);
+ assertEquals(state, EnumUsageState.NOTINUSE);
res = vnfPackageObj.getProvider();
assertEquals(res, "huawei");
EnumOperationalState operState = vnfPackageObj.getOperationalState();
- assertEquals(operState, EnumOperationalState.Enabled);
+ assertEquals(operState, EnumOperationalState.ENABLED);
res = vnfPackageObj.getName();
assertEquals(res, "vnf");
res = vnfPackageObj.getDeletionPending();