aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-distribution-ci/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-distribution-ci/src/main')
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java72
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java77
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java84
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java62
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java39
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java309
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java187
-rw-r--r--sdc-distribution-ci/src/main/resources/ci/conf/attsdc-packages.yaml10
-rw-r--r--sdc-distribution-ci/src/main/resources/ci/conf/attsdc.yaml35
-rw-r--r--sdc-distribution-ci/src/main/resources/ci/conf/log4j.properties34
-rw-r--r--sdc-distribution-ci/src/main/resources/ci/conf/titan.properties5
-rw-r--r--sdc-distribution-ci/src/main/resources/ci/scripts/startTest.sh87
12 files changed, 1001 insertions, 0 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
new file mode 100644
index 0000000..8b2b129
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/AdvanceCallBack.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.api.IDistributionClient;
+import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
+import org.openecomp.sdc.utils.DistributionActionResultEnum;
+
+public class AdvanceCallBack extends SimpleCallback{
+
+
+
+ public AdvanceCallBack(IDistributionClient client) {
+ super(client);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ protected void postDownloadLogic( IDistributionClientDownloadResult downloadResult) {
+ if( downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS){
+ saveArtifactPayloadToDisk(downloadResult);
+ }
+
+ }
+
+ protected void saveFile(byte[] bs, String fileName) {
+ try {
+ String downloadPath = SimpleConfiguration.downloadPath();
+ FileOutputStream fileOuputStream = new FileOutputStream(downloadPath + fileName);
+ fileOuputStream.write(bs);
+ fileOuputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ protected void saveArtifactPayloadToDisk(IDistributionClientDownloadResult downloadResult) {
+ System.out.println("################ Downloaded Artifact Payload Start ################");
+ String fileName = downloadResult.getArtifactName().replaceAll("attachment; filename=","");
+ saveFile(downloadResult.getArtifactPayload(), fileName.replaceAll("\"", ""));
+ System.out.println("################ Downloaded Artifact Payload End ################");
+ }
+
+
+
+
+}
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
new file mode 100644
index 0000000..7d79571
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/ArtifactTypeEnum.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Enum That Represents possible Artifacts Types.
+ *
+ */
+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;
+ }
+
+ private String type;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = 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<String>();
+ for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
+ types.add(ate.getType());
+ }
+ return types;
+ }
+}
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
new file mode 100644
index 0000000..519684b
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/ClientTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+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.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.Level;
+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);
+ String serviceSubstitutionMappingsTypeName = csarHelper.getServiceSubstitutionMappingsTypeName();
+ System.out.println("serviceSubstitutionMappingsTypeName is "+serviceSubstitutionMappingsTypeName);
+ }
+ 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);
+
+ IDistributionClient client = DistributionClientFactory.createDistributionClient();
+ INotificationCallback callback;
+ Boolean download = SimpleConfiguration.toDownload();
+ if( download ){
+ callback = new AdvanceCallBack(client);
+ }
+ else{
+ callback = new SimpleCallback(client);
+ }
+ IDistributionClientResult result = client.init(new SimpleConfiguration(), callback);
+
+ System.out.println(result.getDistributionMessageResult());
+
+ System.out.println("Starting client...");
+ IDistributionClientResult startResult = client.start();
+
+ // Thread.sleep(10000);
+ // client.stop();
+
+ System.out.println(startResult.getDistributionMessageResult());
+
+ }
+
+}
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
new file mode 100644
index 0000000..c7345f2
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/Decoder.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+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();
+ }
+
+}
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java
new file mode 100644
index 0000000..3b2d772
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.test;
+
+import org.openecomp.sdc.api.IDistributionClient;
+import org.openecomp.sdc.api.notification.INotificationData;
+
+public class NotificationCallback extends SimpleCallback{
+ INotificationData latestCallbackData;
+ public INotificationData getData() {
+ return latestCallbackData;
+ }
+ public NotificationCallback(IDistributionClient client) {
+ super(client);
+ }
+
+ public void activateCallback(INotificationData data) {
+ this.latestCallbackData = data;
+ super.activateCallback(data);
+ }
+}
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
new file mode 100644
index 0000000..1166109
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
@@ -0,0 +1,309 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+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;
+
+
+public class SimpleCallback implements INotificationCallback {
+ protected IDistributionClient client;
+ public List<IArtifactInfo> iArtifactInfo;
+
+ public final Map<String, IDistributionClientResult> simpleCallbackResults = new HashMap<String, IDistributionClientResult>();
+
+ public Map<String, IDistributionClientResult> getSimpleCallbackResults() {
+ return simpleCallbackResults;
+ }
+
+ public List<IArtifactInfo> getIArtifactInfo(){
+ return iArtifactInfo;
+ }
+ public SimpleCallback(IDistributionClient client) {
+ this.client = client;
+ }
+
+
+
+
+
+ public void activateCallback(INotificationData data) {
+
+ List<IArtifactInfo> artifacts = getArtifacts(data);
+
+
+ for (IArtifactInfo iArtifactInfo : artifacts) {
+
+ IArtifactInfo artifactMetadataByUUID = data.getArtifactMetadataByUUID(iArtifactInfo.getArtifactUUID());
+ assertEquals("check artifact checksum", iArtifactInfo.getArtifactChecksum(), artifactMetadataByUUID.getArtifactChecksum());
+ System.out.println(artifactMetadataByUUID.getArtifactURL());
+ if (artifactMetadataByUUID.getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA)){
+ IDistributionClientDownloadResult download = client.download(iArtifactInfo);
+ if (download.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS){
+ List<IVfModuleMetadata> decodeVfModuleArtifact = client.decodeVfModuleArtifact(download.getArtifactPayload());
+// assertEquals("decoded not equal to actual group amount ", decodeVfModuleArtifact.size(), 2);
+ if (!decodeVfModuleArtifact.isEmpty()){
+ for (IVfModuleMetadata moduleMetadata : decodeVfModuleArtifact) {
+ List<String> moduleArtifacts = moduleMetadata.getArtifacts();
+ if (moduleArtifacts != null) {
+
+ for (String artifactId : moduleArtifacts) {
+
+ IArtifactInfo artifactInfo = data.getArtifactMetadataByUUID(artifactId);
+ IDistributionClientDownloadResult downloadArt = client.download(artifactInfo);
+ assertEquals(downloadArt.getDistributionActionResult(), DistributionActionResultEnum.SUCCESS);
+
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ for (IArtifactInfo relevantArtifact : artifacts){
+ // Download Artifact
+ IDistributionClientDownloadResult downloadResult = client.download(relevantArtifact);
+
+ postDownloadLogic(downloadResult);
+
+
+
+ simpleCallbackResults.put("downloadResult", downloadResult);
+ System.out.println("downloadResult: " + downloadResult.toString());
+ System.out.println("<<<<<<<<<<< Artifact content >>>>>>>>>>");
+ System.out.println(Decoder.encode(downloadResult.getArtifactPayload()));
+
+ /////Print artifact content to console///////
+
+// byte[] contentInBytes = BaseEncoding.base64().decode(Decoder.encode(downloadResult.getArtifactPayload()));
+// try {
+// System.out.println("Source content: " + new String(contentInBytes, "UTF-8"));
+// } catch (UnsupportedEncodingException e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+ System.out.println("ArtInfo_timeout: "+ relevantArtifact.getArtifactTimeout());
+ System.out.println("ArtInfo_Art_description: "+ relevantArtifact.getArtifactDescription());
+ System.out.println("ArtInfo_Art_CheckSum: "+ relevantArtifact.getArtifactChecksum());
+ System.out.println("ArtInfo_Art_Url: "+ relevantArtifact.getArtifactURL());
+ System.out.println("ArtInfo_Art_Type: "+ relevantArtifact.getArtifactType());
+ System.out.println("ArtInfo_Art_Name: "+ relevantArtifact.getArtifactName());
+ System.out.println("ArtInfo_UUID: " + relevantArtifact.getArtifactUUID());
+ System.out.println("ArtInfo_Version: " + relevantArtifact.getArtifactVersion());
+ System.out.println("ArtInfo_RelatedArtifacts: "+ relevantArtifact.getRelatedArtifacts());
+
+ System.out.println("ArtInfo_Serv_description: " + data.getServiceDescription());
+ System.out.println("ArtInfo_Serv_Name: " + data.getServiceName());
+ System.out.println("Get_serviceVersion: " + data.getServiceVersion());
+ System.out.println("Get_Service_UUID: " + data.getServiceUUID());
+ System.out.println("ArtInfo_DistributionId: " + data.getDistributionID());
+ System.out.println("ArtInfo_ServiceInvariantUUID: " + data.getServiceInvariantUUID());
+
+
+ // assertTrue("response code is not 200, returned :" + downloadResult.getDistributionActionResult(), downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS );
+
+ try {
+ String payload = new String(downloadResult.getArtifactPayload());
+// System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
+// System.out.println(payload);
+// System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
+
+ } catch (Exception e) {
+ System.out.println("catch");
+// break;
+ // TODO: handle exception
+ }
+
+
+
+
+ if (downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
+ handleSuccessfullDownload(data, relevantArtifact);
+ } else {
+ handleFailedDownload(data, relevantArtifact);
+ }
+ }
+// if (data != null){
+// iArtifactInfo.addAll(artifacts);
+// }
+
+ }
+
+ private List<IArtifactInfo> getArtifacts(INotificationData data) {
+ List<IArtifactInfo> ret = new ArrayList<IArtifactInfo>();
+ List<IResourceInstance> resources = data.getResources();
+// data.getArtifactMetadataByUUID(arg0)
+ List<String> relevantArtifactTypes = client.getConfiguration().getRelevantArtifactTypes();
+
+ List<IArtifactInfo> collect = resources.stream().flatMap( e -> e.getArtifacts().stream()).filter(p -> relevantArtifactTypes.contains(p.getArtifactType() )).collect(Collectors.toList());
+// if( resources != null ){
+// for( IResourceInstance resourceInstance : resources){
+// if( resourceInstance.getArtifacts() != null ){
+//
+//
+//
+// ret.addAll(resourceInstance.getArtifacts());
+//
+//
+// }
+// }
+// }
+ ret.addAll(collect);
+
+ List<IArtifactInfo> servicesArt = data.getServiceArtifacts();
+ if( servicesArt != null ){
+ ret.addAll(servicesArt);
+ }
+
+ System.out.println("I am here: " + ret.toString());
+ return ret;
+ }
+
+
+
+ private void handleFailedDownload(INotificationData data,
+ IArtifactInfo relevantArtifact) {
+ // Send Download Status
+ IDistributionClientResult sendDownloadStatus = client.sendDownloadStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.DOWNLOAD_ERROR));
+ postDownloadStatusSendLogic(sendDownloadStatus);
+ }
+
+ private void handleSuccessfullDownload(INotificationData data, IArtifactInfo relevantArtifact) {
+ // Send Download Status
+ IDistributionClientResult sendDownloadStatus = client.sendDownloadStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.DOWNLOAD_OK));
+
+ simpleCallbackResults.put("sendDownloadStatus", sendDownloadStatus);
+// assertTrue("response code is not 200, returned :" + sendDownloadStatus.getDistributionActionResult(), sendDownloadStatus.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS );
+
+ // Doing deployment ...
+ postDownloadStatusSendLogic(sendDownloadStatus);
+ boolean isDeployedSuccessfully = handleDeployment();
+ IDistributionClientResult deploymentStatus;
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (isDeployedSuccessfully) {
+ deploymentStatus = client.sendDeploymentStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.DEPLOY_OK));
+
+ simpleCallbackResults.put("sendDeploymentStatus", deploymentStatus);
+// assertTrue("response code is not 200, returned :" + deploymentStatus.getDistributionActionResult(), deploymentStatus.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS );
+
+ } else {
+ deploymentStatus = handleFailedDeployment(data, relevantArtifact);
+ }
+
+ postDeploymentStatusSendLogic(deploymentStatus);
+ }
+
+ private IDistributionClientResult handleFailedDeployment(INotificationData data, IArtifactInfo relevantArtifact) {
+ IDistributionClientResult deploymentStatus;
+ boolean isAlreadyDeployed = checkIsDeployed();
+ if (isAlreadyDeployed) {
+ deploymentStatus = client.sendDeploymentStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.ALREADY_DEPLOYED));
+ } else {
+ deploymentStatus = client.sendDeploymentStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.DEPLOY_ERROR));
+ }
+ return deploymentStatus;
+ }
+
+ protected void postDownloadLogic(IDistributionClientDownloadResult downloadResult) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void postDownloadStatusSendLogic(
+ IDistributionClientResult sendDownloadStatus) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void postDeploymentStatusSendLogic(
+ IDistributionClientResult deploymentStatus) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private boolean checkIsDeployed() {
+ return false;
+ }
+
+ private boolean handleDeployment() {
+ return true;
+// to return deploy_error use return false
+// return false;
+ }
+
+ public static IDistributionStatusMessage buildStatusMessage(
+ final IDistributionClient client, final INotificationData data,
+ final IArtifactInfo relevantArtifact,
+ final DistributionStatusEnum status) {
+ IDistributionStatusMessage statusMessage = new IDistributionStatusMessage() {
+
+ public long getTimestamp() {
+ long currentTimeMillis = System.currentTimeMillis();
+ return currentTimeMillis;
+ }
+
+ public DistributionStatusEnum getStatus() {
+ return status;
+ }
+
+ public String getDistributionID() {
+ return data.getDistributionID();
+ }
+
+ public String getConsumerID() {
+ return client.getConfiguration().getConsumerID();
+ }
+
+ public String getArtifactURL() {
+ return relevantArtifact.getArtifactURL();
+ }
+ };
+ return statusMessage;
+ }
+
+
+}
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
new file mode 100644
index 0000000..9c07c12
--- /dev/null
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
@@ -0,0 +1,187 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.test;
+
+import java.util.List;
+
+import org.openecomp.sdc.api.consumer.IConfiguration;
+
+public class SimpleConfiguration implements IConfiguration{
+
+ /*public String getUser()
+ {
+ return System.getProperty("user");
+ }
+
+ public List<String> getRelevantArtifactTypes() {
+ return ArtifactTypeEnum.getAllTypes();
+ }
+
+ public int getPollingTimeout()
+ {
+ return 20;
+ }
+
+ public int getPollingInterval()
+ {
+ return 20;
+ }
+
+ public String getPassword()
+ {
+ return System.getProperty("password");
+ }
+
+ public String getEnvironmentName()
+ {
+ return System.getProperty("env");
+ }
+
+ public String getConsumerID()
+ {
+ return System.getProperty("consumerID");
+ }
+
+ public String getConsumerGroup()
+ {
+ return System.getProperty("groupID");
+ }
+
+ public String getAsdcAddress()
+ {
+ return System.getProperty("beAddress");
+ }
+
+ public String getKeyStorePath()
+ {
+ return "";
+ }
+
+ public String getKeyStorePassword()
+ {
+ return "Aa123456";
+ }
+
+ public boolean activateServerTLSAuth()
+ {
+ return Boolean.parseBoolean(System.getProperty("auth"));
+// res.add(ArtifactTypeEnum.HEAT_ARTIFACT);
+// res.add(ArtifactTypeEnum.HEAT_ENV);
+// res.add(ArtifactTypeEnum.MURANO_PKG);
+// res.add(ArtifactTypeEnum.VF_LICENSE);
+// res.add(ArtifactTypeEnum.APPC_CONFIG);
+// res.add(ArtifactTypeEnum.MODEL_INVENTORY_PROFILE);
+// res.add(ArtifactTypeEnum.VNF_CATALOG);
+// res.add(ArtifactTypeEnum.APPC_CONFIG);
+// res.add(ArtifactTypeEnum.VF_MODULES_METADATA);
+// return "PROD-Tedy-Only";
+// return "A-AI";
+// return "A-AI";
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return false;
+ }
+
+ public static String downloadPath() {
+ return "c:\\temp\\";
+ }
+
+ public static Boolean toDownload() {
+ return false;
+ }*/
+
+ public String getUser() {
+ return "ci";
+ }
+
+ public List<String> getRelevantArtifactTypes() {
+
+// List<String> res = new ArrayList<String>();
+// for (ArtifactTypeEnum type : AssetTypeEnum.values()){
+// res.add(type.name());
+// }
+ return ArtifactTypeEnum.getAllTypes();
+ }
+
+
+ public int getPollingTimeout() {
+ return 20;
+ }
+
+ public int getPollingInterval() {
+ return 20;
+ }
+
+ public String getPassword() {
+ return "123456";
+ }
+
+ public String getEnvironmentName() {
+ return "PROD";
+ }
+
+ public String getConsumerID() {
+ return "consumerVasya";
+ }
+
+ public String getConsumerGroup() {
+ return "groupVasya";
+
+ }
+
+ public static Boolean toDownload() {
+ return false;
+ }
+
+ public static String downloadPath() {
+ return "c:\\temp\\";
+ }
+
+ public String getAsdcAddress() {
+ return "127.0.0.1:8443";
+ }
+
+ @Override
+ public String getKeyStorePath() {
+ //return "";
+ return "etc/asdc-client.jks";
+ }
+
+ @Override
+ public String getKeyStorePassword() {
+
+ return "Aa123456";
+ }
+
+ @Override
+ public boolean activateServerTLSAuth() {
+
+ return false;
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return false;
+ }
+
+}
diff --git a/sdc-distribution-ci/src/main/resources/ci/conf/attsdc-packages.yaml b/sdc-distribution-ci/src/main/resources/ci/conf/attsdc-packages.yaml
new file mode 100644
index 0000000..34a78d9
--- /dev/null
+++ b/sdc-distribution-ci/src/main/resources/ci/conf/attsdc-packages.yaml
@@ -0,0 +1,10 @@
+packages:
+ - org.openecomp.sdc.ci.tests.execute.general
+ - org.openecomp.sdc.ci.tests.execute.user
+ - org.openecomp.sdc.ci.tests.execute.property
+ - org.openecomp.sdc.ci.tests.execute.lifecycle
+ - org.openecomp.sdc.ci.tests.execute.resource
+ - org.openecomp.sdc.ci.tests.execute.service
+ - org.openecomp.sdc.ci.tests.execute.artifacts
+ - org.openecomp.sdc.ci.tests.execute.imports
+ - org.openecomp.sdc.ci.tests.execute.category \ No newline at end of file
diff --git a/sdc-distribution-ci/src/main/resources/ci/conf/attsdc.yaml b/sdc-distribution-ci/src/main/resources/ci/conf/attsdc.yaml
new file mode 100644
index 0000000..a9c449e
--- /dev/null
+++ b/sdc-distribution-ci/src/main/resources/ci/conf/attsdc.yaml
@@ -0,0 +1,35 @@
+outputFolder: target
+reportName: index.html
+catalogBeHost: behost
+catalogFeHost: fehost
+esHost: eshost
+disributionClientHost: disClient
+catalogFePort: 8181
+catalogBePort: 8080
+disributionClientPort: 8181
+esPort: 9200
+neoHost: neoHost
+neoPort: 7474
+neoDBusername: neo4j
+neoDBpassword: 123456
+
+resourceConfigDir: src/test/resources/CI/tests
+componentsConfigDir: src/test/resources/CI/components
+importResourceConfigDir: src/test/resources/CI/importResource
+importResourceTestsConfigDir: src/test/resources/CI/importResourceTests
+errorConfigurationFile: ../catalog-be/src/main/resources/config/error-configuration.yaml
+
+titanPropertiesFile: src/main/resources/ci/conf/titan.properties
+
+stopOnClassFailure: false
+
+#List of non-abstract resources to keep during titan cleanup between tests
+#Only 1.0 version will be kept
+resourcesNotToDelete:
+ - tosca.nodes.Compute
+ - tosca.nodes.Database
+ - tosca.nodes.ObjectStorage
+ - tosca.nodes.BlockStorage
+ - tosca.nodes.LoadBalancer
+ - org.openecomp.resource.cp.Port
+ - org.openecomp.resource.vl.Network \ No newline at end of file
diff --git a/sdc-distribution-ci/src/main/resources/ci/conf/log4j.properties b/sdc-distribution-ci/src/main/resources/ci/conf/log4j.properties
new file mode 100644
index 0000000..3e159ec
--- /dev/null
+++ b/sdc-distribution-ci/src/main/resources/ci/conf/log4j.properties
@@ -0,0 +1,34 @@
+# Define the root logger with appender file
+log4j.rootLogger = DEBUG, FILE, stdout
+
+# Define the file appender
+log4j.appender.FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.FILE.File=${targetlog}logs/ci-log.out
+
+# Define the layout for file appender
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n
+
+# Set the maximum file size before rollover
+log4j.appender.FILE.maxFileSize=5MB
+
+# Set the the backup index
+log4j.appender.FILE.maxBackupIndex=10
+
+
+#############################################################
+
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n
+
+log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
+log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
+
+log4j.logger.org.openecomp.sdc.ci.tests.utils=TRACE, FILE, stdout
+log4j.additivity.org.openecomp.sdc.ci.tests.utils=false
+
+
diff --git a/sdc-distribution-ci/src/main/resources/ci/conf/titan.properties b/sdc-distribution-ci/src/main/resources/ci/conf/titan.properties
new file mode 100644
index 0000000..691f4d6
--- /dev/null
+++ b/sdc-distribution-ci/src/main/resources/ci/conf/titan.properties
@@ -0,0 +1,5 @@
+storage.backend=cassandra
+storage.hostname=cassandrahost
+storage.port=9160
+
+cache.db-cache = false \ No newline at end of file
diff --git a/sdc-distribution-ci/src/main/resources/ci/scripts/startTest.sh b/sdc-distribution-ci/src/main/resources/ci/scripts/startTest.sh
new file mode 100644
index 0000000..604903a
--- /dev/null
+++ b/sdc-distribution-ci/src/main/resources/ci/scripts/startTest.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+function usage {
+ echo "Usage: $0 <jar file>"
+}
+
+function exitOnError() {
+ if [ $1 -ne 0 ]
+ then
+ echo "Failed running task $2"
+ exit 2
+ fi
+}
+
+if [ $# -lt 1 ]
+then
+ usage
+ exit 2
+fi
+
+CURRENT_DIR=`pwd`
+BASEDIR=$(dirname $0)
+
+if [ ${BASEDIR:0:1} = "/" ]
+then
+ FULL_PATH=$BASEDIR
+else
+ FULL_PATH=$CURRENT_DIR/$BASEDIR
+fi
+
+LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties
+#############################################
+TARGET_DIR=${FULL_PATH}/target
+CONF_FILE=${FULL_PATH}/conf/attsdc.yaml
+DEBUG=true
+MainClass=org.openecomp.sdc.ci.tests.run.StartTest
+
+JAR_FILE=$1
+
+#TARGET_DIR=`echo ${TARGET_DIR} | sed 's/\//\//g'`
+#echo $TARGET_DIR
+
+TESTS_DIR=/opt/app/sdc/ci/resources/tests
+COMPONENTS_DIR=/opt/app/sdc/ci/resources/components
+
+#sed -i 's#\(outputFolder:\).*#\1 '${TARGET_DIR}'#g' $CONF_FILE
+#sed -i 's#\(resourceConfigDir:\).*#\1 '${TESTS_DIR}'#g' $CONF_FILE
+#sed -i 's#\(componentsConfigDir:\).*#\1 '${COMPONENTS_DIR}'#g' $CONF_FILE
+TARGET_LOG_DIR="${TARGET_DIR}/"
+
+mkdir -p ${TARGET_DIR}
+if [ -d ${TARGET_DIR} ]
+then
+ rm -rf ${TARGET_DIR}/*
+ exitOnError $? "Failed_to_delete_target_dir"
+fi
+
+debug_port=8800
+#JAVA_OPTION="-javaagent:/var/tmp/jacoco/lib/jacocoagent.jar=destfile=jacoco-it.exec"
+JAVA_OPTION=""
+case "$2" in
+ -debug) echo "Debug mode, Listen on port $debug_port"; JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;;
+ "") echo "Standard mode";;
+ *) echo "USAGE: startTest.sh [-debug]";;
+esac
+
+cmd="java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass}"
+
+#echo $cmd
+#console=`$cmd`
+
+if [ $DEBUG == "true" ]
+then
+ $cmd
+else
+ $cmd >> /dev/null
+fi
+status=`echo $?`
+
+
+
+echo "##################################################"
+echo "################# status is ${status} #################"
+echo "##################################################"
+
+exit $status
+