From 49ddd53062def299766fcb0028dd7321777ffaaa Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 6 Aug 2018 09:27:48 +0300 Subject: update readem file add sections * important links * release notes * compilation * local CSAR execution Change-Id: I23a05cb28213d12b48073d5d6ec2e1ceb1f8839c Issue-ID: SDC-1599 Signed-off-by: Michael Lando --- README.md | 52 ++++++++++++++++++++++------- src/test/java/org/onap/sdc/impl/MyTest.java | 41 +++++++++++++++++++++++ src/test/java/org/onap/sdc/impl/myTest.java | 41 ----------------------- 3 files changed, 81 insertions(+), 53 deletions(-) create mode 100644 src/test/java/org/onap/sdc/impl/MyTest.java delete mode 100644 src/test/java/org/onap/sdc/impl/myTest.java diff --git a/README.md b/README.md index 2e85eed..362ca7a 100644 --- a/README.md +++ b/README.md @@ -16,28 +16,56 @@ It uses the underlying generic JTOSCA parser. ONAP SDC-Tosca can be compiled easily using maven command: `mvn clean install` The result is JAR file under "target" folder +# Testing a CSAR locally +to run the parser locally you can use the MyTest Junit test to easily execute the parser on your own input. + +1. to run it place your csar in **sdc-tosca\src\test\resources\csars** + +2. Go to the test class located at **sdc-tosca\src\test\java\org\onap\sdc\impl\MyTest.java** + +3. un comment the logic ther and update the csar name you plced in the step above: +```java +SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); +ISdcCsarHelper = getCsarHelper("csars/"); + +//example of functions +//get node type by name +List serviceNodeTemplatesByType = fdntCsarHelper.getServiceNodeTemplatesByType("org.openecomp.nodes.ForwardingPath"); +//get node type property +String target_range = fdntCsarHelper.getNodeTemplatePropertyLeafValue(serviceNodeTemplatesByType.get(0), "target_range"); + +``` + # Getting Help -*** to be completed on release *** -SDC@lists.onap.org +##### [Mailing list](mailto:onap-sdc@lists.onap.org) + -SDC Javadoc and Maven site - -*** to be completed on rrelease *** -# Release notes for versions +##### [JIRA](http://jira.onap.org) + + + +##### [WIKI](https://wiki.onap.org/display/DW/Service+Design+and+Creation+%28SDC%29+Portal) + +##### [TOSCA Prser AID]((https://wiki.onap.org/display/DW/Service+Design+and+Creation+%28SDC%29+Portal)) + + + + -1.1.31-SNAPSHOT -Initial after separating into separate repo +# Release notes +## 1.4.1 +### Features: +1. **disable max conformance level validation**: until this version the parser had the definition of the max and min conformance level of the CSAR version which it supports. + the conformance level is generated by sdc and as a result the two had to be aligned, over wise the CSAR will fail on parsing. + from this version the max version will no longer be checked by the parser. +2. **Operations support**: add support for parsing the Operations in the tosca models. -------------------------------- -1.1.1-SNAPSHOT -Added toString of Function (GetInput, etc.) -Allowed two arguments for GetInput - name of list input and index in list diff --git a/src/test/java/org/onap/sdc/impl/MyTest.java b/src/test/java/org/onap/sdc/impl/MyTest.java new file mode 100644 index 0000000..cdd36cb --- /dev/null +++ b/src/test/java/org/onap/sdc/impl/MyTest.java @@ -0,0 +1,41 @@ +package org.onap.sdc.impl; + +import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.testng.annotations.Test; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; +import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; + +import java.io.File; + +import static org.onap.sdc.impl.SdcToscaParserBasicTest.getCsarHelper; + +public class MyTest { + + static SdcToscaParserFactory factory; + static ISdcCsarHelper fdntCsarHelper; + + @Test + public void testMyCsar() throws SdcToscaParserException { + + +// factory = SdcToscaParserFactory.getInstance(); +// fdntCsarHelper = getCsarHelper("csars/service-Oren1-csar-4.csar"); +// +// +// List serviceNodeTemplatesByType = fdntCsarHelper.getServiceNodeTemplatesByType("org.openecomp.nodes.ForwardingPath"); +// +// String target_range = fdntCsarHelper.getNodeTemplatePropertyLeafValue(serviceNodeTemplatesByType.get(0), "target_range"); + + } + + + protected static ISdcCsarHelper getCsarHelper(String path) throws SdcToscaParserException { + System.out.println("Parsing CSAR "+path+"..."); + String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile(); + File file1 = new File(fileStr1); + ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath()); + return sdcCsarHelper; + } + +} diff --git a/src/test/java/org/onap/sdc/impl/myTest.java b/src/test/java/org/onap/sdc/impl/myTest.java deleted file mode 100644 index 4833f6f..0000000 --- a/src/test/java/org/onap/sdc/impl/myTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.onap.sdc.impl; - -import org.onap.sdc.toscaparser.api.NodeTemplate; -import org.testng.annotations.Test; -import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; - -import java.io.File; - -import static org.onap.sdc.impl.SdcToscaParserBasicTest.getCsarHelper; - -public class myTest { - - static SdcToscaParserFactory factory; - static ISdcCsarHelper fdntCsarHelper; - - @Test - public void testNoValidationIssues() throws SdcToscaParserException { - - -// factory = SdcToscaParserFactory.getInstance(); -// fdntCsarHelper = getCsarHelper("csars/service-Oren1-csar-4.csar"); -// -// -// List serviceNodeTemplatesByType = fdntCsarHelper.getServiceNodeTemplatesByType("org.openecomp.nodes.ForwardingPath"); -// -// String target_range = fdntCsarHelper.getNodeTemplatePropertyLeafValue(serviceNodeTemplatesByType.get(0), "target_range"); - - } - - - protected static ISdcCsarHelper getCsarHelper(String path) throws SdcToscaParserException { - System.out.println("Parsing CSAR "+path+"..."); - String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile(); - File file1 = new File(fileStr1); - ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath()); - return sdcCsarHelper; - } - -} -- cgit 1.2.3-korg