summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test
diff options
context:
space:
mode:
authorAvinashS <avinash.s@huawei.com>2017-10-12 17:05:06 +0530
committerAvinashS <avinash.s@huawei.com>2017-10-12 17:05:06 +0530
commit0e21a3a775ef63e01b88905365d7fc5787c6c05a (patch)
treeb56ba76edfa541a5974058f5a3ad4d1884257025 /csarvalidation/src/test
parent4fad64a80480eefa441cdebec0f1f7115eacb477 (diff)
Increase the VNF validation scope with new samples
Change-Id: I171c2f3c37e8255bece396107319057463065827 IssueId: VNFSDK-107 Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java74
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java36
-rw-r--r--csarvalidation/src/test/resources/VoLTE.csarbin0 -> 53674 bytes
-rw-r--r--csarvalidation/src/test/resources/vIMS_NS.csarbin0 -> 111654 bytes
4 files changed, 70 insertions, 40 deletions
diff --git a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java
index 19422b9..782e521 100644
--- a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java
@@ -47,24 +47,42 @@ public class CsarValidatorTest {
private String csarFile2 = classLoader.getResource("vEPC_NS.csar").getFile();
String sample2 = System.getProperty("file.separator") + csarFile2.substring(1);
String packageId2 = UUID.randomUUID().toString();
-/*
- private String csarFile3 = classLoader.getResource("sample4.csar").getFile();
+
+ private String csarFile3 = classLoader.getResource("vIMS_NS.csar").getFile();
String sample3 = System.getProperty("file.separator") + csarFile3.substring(1);
- String packageId3 = UUID.randomUUID().toString(); */
+ String packageId3 = UUID.randomUUID().toString();
+
+ private String csarFile4 = classLoader.getResource("VoLTE.csar").getFile();
+ String sample4 = System.getProperty("file.separator") + csarFile4.substring(1);
+ String packageId4 = UUID.randomUUID().toString();
+
+ private String csarFile5 = classLoader.getResource("sample2.csar").getFile();
+ String sample5 = System.getProperty("file.separator") + csarFile5.substring(1);
+ String packageId5 = UUID.randomUUID().toString();
@Test
public void testAll() throws IOException, InterruptedException {
CsarValidator csarValidator = new CsarValidator(packageId, sample1);
- testValidateCsar(csarValidator);
-
CsarValidator csarValidator2 = new CsarValidator(packageId2, sample2);
- // CsarValidator csarValidator3 = new CsarValidator(packageId3, sample3);
+ CsarValidator csarValidator3 = new CsarValidator(packageId3, sample3);
+ CsarValidator csarValidator4 = new CsarValidator(packageId4, sample4);
+ CsarValidator csarValidator5 = new CsarValidator(packageId5, sample5);
+ testValidateCsar(csarValidator);
testValidateCsar(csarValidator2);
+ testValidateCsar(csarValidator3);
+ testValidateCsar(csarValidator4);
+ testValidateCsar(csarValidator5);
String sample1Dir = sample1.replace(".csar", "");
String sample2Dir = sample2.replace(".csar", "");
-
+ String sample3Dir = sample3.replace(".csar", "");
+ String sample4Dir = sample4.replace(".csar", "");
+ String sample5Dir = sample5.replace(".csar", "");
boolean result = FileUtil.deleteDirectory(sample1Dir);
boolean result1 = FileUtil.deleteDirectory(sample2Dir);
- assertEquals(true, result == true && result1 ==true);
+ boolean result2 = FileUtil.deleteDirectory(sample3Dir);
+ boolean result3 = FileUtil.deleteDirectory(sample4Dir);
+ boolean result4 = FileUtil.deleteDirectory(sample5Dir);
+ System.out.println(result4);
+ assertEquals(true, result == true && result1 ==true && result2 == true && result3 == true && result4 == true);
}
@Test
@@ -78,12 +96,33 @@ public class CsarValidatorTest {
testValidateCsarIntegrity(csarValidator2);
testValidateToscaMeta(csarValidator2);
testValidateMainService(csarValidator2);
+
+ CsarValidator csarValidator3 = new CsarValidator(packageId3, sample3);
+ testValidateCsarIntegrity(csarValidator3);
+ testValidateToscaMeta(csarValidator3);
+ testValidateMainService(csarValidator3);
+
+ CsarValidator csarValidator4 = new CsarValidator(packageId4, sample4);
+ testValidateCsarIntegrity(csarValidator4);
+ testValidateToscaMeta(csarValidator4);
+ testValidateMainService(csarValidator4);
+
+ CsarValidator csarValidator5 = new CsarValidator(packageId5, sample5);
+ testValidateCsarIntegrity(csarValidator5);
+ testValidateToscaMeta(csarValidator5);
+ testValidateMainService(csarValidator5);
//Rel1 specific test case
- String dir3 = sample1.replace(".csar", "");
- String dir4 = sample2.replace(".csar", "");
- boolean result = FileUtil.deleteDirectory(dir3);
- boolean result1 = FileUtil.deleteDirectory(dir4);
- assertEquals(true, result == true && result1 ==true);
+ String sample1Dir = sample1.replace(".csar", "");
+ String sample2Dir = sample2.replace(".csar", "");
+ String sample3Dir = sample3.replace(".csar", "");
+ String sample4Dir = sample4.replace(".csar", "");
+ String sample5Dir = sample5.replace(".csar", "");
+ boolean result = FileUtil.deleteDirectory(sample1Dir);
+ boolean result1 = FileUtil.deleteDirectory(sample2Dir);
+ boolean result2 = FileUtil.deleteDirectory(sample3Dir);
+ boolean result3 = FileUtil.deleteDirectory(sample4Dir);
+ boolean result4 = FileUtil.deleteDirectory(sample5Dir);
+ assertEquals(true, result == true && result1 ==true && result2 == true && result3 == true && result4 == true);
}
@Test
public void testCloseInputStream() {
@@ -121,15 +160,6 @@ public class CsarValidatorTest {
FileUtil.closeOutputStream(dir4);
}
- /* @Test
- public void testDeleteDirectory() throws IOException {
- String dir4 = dir2.replace(".csar", "");
- String dir3 = sample2.replace(".csar", "");
- boolean result = FileUtil.deleteDirectory(dir3);
- boolean result1 = FileUtil.deleteDirectory(dir3);
- assertEquals(true, result == true && result1 ==true);
- }*/
-
private void testValidateCsarMeta(CsarValidator cv) {
boolean result = cv.validateCsarMeta();
assertEquals(true, result == true);
diff --git a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java
index 9855288..61ea3ee 100644
--- a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java
@@ -28,24 +28,24 @@ import static org.junit.Assert.assertTrue;
public class ValidationExceptionTest {
ValidationException validationException = new ValidationException();
- @Test
- public void testWrappedInfoThrowableErrorCodes() {
- Throwable ex = new IOException();
- ValidationException result = validationException.wrappedInfo(ex, ErrorCodes.FILE_IO);
- assertTrue(true);
- }
+ @Test
+ public void testWrappedInfoThrowableErrorCodes() {
+ Throwable ex = new IOException();
+ ValidationException result = validationException.wrappedInfo(ex, ErrorCodes.FILE_IO);
+ assertTrue(true);
+ }
- @Test
- public void testWrappedInfoThrowableErrorCodes1() {
- Throwable ex = new ValidationException();
- ValidationException result = validationException.wrappedInfo(ex, ErrorCodes.FILE_IO);
- assertTrue(true);
- }
+ @Test
+ public void testWrappedInfoThrowableErrorCodes1() {
+ Throwable ex = new ValidationException();
+ ValidationException result = validationException.wrappedInfo(ex, ErrorCodes.FILE_IO);
+ assertTrue(true);
+ }
- @Test
- public void testWrappedInfoThrowableErrorCodes2() {
- Throwable ex = new ValidationException();
- ValidationException result = validationException.wrappedInfo(ex, null);
- assertTrue(true);
- }
+ @Test
+ public void testWrappedInfoThrowableErrorCodes2() {
+ Throwable ex = new ValidationException();
+ ValidationException result = validationException.wrappedInfo(ex, null);
+ assertTrue(true);
+ }
}
diff --git a/csarvalidation/src/test/resources/VoLTE.csar b/csarvalidation/src/test/resources/VoLTE.csar
new file mode 100644
index 0000000..9e7b737
--- /dev/null
+++ b/csarvalidation/src/test/resources/VoLTE.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/vIMS_NS.csar b/csarvalidation/src/test/resources/vIMS_NS.csar
new file mode 100644
index 0000000..efab9f8
--- /dev/null
+++ b/csarvalidation/src/test/resources/vIMS_NS.csar
Binary files differ