1 package org.openecomp.sdc.cucumber.steps;
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5 import static org.mockserver.model.HttpCallback.callback;
6 import static org.mockserver.model.HttpRequest.request;
7 import static org.mockserver.model.HttpResponse.response;
8 import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnResult;
9 import static org.testng.Assert.assertEquals;
10 import static org.testng.Assert.assertNotNull;
12 import java.util.ArrayList;
13 import java.util.Arrays;
14 import java.util.Collections;
15 import java.util.Date;
16 import java.util.HashMap;
17 import java.util.HashSet;
18 import java.util.List;
20 import java.util.Optional;
22 import java.util.UUID;
23 import java.util.function.Function;
24 import java.util.stream.Collectors;
26 import org.apache.commons.collections.CollectionUtils;
27 //import org.openecomp.sdc.dmaap.DmaapPublisher;
28 import org.apache.commons.lang3.StringUtils;
29 import org.apache.http.HttpStatus;
30 import org.apache.http.entity.ContentType;
31 import org.apache.http.entity.StringEntity;
32 import org.mockserver.integration.ClientAndServer;
33 import org.mockserver.model.Header;
34 import org.mockserver.model.HttpRequest;
35 import org.openecomp.sdc.api.IDistributionClient;
36 import org.openecomp.sdc.api.consumer.IConfiguration;
37 import org.openecomp.sdc.api.consumer.IFinalDistrStatusMessage;
38 import org.openecomp.sdc.api.consumer.INotificationCallback;
39 import org.openecomp.sdc.api.notification.IArtifactInfo;
40 import org.openecomp.sdc.api.notification.INotificationData;
41 import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
42 import org.openecomp.sdc.api.results.IDistributionClientResult;
43 import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
44 import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao;
45 import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum;
46 import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
47 import org.openecomp.sdc.common.datastructure.FunctionalInterfaces;
48 import org.openecomp.sdc.common.datastructure.Wrapper;
49 import org.openecomp.sdc.cucumber.spring.ImportTableConfig;
50 import org.openecomp.sdc.http.HttpAsdcClient;
51 import org.openecomp.sdc.http.HttpAsdcResponse;
52 import org.openecomp.sdc.http.IHttpAsdcClient;
53 import org.openecomp.sdc.impl.DistributionClientFactory;
54 import org.openecomp.sdc.utils.ArtifactTypeEnum;
55 import org.openecomp.sdc.utils.DistributionActionResultEnum;
56 import org.openecomp.sdc.utils.DistributionStatusEnum;
57 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
59 import com.google.common.base.Strings;
60 import com.google.common.net.HttpHeaders;
61 import com.google.gson.JsonElement;
62 import com.google.gson.JsonParser;
64 import cucumber.api.java.After;
65 import cucumber.api.java.Before;
66 import cucumber.api.java.en.Given;
67 import cucumber.api.java.en.Then;
68 import cucumber.api.java.en.When;
69 import fj.data.Either;
71 public class StepsTenantIsolationCI {
73 private Map<String, OperationalEnvironmentEntry> recordMap = new HashMap<>();
74 private OperationalEnvironmentDao operationalEnvironmentDao;
75 private ClientAndServer aaiMockServer;
76 private ClientAndServer msoMockServer;
77 private List<IDistributionClient> distributionClients = new ArrayList<>();
79 private List<String> wdFinalStatusSent = new ArrayList<>();
81 private HttpRequest msoHttpRequest;
82 private List<String> uuidServicesList;
83 private boolean cleanFlag = true;
84 private int maxStepWaitTimeMs;
86 private List<String> envIds = new ArrayList<>();
87 private List<OperationalEnvironmentEntry> envList = new ArrayList<>();
88 private String asdcAddress;
89 private volatile int numberOfFinalDistributionsSentByASDC;
90 private int numOfArtifactsToDownload;
91 private volatile int totalNumOfArtifactsToDownload;
92 private List<String> envNames = new ArrayList<>(Arrays.asList("Apple", "Orange", "Grape", "Pear", "Watermelon", "Bannana", "Cherry", "Coconut", "Fig", "Mango", "Peach", "Pineapple", "Plum", "Strawberries", "Apricot"));
94 private static final String AAI_RESPONSE_BODY_FMT = "{\"operational-environment-id\":\"UUID of Operational Environment\","
95 + "\"operational-environment-name\":\"Op Env Name\"," + "\"operational-environment-type\":\"ECOMP\","
96 + "\"operational-environment-status\":\"Activate\"," + "\"tenant-context\":\"%s\","
97 + "\"workload-context\":\"%s\"," + "\"resource-version\":\"1505228226913\"," + "\"relationship-list\":{}}";
99 private static final String AAI_PATH_REGEX = "/aai/v12/cloud-infrastructure/operational-environments/.*";
101 private static final String MSO_PATH_REGEX = "/onap/mso/infra/modelDistributions/v1/distributions/.*";
104 public void beforeScenario() {
105 Collections.shuffle(envNames);
106 aaiMockServer = ClientAndServer.startClientAndServer(1111);
107 msoMockServer = ClientAndServer.startClientAndServer(1112);
109 this.operationalEnvironmentDao = createDaoObj();
113 public void afterScenario() {
114 System.out.println("Cleaning Up After Scenario...");
115 aaiMockServer.stop();
116 msoMockServer.stop();
118 envIds.stream().forEach(operationalEnvironmentDao::delete);
120 distributionClients.stream().forEach(IDistributionClient::stop);
121 System.out.println("Cleaning Up After Scenario Done");
124 // ############################# Given - Start #############################
126 @Given("^clean db after test is (.*)$")
127 public void clean_db_after_test_is(boolean cleanFlag) {
128 this.cleanFlag = cleanFlag;
131 @Given("^AAI returns (.*) and aai_body contains (.*) and (.*)$")
132 public void aai_returns(int retCode, String tenant, String workload) throws Throwable {
133 String aaiResponseBody = String.format(AAI_RESPONSE_BODY_FMT, tenant, workload);
135 setAaiMockServer(aaiResponseBody);
137 System.out.println(aaiMockServer.getClass());
140 @Given("^MSO-WD Simulators Started with topic name (.*)$")
141 public void notification_listner_simulators_started(String topicName) throws Throwable {
142 envList.forEach(env -> {
143 final IDistributionClient distClientSim = simulateDistributionClientWD(topicName, env);
144 distributionClients.add(distClientSim);
149 @Given("^MSO Final Distribution Simulator is UP$")
150 public void mso_Final_Distribution_Simulator_is_UP() throws Throwable {
151 msoHttpRequest = request().withPath(MSO_PATH_REGEX);
152 msoMockServer.when(msoHttpRequest).callback(
153 callback().withCallbackClass("org.openecomp.sdc.cucumber.steps.PrecannedTestExpectationCallback"));
156 @Given("^ASDC Address is (.*)$")
157 public void asdc_Address_is(String asdcAddress) throws Throwable {
158 this.asdcAddress = asdcAddress;
162 @Given("^ASDC Contains the following services (.*)$")
163 public void asdc_Contains_the_following_services(String listOfServicesUUID) throws Throwable {
164 uuidServicesList = Arrays.asList(listOfServicesUUID.split(",")).stream().map(String::trim)
165 .collect(Collectors.toList());
167 int maxMinWait = uuidServicesList.size() * envIds.size();
168 this.maxStepWaitTimeMs = 60000 * maxMinWait;
169 System.out.println(String.format("Set Max Step Wait Time To: %s Minutes", maxMinWait));
172 @Given("^The number of complete environments is (.*)$")
173 public void the_number_of_complete_environments_is(int envNum) throws Throwable {
176 while( envNum > envNames.size()){
177 envNames.add(String.valueOf(counter));
182 for (int i = 0; i < envNum; i++) {
183 OperationalEnvironmentEntry preSaveEntry = new OperationalEnvironmentEntry();
185 preSaveEntry.setStatus(EnvironmentStatusEnum.COMPLETED);
186 preSaveEntry.setLastModified(new Date(System.currentTimeMillis()));
188 Set<String> uebAdresses = new HashSet<>();
189 uebAdresses.add("uebsb92sfdc.it.att.com");
190 preSaveEntry.setDmaapUebAddress(uebAdresses);
191 preSaveEntry.setIsProduction(false);
192 preSaveEntry.setUebApikey("sSJc5qiBnKy2qrlc");
193 preSaveEntry.setUebSecretKey("4ZRPzNJfEUK0sSNBvccd2m7X");
194 preSaveEntry.setTenant("TEST");
195 preSaveEntry.setEcompWorkloadContext("ECOMP_E2E-IST");
197 // String envId = UUID.randomUUID().toString();
198 String envId = envNames.get(i);
199 preSaveEntry.setEnvironmentId(envId);
201 envList.add(preSaveEntry);
202 operationalEnvironmentDao.save(preSaveEntry);
206 @Given("^The number of artifacts each Simulator downloads from a service is (.*)$")
207 public void number_of_artifacts_each_simulator_downloads(int numOfArtifactsToDownload) throws Throwable {
208 this.numOfArtifactsToDownload = numOfArtifactsToDownload;
211 // ############################# Given - End #############################
213 // ############################# When - Start #############################
214 @When("^Distribution Requests are Sent By MSO$")
215 public void distribution_Requests_are_Sent_By_MSO() throws Throwable {
216 envList.stream().forEach(this::distributeServiceInEnv);
220 @When("^The Number Of Operational Envrinoments that created is (.*) and Records are added with data (.*)$")
221 public void operational_envrinoments_records_are_added_with_data(int numOfRecords, String recordData)
223 for (int i = 0; i < numOfRecords; i++) {
224 OperationalEnvironmentEntry preSaveEntry = new OperationalEnvironmentEntry();
225 JsonElement root = new JsonParser().parse(recordData);
227 String originalStatus = root.getAsJsonObject().get("status").getAsString();
228 int delta = root.getAsJsonObject().get("last_modified_delta").getAsInt();
229 preSaveEntry.setStatus(EnvironmentStatusEnum.getByName(originalStatus));
230 long last_modified = System.currentTimeMillis() + delta * 1000;
231 preSaveEntry.setLastModified(new Date(last_modified));
232 String envId = UUID.randomUUID().toString();
233 preSaveEntry.setEnvironmentId(envId);
235 // envrionmentIds.add(envId);
236 operationalEnvironmentDao.save(preSaveEntry);
242 // ############################# When - End #############################
244 // ############################# Then - Start #############################
245 @Then("^Operational Environment record contains tenant field (.*$)")
246 public void operational_environment_record_contains_tenant(boolean tenantExist) throws Throwable {
247 envIds.forEach(envId -> {
248 validateStringFieldPresent(tenantExist, OperationalEnvironmentEntry::getTenant, envId,
249 "Tenant is not as expected");
253 @Then("^Operational Environment record contains workload field (.*$)")
254 public void operational_environment_record_contains_workload(boolean workloadExist) throws Throwable {
255 envIds.forEach(envId -> {
256 validateStringFieldPresent(workloadExist, OperationalEnvironmentEntry::getEcompWorkloadContext, envId,
257 "Workload is not as expected");
261 @Then("^Operational Environment record contains UEB Address field (.*$)")
262 public void operational_environment_record_contains_ueb_address(boolean uebAddresExist) throws Throwable {
263 envIds.forEach(envId -> {
264 validateStringFieldPresent(uebAddresExist, this::convertUebAddressToList, envId,
265 "UEB Address is not as expected");
269 @Then("^The Number Of Environment is (.*) with status (.*)$")
270 public void the_Number_Of_Environment_Created_is(int numberOfEnvsCreated, String status) throws Throwable {
271 // Write code here that turns the phrase above into concrete actions
273 retryMethodOnResult(() -> getCurrentEnvironmets(status), envList -> envList.size() == numberOfEnvsCreated,
276 List<OperationalEnvironmentEntry> environmentsFound = getCurrentEnvironmets(status);
278 assertThat(environmentsFound.size(), is(numberOfEnvsCreated));
280 environmentsFound.forEach(env -> recordMap.put(env.getEnvironmentId(), env));
281 envList.addAll(environmentsFound);
284 @Then("^MSO Final Distribution Recieved Correct Number Of Request$")
285 public void mso_final_distribution_recieved_request() throws Throwable {
286 int expectedNumberOfRequestsSentByASDC = calculateExcpectedNumberOfDistributionRequets();
287 Function<Integer, Boolean> resultVerifier = actualStatusList -> actualStatusList >= expectedNumberOfRequestsSentByASDC;
288 retryMethodOnResult(() -> numberOfFinalDistributionsSentByASDC(expectedNumberOfRequestsSentByASDC),
289 resultVerifier, maxStepWaitTimeMs, 500);
290 int actualNumberOfRequestsSentByASDC = numberOfFinalDistributionsSentByASDC(expectedNumberOfRequestsSentByASDC);
291 assertThat(actualNumberOfRequestsSentByASDC, is(expectedNumberOfRequestsSentByASDC));
294 @Then("^All MSO-WD Simulators Sent The Distribution Complete Notifications$")
295 public void all_mso_wd_simulators_sent_the_distribution_complete_notifications() {
296 // Wait Watch Dogs To Send Final Distribution
297 int excpectedNumberOfDistributionCompleteNotifications = calculateExcpectedNumberOfDistributionRequets();
298 final Function<List<String>, Boolean> resultVerifier = actualStatusList -> actualStatusList
299 .size() == excpectedNumberOfDistributionCompleteNotifications;
300 retryMethodOnResult(() -> wdFinalStatusSent, resultVerifier, maxStepWaitTimeMs, 500);
301 assertThat(wdFinalStatusSent.size(), is(excpectedNumberOfDistributionCompleteNotifications));
303 @Then("^All Artifacts were downloaded by Simulators$")
304 public void all_artifacts_downloaded() {
305 // Wait Watch Dogs To Send Final Distribution
306 int excpectedNumberOfArtifactsToDownload = numOfArtifactsToDownload * envIds.size() * uuidServicesList.size();
307 assertThat(totalNumOfArtifactsToDownload, is(excpectedNumberOfArtifactsToDownload));
309 // ############################# Then - End #############################
311 private List<OperationalEnvironmentEntry> getCurrentEnvironmets(String status) {
312 Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> eitherStatus = operationalEnvironmentDao
313 .getByEnvironmentsStatus(EnvironmentStatusEnum.getByName(status));
314 assertThat(eitherStatus.isLeft(), is(true));
316 List<OperationalEnvironmentEntry> environmentsRetrieved = eitherStatus.left().value();
318 List<OperationalEnvironmentEntry> environmentsFound = environmentsRetrieved.stream()
319 .filter(env -> envIds.contains(env.getEnvironmentId())).collect(Collectors.toList());
320 return environmentsFound;
323 private int numberOfFinalDistributionsSentByASDC(int expectedNumberOfRequestsSentByASDC) {
324 final int newVal = msoMockServer.retrieveRecordedRequests(msoHttpRequest).length;
325 if (newVal != numberOfFinalDistributionsSentByASDC) {
326 System.out.println(String.format(
327 "MSO Server Simulator Recieved %s/%s Final Distribution Complete Rest Reports From ASDC", newVal,
328 expectedNumberOfRequestsSentByASDC));
329 numberOfFinalDistributionsSentByASDC = newVal;
335 private int calculateExcpectedNumberOfDistributionRequets() {
336 int numberOfDistributionRequests = envList.size() * uuidServicesList.size();
337 return numberOfDistributionRequests;
340 private static OperationalEnvironmentDao createDaoObj() {
341 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ImportTableConfig.class);
342 final OperationalEnvironmentDao openvDao = (OperationalEnvironmentDao) context
343 .getBean("operational-environment-dao");
347 private OperationalEnvironmentEntry getRecord(String environmentId) {
348 Either<OperationalEnvironmentEntry, CassandraOperationStatus> result = operationalEnvironmentDao
350 return result.isLeft() ? result.left().value() : null;
353 private void validateStringFieldPresent(boolean fieldExist,
354 Function<OperationalEnvironmentEntry, String> getFieldFunc, String envId, String msg) {
355 OperationalEnvironmentEntry record = recordMap.computeIfAbsent(envId, this::getRecord);
357 assertNotNull(record, "Expected DB record was not found");
359 String actualValue = getFieldFunc.apply(record);
361 assertEquals(fieldExist, !Strings.isNullOrEmpty(actualValue), msg);
364 private void setAaiMockServer(String aaiResponseBody) {
365 HttpRequest httpRequest = request().withMethod("GET").withPath(AAI_PATH_REGEX)
366 .withHeaders(new Header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType()));
368 aaiMockServer.when(httpRequest)
370 .withHeaders(new Header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType()))
371 .withBody(aaiResponseBody));
374 private IDistributionClient simulateDistributionClientWD(String topicName, OperationalEnvironmentEntry opEnv) {
376 IDistributionClient client = DistributionClientFactory.createDistributionClient();
377 final IConfiguration buildDistributionClientConfiguration = buildDistributionClientConfiguration(topicName,
379 IDistributionClientResult initResult = client.init(buildDistributionClientConfiguration,
380 new INotificationCallback() {
383 public void activateCallback(INotificationData data) {
384 buildWdSimulatorCallback(opEnv, client, buildDistributionClientConfiguration, data);
389 assertThat(initResult.getDistributionActionResult(), is(DistributionActionResultEnum.SUCCESS));
390 IDistributionClientResult startResult = client.start();
391 assertThat(startResult.getDistributionActionResult(), is(DistributionActionResultEnum.SUCCESS));
392 System.out.println(String.format("WD Simulator On Environment:\"%s\" Started Successfully",
393 buildDistributionClientConfiguration.getConsumerID()));
397 private IFinalDistrStatusMessage buildFinalDistribution() {
398 return new IFinalDistrStatusMessage() {
401 public long getTimestamp() {
402 return System.currentTimeMillis();
406 public DistributionStatusEnum getStatus() {
407 return DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK;
411 public String getDistributionID() {
412 return "FakeDistributionId";
417 private IConfiguration buildDistributionClientConfiguration(String topicName, OperationalEnvironmentEntry opEnv) {
418 return new IConfiguration() {
420 public String getUser() {
424 public int getPollingTimeout() {
428 public int getPollingInterval() {
432 public String getPassword() {
436 public String getEnvironmentName() {
440 public String getConsumerID() {
441 return opEnv.getEnvironmentId();
444 public String getConsumerGroup() {
445 return String.format("BenchMarkDistributionClientConsumerGroup%s", opEnv.getEnvironmentId());
448 public String getAsdcAddress() {
449 return String.format("%s:8443", asdcAddress);
453 public String getKeyStorePath() {
454 // TODO Auto-generated method stub
459 public String getKeyStorePassword() {
460 // TODO Auto-generated method stub
465 public boolean activateServerTLSAuth() {
466 // TODO Auto-generated method stub
471 public List<String> getRelevantArtifactTypes() {
472 return Arrays.asList(ArtifactTypeEnum.values()).stream()
473 .map(artifactTypeEnum -> artifactTypeEnum.name()).collect(Collectors.toList());
477 public boolean isFilterInEmptyResources() {
478 // TODO Auto-generated method stub
483 public Boolean isUseHttpsWithDmaap() {
488 public List<String> getMsgBusAddress() {
489 return opEnv.getDmaapUebAddress().stream().map(this::extractHost).collect(Collectors.toList());
492 private String extractHost(String url) {
493 return url.split(":")[0];
498 private void distributeServiceInEnv(OperationalEnvironmentEntry env) {
499 uuidServicesList.stream().forEach(serviceUUID -> distributeSingleService(env, serviceUUID));
502 private void distributeSingleService(OperationalEnvironmentEntry env, String serviceUUID) {
503 IHttpAsdcClient client = new HttpAsdcClient(buildDistributionClientConfiguration(StringUtils.EMPTY, env));
504 String pattern = "/sdc/v1/catalog/services/%s/distribution/%s/activate";
505 String requestUrl = String.format(pattern, serviceUUID, env.getEnvironmentId());
506 String requestBody = String.format("{\"workloadContext\":\"%s\"}", env.getEnvironmentId());
507 StringEntity body = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
508 Map<String, String> headersMap = new HashMap<>();
509 headersMap.put("USER_ID", "cs0008");
510 headersMap.put("X-ECOMP-InstanceID", "test");
511 headersMap.put("Content-Type", "application/json");
513 HttpAsdcResponse postRequest = FunctionalInterfaces.retryMethodOnResult(
514 () -> distributeMethod(client, requestUrl, serviceUUID, body, headersMap, env.getEnvironmentId()),
515 resp -> resp.getStatus() == HttpStatus.SC_ACCEPTED);
516 assertThat(postRequest.getStatus(), is(HttpStatus.SC_ACCEPTED));
520 private HttpAsdcResponse distributeMethod(IHttpAsdcClient client, String requestUrl, String serviceUUID,
521 StringEntity body, Map<String, String> headersMap, String envId) {
523 final HttpAsdcResponse postRequest = client.postRequest(requestUrl, body, headersMap);
524 final String message = String.format(
525 "MSO Client Simulator Distributes Service:%s On Environment:\"%s\" - Recieved Response: %s", serviceUUID, envId,
526 postRequest.getStatus());
527 if (postRequest.getStatus() != HttpStatus.SC_ACCEPTED) {
528 System.err.println(message);
530 System.out.println(message);
536 private String convertUebAddressToList(OperationalEnvironmentEntry op) {
537 Set<String> dmaapUebAddress = op.getDmaapUebAddress();
538 Wrapper<String> resultWrapper = new Wrapper<>(StringUtils.EMPTY);
539 if (!CollectionUtils.isEmpty(dmaapUebAddress)) {
540 dmaapUebAddress.stream()
541 .forEach(uebAddress -> resultWrapper.setInnerElement(resultWrapper.getInnerElement() + uebAddress));
544 return resultWrapper.getInnerElement();
547 private void buildWdSimulatorCallback(OperationalEnvironmentEntry opEnv, IDistributionClient client,
548 final IConfiguration buildDistributionClientConfiguration, INotificationData data) {
549 if (StringUtils.equals(data.getWorkloadContext(), opEnv.getEnvironmentId())) {
551 final String expectedArtifactType = org.openecomp.sdc.common.api.ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.name();
552 Optional<IArtifactInfo> optional = data.getServiceArtifacts().stream().filter( artifact -> {
553 return StringUtils.equals(artifact.getArtifactType(), expectedArtifactType);
556 for (int i = 0; i < numOfArtifactsToDownload; i++) {
557 optional.ifPresent( artifactInfo -> simulateDownload(client , artifactInfo, data) );
558 optional.orElseThrow( () -> handleArtifactNotFound(expectedArtifactType, data));
561 if( numOfArtifactsToDownload > 0 ){
562 System.out.println(String.format(
563 "ASDC Consumer Simulator On Environment:\"%s\" Downloaded %s Artifacts From ASDC Service with UUID:%s Total Artifacts Downloaded from ASDC is: %s",
564 data.getWorkloadContext(), numOfArtifactsToDownload,
565 data.getServiceUUID(), totalNumOfArtifactsToDownload));
568 IDistributionClientResult finalDistrStatus = client.sendFinalDistrStatus(buildFinalDistribution());
569 assertThat(finalDistrStatus.getDistributionActionResult(), is(DistributionActionResultEnum.SUCCESS));
570 wdFinalStatusSent.add(data.getWorkloadContext());
572 System.out.println(String.format(
573 "WD Simulator On Environment:\"%s\" Recieved Notification From ASDC On WorkLoad: %s And Service UUID:%s And Sends Distribution Complete Notification",
574 buildDistributionClientConfiguration.getConsumerID(), data.getWorkloadContext(),
575 data.getServiceUUID()));
579 private IllegalStateException handleArtifactNotFound(String expectedArtifactType, INotificationData data ){
580 final String stringMessage = String.format("Did Not Find Artifact of type: %s to download from service with UUID:%s", expectedArtifactType, data.getServiceUUID());
581 System.err.println(stringMessage);
582 return new IllegalStateException(stringMessage);
586 private void simulateDownload(IDistributionClient client, IArtifactInfo info, INotificationData data){
587 IDistributionClientDownloadResult downloadResult = client.download(info);
588 if( downloadResult.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS ){
589 System.err.println(String.format("Client Simulator %s Failed to download artifact from service : %s", client.getConfiguration().getConsumerID(), data.getServiceUUID()));
590 assertThat(downloadResult.getDistributionActionResult(), is(DistributionActionResultEnum.SUCCESS));
593 totalNumOfArtifactsToDownload++;