diff options
author | Michael Lando <ml636r@att.com> | 2017-06-09 03:19:04 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-06-09 03:19:04 +0300 |
commit | ed64b5edff15e702493df21aa3230b81593e6133 (patch) | |
tree | a4cb01fdaccc34930a8db403a3097c0d1e40914b /distribution-ci/src | |
parent | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (diff) |
[SDC-29] catalog 1707 rebase commit.
Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'distribution-ci/src')
13 files changed, 0 insertions, 1425 deletions
diff --git a/distribution-ci/src/main/java/org/openecomp/test/BaseInit.java b/distribution-ci/src/main/java/org/openecomp/test/BaseInit.java deleted file mode 100644 index b056b35b75..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/BaseInit.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.openecomp.test; - -//import static org.junit.Assert.assertNotNull; -//import static org.junit.Assert.assertTrue; -// -//import java.io.IOException; -// -//import org.junit.Before; -//import org.junit.rules.TestName; -// -//import org.openecomp.sdc.be.model.User; -//import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -//import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -//import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; -//import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -//import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; -//import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -////import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; -//import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -//import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; -//import org.openecomp.sdc.ci.tests.utils.ArtifactUtils; -//import org.openecomp.sdc.ci.tests.utils.DbUtils; -////import org.openecomp.sdc.ci.tests.utils.ResourceUtils; -////import org.openecomp.sdc.ci.tests.utils.ServiceUtils; -//import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -//import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -//import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; -//import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -//import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; -//import org.openecomp.sdc.common.api.ArtifactTypeEnum; - -public abstract class BaseInit { - - -// protected ResourceReqDetails resourceDetails; -// protected ResourceReqDetails resourceDetails1; -// protected ServiceReqDetails serviceDetails; -// protected ServiceReqDetails serviceDetails2; -// protected ComponentInstanceReqDetails resourceInstanceReqDetails; -// protected ComponentInstanceReqDetails resourceInstanceReqDetails2; -// protected User sdncDesignerDetails1; -// protected User sdncTesterDeatails1; -// protected User sdncAdminDetails1; -// protected ArtifactReqDetails heatArtifactDetails; -// -// protected ArtifactReqDetails defaultArtifactDetails; -// //protected ResourceUtils resourceUtils; -// protected ArtifactUtils artifactUtils; -// -// -// //static ServiceUtils serviceUtils = new ServiceUtils(); -// public BaseInit(TestName testName, String className) { -// super(testName, className); -// } -// @Before -// public void before() throws Exception{ -// -// initializeMembers(); -// -// createComponents(); -// -// } -// public void initializeMembers() throws IOException, Exception { -// -// resourceDetails = ElementFactory.getDefaultResource(); -// resourceDetails1 = ElementFactory.getDefaultResource("secondResource", NormativeTypesEnum.ROOT); -// serviceDetails = ElementFactory.getDefaultService(); -// serviceDetails2 = ElementFactory.getDefaultService("newTestService2", ServiceCategoriesEnum.MOBILITY, "al1976"); -// sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); -// sdncTesterDeatails1 = ElementFactory.getDefaultUser(UserRoleEnum.TESTER); -// sdncAdminDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); -// heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType()); -// resourceInstanceReqDetails = ElementFactory.getDefaultComponentInstance(); -// resourceInstanceReqDetails2 = ElementFactory.getDefaultComponentInstance(); -// -// } -// protected void createComponents() throws Exception{ -// -//// Create resources -// RestResponse response = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1); -// assertTrue("create request returned status:" + response.getErrorCode(),response.getErrorCode() == 201); -// assertNotNull("resource uniqueId is null:", resourceDetails.getUniqueId()); -// -// response = ResourceRestUtils.createResource(resourceDetails1, sdncDesignerDetails1); -// assertTrue("create request returned status:" + response.getErrorCode(),response.getErrorCode() == 201); -// assertNotNull("resource uniqueId is null:", resourceDetails1.getUniqueId()); -// -//// Create services -// response = ServiceRestUtils.createService(serviceDetails, sdncDesignerDetails1); -// assertTrue("create request returned status:" + response.getErrorCode(),response.getErrorCode() == 201); -// assertNotNull("service uniqueId is null:", serviceDetails.getUniqueId()); -// -// response = ServiceRestUtils.createService(serviceDetails2, sdncDesignerDetails1); -// assertTrue("create request returned status:" + response.getErrorCode(),response.getErrorCode() == 201); -// assertNotNull("service uniqueId is null:", serviceDetails2.getUniqueId()); -// -// ArtifactReqDetails heatArtifactDetails = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType()); -// response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails, sdncDesignerDetails1, resourceDetails.getUniqueId()); -// assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(),response.getErrorCode() == 200); -// -// ArtifactReqDetails heatArtifactDetails1 = ElementFactory.getDefaultDeploymentArtifactForType(ArtifactTypeEnum.HEAT.getType()); -// response = ArtifactRestUtils.addInformationalArtifactToResource(heatArtifactDetails1, sdncDesignerDetails1, resourceDetails1.getUniqueId()); -// assertTrue("add HEAT artifact to resource request returned status:" + response.getErrorCode(),response.getErrorCode() == 200); -// -// // certified resources -//// response = LCSbaseTest.certifyResource(resourceDetails); -//// assertTrue("certify resource request returned status:" + response.getErrorCode(),response.getErrorCode() == 200); -//// -//// response = LCSbaseTest.certifyResource(resourceDetails1); -//// assertTrue("certify resource request returned status:" + response.getErrorCode(),response.getErrorCode() == 200); -//// -//// add resource instance with HEAT deployment artifact to the service -// resourceInstanceReqDetails.setUniqueId(resourceDetails.getUniqueId()); -//// response = ServiceUtils.createResourceInstance(resourceInstanceReqDetails, sdncDesignerDetails1, serviceDetails.getUniqueId()); -//// assertTrue("response code is not 200, returned: " + response.getErrorCode(),response.getErrorCode() == 200); -// -// DbUtils.cleanAllAudits(); -// -// -// } - -} diff --git a/distribution-ci/src/main/java/org/openecomp/test/CallableTask.java b/distribution-ci/src/main/java/org/openecomp/test/CallableTask.java deleted file mode 100644 index 814fe9ae46..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/CallableTask.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.openecomp.test; - -//import java.util.concurrent.Callable; -// -//import org.openecomp.sdc.api.IDistributionClient; -//import org.openecomp.sdc.api.results.IDistributionClientResult; -//import org.openecomp.sdc.impl.DistributionClientFactory; -//import org.openecomp.sdc.be.model.Service; -//import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; - -public class CallableTask { - -// NotificationCallback notifCallback = null; -// //private ServiceUtils serviceUtils; -// private Service service; -// -// //public CallableTask(ServiceUtils serviceUtils, Service service) { -// public CallableTask(Service service) { -// //this.serviceUtils = serviceUtils; -// this.service = service; -// } -// -// public NotificationCallback getNotifCallback() { -// return notifCallback; -// } -// -// @Override -// public Boolean call() throws Exception { -// -// IDistributionClient client = DistributionClientFactory.createDistributionClient(); -// -// notifCallback = new NotificationCallback(client); -// IDistributionClientResult result = client.init(new SimpleConfiguration(), notifCallback); -// -// System.out.println("result.getDistributionMessageResult: " + result.getDistributionMessageResult()); -// -// System.out.println("Starting client..."); -// IDistributionClientResult start = client.start(); -// System.out.println(start.getDistributionMessageResult()); -// -//// RestResponse changeStateToDISTRIBUTED = serviceUtils.changeStateToDISTRIBUTED(service, UserUtils.getGovernorDetails1()); -// ServiceReqDetails serviceDetails = new ServiceReqDetails(); -// serviceDetails.setUniqueId(service.getUniqueId()); -// //RestResponse changeStateToDISTRIBUTED = serviceUtils.changeDistributionStatus(serviceDetails, "1.0", UserUtils.getGovernorDetails1(), "change", DistributionStatusEnum.DISTRIBUTED); -// //assertTrue("response code is not 200, returned :" + changeStateToDISTRIBUTED.getErrorCode(), changeStateToDISTRIBUTED.getErrorCode() == 200); -// -// -//// while (simpleCallback.getSimpleCallbackResults().size()<3){ -// System.err.println("Sleeping..."); -// Thread.sleep(5000); -// System.err.println("Finished Sleeping..."); -//// } -// -// return true; -// } - -} diff --git a/distribution-ci/src/main/java/org/openecomp/test/ClientTest.java b/distribution-ci/src/main/java/org/openecomp/test/ClientTest.java deleted file mode 100644 index 1a10860828..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/ClientTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.test; - -import org.slf4j.LoggerFactory; - -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.results.IDistributionClientResult; -import org.openecomp.sdc.impl.DistributionClientFactory; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.LoggerContext; - -public class ClientTest { - public static void main(String[] args) throws InterruptedException { - - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - lc.getLogger("org.apache.http").setLevel(Level.INFO); - - IDistributionClient client = DistributionClientFactory.createDistributionClient(); - - IDistributionClientResult result = client.init(new SimpleConfiguration(), new NotificationCallback(client)); - 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/distribution-ci/src/main/java/org/openecomp/test/E2eFlows.java b/distribution-ci/src/main/java/org/openecomp/test/E2eFlows.java deleted file mode 100644 index 521fc21312..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/E2eFlows.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.openecomp.test; - -import org.junit.rules.TestName; - -//import static org.junit.Assert.assertTrue; -// -//import java.util.concurrent.ExecutorService; -//import java.util.concurrent.Executors; -//import java.util.concurrent.Future; -//import java.util.concurrent.TimeUnit; -// -//import org.junit.After; -//import org.junit.Test; -//import org.junit.rules.TestName; -// -//import org.openecomp.sdc.api.IDistributionClient; -//import org.openecomp.sdc.api.notification.IArtifactInfo; -//import org.openecomp.sdc.api.notification.INotificationData; -//import org.openecomp.sdc.api.results.IDistributionClientResult; -//import org.openecomp.sdc.impl.DistributionClientFactory; -//import org.openecomp.sdc.utils.DistributionActionResultEnum; -//import org.openecomp.sdc.be.model.DistributionStatusEnum; -//import org.openecomp.sdc.be.model.Service; -//import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; -//import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -////import org.openecomp.sdc.ci.tests.users.UserUtils; -//import org.openecomp.sdc.ci.tests.utils.DbUtils; -//import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; - -public class E2eFlows { - - - -// private IDistributionClient client = DistributionClientFactory.createDistributionClient(); -// private ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor(); -// -// private CallableTask callableTask; -// private NotificationCallback notifCallback; -// private IArtifactInfo iArtifactInfo; -// - - -// -// @After -// public void after() throws Exception { -// client.stop(); -// Thread.sleep(5000); -// } -// -// // ---------------------------------Success -// // scenario-------------------------------------------------------------------------------- -// -// @Test -// public void distributeService() throws Exception{ -// createServiceReadyForDistribution(); -// //RestResponse changeStateToDISTRIBUTED = serviceUtils.changeDistributionStatus(serviceDetails, "1.0", UserUtils.getGovernorDetails1(), "change", DistributionStatusEnum.DISTRIBUTED); -// //assertTrue("response code is not 200, returned :" + changeStateToDISTRIBUTED.getErrorCode(), changeStateToDISTRIBUTED.getErrorCode() == 200); -// -// } -// @Test -// public void E2E_Success() throws Exception { -// Service service = createServiceReadyForDistribution(); -// -//// clean audit -// DbUtils.cleanAllAudits(); -// -// //Create task to run in BG -// callableTask = new CallableTask(service); -// -// //Run the task in BG -// System.err.println("Executing Task..."); -// Future<Boolean> f = newSingleThreadExecutor.submit(callableTask); -// -// //Wait for task to complete and return with result -// -//// while (!f.isDone()){ -// System.err.println("Waiting for result..."); -// // Thread.sleep(30000); -//// } -// Boolean result = f.get(15, TimeUnit.SECONDS); -// -// System.out.println("future:" + result); -// -// //Check Results -// notifCallback = callableTask.getNotifCallback(); -// -// INotificationData data = notifCallback.getData(); -// -// System.out.println("result map size = "+ notifCallback.getSimpleCallbackResults().size()); -// IDistributionClientResult downloadResult = notifCallback.getSimpleCallbackResults().get("downloadResult"); -// assertTrue("response code is not SUCCESS, returned :"+ downloadResult.getDistributionActionResult(),downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS); -// -// } -// -// -// private Service createServiceReadyForDistribution() throws Exception { -//// RestResponse response = LCSbaseTest.certifyService(serviceDetails); -//// assertTrue("response code is not 200, returned :" + response.getErrorCode(), response.getErrorCode() == 200); -//// Service service = ResponseParser.convertServiceResponseToJavaObject(response.getResponse()); -//// -//// RestResponse changeDistributionStateToApprove = serviceUtils.changeDistributionStateToApprove(service,UserUtils.getGovernorDetails1()); -//// assertTrue("response code is not 200, returned :" + changeDistributionStateToApprove.getErrorCode(), changeDistributionStateToApprove.getErrorCode() == 200); -//// service = ResponseParser.convertServiceResponseToJavaObject(changeDistributionStateToApprove.getResponse()); -//// return service; -// return null; -// } - -} diff --git a/distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java b/distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java deleted file mode 100644 index 247b9a9984..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/NotificationCallback.java +++ /dev/null @@ -1,19 +0,0 @@ -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/distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java b/distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java deleted file mode 100644 index a7b2311867..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java +++ /dev/null @@ -1,275 +0,0 @@ -package org.openecomp.test; - -import static org.junit.Assert.*; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.apache.commons.codec.binary.Base64; - -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.openecomp.sdc.ci.tests.utils.Decoder; -import org.openecomp.sdc.ci.tests.utils.general.FileUtils; -import com.google.common.io.BaseEncoding; - -public class SimpleCallback implements INotificationCallback { - private 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; - } - - private 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/distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java b/distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java deleted file mode 100644 index 7f2ff91906..0000000000 --- a/distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.openecomp.test; - -import java.util.List; - -import org.openecomp.sdc.api.consumer.IConfiguration; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; - -public class SimpleConfiguration implements IConfiguration{ - -// public String getUser() -// { -// return System.getProperty("user"); -// } -// -// public List<String> getRelevantArtifactTypes() { -// List<String> res = new ArrayList<String>(); -// for (ArtifactTypeEnum type : ArtifactTypeEnum.values()){ -// res.add(type.name()); -// } -// return res; -// } -// -// 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"; -// } - - - - 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-Rom"; - } - - public String getConsumerID() { - return "ys9693-groupVasya"; - } - - public String getConsumerGroup() { -// return "mso-groupTedy"; - return "ys9693-consumerVasya"; - } - - 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; - } - -} diff --git a/distribution-ci/src/main/resources/ci/conf/log4j.properties b/distribution-ci/src/main/resources/ci/conf/log4j.properties deleted file mode 100644 index 3e159ec8df..0000000000 --- a/distribution-ci/src/main/resources/ci/conf/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# 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/distribution-ci/src/main/resources/ci/conf/sdc-packages.yaml b/distribution-ci/src/main/resources/ci/conf/sdc-packages.yaml deleted file mode 100644 index 34a78d9275..0000000000 --- a/distribution-ci/src/main/resources/ci/conf/sdc-packages.yaml +++ /dev/null @@ -1,10 +0,0 @@ -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/distribution-ci/src/main/resources/ci/conf/sdc.yaml b/distribution-ci/src/main/resources/ci/conf/sdc.yaml deleted file mode 100644 index a9c449e672..0000000000 --- a/distribution-ci/src/main/resources/ci/conf/sdc.yaml +++ /dev/null @@ -1,35 +0,0 @@ -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/distribution-ci/src/main/resources/ci/conf/titan.properties b/distribution-ci/src/main/resources/ci/conf/titan.properties deleted file mode 100644 index 691f4d6877..0000000000 --- a/distribution-ci/src/main/resources/ci/conf/titan.properties +++ /dev/null @@ -1,5 +0,0 @@ -storage.backend=cassandra -storage.hostname=cassandrahost -storage.port=9160 - -cache.db-cache = false
\ No newline at end of file diff --git a/distribution-ci/src/main/resources/ci/scripts/startTest.sh b/distribution-ci/src/main/resources/ci/scripts/startTest.sh deleted file mode 100644 index 88659a80b6..0000000000 --- a/distribution-ci/src/main/resources/ci/scripts/startTest.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/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/sdc.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 - diff --git a/distribution-ci/src/test/java/org/openecomp/sdc/ci/tests/execute/downloadArtifactUGN/ClientDownloadArtifact.java b/distribution-ci/src/test/java/org/openecomp/sdc/ci/tests/execute/downloadArtifactUGN/ClientDownloadArtifact.java deleted file mode 100644 index 7337c941a5..0000000000 --- a/distribution-ci/src/test/java/org/openecomp/sdc/ci/tests/execute/downloadArtifactUGN/ClientDownloadArtifact.java +++ /dev/null @@ -1,491 +0,0 @@ -package org.openecomp.sdc.ci.tests.execute.downloadArtifactUGN; - -import org.junit.Test; - -/** - * - * @author al714h - * US510007 - Story : ASDC Distr Client - Download Artifact - * following test set partially cover the US451327 - Story : API to download the specific artifact, cover the audit message. - */ - -//public class ClientDownloadArtifact extends AttSdcTest{ - public class ClientDownloadArtifact { - -// Logger logger = null; -// -// DistributionUtils distributionUtils = new DistributionUtils(); -// DownloadArtifactDetails downloadArtifactDetails = new DownloadArtifactDetails(); -// Utils utils = new Utils(); -// DbUtils dbUtils = new DbUtils(); -// UserUtils userUtils = new UserUtils(); -// ResourceUtils resourceUtils = new ResourceUtils(); -// ServiceUtils serviceUtils = new ServiceUtils(); -// ArtifactUtils artifactUtils = new ArtifactUtils(); -// private JSONParser jsonParser = new JSONParser(); -// - String serviceBaseVersion = "0.1"; -// -// @Before -// public void before() throws Exception { -// -// distributionUtils.resetInit(); -// dbUtils.cleanAllAudits(); -// } -// @Rule -// public static TestName name = new TestName(); -// -// } -// -// @Rule -// public static TestName name = new TestName(); -// -//// public ClientDownloadArtifact() { -//// super(name, ClientDownloadArtifact.class.getName()); -//// } -// -// ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource(); -//// get default artifact info to upload -// ArtifactDefinition uploadedResourceArtifactInfo = artifactUtils.constructDefaultArtifactInfo(); -//// set artifact info for download -// downloadArtifactDetails.setArtifactName(uploadedResourceArtifactInfo.getArtifactName()); -// String artifactName = downloadArtifactDetails.getArtifactName(); -//// Andrey TODO String resourceArtifactUrl = String.format(Urls.DOWNLOAD_RESOURCE_ARTIFACT,); -// -// int numOfResourcArtifacts = 1; -// RestResponse createCertifiedResourceWithArtifacts = resourceUtils.createCertifiedResourceWithArtifacts(resourceDetails, uploadedResourceArtifactInfo, numOfResourcArtifacts); -// -// -// -// try{ -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// distributionUtils.verifyDownloadedArtifact(downloadArtifactRestResponse, uploadedResourceArtifactInfo); -// -// // validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// }finally{ -//// delete created resource -// resourceUtils.deleteResource_allVersions(resourceDetails, UserUtils.getAdminDetails()); -// } - -// } - -// send all mandatory headers only - @Test - public void downloadServiceArtifactSuccess() throws Exception{ - -//// ServiceReqDetails serviceDetails = serviceUtils.createDefaultDetailsService(); -// ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(); -// Service service = new Service(); -// try{ -//// get default artifact info to upload -// ArtifactDefinition uploadedResourceArtifactInfo = artifactUtils.constructDefaultArtifactInfo(); -// uploadedResourceArtifactInfo.setArtifactType(ArtifactTypeEnum.HEAT.getType()); -// ArtifactDefinition uploadedServiceArtifactInfo = artifactUtils.constructDefaultArtifactInfo(); -// uploadedServiceArtifactInfo.setArtifactType(ArtifactTypeEnum.MURANO_PKG.getType()); -// -//// set artifact info for download -// downloadArtifactDetails.setArtifactName(uploadedServiceArtifactInfo.getArtifactName()); -// downloadArtifactDetails.setArtifactType(ArtifactTypeEnum.MURANO_PKG.getType()); -// String artifactName = downloadArtifactDetails.getArtifactName(); -// -//// create default resource details -// ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource(); -// -// int numOfResourcArtifacts = 1; -// service = serviceUtils.createCertifiedServiceWithResourceInstanceAndArtifacts(serviceDetails, resourceDetails, uploadedResourceArtifactInfo, uploadedServiceArtifactInfo , numOfResourcArtifacts); -// logger.debug("service version = " + service.getVersion()); -// logger.debug("service distribution status = " + service.getDistributionStatus()); -// RestResponse changeDistributionStateToApprove = serviceUtils.changeDistributionStateToApprove(service, UserUtils.getGovernorDetails1()); -// -// int status = changeDistributionStateToApprove.getErrorCode(); -// assertTrue("response code is not 200, returned :" + status, status == 200); -// -// serviceDetails.setVersion(service.getVersion()); -// serviceDetails.setUniqueId(service.getUniqueId()); -// -// String responseString = changeDistributionStateToApprove.getResponse(); -// Gson gson = new Gson(); -// service = gson.fromJson(responseString, Service.class); -// ServiceMetadataDataDefinition serviceMetadataDataDefinition = gson.fromJson(responseString, ServiceMetadataDataDefinition.class); -// service.setDistributionStatus(DistributionStatusEnum.findState(serviceMetadataDataDefinition.getDistributionStatus())); -// DistributionStatusEnum distributionStatus = service.getDistributionStatus(); -// assertNotNull("distribution state is null",distributionStatus.name()); -// assertTrue("the default distribution state is invalid", DistributionStatusEnum.DISTRIBUTION_APPROVED.equals(distributionStatus)); -// -// String serviceArtifactUrl = String.format(Urls.DISTRIBUTION_DOWNLOAD_ARTIFACT,service.getName(), service.getVersion(), artifactName); -// logger.debug("download service artifact url: "+ serviceArtifactUrl+ " serviceName = " + service.getName() + " service version = " + service.getVersion() + "service artifact name = " + artifactName); -// -// -//// Log.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -//// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -//// distributionUtils.verifyDownloadedArtifact(downloadArtifactRestResponse, uploadedArtifactInfo); -//// -//// // validate audit message server side -//// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -//// String action = "ArtifactDownload"; -//// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -//// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// }finally{ -//// delete created service -// serviceUtils.deleteService_allVersions(serviceDetails, UserUtils.getAdminDetails()); -// } - -// @Test -// public void downloadServiceArtifactSuccess() throws Exception{ -// -//// ServiceReqDetails serviceDetails = serviceUtils.createDefaultDetailsService(); -// ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(); -// Service service = new Service(); -// try{ -//// get default artifact info to upload -// ArtifactDefinition uploadedResourceArtifactInfo = artifactUtils.constructDefaultArtifactInfo(); -// uploadedResourceArtifactInfo.setArtifactType(ArtifactTypeEnum.HEAT.getType()); -// ArtifactDefinition uploadedServiceArtifactInfo = artifactUtils.constructDefaultArtifactInfo(); -// uploadedServiceArtifactInfo.setArtifactType(ArtifactTypeEnum.MURANO_PKG.getType()); -// -//// set artifact info for download -// downloadArtifactDetails.setArtifactName(uploadedServiceArtifactInfo.getArtifactName()); -// downloadArtifactDetails.setArtifactType(ArtifactTypeEnum.MURANO_PKG.getType()); -// String artifactName = downloadArtifactDetails.getArtifactName(); -// -//// create default resource details -// ResourceReqDetails resourceDetails = ElementFactory.getDefaultResource(); -// -// int numOfResourcArtifacts = 1; -// service = serviceUtils.createCertifiedServiceWithResourceInstanceAndArtifacts(serviceDetails, resourceDetails, uploadedResourceArtifactInfo, uploadedServiceArtifactInfo , numOfResourcArtifacts); -// logger.debug("service version = " + service.getVersion()); -// logger.debug("service distribution status = " + service.getDistributionStatus()); -// RestResponse changeDistributionStateToApprove = serviceUtils.changeDistributionStateToApprove(service, UserUtils.getGovernorDetails1()); -// -// int status = changeDistributionStateToApprove.getErrorCode(); -// assertTrue("response code is not 200, returned :" + status, status == 200); -// -// serviceDetails.setVersion(service.getVersion()); -// serviceDetails.setUniqueId(service.getUniqueId()); -// -// String responseString = changeDistributionStateToApprove.getResponse(); -// Gson gson = new Gson(); -// service = gson.fromJson(responseString, Service.class); -// ServiceMetadataDataDefinition serviceMetadataDataDefinition = gson.fromJson(responseString, ServiceMetadataDataDefinition.class); -// service.setDistributionStatus(DistributionStatusEnum.findState(serviceMetadataDataDefinition.getDistributionStatus())); -// DistributionStatusEnum distributionStatus = service.getDistributionStatus(); -// assertNotNull("distribution state is null",distributionStatus.name()); -// assertTrue("the default distribution state is invalid", DistributionStatusEnum.DISTRIBUTION_APPROVED.equals(distributionStatus)); -// -// String serviceArtifactUrl = String.format(Urls.DISTRIBUTION_DOWNLOAD_ARTIFACT,service.getName(), service.getVersion(), artifactName); -// logger.debug("download service artifact url: "+ serviceArtifactUrl+ " serviceName = " + service.getName() + " service version = " + service.getVersion() + "service artifact name = " + artifactName); -// -// -//// Log.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -//// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -//// distributionUtils.verifyDownloadedArtifact(downloadArtifactRestResponse, uploadedArtifactInfo); -//// -//// // validate audit message server side -//// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -//// String action = "ArtifactDownload"; -//// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -//// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// }finally{ -//// delete created service -// serviceUtils.deleteService_allVersions(serviceDetails, UserUtils.getAdminDetails()); -// } -// -// } -// -//// Andrey not relevant, dev ci should cover, qa can't influence on sending headers -////// send all headers mandatory and not mandatory -//// @Test -//// public void downloadArtifactSuccessMandatoryAndNotMandatoryHeaders() throws Exception{ -//// -//// Log.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -//// -//// Map<String, String> headersMap = new HashMap<String,String>(); -//// headersMap.put(HttpHeaderEnum.X_ECOMP_InstanceID.getValue(), "instar_name"); // mandatory -//// headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), "usernamePassword"); // mandatory -//// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/octet-stream"); // not mandatory -//// headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(),downloadArtifactDetails.getResourceUUID());// not mandatory -//// Log.debug("headers detailes: "+ headersMap.toString()); -//// -//// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, headersMap); -//// distributionUtils.verifyDownloadedArtifact(downloadArtifactRestResponse); -//// -////// validate audit message server side -//// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -//// String action = "ArtifactDownload"; -//// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -//// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -//// -//// } -// -// -////---------------------------------Failure scenario-------------------------------------------------------------------------------- -// -//// Andrey not relevant, dev ci should cover, qa can't influence on sending headers -////// missing InstanceID mandatory header -//// @Test -//// public void downloadArtifactMissingInstanceIdHeader() throws Exception, JSONException{ -//// -//// Log.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -//// -//// Map<String, String> headersMap = new HashMap<String,String>(); -//// headersMap.put(HttpHeaderEnum.AUTHORIZATION.getValue(), "usernamePassword"); // mandatory -//// Log.debug("headers detailes: "+ headersMap.toString()); -//// -//// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, headersMap); -//// -//// ErrorInfo errorInfo = utils.parseYaml(ActionStatus.MISSING_X_ECOMP_INSTANCE_ID.name()); -//// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -//// -//// List<String> variables = Arrays.asList(); -//// utils.checkBodyResponseOnError(ActionStatus.MISSING_X_ECOMP_INSTANCE_ID.name(), variables, downloadArtifactRestResponse.getResponse())); -//// -//// } -// -//// Andrey not relevant, dev ci should cover, qa can't influence on sending headers -////// missing Authorization mandatory header -//// @Test -//// public void downloadArtifactMissingAuthorizationHeader() throws Exception, JSONException{ -//// -//// Log.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -//// -//// Map<String, String> headersMap = new HashMap<String,String>(); -//// headersMap.put(HttpHeaderEnum.X_ECOMP_InstanceID.getValue(), "usernamePassword"); // mandatory -//// Log.debug("headers detailes: "+ headersMap.toString()); -//// -//// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, headersMap); -//// -//// ErrorInfo errorInfo = utils.parseYaml(ActionStatus.ECOMP_RESEND_WITH_BASIC_AUTHENTICATION_CREDENTIALS.name()); -//// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -//// -//// List<String> variables = Arrays.asList(); -//// utils.checkBodyResponseOnError(ActionStatus.ECOMP_RESEND_WITH_BASIC_AUTHENTICATION_CREDENTIALS.name(), variables, downloadArtifactRestResponse.getResponse())); -//// -//// } -// -// -//// artifact not found -// @Test -// public void downloadArtifactArtifactNotFound() throws Exception, JSONException{ -// -// downloadArtifactDetails.setArtifactName("artifactNotExist"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.DISTRIBUTION_ARTIFACT_NOT_FOUND.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.DISTRIBUTION_ARTIFACT_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse()); -// -//// validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// expectedArtifactDownloadAuditMessageInfo.setStatus(errorInfo.getCode().toString()); -// String desc = "Error: Artifact " + downloadArtifactDetails.getArtifactName() + " was not found"; -// expectedArtifactDownloadAuditMessageInfo.setDesc(desc); -// -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// -// } -// -//// service not found -// @Test -// public void downloadArtifactServiceNameNotFound() throws Exception, JSONException{ -// -// downloadArtifactDetails.setArtifactURL("/asdc/v1/services/serviceNotExist/0.1/artifacts/aaa.hh"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.SERVICE_NOT_FOUND.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse()); -// -//// validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// expectedArtifactDownloadAuditMessageInfo.setStatus(errorInfo.getCode().toString()); -//// TODO Andrey, change desc message -// String desc = "Error: Artifact " + downloadArtifactDetails.getArtifactName() + " was not found"; -// expectedArtifactDownloadAuditMessageInfo.setDesc(desc); -// -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// -// } -// -// -//// service version not found -// @Test -// public void downloadArtifactServiceVersionNotFound() throws Exception, JSONException{ -// -// downloadArtifactDetails.setArtifactURL("/asdc/v1/services/serviceName/0.888/artifacts/aaa.hh"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.COMPONENT_VERSION_NOT_FOUND.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.COMPONENT_VERSION_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse()); -// -//// validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// expectedArtifactDownloadAuditMessageInfo.setStatus(errorInfo.getCode().toString()); -//// TODO Andrey, change desc message -// String desc = "Error: Artifact " + downloadArtifactDetails.getArtifactName() + " was not found"; -// expectedArtifactDownloadAuditMessageInfo.setDesc(desc); -// -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// -// } -// -//// invalid HTTP method, PUT HTTP method -// @Test -// public void downloadArtifactByPutMethod() throws Exception, JSONException{ -// -// String method = "PUT"; -// -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendDownloadedArtifactByMethod(downloadArtifactDetails, null, method); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT.name(), variables, downloadArtifactRestResponse.getResponse()); -// -// } -// -//// invalid HTTP method, DELETE HTTP method -// @Test -// public void downloadArtifactByDeleteMethod() throws Exception, JSONException{ -// -// String method = "DELETE"; -// downloadArtifactDetails.setArtifactName("artifactNotExist"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.DISTRIBUTION_ARTIFACT_NOT_FOUND.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.DISTRIBUTION_ARTIFACT_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse()); -// -//// validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// expectedArtifactDownloadAuditMessageInfo.setStatus(errorInfo.getCode().toString()); -// String desc = "Error: Artifact " + downloadArtifactDetails.getArtifactName() + " was not found"; -// expectedArtifactDownloadAuditMessageInfo.setDesc(desc); -// -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// -// downloadArtifactDetails.setArtifactURL("/asdc/v1/services/serviceNotExist/0.1/artifacts/aaa.hh"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.SERVICE_NOT_FOUND.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.SERVICE_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse()); -// -//// validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// expectedArtifactDownloadAuditMessageInfo.setStatus(errorInfo.getCode().toString()); -//// TODO Andrey, change desc message -// String desc = "Error: Artifact " + downloadArtifactDetails.getArtifactName() + " was not found"; -// expectedArtifactDownloadAuditMessageInfo.setDesc(desc); -// -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// downloadArtifactDetails.setArtifactURL("/asdc/v1/services/serviceName/0.888/artifacts/aaa.hh"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.COMPONENT_VERSION_NOT_FOUND.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.COMPONENT_VERSION_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse()); -// -//// validate audit message server side -// ArtifactDownloadAuditMessageInfo expectedArtifactDownloadAuditMessageInfo = distributionUtils.constructDefaultArtifactDownloadAuditMessageInfo(); -// expectedArtifactDownloadAuditMessageInfo.setStatus(errorInfo.getCode().toString()); -//// TODO Andrey, change desc message -// String desc = "Error: Artifact " + downloadArtifactDetails.getArtifactName() + " was not found"; -// expectedArtifactDownloadAuditMessageInfo.setDesc(desc); -// -// String action = "ArtifactDownload"; -// ArtifactDownloadAuditMessageInfo actualArtifactDownloadAuditMessageInfo = userUtils.parseDestributionAuditRespByAction(action); -// distributionUtils.validateArtifactDownloadAuditMessage(actualArtifactDownloadAuditMessageInfo, expectedArtifactDownloadAuditMessageInfo); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendDownloadedArtifactByMethod(downloadArtifactDetails, null, method); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT.name(), variables, downloadArtifactRestResponse.getResponse()); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendDownloadedArtifactByMethod(downloadArtifactDetails, null, method); -// -// ErrorInfo errorInfo = utils.parseErrorConfigYaml(ActionStatus.METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT.name()); -// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -// -// List<String> variables = Arrays.asList(); -// utils.checkBodyResponseOnError(ActionStatus.METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT.name(), variables, downloadArtifactRestResponse.getResponse()); -// downloadArtifactDetails.setArtifactChecksum("invalidChecksum"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -//// TODO -// -//// ErrorInfo errorInfo = utils.parseYaml(ActionStatus.SPECIFIED_SERVICE_RESOURCE_VERSION_NOT_FOUND.name()); -//// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -//// -//// List<String> variables = Arrays.asList(); -//// utils.checkBodyResponseOnError(ActionStatus.SPECIFIED_SERVICE_RESOURCE_VERSION_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse())); -// -// downloadArtifactDetails.setArtifactChecksum("invalidChecksum"); -// logger.debug("artifact detailes: "+ downloadArtifactDetails.toString()); -// -// RestResponse downloadArtifactRestResponse = distributionUtils.sendGetDownloadedArtifact(downloadArtifactDetails, null); -//// TODO -// -//// ErrorInfo errorInfo = utils.parseYaml(ActionStatus.SPECIFIED_SERVICE_RESOURCE_VERSION_NOT_FOUND.name()); -//// assertEquals("Check response code after artifact download request", errorInfo.getCode(), downloadArtifactRestResponse.getErrorCode()); -//// -//// List<String> variables = Arrays.asList(); -//// utils.checkBodyResponseOnError(ActionStatus.SPECIFIED_SERVICE_RESOURCE_VERSION_NOT_FOUND.name(), variables, downloadArtifactRestResponse.getResponse())); -// -// } -// -// -// -// - - } - -} |