summaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace/src/test/java
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-09-05 12:40:17 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-09-08 18:49:51 +0530
commitd17103ecbdb0c93b3f0e3980455417027c52fee1 (patch)
tree0433f52819c9bc3380fca4461fe9ea4e7b7cdb96 /vnfmarket-be/vnf-sdk-marketplace/src/test/java
parentf1b0f474d7d3cd6faaec7c2e4d8f4e9c183607e8 (diff)
VTP: Migrate csar validation to VTP
Issue-ID: VNFSDK-305 Change-Id: I671195eec1e015de0e7457617b17dc0328a27a9a Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/test/java')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java30
1 files changed, 23 insertions, 7 deletions
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 c9c03cc9..6ec0406a 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
@@ -67,6 +67,8 @@ import org.onap.vnfsdk.marketplace.rest.RestResponse;
import org.onap.vnfsdk.marketplace.rest.RestfulClient;
import org.onap.vnfsdk.marketplace.wrapper.PackageWrapper;
import org.onap.vnfsdk.marketplace.wrapper.PackageWrapperUtil;
+import org.open.infc.grpc.Result;
+import org.open.infc.grpc.client.OpenRemoteCli;
import mockit.Mock;
import mockit.MockUp;
@@ -640,11 +642,11 @@ public class PackageResourceTest {
packageDataList.add(packageData);
return packageDataList;
}
-
+
@Mock
public List<PackageData> getPackageDataSubset(Map<String, String> paramsMap) {
List<PackageData> packageDataList = new ArrayList<PackageData>();
-
+
return packageDataList;
}
};
@@ -731,6 +733,20 @@ public class PackageResourceTest {
}
};
+
+ new MockUp<OpenRemoteCli>() {
+
+ @Mock
+ public Result run(String[] args) {
+ Result result = Result.newBuilder().
+ setExitCode(0).
+ setOutput("{\"error\":\"SUCCESS\"}").
+ build();
+
+ return result;
+ }
+ };
+
FormDataContentDisposition fileDetail =
FormDataContentDisposition.name("fileName").fileName("clearwater_ns.csar").build();
@@ -1068,12 +1084,12 @@ public class PackageResourceTest {
public void testPkgFormat() {
assertNotNull(PackageWrapperUtil.getPackageFormat("xml"));
assertNotNull(PackageWrapperUtil.getPackageFormat("yml"));
- assertNull(PackageWrapperUtil.getPackageFormat("pdf"));
+ assertNull(PackageWrapperUtil.getPackageFormat("pdf"));
MsbDetailsHolder.getMsbDetails();
try {
IMarketplaceDao dao = new MarketplaceDaoImpl();
-
+
packageDataList = new ArrayList<PackageData>();
packageData = new PackageData();
packageData.setCsarId("21");
@@ -1083,13 +1099,13 @@ public class PackageResourceTest {
packageData.setVersion("v1.0");
packageData.setProvider("Huawei");
packageDataList.add(packageData);
-
+
dao.savePackageData(packageData);
dao.getAllPackageData();
dao.getPackageData("21");
dao.updatePackageData(packageData);
- dao.deletePackageData("21");
-
+ dao.deletePackageData("21");
+
} catch(Exception e) {
}