diff options
author | Yuli Shlosberg <ys9693@att.com> | 2018-03-07 16:29:57 +0200 |
---|---|---|
committer | Yuli Shlosberg <ys9693@att.com> | 2018-03-08 14:23:18 +0200 |
commit | e8d8a37da95c6fea435e0b3e93a477b5aa45b9b1 (patch) | |
tree | 415c9e5643f051e792ee414d887f8fe996a2b372 /sdc-distribution-ci/src/main/java | |
parent | 2f2d71255620b40e6021a54fe514783ebc2d5260 (diff) |
update distribution-client package namesv1.3.02.0.0-ONAPbeijing2.0.0-ONAP
Change-Id: Ic6f81bc8fdd3b021033c7c68e44f876a6ee1d21a
Issue-ID: SDC-952
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'sdc-distribution-ci/src/main/java')
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/AdvanceCallBack.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java) | 8 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/ArtifactTypeEnum.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java) | 2 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/ClientTest.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java) | 18 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/CsarToscaTester.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java) | 242 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/Decoder.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java) | 2 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/NotificationCallback.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java) | 6 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/SimpleCallback.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java) | 26 | ||||
-rw-r--r-- | sdc-distribution-ci/src/main/java/org/onap/test/SimpleConfiguration.java (renamed from sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java) | 4 |
8 files changed, 154 insertions, 154 deletions
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java b/sdc-distribution-ci/src/main/java/org/onap/test/AdvanceCallBack.java index faabaeb..a122ca0 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/AdvanceCallBack.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; import java.io.FileOutputStream; import java.io.IOException; -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; -import org.openecomp.sdc.utils.DistributionActionResultEnum; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.results.IDistributionClientDownloadResult; +import org.onap.sdc.utils.DistributionActionResultEnum; /** * diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java b/sdc-distribution-ci/src/main/java/org/onap/test/ArtifactTypeEnum.java index 5c4c9e2..1f5e799 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/ArtifactTypeEnum.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; import java.util.ArrayList; import java.util.List; diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java b/sdc-distribution-ci/src/main/java/org/onap/test/ClientTest.java index 872240b..24160b5 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/ClientTest.java @@ -18,16 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.consumer.IComponentDoneStatusMessage; -import org.openecomp.sdc.api.consumer.IStatusCallback; -import org.openecomp.sdc.api.notification.INotificationData; -import org.openecomp.sdc.api.notification.IStatusData; -import org.openecomp.sdc.api.results.IDistributionClientResult; -import org.openecomp.sdc.impl.DistributionClientFactory; -import org.openecomp.sdc.utils.DistributionStatusEnum; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.consumer.IComponentDoneStatusMessage; +import org.onap.sdc.api.consumer.IStatusCallback; +import org.onap.sdc.api.notification.INotificationData; +import org.onap.sdc.api.notification.IStatusData; +import org.onap.sdc.api.results.IDistributionClientResult; +import org.onap.sdc.impl.DistributionClientFactory; +import org.onap.sdc.utils.DistributionStatusEnum; public class ClientTest { public static void main(String[] args) throws Exception { diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java b/sdc-distribution-ci/src/main/java/org/onap/test/CsarToscaTester.java index 98072fa..1102150 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/CsarToscaTester.java @@ -1,121 +1,121 @@ -package org.openecomp.test;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
-import org.openecomp.sdc.tosca.parser.impl.SdcTypes;
-import org.openecomp.sdc.toscaparser.api.Group;
-import org.openecomp.sdc.toscaparser.api.NodeTemplate;
-import org.openecomp.sdc.toscaparser.api.elements.Metadata;
-import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
-
-public class CsarToscaTester {
- public static void main(String[] args) throws Exception {
- System.out.println("CsarToscaParser - path to CSAR's Directory is " + Arrays.toString(args));
- SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
-
- File folder = new File(args[0]);
- File[] listOfFiles = folder.listFiles();
- Date now = new Date();
- SimpleDateFormat dateFormat = new SimpleDateFormat("d-MM-y-HH_mm_ss");
- String time = dateFormat.format(now);
- String csarsDir = args[1] + "/csar-reports-" + time;
- File dir = new File(csarsDir);
- dir.mkdir();
-
-
- for (File file : listOfFiles) {
- if (file.isFile()) {
- System.out.println("File " + file.getAbsolutePath());
- String name = file.getName();
- String currentCsarDir = csarsDir+"/"+name+"-"+time;
- dir = new File(currentCsarDir);
- dir.mkdir();
- try {
- processCsar(factory, file);
- } catch (SdcToscaParserException e){
- System.out.println("SdcToscaParserException caught. Code: "+e.getCode()+", message: "+ e.getMessage());
- }
- List<String> validationIssueReport = ThreadLocalsHolder.getCollector().getValidationIssueReport();
- System.out.println("Validation issues during CSAR parsing are: " + (validationIssueReport != null ? validationIssueReport.toString() : "none"));
-
- try {
- generateReport(time, name, currentCsarDir, validationIssueReport, "validationIssues");
-
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
-
- }
- }
-
- private static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException {
- ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file.getAbsolutePath());
- //Service level
- System.out.println("Invoking sdc-tosca methods on this CSAR....");
- String conformanceLevel = sdcCsarHelper.getConformanceLevel();
- System.out.println("getConformanceLevel() - conformance level is "+conformanceLevel);
- String serviceSubstitutionMappingsTypeName = sdcCsarHelper.getServiceSubstitutionMappingsTypeName();
- System.out.println("serviceSubstitutionMappingsTypeName() - subst mappings type of service is "+serviceSubstitutionMappingsTypeName);
- List<Input> serviceInputs = sdcCsarHelper.getServiceInputs();
- System.out.println("getServiceInputs() - service inputs are "+serviceInputs);
- Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata();
- System.out.println("getServiceMetadata() - service metadata is "+serviceMetadata);
- Map<String, Object> serviceMetadataProperties = sdcCsarHelper.getServiceMetadataProperties();
- System.out.println("getServiceMetadataProperties() - service metadata properties is "+serviceMetadataProperties);
- List<NodeTemplate> allottedResources = sdcCsarHelper.getAllottedResources();
- System.out.println("getAllottedResources() - service allotted resources are "+allottedResources);
- List<NodeTemplate> serviceVfList = sdcCsarHelper.getServiceVfList();
- System.out.println("getServiceVfList() - VF list is "+serviceVfList);
- List<NodeTemplate> serviceNodeTemplateBySdcType = sdcCsarHelper.getServiceNodeTemplateBySdcType(SdcTypes.VF);
- System.out.println("getServiceNodeTemplateBySdcType() - VF list is "+serviceNodeTemplateBySdcType);
- List<NodeTemplate> serviceNodeTemplates = sdcCsarHelper.getServiceNodeTemplates();
- System.out.println("getServiceNodeTemplates() - all node templates list of service is "+serviceNodeTemplates);
-
- serviceVfList.forEach(x -> {
- String nodeTemplateCustomizationUuid = sdcCsarHelper.getNodeTemplateCustomizationUuid(x);
- System.out.println("getNodeTemplateCustomizationUuid() - VF ID is "+nodeTemplateCustomizationUuid);
- String typeOfNodeTemplate = sdcCsarHelper.getTypeOfNodeTemplate(x);
- System.out.println("getTypeOfNodeTemplate() - VF tosca type is "+typeOfNodeTemplate);
- List<Group> vfModulesByVf = sdcCsarHelper.getVfModulesByVf(nodeTemplateCustomizationUuid);
- System.out.println("getVfModulesByVf() - VF modules list is "+vfModulesByVf);
- vfModulesByVf.forEach(y -> {
- List<NodeTemplate> membersOfVfModule = sdcCsarHelper.getMembersOfVfModule(x, y);
- System.out.println("getMembersOfVfModule() - members of VfModule are "+membersOfVfModule);
- });
- List<NodeTemplate> vfcListByVf = sdcCsarHelper.getVfcListByVf(nodeTemplateCustomizationUuid);
- System.out.println("getVfcListByVf() - VFC list is "+vfcListByVf);
- vfcListByVf.forEach(z -> {
- List<NodeTemplate> nodeTemplateBySdcType = sdcCsarHelper.getNodeTemplateBySdcType(z, SdcTypes.CP);
- System.out.println("getNodeTemplateBySdcType() - CP children node templates of this VFC are "+nodeTemplateBySdcType);
- Map<String, Map<String, Object>> cpPropertiesFromVfcAsObject = sdcCsarHelper.getCpPropertiesFromVfcAsObject(z);
- System.out.println("getCpPropertiesFromVfcAsObject() - consolidated CP properties for this VFC are "+cpPropertiesFromVfcAsObject);
- boolean hasTopology = sdcCsarHelper.hasTopology(z);
- System.out.println("hasTopology() - this VFC is "+(hasTopology ? "nested" : "not nested"));
- });
- });
-
- }
-
- private static void generateReport(String time, String name, String currentCsarDir, List<String> criticalsReport, String type)
- throws IOException {
- FileWriter fw;
- fw = new FileWriter(new File(currentCsarDir + "/" + criticalsReport.size() + "-"+type+"-" + name +"-"+time + ".txt"));
- for (String exception : criticalsReport) {
- fw.write(exception);
- fw.write("\r\n");
- }
- fw.close();
- }
-}
+package org.onap.test; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +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 org.onap.sdc.tosca.parser.impl.SdcTypes; +import org.onap.sdc.toscaparser.api.Group; +import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.parameters.Input; +import org.onap.sdc.toscaparser.api.utils.ThreadLocalsHolder; + +public class CsarToscaTester { + public static void main(String[] args) throws Exception { + System.out.println("CsarToscaParser - path to CSAR's Directory is " + Arrays.toString(args)); + SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); + + File folder = new File(args[0]); + File[] listOfFiles = folder.listFiles(); + Date now = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("d-MM-y-HH_mm_ss"); + String time = dateFormat.format(now); + String csarsDir = args[1] + "/csar-reports-" + time; + File dir = new File(csarsDir); + dir.mkdir(); + + + for (File file : listOfFiles) { + if (file.isFile()) { + System.out.println("File " + file.getAbsolutePath()); + String name = file.getName(); + String currentCsarDir = csarsDir+"/"+name+"-"+time; + dir = new File(currentCsarDir); + dir.mkdir(); + try { + processCsar(factory, file); + } catch (SdcToscaParserException e){ + System.out.println("SdcToscaParserException caught. Code: "+e.getCode()+", message: "+ e.getMessage()); + } + List<String> validationIssueReport = ThreadLocalsHolder.getCollector().getValidationIssueReport(); + System.out.println("Validation issues during CSAR parsing are: " + (validationIssueReport != null ? validationIssueReport.toString() : "none")); + + try { + generateReport(time, name, currentCsarDir, validationIssueReport, "validationIssues"); + + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + } + } + + private static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException { + ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file.getAbsolutePath()); + //Service level + System.out.println("Invoking sdc-tosca methods on this CSAR...."); + String conformanceLevel = sdcCsarHelper.getConformanceLevel(); + System.out.println("getConformanceLevel() - conformance level is "+conformanceLevel); + String serviceSubstitutionMappingsTypeName = sdcCsarHelper.getServiceSubstitutionMappingsTypeName(); + System.out.println("serviceSubstitutionMappingsTypeName() - subst mappings type of service is "+serviceSubstitutionMappingsTypeName); + List<Input> serviceInputs = sdcCsarHelper.getServiceInputs(); + System.out.println("getServiceInputs() - service inputs are "+serviceInputs); + Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata(); + System.out.println("getServiceMetadata() - service metadata is "+serviceMetadata); + Map<String, Object> serviceMetadataProperties = sdcCsarHelper.getServiceMetadataProperties(); + System.out.println("getServiceMetadataProperties() - service metadata properties is "+serviceMetadataProperties); + List<NodeTemplate> allottedResources = sdcCsarHelper.getAllottedResources(); + System.out.println("getAllottedResources() - service allotted resources are "+allottedResources); + List<NodeTemplate> serviceVfList = sdcCsarHelper.getServiceVfList(); + System.out.println("getServiceVfList() - VF list is "+serviceVfList); + List<NodeTemplate> serviceNodeTemplateBySdcType = sdcCsarHelper.getServiceNodeTemplateBySdcType(SdcTypes.VF); + System.out.println("getServiceNodeTemplateBySdcType() - VF list is "+serviceNodeTemplateBySdcType); + List<NodeTemplate> serviceNodeTemplates = sdcCsarHelper.getServiceNodeTemplates(); + System.out.println("getServiceNodeTemplates() - all node templates list of service is "+serviceNodeTemplates); + + serviceVfList.forEach(x -> { + String nodeTemplateCustomizationUuid = sdcCsarHelper.getNodeTemplateCustomizationUuid(x); + System.out.println("getNodeTemplateCustomizationUuid() - VF ID is "+nodeTemplateCustomizationUuid); + String typeOfNodeTemplate = sdcCsarHelper.getTypeOfNodeTemplate(x); + System.out.println("getTypeOfNodeTemplate() - VF tosca type is "+typeOfNodeTemplate); + List<Group> vfModulesByVf = sdcCsarHelper.getVfModulesByVf(nodeTemplateCustomizationUuid); + System.out.println("getVfModulesByVf() - VF modules list is "+vfModulesByVf); + vfModulesByVf.forEach(y -> { + List<NodeTemplate> membersOfVfModule = sdcCsarHelper.getMembersOfVfModule(x, y); + System.out.println("getMembersOfVfModule() - members of VfModule are "+membersOfVfModule); + }); + List<NodeTemplate> vfcListByVf = sdcCsarHelper.getVfcListByVf(nodeTemplateCustomizationUuid); + System.out.println("getVfcListByVf() - VFC list is "+vfcListByVf); + vfcListByVf.forEach(z -> { + List<NodeTemplate> nodeTemplateBySdcType = sdcCsarHelper.getNodeTemplateBySdcType(z, SdcTypes.CP); + System.out.println("getNodeTemplateBySdcType() - CP children node templates of this VFC are "+nodeTemplateBySdcType); + Map<String, Map<String, Object>> cpPropertiesFromVfcAsObject = sdcCsarHelper.getCpPropertiesFromVfcAsObject(z); + System.out.println("getCpPropertiesFromVfcAsObject() - consolidated CP properties for this VFC are "+cpPropertiesFromVfcAsObject); + boolean hasTopology = sdcCsarHelper.hasTopology(z); + System.out.println("hasTopology() - this VFC is "+(hasTopology ? "nested" : "not nested")); + }); + }); + + } + + private static void generateReport(String time, String name, String currentCsarDir, List<String> criticalsReport, String type) + throws IOException { + FileWriter fw; + fw = new FileWriter(new File(currentCsarDir + "/" + criticalsReport.size() + "-"+type+"-" + name +"-"+time + ".txt")); + for (String exception : criticalsReport) { + fw.write(exception); + fw.write("\r\n"); + } + fw.close(); + } +} diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java b/sdc-distribution-ci/src/main/java/org/onap/test/Decoder.java index 434952b..384d26d 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/Decoder.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; import java.io.BufferedReader; import java.io.FileReader; diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java b/sdc-distribution-ci/src/main/java/org/onap/test/NotificationCallback.java index 3b2d772..48fda0a 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/NotificationCallback.java @@ -18,10 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.notification.INotificationData; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.notification.INotificationData; public class NotificationCallback extends SimpleCallback{ INotificationData latestCallbackData; diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java b/sdc-distribution-ci/src/main/java/org/onap/test/SimpleCallback.java index 0c03bb0..547dde2 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/SimpleCallback.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; import static org.junit.Assert.assertEquals; @@ -31,18 +31,18 @@ import java.util.stream.Collectors; import org.json.JSONArray; import org.json.JSONObject; -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.consumer.IDistributionStatusMessage; -import org.openecomp.sdc.api.consumer.INotificationCallback; -import org.openecomp.sdc.api.notification.IArtifactInfo; -import org.openecomp.sdc.api.notification.INotificationData; -import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.api.notification.IVfModuleMetadata; -import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; -import org.openecomp.sdc.api.results.IDistributionClientResult; -import org.openecomp.sdc.utils.ArtifactTypeEnum; -import org.openecomp.sdc.utils.DistributionActionResultEnum; -import org.openecomp.sdc.utils.DistributionStatusEnum; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.consumer.IDistributionStatusMessage; +import org.onap.sdc.api.consumer.INotificationCallback; +import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.sdc.api.notification.INotificationData; +import org.onap.sdc.api.notification.IResourceInstance; +import org.onap.sdc.api.notification.IVfModuleMetadata; +import org.onap.sdc.api.results.IDistributionClientDownloadResult; +import org.onap.sdc.api.results.IDistributionClientResult; +import org.onap.sdc.utils.ArtifactTypeEnum; +import org.onap.sdc.utils.DistributionActionResultEnum; +import org.onap.sdc.utils.DistributionStatusEnum; /** * diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java b/sdc-distribution-ci/src/main/java/org/onap/test/SimpleConfiguration.java index 417f564..d22bcf2 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java +++ b/sdc-distribution-ci/src/main/java/org/onap/test/SimpleConfiguration.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.test; +package org.onap.test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.openecomp.sdc.api.consumer.IConfiguration; +import org.onap.sdc.api.consumer.IConfiguration; public class SimpleConfiguration implements IConfiguration{ |