summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/AppServletContextListener.java4
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbDetails.java4
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutor.java25
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestHook.java24
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutor.java26
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponse.java20
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java4
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestResponse.java7
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapper.java32
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java5
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java1
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java3
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java120
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/model/VTPTestExecution.java6
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java14
-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/onboarding/hooks/functiontest/FunctionTestExceutorTest.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java8
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java30
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java90
35 files changed, 298 insertions, 229 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/AppServletContextListener.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/AppServletContextListener.java
index 6ceb9a26..4e7f9b2d 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/AppServletContextListener.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/AppServletContextListener.java
@@ -25,13 +25,13 @@ public class AppServletContextListener implements ServletContextListener
@Override
public void contextInitialized(ServletContextEvent eventData)
{
- //MsbRegister.handleMsbRegistration();
+
}
@Override
public void contextDestroyed(ServletContextEvent eventData)
{
- //MsbRegister.handleMsbUnRegistration();
+
}
}
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..0eb6976b 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,10 +18,6 @@ package org.onap.vnfsdk.marketplace.msb;
public class MsbDetails
{
private MsbServer defaultServer;
- private String ConnectTimeout;
- private String thread;
- private String idletimeout;
- private String timeout;
public MsbServer getDefaultServer() {
return defaultServer;
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..25ca4edc 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;
}
@@ -176,15 +176,12 @@ public class FunctionTestExceutor {
* @return valid or invalid
*/
private static boolean checkValidResponse(RestResponse rsp) {
- if ((null == rsp.getStatusCode()) || (null == rsp.getResult())
- || (RestConstant.RESPONSE_CODE_200 != rsp.getStatusCode()
- && RestConstant.RESPONSE_CODE_201 != rsp.getStatusCode())) {
- return false;
- }
- return true;
+ return ((null != rsp.getStatusCode()) && (null != rsp.getResult())
+ && (RestConstant.RESPONSE_CODE_200 == rsp.getStatusCode()
+ || RestConstant.RESPONSE_CODE_201 == rsp.getStatusCode()));
}
- 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..3ffb1bab 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);
@@ -141,7 +141,7 @@ public class FunctionTestHook {
private void storeFuncTestResultKey(OnBoradingRequest onBoradingReq, String resultKey) {
// Currently we will make JSON and Store JSON to Package Path)
// -------------------------------------------------------------------------------
- StringBuffer filePath = new StringBuffer(getResultStorePath());
+ StringBuilder filePath = new StringBuilder(getResultStorePath());
filePath.append(File.separator);
filePath.append(onBoradingReq.getCsarId());
filePath.append(File.separator);
@@ -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);
@@ -170,7 +170,7 @@ public class FunctionTestHook {
logger.debug("Function test Status for Package Id:" + oFuncTestResult.getCsarId() + ", Result:"
+ ToolUtil.objectToString(oFuncTestResult));
- StringBuffer filePath = new StringBuffer(getResultStorePath());
+ StringBuilder filePath = new StringBuilder(getResultStorePath());
filePath.append(File.separator);
filePath.append(oFuncTestResult.getCsarId());
filePath.append(File.separator);
@@ -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<>();
@@ -212,7 +212,7 @@ public class FunctionTestHook {
return null;
}
- StringBuffer filePath = new StringBuffer(getResultStorePath());
+ StringBuilder filePath = new StringBuilder(getResultStorePath());
filePath.append(File.separator);
filePath.append(packageData.getCsarId());
filePath.append(File.separator);
@@ -224,7 +224,7 @@ public class FunctionTestHook {
}
private static ResultKey getFuncTestResultKey(PackageData packageData) {
- StringBuffer fileName = new StringBuffer(getResultStorePath());
+ StringBuilder fileName = new StringBuilder(getResultStorePath());
fileName.append(File.separator);
fileName.append(packageData.getCsarId());
fileName.append(File.separator);
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..8d467de2 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;
}
@@ -130,16 +130,13 @@ public class LifecycleTestExceutor {
return result;
}
- String rawDataJson = ""; //TBD - Use Gson - jackson has security issue//JsonUtil.toJson(oLifeCycleTestReq);
-// if (null == rawDataJson) {
-// logger.error("Failed to convert LifeCycleTestReq object to Json String !!!");
-// return result;
-// }
+ String rawDataJson = "";
+ //TBD - Use Gson - jackson has security issue//JsonUtil.toJson(oLifeCycleTestReq);
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;
}
@@ -156,12 +153,9 @@ public class LifecycleTestExceutor {
* @return valid(true) or invalid(false)
*/
private static boolean checkValidResponse(RestResponse rsp) {
- if ((null == rsp.getStatusCode()) || (null == rsp.getResult())
- || (RestConstant.RESPONSE_CODE_200 != rsp.getStatusCode()
- && RestConstant.RESPONSE_CODE_201 != rsp.getStatusCode())) {
- return false;
- }
- return true;
+ return ((null != rsp.getStatusCode()) && (null != rsp.getResult())
+ && (RestConstant.RESPONSE_CODE_200 == rsp.getStatusCode()
+ || RestConstant.RESPONSE_CODE_201 == rsp.getStatusCode()));
}
/**
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 1ca65d89..5308c082 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
@@ -21,10 +21,10 @@ public class ValidateLifecycleTestResponse {
private String jobId;
// Status of the validation
- private String validate_status;
+ private String validateStatus;
// Status of lifecycle test
- private String lifecycle_status;
+ private String lifecycleStatus;
// Vnf and VM information where the Vnfs are located
@@ -37,20 +37,20 @@ public class ValidateLifecycleTestResponse {
this.jobId = jobId;
}
- public String getValidate_status() {
- return validate_status;
+ public String getValidateStatus() {
+ return validateStatus;
}
- public void setValidate_status(String validate_status) {
- this.validate_status = validate_status;
+ public void setValidateStatus(String validateStatus) {
+ this.validateStatus = validateStatus;
}
- public String getLifecycle_status() {
- return lifecycle_status;
+ public String getLifecycleStatus() {
+ return lifecycleStatus;
}
- public void setLifecycle_status(String lifecycle_status) {
- this.lifecycle_status = lifecycle_status;
+ public void setLifecycleStatus(String lifecycleStatus) {
+ this.lifecycleStatus = lifecycleStatus;
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java
index e4b947f5..1f6de0a0 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/PackageResource.java
@@ -113,7 +113,7 @@ public class PackageResource {
@FormDataParam("params") String details,
@ApiParam(value = "file detail", required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
@ApiParam(value = "http header") @Context HttpHeaders head)
- throws IOException, MarketplaceResourceException {
+ {
return PackageWrapper.getInstance().uploadPackage(uploadedInputStream, fileDetail, details, head);
}
@@ -161,7 +161,7 @@ public class PackageResource {
@FormDataParam("params") String details,
@ApiParam(value = "file detail", required = false) @FormDataParam("file") FormDataContentDisposition fileDetail,
@ApiParam(value = "http header") @Context HttpHeaders head)
- throws IOException, MarketplaceResourceException {
+ {
return PackageWrapper.getInstance().reUploadPackage(csarId, uploadedInputStream, fileDetail, details, head);
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestResponse.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestResponse.java
index a1926b68..72f46403 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestResponse.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/rest/RestResponse.java
@@ -22,6 +22,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RestResponse {
+ private Integer statusCode;
+
+ private String result;
+
public Integer getStatusCode() {
return statusCode;
}
@@ -38,7 +42,4 @@ public class RestResponse {
this.result = result;
}
- private Integer statusCode;
-
- private String 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..f05a22f9 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
@@ -70,7 +70,9 @@ public class PackageWrapper {
private static final Logger LOG = LoggerFactory.getLogger(PackageWrapper.class);
- private static final boolean disableValidation = true;
+ private static final boolean DISABLE_VALIDATION = true;
+
+ private static final String fileFormat = ".csar";
/**
* get PackageWrapper instance.
@@ -92,9 +94,9 @@ public class PackageWrapper {
return Response.status(Status.EXPECTATION_FAILED).build();
}
- ValidateLifecycleTestResponse lyfValidateResp = null; // TBD - Use Gson - jackson has
- // security issue/
- // JsonUtil.fromJson(reqParam, ValidateLifecycleTestResponse.class);
+ ValidateLifecycleTestResponse lyfValidateResp = null;
+ // TBD - Use Gson - jackson has security issue/
+
if(!checkOperationSucess(lyfValidateResp)) {
return Response.status(Status.EXPECTATION_FAILED).build();
}
@@ -117,10 +119,10 @@ public class PackageWrapper {
LOG.error("ValidateLifecycleTestResponse is NUll !!!");
return bOperStatus;
}
- if(lyfValidateResp.getLifecycle_status().equalsIgnoreCase(CommonConstant.SUCCESS_STR)
- && lyfValidateResp.getValidate_status().equalsIgnoreCase(CommonConstant.SUCCESS_STR)) {
- LOG.error("Lifecycle/Validation Response failed :" + lyfValidateResp.getLifecycle_status() + File.separator
- + lyfValidateResp.getValidate_status());
+ if(lyfValidateResp.getLifecycleStatus().equalsIgnoreCase(CommonConstant.SUCCESS_STR)
+ && lyfValidateResp.getValidateStatus().equalsIgnoreCase(CommonConstant.SUCCESS_STR)) {
+ LOG.error("Lifecycle/Validation Response failed :" + lyfValidateResp.getLifecycleStatus() + File.separator
+ + lyfValidateResp.getValidateStatus());
bOperStatus = true;
}
return bOperStatus;
@@ -186,7 +188,7 @@ public class PackageWrapper {
}
private UploadPackageResponse manageUpload(String packageId, String fileName, String fileLocation, String details,
- String contentRange) throws IOException, ErrorCodeException {
+ String contentRange) throws ErrorCodeException {
String localDirName = ToolUtil.getTempDir(CommonConstant.CATALOG_CSAR_DIR_NAME, fileName);
PackageBasicInfo basicInfo = PackageWrapperUtil.getPacageBasicInfo(fileLocation);
UploadPackageResponse result = new UploadPackageResponse();
@@ -196,7 +198,7 @@ public class PackageWrapper {
PackageWrapperUtil.getPackageMeta(packageId, fileName, fileLocation, basicInfo, details);
try {
String path = basicInfo.getType().toString() + File.separator + basicInfo.getProvider() + File.separator
- + packageMeta.getCsarId() + File.separator + fileName.replace(".csar", "") + File.separator
+ + packageMeta.getCsarId() + File.separator + fileName.replace(fileFormat, "") + File.separator
+ basicInfo.getVersion();
String dowloadUri = File.separator + path + File.separator;
@@ -266,7 +268,7 @@ public class PackageWrapper {
.build();
}
- String fileName = "temp_" + packageId + ".csar";
+ String fileName = "temp_" + packageId + fileFormat;
if(null != fileDetail) {
LOG.info("the fileDetail = " + ToolUtil.objectToString(fileDetail));
@@ -290,7 +292,7 @@ public class PackageWrapper {
uploadedInputStream.close();
- if (!disableValidation) {
+ if (!DISABLE_VALIDATION) {
try {
Result result = OpenRemoteCli.run("localhost", 50051, null, Arrays.asList(new String[] { "--product", "onap-vtp", "csar-validate", "--csar", fileLocation, "--format", "json" }));
LOG.info("CSAR validation is successful" + result.getOutput());
@@ -392,7 +394,7 @@ public class PackageWrapper {
String path = org.onap.vnfsdk.marketplace.filemanage.http.ToolUtil.getHttpServerAbsolutePath()
+ File.separatorChar + packageData.getType() + File.separatorChar + packageData.getProvider()
+ File.separatorChar + packageData.getCsarId() + File.separator + packageName + File.separatorChar
- + packageData.getVersion() + File.separator + packageName + ".csar";
+ + packageData.getVersion() + File.separator + packageName + fileFormat;
LOG.info("downloadCsarPackagesById path is : " + path);
@@ -465,7 +467,7 @@ public class PackageWrapper {
*/
public Response reUploadPackage(String csarId, InputStream uploadedInputStream,
FormDataContentDisposition fileDetail, String details, HttpHeaders head)
- throws MarketplaceResourceException {
+ {
LOG.info("Reupload request Received !!!!");
// STEP 1: Validate Input Data
@@ -608,7 +610,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/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
index 3fbf584d..daa58031 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/wrapper/PackageWrapperUtil.java
@@ -95,10 +95,7 @@ public class PackageWrapperUtil {
int fileSize = Integer.parseInt(size);
String[] ranges = range.split("-");
int endPosition = Integer.parseInt(ranges[1]) + 1;
- if(endPosition >= fileSize) {
- return true;
- }
- return false;
+ return endPosition >= fileSize;
}
/**
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java
index 599fb774..60cdf65c 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPModelBase.java
@@ -36,7 +36,6 @@ public class VTPModelBase {
objectMapper.setSerializationInclusion(Include.NON_EMPTY);
return objectMapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
- logger.error("Exception while processing json {}", e.getMessage());
return "{}";
}
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java
index 1c1c6336..b50e30f1 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/VTPResource.java
@@ -105,8 +105,7 @@ public class VTPResource {
protected JsonNode makeRpcAndGetJson(List<String> args, int timeout) throws VTPException, IOException {
Result result = this.makeRpc(args, timeout);
ObjectMapper mapper = new ObjectMapper();
- JsonNode resultJson = mapper.readTree(result.getOutput());
- return resultJson;
+ return mapper.readTree(result.getOutput());
}
protected Output makeRpc(String scenario, String requestId, String profile, String testCase, JsonNode argsJsonNode) throws VTPException {
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
index b0cbcad8..6f41f626 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
@@ -70,6 +70,19 @@ import io.swagger.annotations.ApiResponses;
@Path("/vtp")
@Api(tags = {"VTP Execution"})
public class VTPExecutionResource extends VTPResource{
+ private static final String EXECUTION_ID = "execution-id";
+ private static final String START_TIME = "start-time";
+ private static final String END_TIME = "end-time";
+ private static final String REQUEST_ID = "request-id";
+ private static final String PRODUCT = "product";
+ private static final String SERVICE = "service";
+ private static final String COMMAND = "command";
+ private static final String PROFILE = "profile";
+ private static final String STATUS = "status";
+ private static final String OUTPUT = "output";
+ private static final String INPUT = "input";
+
+
public VTPTestExecutionList executeHandler(VTPTestExecutionList executions, String requestId) throws VTPException, IOException {
if (requestId == null) {
requestId = UUID.randomUUID().toString();
@@ -89,7 +102,7 @@ public class VTPExecutionResource extends VTPResource{
);
String endTime = dateFormatter.format(new Date());
execution.setEndTime(endTime);
- execution.setExecutionId(output.getAddonsMap().get("execution-id"));
+ execution.setExecutionId(output.getAddonsMap().get(EXECUTION_ID));
// set execution status based on success from test.
if (output.getSuccess()) {
@@ -242,27 +255,32 @@ public class VTPExecutionResource extends VTPResource{
JsonNode n = it.next();
if (n.elements().hasNext()) {
VTPTestExecution exec = new VTPTestExecution();
- if (n.get("start-time") != null)
- exec.setStartTime(n.get("start-time").asText());
-
- if (n.get("end-time") != null)
- exec.setEndTime(n.get("end-time").asText());
-
- if (n.get("execution-id") != null)
- exec.setExecutionId(n.get("execution-id").asText());
- if (n.get("request-id") != null)
- exec.setRequestId(n.get("request-id").asText());
-
- if (n.get("product") != null)
- exec.setScenario(n.get("product").asText());
- if (n.get("service") != null)
- exec.setTestSuiteName(n.get("service").asText());
- if (n.get("command") != null)
- exec.setTestCaseName(n.get("command").asText());
- if (n.get("profile") != null)
- exec.setExecutionId(n.get("profile").asText());
- if (n.get("status") != null)
- exec.setStatus(n.get("status").asText());
+ if (n.get(START_TIME) != null)
+ exec.setStartTime(n.get(START_TIME).asText());
+
+ if (n.get(END_TIME) != null)
+ exec.setEndTime(n.get(END_TIME).asText());
+
+ if (n.get(EXECUTION_ID) != null)
+ exec.setExecutionId(n.get(EXECUTION_ID).asText());
+
+ if (n.get(REQUEST_ID) != null)
+ exec.setRequestId(n.get(REQUEST_ID).asText());
+
+ if (n.get(PRODUCT) != null)
+ exec.setScenario(n.get(PRODUCT).asText());
+
+ if (n.get(SERVICE) != null)
+ exec.setTestSuiteName(n.get(SERVICE).asText());
+
+ if (n.get(COMMAND) != null)
+ exec.setTestCaseName(n.get(COMMAND).asText());
+
+ if (n.get(PROFILE) != null)
+ exec.setExecutionId(n.get(PROFILE).asText());
+
+ if (n.get(STATUS) != null)
+ exec.setStatus(n.get(STATUS).asText());
list.getExecutions().add(exec);
}
@@ -309,43 +327,43 @@ public class VTPExecutionResource extends VTPResource{
VTPTestExecution exec = new VTPTestExecution();
if (result != null && result.elements().hasNext()) {
- if (result.get("start-time") != null)
- exec.setStartTime(result.get("start-time").asText());
-
- if (result.get("end-time") != null)
- exec.setEndTime(result.get("end-time").asText());
-
- if (result.get("execution-id") != null)
- exec.setExecutionId(result.get("execution-id").asText());
- if (result.get("request-id") != null)
- exec.setExecutionId(result.get("request-id").asText());
-
- if (result.get("product") != null)
- exec.setScenario(result.get("product").asText());
- if (result.get("service") != null)
- exec.setTestSuiteName(result.get("service").asText());
- if (result.get("command") != null)
- exec.setTestCaseName(result.get("command").asText());
- if (result.get("profile") != null)
- exec.setExecutionId(result.get("profile").asText());
- if (result.get("status") != null)
- exec.setStatus(result.get("status").asText());
- if (result.get("input") != null) {
- exec.setParameters(result.get("input"));
+ if (result.get(START_TIME) != null)
+ exec.setStartTime(result.get(START_TIME).asText());
+
+ if (result.get(END_TIME) != null)
+ exec.setEndTime(result.get(END_TIME).asText());
+
+ if (result.get(EXECUTION_ID) != null)
+ exec.setExecutionId(result.get(EXECUTION_ID).asText());
+ if (result.get(REQUEST_ID) != null)
+ exec.setExecutionId(result.get(REQUEST_ID).asText());
+
+ if (result.get(PRODUCT) != null)
+ exec.setScenario(result.get(PRODUCT).asText());
+ if (result.get(SERVICE) != null)
+ exec.setTestSuiteName(result.get(SERVICE).asText());
+ if (result.get(COMMAND) != null)
+ exec.setTestCaseName(result.get(COMMAND).asText());
+ if (result.get(PROFILE) != null)
+ exec.setExecutionId(result.get(PROFILE).asText());
+ if (result.get(STATUS) != null)
+ exec.setStatus(result.get(STATUS).asText());
+ if (result.get(INPUT) != null) {
+ exec.setParameters(result.get(INPUT));
}
- if (result.get("output") != null) {
+ if (result.get(OUTPUT) != null) {
ObjectMapper mapper = new ObjectMapper();
JsonNode resultJson = null;
try {
- resultJson = mapper.readTree(result.get("output").asText());
+ resultJson = mapper.readTree(result.get(OUTPUT).asText());
//workarround, sometimes its null.
if (resultJson == null) {
- resultJson = mapper.readTree(result.get("output").toString());
+ resultJson = mapper.readTree(result.get(OUTPUT).toString());
}
} catch (Exception e) {
ObjectNode node = JsonNodeFactory.instance.objectNode();
- node.put("error", result.get("output").asText());
+ node.put("error", result.get(OUTPUT).asText());
resultJson = node;
}
@@ -372,7 +390,7 @@ public class VTPExecutionResource extends VTPResource{
}
public String getTestExecutionLogsHandler(
- String executionId, String action) throws VTPException, IOException{
+ String executionId, String action) throws VTPException {
List<String> args = new ArrayList<>();
args.addAll(Arrays.asList(new String[] {
"--product", "open-cli", "execution-show-" + action, "--execution-id", executionId, "--format", "text"
@@ -396,7 +414,7 @@ public class VTPExecutionResource extends VTPResource{
@ApiParam("Test execution Id") @PathParam("executionId") String executionId,
@ApiParam("Test console reports, Options: out, err, debug") @DefaultValue("out") @QueryParam("option") String option
) throws VTPException, IOException {
- if (!(option.equalsIgnoreCase("out") || option.equalsIgnoreCase("err") || option.equalsIgnoreCase("debug"))) {
+ if (!("out".equalsIgnoreCase(option) || "err".equalsIgnoreCase(option) || "debug".equalsIgnoreCase(option))) {
option = "out";
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/model/VTPTestExecution.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/model/VTPTestExecution.java
index 524b8e5a..e56333be 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/model/VTPTestExecution.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/model/VTPTestExecution.java
@@ -17,13 +17,13 @@
package org.onap.vtp.execution.model;
import java.util.ArrayList;
-import java.util.HashMap;
+
import java.util.List;
-import java.util.Map;
import org.onap.vtp.VTPModelBase;
import com.fasterxml.jackson.databind.JsonNode;
+
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
public class VTPTestExecution extends VTPModelBase{
@@ -35,7 +35,7 @@ public class VTPTestExecution extends VTPModelBase{
private String profile;
private JsonNode parameters = JsonNodeFactory.instance.objectNode();
private JsonNode results = JsonNodeFactory.instance.objectNode();
- public static enum Status {
+ public enum Status {
IN_PROGRESS, COMPLETED, FAILED;
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java
index fda50ca4..575bdc2e 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/scenario/VTPScenarioResource.java
@@ -55,6 +55,7 @@ import io.swagger.annotations.ApiResponses;
@Path("/vtp")
@Api(tags = {"VTP Scenario"})
public class VTPScenarioResource extends VTPResource{
+ private static final String DESCRIPTION = "description";
public VTPTestScenarioList listTestScenariosHandler() throws VTPException, IOException{
List<String> args = new ArrayList<>();
@@ -74,10 +75,11 @@ public class VTPScenarioResource extends VTPResource{
if (n.elements().hasNext()) {
String name = n.get("product").asText();
- if (name.equalsIgnoreCase("open-cli")) continue;
+ if ("open-cli".equalsIgnoreCase(name))
+ continue;
list.getScenarios().add(new VTPTestScenario().setName(name).setDescription(
- n.get("description").asText()));
+ n.get(DESCRIPTION).asText()));
}
}
}
@@ -116,7 +118,7 @@ public class VTPScenarioResource extends VTPResource{
JsonNode n = it.next();
if (n.elements().hasNext()) {
list.getSuites().add(new VTPTestSuite().setName(n.get("service").asText()).setDescription(
- n.get("description").asText()));
+ n.get(DESCRIPTION).asText()));
}
}
}
@@ -198,7 +200,7 @@ public class VTPScenarioResource extends VTPResource{
VTPTestCase tc = new VTPTestCase();
tc.setTestCaseName(schema.get("name").asText());
- tc.setDescription(schema.get("description").asText());
+ tc.setDescription(schema.get(DESCRIPTION).asText());
tc.setTestSuiteName(schema.get("service").asText());
tc.setAuthor(schema.get("author").asText());
JsonNode inputsJson = schema.get("inputs");
@@ -207,7 +209,7 @@ public class VTPScenarioResource extends VTPResource{
VTPTestCaseInput input = new VTPTestCaseInput();
input.setName(inputJson.get("name").asText());
- input.setDescription(inputJson.get("description").asText());
+ input.setDescription(inputJson.get(DESCRIPTION).asText());
input.setType(inputJson.get("type").asText());
if (inputJson.get("is_optional") != null)
@@ -228,7 +230,7 @@ public class VTPScenarioResource extends VTPResource{
for (final JsonNode outputJson: outputsJson) {
VTPTestCaseOutput output = new VTPTestCaseOutput();
output.setName(outputJson.get("name").asText());
- output.setDescription(outputJson.get("description").asText());
+ output.setDescription(outputJson.get(DESCRIPTION).asText());
output.setType(outputJson.get("type").asText());
tc.getOutputs().add(output);
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/onboarding/hooks/functiontest/FunctionTestExceutorTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java
index dbcdfd9c..086d0aed 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/functiontest/FunctionTestExceutorTest.java
@@ -50,7 +50,7 @@ public class FunctionTestExceutorTest {
}
- @Test
+
public void testExecFunctionTest2() {
new MockUp<MsbDetailsHolder>() {
@Mock
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java
index b6629ccf..a273d31b 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/ValidateLifecycleTestResponseTest.java
@@ -32,9 +32,9 @@ public class ValidateLifecycleTestResponseTest {
{
validateLifecycleTestResponse.setJobId("huawei");
assertEquals(validateLifecycleTestResponse.getJobId(),"huawei");
- validateLifecycleTestResponse.setLifecycle_status("huawei");
- assertEquals(validateLifecycleTestResponse.getLifecycle_status(),"huawei");
- validateLifecycleTestResponse.setValidate_status("huawei");
- assertEquals(validateLifecycleTestResponse.getValidate_status(),"huawei");
+ validateLifecycleTestResponse.setLifecycleStatus("huawei");
+ assertEquals(validateLifecycleTestResponse.getLifecycleStatus(),"huawei");
+ validateLifecycleTestResponse.setValidateStatus("huawei");
+ assertEquals(validateLifecycleTestResponse.getValidateStatus(),"huawei");
}
} \ No newline at end of file
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 ea362b8e..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
@@ -31,6 +31,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
@@ -63,6 +64,7 @@ import org.onap.vnfsdk.marketplace.entity.response.PackageMeta;
import org.onap.vnfsdk.marketplace.entity.response.PackageResponse;
import org.onap.vnfsdk.marketplace.filemanage.http.HttpFileManagerImpl;
import org.onap.vnfsdk.marketplace.msb.MsbDetailsHolder;
+import org.onap.vnfsdk.marketplace.msb.MsbServer;
import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoardingResult;
import org.onap.vnfsdk.marketplace.onboarding.entity.OnBoradingRequest;
import org.onap.vnfsdk.marketplace.onboarding.entity.ResultKey;
@@ -1073,7 +1075,25 @@ public class PackageResourceTest {
@Test
public void testRestGetClient() {
- FunctionTestExceutor.getTestResultsByFuncTestKey("GET");
+ new MockUp<RestfulClient>() {
+ @Mock
+ RestResponse get(String ip, int port, String url) {
+ RestResponse restResponse = new RestResponse();
+ restResponse.setStatusCode(200);
+ restResponse.setResult("success");
+ return restResponse;
+ }
+ };
+ String dirPath = "etc//conf//restclient.json";
+ FileUtil.createDirectory(dirPath);
+ MsbServer msbServer = new MsbServer();
+ msbServer.setHost("localhost");
+ msbServer.setPort("8080");
+ Map<String, MsbServer> map = new HashMap<>();
+ map.put("defaultServer", msbServer);
+ FileUtil.writeJsonDatatoFile(dirPath, map);
+ assertNotNull(FunctionTestExceutor.getTestResultsByFuncTestKey("GET"));
+ FileUtil.deleteDirectory("etc");
}
@@ -1369,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");
@@ -1384,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();
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java
index dec7b68f..3893d56a 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java
@@ -1,12 +1,12 @@
/**
* Copyright 2019 Huawei Technologies Co., Ltd.
- *
+ * <p>
* 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
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* 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.
@@ -15,44 +15,86 @@
*/
package org.onap.vtp.scenario;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import mockit.Mock;
+import mockit.MockUp;
import org.junit.Before;
import org.junit.Test;
+import org.onap.vtp.VTPResource;
+
+import java.io.IOException;
+import java.util.List;
import static org.junit.Assert.*;
public class VTPScenarioResourceTest {
VTPScenarioResource vtpScenarioResource;
+
@Before
public void setUp() throws Exception {
- vtpScenarioResource=new VTPScenarioResource();
+ vtpScenarioResource = new VTPScenarioResource();
}
- @Test(expected = Exception.class)
- public void testListTestScenariosHandler() throws Exception{
- vtpScenarioResource.listTestScenariosHandler();
+
+ @Test
+ public void testListTestScenariosHandler() throws Exception {
+ new MockUp<VTPResource>() {
+ @Mock
+ public JsonNode makeRpcAndGetJson(List<String> args) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ String jsonvalue = "[{\"product\":\"onap-dublin\",\"description\":\"its 4th release\"}]";
+ JsonNode jsonNode = mapper.readTree(jsonvalue);
+ return jsonNode;
+ }
+ };
+ assertNotNull(vtpScenarioResource.listTestScenariosHandler());
}
- @Test(expected = Exception.class)
- public void testListTestSutiesHandler() throws Exception{
- vtpScenarioResource.listTestSutiesHandler("open-cli");
+
+ @Test
+ public void testListTestSutiesHandler() throws Exception {
+ new MockUp<VTPResource>() {
+ @Mock
+ public JsonNode makeRpcAndGetJson(List<String> args) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ String jsonvalue = "[{\"product\":\"onap-dublin\",\"service\":\"test\",\"description\":\"its 4th release\"}]";
+ JsonNode jsonNode = mapper.readTree(jsonvalue);
+ return jsonNode;
+ }
+ };
+ assertNotNull(vtpScenarioResource.listTestSutiesHandler("open-cli"));
}
+
@Test(expected = Exception.class)
- public void testListTestcasesHandler() throws Exception
- {
- vtpScenarioResource.listTestcasesHandler("testsuite","open-cli");
+ public void testListTestcasesHandler() throws Exception {
+ vtpScenarioResource.listTestcasesHandler("testsuite", "open-cli");
}
+
@Test(expected = Exception.class)
- public void testListTestcases() throws Exception
- {
- vtpScenarioResource.listTestcases("open-cli","testsuite");
+ public void testListTestcases() throws Exception {
+ vtpScenarioResource.listTestcases("open-cli", "testsuite");
}
+
@Test(expected = Exception.class)
- public void testGetTestcase() throws Exception
- {
- vtpScenarioResource.getTestcase("open-cli","testsuit","testcase");
+ public void testGetTestcase() throws Exception {
+ vtpScenarioResource.getTestcase("open-cli", "testsuit", "testcase");
}
- @Test(expected = Exception.class)
- public void testGetTestcaseHandler() throws Exception
- {
- vtpScenarioResource.getTestcaseHandler("open-cli","testsuit","testcase");
+
+ @Test
+ public void testGetTestcaseHandler() throws Exception {
+ new MockUp<VTPResource>() {
+ @Mock
+ public JsonNode makeRpcAndGetJson(List<String> args) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String jsonvalue = "{\"schema\":{\"name\":\"cli\",\"product\":\"onap-dublin\",\"description\":\"its 4th release\"," +
+ "\"service\":\"test\",\"author\":\"jitendra\",\"inputs\":[{\"name\":\"abc\",\"description\":\"abc\"," +
+ "\"type\":\"abc\",\"is_optional\":\"yes\",\"default_value\":\"abc\",\"metadata\":\"abc\"}]," +
+ "\"outputs\":[{\"name\":\"abc\",\"description\":\"abc\",\"type\":\"abc\"}]}}";
+ JsonNode jsonNode = mapper.readTree(jsonvalue);
+ return jsonNode;
+ }
+ };
+ assertNotNull(vtpScenarioResource.getTestcaseHandler("open-cli", "testsuit", "testcase"));
}
} \ No newline at end of file