summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java41
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java9
-rw-r--r--csarvalidation/src/test/resources/vEPC_NS.csarbin0 -> 149128 bytes
3 files changed, 26 insertions, 24 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 9e0500d..19422b9 100644
--- a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java
@@ -41,10 +41,10 @@ public class CsarValidatorTest {
Pattern pattern = Pattern.compile(regex);
private String csarFile = classLoader.getResource("enterprise2DC.csar").getFile();
Matcher matcher = pattern.matcher(csarFile);
- String dir2 = System.getProperty("file.separator") + csarFile.substring(1);
+ String sample1 = System.getProperty("file.separator") + csarFile.substring(1);
String packageId = UUID.randomUUID().toString();
- private String csarFile2 = classLoader.getResource("sample2.csar").getFile();
+ private String csarFile2 = classLoader.getResource("vEPC_NS.csar").getFile();
String sample2 = System.getProperty("file.separator") + csarFile2.substring(1);
String packageId2 = UUID.randomUUID().toString();
/*
@@ -52,25 +52,24 @@ public class CsarValidatorTest {
String sample3 = System.getProperty("file.separator") + csarFile3.substring(1);
String packageId3 = UUID.randomUUID().toString(); */
@Test
- public void testAll() {
- CsarValidator csarValidator = new CsarValidator(packageId, dir2);
+ 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);
testValidateCsar(csarValidator2);
- String dir3 = dir2.replace(".csar", "");
- String dir4 = sample2.replace(".csar", "");
- // String dir5 = sample3.replace(".csar", "");
- boolean result = FileUtil.deleteDirectory(dir3);
- boolean result1 = FileUtil.deleteDirectory(dir4);
- //boolean result2 = FileUtil.deleteDirectory(dir5);
+ String sample1Dir = sample1.replace(".csar", "");
+ String sample2Dir = sample2.replace(".csar", "");
+
+ boolean result = FileUtil.deleteDirectory(sample1Dir);
+ boolean result1 = FileUtil.deleteDirectory(sample2Dir);
assertEquals(true, result == true && result1 ==true);
}
@Test
- public void testIndividual() {
- CsarValidator csarValidator = new CsarValidator(packageId, dir2);
+ public void testIndividual() throws IOException, InterruptedException {
+ CsarValidator csarValidator = new CsarValidator(packageId, sample1);
testValidateCsarMeta(csarValidator);
testValidateCsarIntegrity(csarValidator);
testValidateToscaMeta(csarValidator);
@@ -78,9 +77,9 @@ public class CsarValidatorTest {
CsarValidator csarValidator2 = new CsarValidator(packageId2, sample2);
testValidateCsarIntegrity(csarValidator2);
testValidateToscaMeta(csarValidator2);
- testValidateMainService(csarValidator2);
+ testValidateMainService(csarValidator2);
//Rel1 specific test case
- String dir3 = dir2.replace(".csar", "");
+ String dir3 = sample1.replace(".csar", "");
String dir4 = sample2.replace(".csar", "");
boolean result = FileUtil.deleteDirectory(dir3);
boolean result1 = FileUtil.deleteDirectory(dir4);
@@ -92,31 +91,31 @@ public class CsarValidatorTest {
FileUtil.closeInputStream(dir);
assertTrue(true);
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testReadJsonDatafFromFile() {
- FileUtil.readJsonDatafFromFile(dir2, null);
+ FileUtil.readJsonDatafFromFile(sample1, null);
}
@Test
public void testCloseZipFile() throws ZipException, IOException {
- File file = new File(dir2);
+ File file = new File(sample1);
ZipFile dir1 = new ZipFile(file);
FileUtil.closeZipFile(dir1);
assertTrue(true);
}
@Test
public void testCloseFileStream() throws FileNotFoundException {
- FileInputStream dir3 = new FileInputStream(dir2);
+ FileInputStream dir3 = new FileInputStream(sample1);
FileUtil.closeFileStream(dir3 );
}
@Test
public void testCloseOutptutStream() {
OutputStream dir4 = new OutputStream() {
-
+
@Override
public void write(int b) throws IOException {
-
+
}
};
FileUtil.closeOutputStream(dir4);
@@ -138,7 +137,7 @@ public class CsarValidatorTest {
private void testValidateCsarIntegrity(CsarValidator cv) {
- boolean result = cv.validateCsarIntegrity(dir2);
+ boolean result = cv.validateCsarIntegrity(sample1);
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 dfbd32d..9855288 100644
--- a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/ValidationExceptionTest.java
@@ -27,22 +27,25 @@ 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);
+ 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);
+ ValidationException result = validationException.wrappedInfo(ex, ErrorCodes.FILE_IO);
assertTrue(true);
}
+
@Test
public void testWrappedInfoThrowableErrorCodes2() {
Throwable ex = new ValidationException();
- ValidationException result = validationException.wrappedInfo(ex , null);
+ ValidationException result = validationException.wrappedInfo(ex, null);
assertTrue(true);
}
}
diff --git a/csarvalidation/src/test/resources/vEPC_NS.csar b/csarvalidation/src/test/resources/vEPC_NS.csar
new file mode 100644
index 0000000..67ab75a
--- /dev/null
+++ b/csarvalidation/src/test/resources/vEPC_NS.csar
Binary files differ