summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test/java
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2019-11-22 10:11:45 +0800
committerLianhao Lu <lianhao.lu@intel.com>2019-11-22 17:30:56 +0800
commit8db4db6563a98c4fac3e833707ab2b14098657d5 (patch)
tree6dab9858272cf765943be5b0caeafbf6ff7f62a1 /csarvalidation/src/test/java
parent5e89003fa9a6f892c2922658a5c1d3f900b557d9 (diff)
Support non DOS/Windows format CSAR manifest file
When recreating the csar manifest file during signature verification, we should use the same newline charater as the original file instead of using the DOS/Windows newline charater to avoid false positive signature verfication failure. Issue-ID: VNFSDK-520 Signed-off-by: Lianhao Lu <lianhao.lu@intel.com> Change-Id: I7bdf0a7f6b46c7def0a92d7ec7f245e268355959
Diffstat (limited to 'csarvalidation/src/test/java')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/parser/ManifestFileSplitterTest.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/parser/ManifestFileSplitterTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/parser/ManifestFileSplitterTest.java
index b530691..11cddbe 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/parser/ManifestFileSplitterTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/parser/ManifestFileSplitterTest.java
@@ -21,19 +21,27 @@ import org.assertj.core.api.Assertions;
import org.junit.Test;
import java.io.File;
+import java.net.URISyntaxException;
+
+import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.absoluteFilePath;
/*
How to sing files see to README.txt file into test/resources folder
*/
public class ManifestFileSplitterTest {
- @Test
- public void shouldSplitManifestFileOnDataPartAndCMS() {
- File file = new File("./src/test/resources/cvc/csar/parser/MainServiceTemplate.mf");
+ private ManifestFileModel getModel(String resourceFilePath) throws URISyntaxException {
+ File file = new File(absoluteFilePath(resourceFilePath));
ManifestFileSplitter manifestFileSplitter = new ManifestFileSplitter();
+ return manifestFileSplitter.split(file);
+ }
- ManifestFileModel manifestFileModel = manifestFileSplitter.split(file);
+ @Test
+ public void shouldSplitManifestFileOnDataPartAndCMS() throws URISyntaxException {
+ String resource = "cvc/csar/parser/MainServiceTemplate.mf";
+ ManifestFileModel manifestFileModel = getModel(resource);
+ Assertions.assertThat(manifestFileModel.getNewLine()).isEqualTo("\n");
Assertions.assertThat(manifestFileModel.getData()).contains("metadata:",
" pnfd_name: RadioNode",
" pnfd_provider: Ericsson",
@@ -47,4 +55,11 @@ public class ManifestFileSplitterTest {
"-----END CMS-----"
);
}
+
+ @Test
+ public void shouldBeWindowsStyle() throws URISyntaxException {
+ String resource = "cvc/csar/parser/MainServiceTemplate.windows.mf";
+ ManifestFileModel manifestFileModel = getModel(resource);
+ Assertions.assertThat(manifestFileModel.getNewLine()).isEqualTo("\r\n");
+ }
}