summaryrefslogtreecommitdiffstats
path: root/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi
diff options
context:
space:
mode:
authorDenes Nemeth <denes.nemeth@nokia.com>2018-04-10 22:48:30 +0200
committerDenes Nemeth <denes.nemeth@nokia.com>2018-04-11 00:05:42 +0200
commit20297ddd0487602208bd98d89b8acbf940952e7b (patch)
tree5f0b9e8af04e2b3685f6da47a4bcac7a9b14377e /nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi
parenta995e82e01a3315940051ca55133c9cb14eccc6b (diff)
Fix automatic package conversion
Issue-ID: VFC-728 Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com> Change-Id: Ie015f2e5406329f16e74ab8abd44060dfc44148a
Diffstat (limited to 'nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi')
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/TestConverterApi.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/TestConverterApi.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/TestConverterApi.java
index 8f8cc8c1..d8db6226 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/TestConverterApi.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/TestConverterApi.java
@@ -16,7 +16,6 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.restapi;
-import com.google.common.collect.Lists;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -72,11 +71,11 @@ public class TestConverterApi extends TestBase {
when(systemFunctions.loadFile("cbam.collectConnectionPoints.js")).thenCallRealMethod();
when(systemFunctions.loadFile("cbam.post.collectConnectionPoints.js")).thenCallRealMethod();
when(systemFunctions.loadFile("TOSCA.meta")).thenCallRealMethod();
- when(systemFunctions.loadFile("MainServiceTemplate.meta")).thenCallRealMethod();
+ when(systemFunctions.loadFile("MainServiceTemplate.mf")).thenCallRealMethod();
when(httpResponse.getOutputStream()).thenReturn(new DelegatingServletOutputStream(actualOut));
Part part = Mockito.mock(Part.class);
when(part.getInputStream()).thenReturn(new ByteArrayInputStream(TestUtil.loadFile("unittests/packageconverter/cbam.package.zip")));
- when(httpRequest.getParts()).thenReturn(Lists.newArrayList(part));
+ when(httpRequest.getPart("fileToUpload")).thenReturn(part);
//when
converterApi.convert(httpResponse, httpRequest);
//verify
@@ -91,9 +90,8 @@ public class TestConverterApi extends TestBase {
String cbamVnfd = new String(TestUtil.loadFile("unittests/packageconverter/cbam.package.zip.vnfd"));
String expectedOnapVnfd = new OnapVnfdBuilder().toOnapVnfd(cbamVnfd);
assertFileInZip(bos.toByteArray(), "TOSCA-Metadata/TOSCA.meta", TestUtil.loadFile("TOSCA.meta"));
- assertFileInZip(bos.toByteArray(), "Definitions/MainServiceTemplate.yaml", expectedOnapVnfd.getBytes());
assertFileInZip(bos.toByteArray(), "MainServiceTemplate.yaml", expectedOnapVnfd.getBytes());
- assertFileInZip(bos.toByteArray(), "MainServiceTemplate.meta", TestUtil.loadFile("MainServiceTemplate.meta"));
+ assertFileInZip(bos.toByteArray(), "MainServiceTemplate.mf", TestUtil.loadFile("MainServiceTemplate.mf"));
ByteArrayOutputStream actualModifiedCbamVnfPackage = getFileInZip(new ByteArrayInputStream(bos.toByteArray()), "Artifacts/Deployment/OTHER/cbam.package.zip");
byte[] expectedModifiedCbamPackage = new CbamVnfPackageBuilder().toModifiedCbamVnfPackage(TestUtil.loadFile("unittests/packageconverter/cbam.package.zip"), "vnfdloc/a.yaml", new CbamVnfdBuilder().build(cbamVnfd));
assertItenticalZips(expectedModifiedCbamPackage, actualModifiedCbamVnfPackage.toByteArray());
@@ -121,7 +119,7 @@ public class TestConverterApi extends TestBase {
@Test
public void testUnableToExtractPackageToBeConverted() throws Exception {
IOException expectedException = new IOException();
- when(httpRequest.getParts()).thenThrow(expectedException);
+ when(httpRequest.getPart("fileToUpload")).thenThrow(expectedException);
try {
converterApi.convert(httpResponse, httpRequest);
fail();
@@ -139,7 +137,7 @@ public class TestConverterApi extends TestBase {
public void testUnableToConvertPackage() throws Exception {
Part part = Mockito.mock(Part.class);
when(part.getInputStream()).thenReturn(new ByteArrayInputStream(TestUtil.loadFile("unittests/packageconverter/cbam.package.zip")));
- when(httpRequest.getParts()).thenReturn(Lists.newArrayList(part));
+ when(httpRequest.getPart("fileToUpload")).thenReturn(part);
try {
converterApi.convert(httpResponse, httpRequest);
fail();