From a04f31a2b6aa49cc0646a35bf6f7f7566bb1c331 Mon Sep 17 00:00:00 2001 From: AvinashS Date: Wed, 20 Sep 2017 10:13:15 +0000 Subject: Updated validation for CSIT Lib interface for CSIT with marketplace Change-Id: I73c68b2f8f7a3940cb175cce2397abd4a4deaff4 IssueId: VNFSDK-90 Signed-off-by: AvinashS --- .../csarvalidationtest/CsarParserTest.java | 62 --------------------- .../csarvalidationtest/CsarValidatorTest.java | 64 ++++++++++++++++++++++ 2 files changed, 64 insertions(+), 62 deletions(-) delete mode 100644 csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarParserTest.java create mode 100644 csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java (limited to 'csarvalidation/src/test/java') diff --git a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarParserTest.java b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarParserTest.java deleted file mode 100644 index ce9ba5b..0000000 --- a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarParserTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2017 Huawei Technologies Co., Ltd. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.validation.csarvalidationtest; - -import org.junit.Test; -import org.onap.validation.csar.CsarParser; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class CsarParserTest { - - String regex = "^\\/[a-zA-Z]\\:\\/"; - ClassLoader classLoader = getClass().getClassLoader(); - Pattern pattern = Pattern.compile(regex); - private String configFile = classLoader.getResource("enterprise2DC.csar").getFile(); - Matcher matcher = pattern.matcher(configFile); - String dir2 = "/"+configFile.substring(1); - - CsarParser csarParser = new CsarParser(dir2); - - @Test - public void testValidateCsarMeta() { - boolean result = CsarParser.validateCsarMeta(); - assertEquals(true, result == true); - System.out.println("inside testValidateCsarMeta : " + result); - } - - @Test - public void testValidateCsarIntegrity() { - boolean result = csarParser.validateCsarIntegrity(dir2); - assertEquals(true, result == true); - System.out.println("inside testValidateCsarIntegrity : " + result); - } - - @Test - public void testValidateToscaMeta() { - boolean result = csarParser.validateToscaMeta(); - assertEquals(true, result == true); - System.out.println("inside testValidateToscaMeta : " + result); - } - -} - - - diff --git a/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java new file mode 100644 index 0000000..46d7beb --- /dev/null +++ b/csarvalidation/src/test/java/org/onap/validation/csarvalidationtest/CsarValidatorTest.java @@ -0,0 +1,64 @@ +/** + * Copyright 2017 Huawei Technologies Co., Ltd. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.validation.csarvalidationtest; + +import org.junit.Test; +import org.onap.validation.csar.CsarValidator; + +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class CsarValidatorTest { + + String regex = "^\\/[a-zA-Z]\\:\\/"; + ClassLoader classLoader = getClass().getClassLoader(); + 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 packageId = UUID.randomUUID().toString(); + + CsarValidator csarValidator = new CsarValidator(packageId, dir2); + + @Test + public void testValidateCsarMeta() { + boolean result = CsarValidator.validateCsarMeta(); + assertEquals(true, result == true); + System.out.println("inside testValidateCsarMeta : " + result); + } + + @Test + public void testValidateCsarIntegrity() { + boolean result = csarValidator.validateCsarIntegrity(dir2); + assertEquals(true, result == true); + System.out.println("inside testValidateCsarIntegrity : " + result); + } + + @Test + public void testValidateToscaMeta() { + boolean result = csarValidator.validateToscaMeta(); + assertEquals(true, result == true); + System.out.println("inside testValidateToscaMeta : " + result); + } + +} + + + -- cgit 1.2.3-korg