aboutsummaryrefslogtreecommitdiffstats
path: root/distribution-ci/src/main/java/org/openecomp/test/E2eFlows.java
blob: 521fc213120e1f5fcf5582181701c91e25f33bf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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;
//	}

}