diff options
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/test')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java | 30 |
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) { } |