From b51f888ee16f8bf92c7d9a0331eaa05e3bb938d2 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Sun, 2 Apr 2017 09:21:38 +0300 Subject: [SDC-8] adding factory/parser init logic Change-Id: I4ed1581a2871915e12f0795de304f90fcab7d0db Signed-off-by: Pavel Aharoni --- .../main/java/org/openecomp/test/ClientTest.java | 28 ++++++---------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'sdc-distribution-ci/src') diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java index 519684b..5e8dafd 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java +++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java @@ -20,16 +20,12 @@ package org.openecomp.test; -import java.io.IOException; - import org.openecomp.sdc.api.IDistributionClient; import org.openecomp.sdc.api.consumer.INotificationCallback; import org.openecomp.sdc.api.results.IDistributionClientResult; import org.openecomp.sdc.impl.DistributionClientFactory; -import org.openecomp.sdc.tosca.parser.impl.SdcCsarHelperImpl; -import org.openecomp.sdc.toscaparser.ToscaParser; -import org.openecomp.sdc.toscaparser.ToscaParserFactory; -import org.openecomp.sdc.toscaparser.api.ToscaTemplate; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.slf4j.LoggerFactory; import ch.qos.logback.classic.Level; @@ -37,24 +33,14 @@ import ch.qos.logback.classic.LoggerContext; public class ClientTest { public static void main(String[] args) throws Exception { - /* ToscaParserFactory toscaParserFactory = null; - try { - toscaParserFactory = new ToscaParserFactory(); - ToscaParser parser = toscaParserFactory.create(); - ToscaTemplate toscaTemplate = parser.parse("test.csar"); - SdcCsarHelperImpl csarHelper = new SdcCsarHelperImpl(toscaTemplate); + try (SdcToscaParserFactory toscaParserFactory = SdcToscaParserFactory.getInstance()){ + //ISdcCsarHelper csarHelper = toscaParserFactory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar-nt-metadata.csar"); + ISdcCsarHelper csarHelper = toscaParserFactory.getSdcCsarHelper("C:\\Users\\pa0916\\Desktop\\Work\\ASDC\\CSARs\\service-ServiceFdnt-csar.csar"); String serviceSubstitutionMappingsTypeName = csarHelper.getServiceSubstitutionMappingsTypeName(); System.out.println("serviceSubstitutionMappingsTypeName is "+serviceSubstitutionMappingsTypeName); + String nodeTemplatePropertyLeafValue = csarHelper.getNodeTemplatePropertyLeafValue(csarHelper.getServiceVfList().get(0), "nf_role"); + System.out.println("property is "+nodeTemplatePropertyLeafValue); } - catch (Exception e){ - System.out.println(e); - } - finally{ - if (toscaParserFactory != null){ - toscaParserFactory.close(); - } - }*/ - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); lc.getLogger("org.apache.http").setLevel(Level.INFO); -- cgit 1.2.3-korg