summaryrefslogtreecommitdiffstats
path: root/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CustomizationUUIDTest.java
blob: cd87ea5265a4ccbb98ed9319a53f4e97da6cd389 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.ci.tests.execute.resource;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
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.ComponentInstanceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
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.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.testng.annotations.Test;

public class CustomizationUUIDTest extends ComponentBaseTest {

	@Rule
	public static TestName name = new TestName();

	public CustomizationUUIDTest() {
		super(name, CustomizationUUIDTest.class.getName());
	}

	@Test(enabled = true)
	public void resourceCustomUUIDTestUpdateMeta() throws Exception {
		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);

		// create resource in checkin status
		Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");

		RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
		BaseRestUtils.checkSuccess(checkinState);

		// create service
		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
		ResourceRestUtils.checkCreateResponse(createServiceResponse);
		Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);

		// create instance 1
		ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
		RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
		ResourceRestUtils.checkCreateResponse(createComponentInstance);

		ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
		assertNotNull(ci1.getCustomizationUUID());
		String ci1CustUUID = ci1.getCustomizationUUID();

		// get service with 1 instance
		RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		List<ComponentInstance> componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertEquals(1, componentInstances.size());

		// change name of instance 1 and check custom UUID
		String newCi1Name = "newCi1Name";
		ci1.setName(newCi1Name);
		RestResponse updateComponentInstance = ComponentInstanceRestUtils.updateComponentInstance(ci1, sdncModifierDetails, service.getUniqueId(), ComponentTypeEnum.SERVICE);
		ResourceRestUtils.checkSuccess(updateComponentInstance);
		ComponentInstance ci1AfterChange = ResponseParser.parseToObjectUsingMapper(updateComponentInstance.getResponse(), ComponentInstance.class);

		// must be different
		assertFalse(ci1.getCustomizationUUID().equals(ci1AfterChange.getCustomizationUUID()));

		// change position of instance 1 and check UUID
		ci1.setPosX("151");
		ci1.setPosY("20");
		updateComponentInstance = ComponentInstanceRestUtils.updateComponentInstance(ci1, sdncModifierDetails, service.getUniqueId(), ComponentTypeEnum.SERVICE);
		ResourceRestUtils.checkSuccess(updateComponentInstance);
		ci1AfterChange = ResponseParser.parseToObjectUsingMapper(updateComponentInstance.getResponse(), ComponentInstance.class);
		// must be same
		assertTrue(ci1.getCustomizationUUID().equals(ci1AfterChange.getCustomizationUUID()));
	}

	@Test(enabled = true)
	public void resourceCustomUUIDPropertyTest() throws Exception {
		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);

		// create resource
		Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");

		RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
		BaseRestUtils.checkSuccess(checkinState);

		// 2 create service
		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
		ResourceRestUtils.checkCreateResponse(createServiceResponse);
		Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);

		// create instance
		ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
		RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
		ResourceRestUtils.checkCreateResponse(createComponentInstance);

		ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
		assertNotNull(ci1.getCustomizationUUID());
		String ci1CustUUID = ci1.getCustomizationUUID();

		// get service with 1 instance
		RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		List<ComponentInstance> componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertEquals(1, componentInstances.size());

		// instance property values
		Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = service.getComponentInstancesProperties();
		assertNotNull(componentInstancesProperties);
		List<ComponentInstanceProperty> listProps = componentInstancesProperties.get(ci1.getUniqueId());
		assertNotNull(listProps);

		ComponentInstanceProperty updatedInstanceProperty = null;
		for (ComponentInstanceProperty cip : listProps) {
			if (cip.getType().equals("string")) {
				updatedInstanceProperty = cip;
				break;
			}
		}
		assertNotNull(updatedInstanceProperty);
		updatedInstanceProperty.setValue("newValue");

		RestResponse updatePropRes = ComponentInstanceRestUtils.updatePropertyValueOnResourceInstance(service, ci1, sdncModifierDetails, updatedInstanceProperty);
		BaseRestUtils.checkSuccess(updatePropRes);

		getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		ComponentInstance ciAfterUpdateProp = componentInstances.get(0);

		assertFalse(ci1.getCustomizationUUID().equals(ciAfterUpdateProp.getCustomizationUUID()));
	}

	@Test(enabled = true)
	public void resourceCustomUUIDChangeVersionTest() throws Exception {
		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);

		// create resource in checkin status
		Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");

		RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
		BaseRestUtils.checkSuccess(checkinState);

		// create service
		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
		ResourceRestUtils.checkCreateResponse(createServiceResponse);
		Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);

		// create instance 1
		ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
		RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
		ResourceRestUtils.checkCreateResponse(createComponentInstance);

		ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
		assertNotNull(ci1.getCustomizationUUID());
		String ci1CustUUID = ci1.getCustomizationUUID();

		// create 0.2 version of resource( check out and check in)
		RestResponse checkoutState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKOUT);
		BaseRestUtils.checkSuccess(checkoutState);
		resource1 = ResponseParser.parseToObjectUsingMapper(checkoutState.getResponse(), Resource.class);
		assertNotNull(resource1);

		checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
		BaseRestUtils.checkSuccess(checkinState);

		// change version of instance
		RestResponse changeComponentInstanceVersion = ComponentInstanceRestUtils.changeComponentInstanceVersion(service, ci1, resource1, sdncModifierDetails);
		BaseRestUtils.checkSuccess(changeComponentInstanceVersion);
		RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		List<ComponentInstance> componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertEquals(1, componentInstances.size());
		assertFalse(ci1CustUUID.equals(componentInstances.get(0).getCustomizationUUID()));

	}

	@Test(enabled = true)
	public void resourceCustomUUIDChangeArtifactsTest() throws Exception {
		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);

		// create resource in checkin status
		Resource resource1 = createVfFromCSAR(sdncModifierDetails, "csar_1");

		RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource1, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
		BaseRestUtils.checkSuccess(checkinState);

		// create service
		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
		ResourceRestUtils.checkCreateResponse(createServiceResponse);
		Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);

		// create instance 1
		ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource1);
		RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
		ResourceRestUtils.checkCreateResponse(createComponentInstance);

		ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
		assertNotNull(ci1.getCustomizationUUID());
		String lastUUID = ci1.getCustomizationUUID();

		RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);

		List<ComponentInstance> componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertEquals(1, componentInstances.size());
		ComponentInstance ci = componentInstances.get(0);
		Map<String, ArtifactDefinition> deploymentArtifacts = ci.getDeploymentArtifacts();
		assertNotNull(deploymentArtifacts);
		// find artifact for update
		ArtifactDefinition artifactForUpdate = null;
		for (ArtifactDefinition ad : deploymentArtifacts.values()) {
			if (ad.getArtifactType().equals("HEAT_ENV")) {
				artifactForUpdate = ad;
				break;
			}
		}

		assertNotNull(artifactForUpdate);
		// update heat env on instance
		RestResponse updateArtifact = ArtifactRestUtils.updateDeploymentArtifactToRI(artifactForUpdate, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
		BaseRestUtils.checkSuccess(updateArtifact);
		getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
		lastUUID = componentInstances.get(0).getCustomizationUUID();

		// add artifact to instance
		ArtifactReqDetails artifactDetails = ElementFactory.getDefaultArtifact();
		RestResponse addArtifactToResourceInstance = ArtifactRestUtils.addArtifactToResourceInstance(artifactDetails, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
		BaseRestUtils.checkSuccess(addArtifactToResourceInstance);
		ArtifactDefinition artifactDef = ResponseParser.parseToObjectUsingMapper(addArtifactToResourceInstance.getResponse(), ArtifactDefinition.class);
		assertNotNull(artifactDef);

		getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);

		componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
		lastUUID = componentInstances.get(0).getCustomizationUUID();

		//update artifact
		//not supported now!!!!!
//		artifactDef.setDescription("new description");
//		RestResponse updateArtifactRes = ArtifactRestUtils.updateArtifactToResourceInstance(artifactDef, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
//		BaseRestUtils.checkSuccess(updateArtifactRes);
//		artifactDef = ResponseParser.parseToObjectUsingMapper(addArtifactToResourceInstance.getResponse(), ArtifactDefinition.class);
//		assertNotNull(artifactDef);
//		
//		getService = ServiceRestUtils.getService(service.getUniqueId());
//		BaseRestUtils.checkSuccess(getService);
//		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
//
//		componentInstances = service.getComponentInstances();
//		assertNotNull(componentInstances);
//		assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
//		lastUUID = componentInstances.get(0).getCustomizationUUID();
//		
//		//delete artifact
//		RestResponse deleteArtifactRes = ArtifactRestUtils.deleteArtifactFromResourceInstance (artifactDef, sdncModifierDetails, ci.getUniqueId(), service.getUniqueId());
//		BaseRestUtils.checkSuccess(deleteArtifactRes);
//		getService = ServiceRestUtils.getService(service.getUniqueId());
//		BaseRestUtils.checkSuccess(getService);
//		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
//
//		componentInstances = service.getComponentInstances();
//		assertNotNull(componentInstances);
//		assertFalse(lastUUID.equals(componentInstances.get(0).getCustomizationUUID()));
	}

	@Test(enabled = true)
	public void resourceCustomUUIDRelationTest() throws Exception {
		User sdncModifierDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);

		// create resource in checkin status
		Resource resource = createVfFromCSAR(sdncModifierDetails, "csar_1");

		RestResponse checkinState = LifecycleRestUtils.changeComponentState(resource, sdncModifierDetails, LifeCycleStatesEnum.CHECKIN);
		BaseRestUtils.checkSuccess(checkinState);

		// create service
		ServiceReqDetails serviceDetails = ElementFactory.getDefaultService("ciNewtestservice1", ServiceCategoriesEnum.MOBILITY, sdncModifierDetails.getUserId());
		RestResponse createServiceResponse = ServiceRestUtils.createService(serviceDetails, sdncModifierDetails);
		ResourceRestUtils.checkCreateResponse(createServiceResponse);
		Service service = ResponseParser.parseToObjectUsingMapper(createServiceResponse.getResponse(), Service.class);

		// create instance 1
		ComponentInstanceReqDetails componentInstanceDetails = ElementFactory.getComponentInstance(resource);
		RestResponse createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
		ResourceRestUtils.checkCreateResponse(createComponentInstance);
		
		ComponentInstance ci1 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
		assertNotNull(ci1.getCustomizationUUID());
		String ci1LastUUID = ci1.getCustomizationUUID();

		// create instance 2
		createComponentInstance = ComponentInstanceRestUtils.createComponentInstance(componentInstanceDetails, sdncModifierDetails, service);
		ResourceRestUtils.checkCreateResponse(createComponentInstance);

		ComponentInstance ci2 = ResponseParser.parseToObjectUsingMapper(createComponentInstance.getResponse(), ComponentInstance.class);
		assertNotNull(ci2.getCustomizationUUID());
		String ci2LastUUID = ci2.getCustomizationUUID();
		
		// get service with 2 instances
		RestResponse getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		List<ComponentInstance> componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		assertEquals(2, componentInstances.size());

		ComponentInstance ciFrom = componentInstances.get(0);
		ComponentInstance ciTo = componentInstances.get(1);
		
		Map<String, List<RequirementDefinition>> requirements = ciFrom.getRequirements();
		assertNotNull(requirements);
		List<RequirementDefinition> listReq = requirements.get("tosca.capabilities.network.Bindable");
		assertNotNull(listReq);
		RequirementDefinition req = listReq.get(0);
		
		
		Map<String, List<CapabilityDefinition>> capabilities = ciTo.getCapabilities();
		assertNotNull(capabilities);
		List<CapabilityDefinition> listCap = capabilities.get("tosca.capabilities.network.Bindable");
		assertNotNull(listCap);
		CapabilityDefinition cap = listCap.get(0);
			
		List<CapabilityDefinition> capList = new ArrayList<>();
		capList.add(cap);
		List<RequirementDefinition> reqList = new ArrayList<>();
		reqList.add(req);
		
		RequirementCapabilityRelDef relation = ElementFactory.getReqCapRelation(ciFrom.getUniqueId(),ciTo.getUniqueId(), req.getOwnerId(), cap.getOwnerId(), cap.getType(), req.getName(), capList, reqList );
		
		RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(relation, sdncModifierDetails,service.getUniqueId(), ComponentTypeEnum.SERVICE);
		ResourceRestUtils.checkSuccess(associateInstances);
		
		getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		
		for ( ComponentInstance ci : componentInstances){
			if ( ci.getUniqueId().equals(ci1.getUniqueId()) ){
				assertFalse( ci1LastUUID.equals(ci.getCustomizationUUID()) );
				ci1LastUUID = ci.getCustomizationUUID();
			}else{
				assertFalse( ci2LastUUID.equals(ci.getCustomizationUUID()) );
				ci2LastUUID = ci.getCustomizationUUID();
			}
		}
		associateInstances = ComponentInstanceRestUtils.dissociateInstances(relation, sdncModifierDetails,service.getUniqueId(), ComponentTypeEnum.SERVICE);
		ResourceRestUtils.checkSuccess(associateInstances);
		
		getService = ServiceRestUtils.getService(service.getUniqueId());
		BaseRestUtils.checkSuccess(getService);
		service = ResponseParser.parseToObjectUsingMapper(getService.getResponse(), Service.class);
		componentInstances = service.getComponentInstances();
		assertNotNull(componentInstances);
		
		for ( ComponentInstance ci : componentInstances){
			if ( ci.getUniqueId().equals(ci1.getUniqueId()) ){
				assertFalse( ci1LastUUID.equals(ci.getCustomizationUUID()) );
			}else{
				assertFalse( ci2LastUUID.equals(ci.getCustomizationUUID()) );
			}
		}
	}
}