summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'csarvalidation/src/test/java/org')
-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
2 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);
+ }
}