aboutsummaryrefslogtreecommitdiffstats
path: root/distribution-ci/src/main/java/org/openecomp/test/BaseInit.java
blob: b056b35b75ef69f137f75dcb646c41a8b3fd7a44 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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();
//	
//	
//	}
	
}