summaryrefslogtreecommitdiffstats
path: root/sdc-distribution-ci/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-distribution-ci/src')
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java13
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java114
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java60
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java7
4 files changed, 115 insertions, 79 deletions
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java
index f78a38b..faabaeb 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java
@@ -27,13 +27,16 @@ import org.openecomp.sdc.api.IDistributionClient;
import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
import org.openecomp.sdc.utils.DistributionActionResultEnum;
+/**
+ *
+ * @author tg851x
+ * This is class used in testing and run locally in the IDE
+ * logging not needed it is monitored through the IDE console.
+ */
public class AdvanceCallBack extends SimpleCallback{
-
-
public AdvanceCallBack(IDistributionClient client) {
super(client);
- // TODO Auto-generated constructor stub
}
@Override
@@ -45,13 +48,11 @@ public class AdvanceCallBack extends SimpleCallback{
}
protected void saveFile(byte[] bs, String fileName) {
- try {
String downloadPath = SimpleConfiguration.downloadPath();
- FileOutputStream fileOuputStream = new FileOutputStream(downloadPath + fileName);
+ try(FileOutputStream fileOuputStream = new FileOutputStream(downloadPath + fileName);) {
fileOuputStream.write(bs);
fileOuputStream.close();
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java
index 7d79571..5c4c9e2 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java
@@ -28,50 +28,84 @@ import java.util.List;
*
*/
public enum ArtifactTypeEnum {
- CHEF("CHEF"), PUPPET("PUPPET"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), ICON("ICON"), UNKNOWN("UNKNOWN"), HEAT("HEAT"), DG_XML("DG_XML"), MURANO_PKG("MURANO_PKG"),
- HEAT_ENV("HEAT_ENV"), YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"), HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"), NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"),
- TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"), VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"), VENDOR_LICENSE("VENDOR_LICENSE"),
- MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"), APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"),
- HEAT_ARTIFACT("HEAT_ARTIFACT"), VF_MODULES_METADATA("VF_MODULES_METADATA"),
- // DCAE Artifacts
- DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"),
- DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"), DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"),
- DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
- // AAI Artifacts
- AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
- // MIB artifacts
- SNMP_POLL ("SNMP_POLL"), SNMP_TRAP("SNMP_TRAP"), GUIDE("GUIDE")
- ;
- ArtifactTypeEnum(String type) {
- this.type = type;
- }
+ CHEF("CHEF"),
+ PUPPET("PUPPET"),
+ YANG("YANG"),
+ SHELL_SCRIPT("SHELL_SCRIPT"),
+ ICON("ICON"),
+ UNKNOWN("UNKNOWN"),
+ HEAT("HEAT"),
+ DG_XML("DG_XML"),
+ MURANO_PKG("MURANO_PKG"),
+ HEAT_ENV("HEAT_ENV"),
+ YANG_XML("YANG_XML"),
+ HEAT_VOL("HEAT_VOL"),
+ HEAT_NET("HEAT_NET"),
+ OTHER("OTHER"),
+ WORKFLOW("WORKFLOW"),
+ NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"),
+ TOSCA_TEMPLATE("TOSCA_TEMPLATE"),
+ TOSCA_CSAR("TOSCA_CSAR"),
+ VNF_CATALOG("VNF_CATALOG"),
+ VF_LICENSE("VF_LICENSE"),
+ VENDOR_LICENSE("VENDOR_LICENSE"),
+ MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"),
+ MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"),
+ APPC_CONFIG("APPC_CONFIG"),
+ HEAT_NESTED("HEAT_NESTED"),
+ HEAT_ARTIFACT("HEAT_ARTIFACT"),
+ VF_MODULES_METADATA("VF_MODULES_METADATA"),
- private String type;
+ // DCAE Artifacts
+ DCAE_TOSCA("DCAE_TOSCA"),
+ DCAE_JSON("DCAE_JSON"),
+ DCAE_POLICY("DCAE_POLICY"),
+ DCAE_DOC("DCAE_DOC"),
+ DCAE_EVENT("DCAE_EVENT"),
+ DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"),
+ DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
+ DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"),
+ DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"),
+ DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"),
+ DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
- public String getType() {
- return type;
- }
+ // AAI Artifacts
+ AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"),
+ AAI_VF_MODEL("AAI_VF_MODEL"),
+ AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"),
+ AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
- public void setType(String type) {
- this.type = type;
- }
+ // MIB artifacts
+ SNMP_POLL("SNMP_POLL"),
+ SNMP_TRAP("SNMP_TRAP"),
+ GUIDE("GUIDE");
- public static ArtifactTypeEnum findType(final String type) {
- for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- // According to Pavel/Ella
- if (ate.getType().equalsIgnoreCase(type)) {
- return ate;
- }
- }
- return null;
- }
+ ArtifactTypeEnum(String type) {
+ this.type = type;
+ }
- public static List<String> getAllTypes() {
- List<String> types = new ArrayList<String>();
- for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- types.add(ate.getType());
- }
- return types;
- }
+ private String type;
+
+ public String getType() {
+ return type;
+ }
+
+ public static ArtifactTypeEnum findType(final String type) {
+ for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
+ // According to Pavel/Ella
+ if (ate.getType().equalsIgnoreCase(type)) {
+ return ate;
+ }
+ }
+ return null;
+ }
+
+ public static List<String> getAllTypes() {
+ List<String> types = new ArrayList<>();
+ for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
+ types.add(ate.getType());
+ }
+ return types;
+ }
}
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java
index c7345f2..434952b 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java
@@ -23,40 +23,36 @@ package org.openecomp.test;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
-
import org.apache.commons.codec.binary.Base64;
public class Decoder {
- public static String encode(byte[] byteArrayToEncode) {
-
- byte[] bytesEncoded = Base64.encodeBase64(byteArrayToEncode);
- String strEncoded = new String(bytesEncoded);
- return strEncoded;
- }
-
- public static String decode(String strEncoded) throws IOException {
-
- byte[] byteDecoded = Base64.decodeBase64(strEncoded);
- String decoded = new String(byteDecoded);
-
- return decoded;
-
- }
-
- public static String readFileToString(String file) throws IOException {
-
- BufferedReader reader = new BufferedReader(new FileReader(file));
- String line = null;
- StringBuilder stringBuilder = new StringBuilder();
- String ls = System.getProperty("line.separator");
-
- while ((line = reader.readLine()) != null) {
- stringBuilder.append(line);
- stringBuilder.append(ls);
- }
- reader.close();
- return stringBuilder.toString();
- }
-
+ public static String encode(byte[] byteArrayToEncode) {
+ return new String(Base64.encodeBase64(byteArrayToEncode));
+ }
+
+ public static String decode(String strEncoded) {
+ return new String(Base64.decodeBase64(strEncoded));
+ }
+
+ public static String readFileToString(String file) throws IOException {
+
+ try (FileReader fileReader = new FileReader(file);
+ BufferedReader reader = new BufferedReader(fileReader)) {
+ String line;
+ StringBuilder stringBuilder = new StringBuilder();
+ String ls = System.getProperty("line.separator");
+
+ while ((line = reader.readLine()) != null) {
+ stringBuilder.append(line);
+ stringBuilder.append(ls);
+ }
+
+ reader.close();
+ fileReader.close();
+ return stringBuilder.toString();
+ } catch (IOException e) {
+ throw new IOException(e);
+ }
+ }
}
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
index 98df4d0..0c03bb0 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
@@ -44,7 +44,12 @@ import org.openecomp.sdc.utils.ArtifactTypeEnum;
import org.openecomp.sdc.utils.DistributionActionResultEnum;
import org.openecomp.sdc.utils.DistributionStatusEnum;
-
+/**
+ *
+ * @author tg851x
+ * This is class used in testing and run locally in the IDE
+ * logging not needed it is monitored through the IDE console.
+ */
public class SimpleCallback implements INotificationCallback {
protected IDistributionClient client;
public List<IArtifactInfo> iArtifactInfo;