aboutsummaryrefslogtreecommitdiffstats
path: root/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java
blob: 263454359deaa988e3f7947e6afd9b74283aa274 (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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
package org.openecomp.mso.global_tests.asdc;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URISyntaxException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.LinkedList;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.Testable;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
import org.openecomp.sdc.api.notification.IArtifactInfo;
import org.openecomp.sdc.api.notification.IResourceInstance;
import org.openecomp.mso.asdc.installer.VfModuleMetaData;
import org.openecomp.mso.asdc.installer.IVfModuleData;
import org.openecomp.sdc.utils.DistributionStatusEnum;
import org.openecomp.mso.asdc.client.ASDCConfiguration;
import org.openecomp.mso.asdc.client.ASDCController;
import org.openecomp.mso.asdc.client.exceptions.ASDCControllerException;
import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
import org.openecomp.mso.db.catalog.beans.HeatFiles;
import org.openecomp.mso.db.catalog.beans.HeatTemplate;
import org.openecomp.mso.db.catalog.beans.Service;
import org.openecomp.mso.db.catalog.beans.VfModule;
import org.openecomp.mso.db.catalog.beans.VnfResource;
import org.openecomp.mso.global_tests.ArquillianPackagerForITCases;
import org.openecomp.mso.global_tests.asdc.notif_emulator.DistributionClientEmulator;
import org.openecomp.mso.global_tests.asdc.notif_emulator.JsonNotificationData;

@RunWith(Arquillian.class)
public class ASDCITCase {

	/**
	 * Add the resources in the right folder of a jar
	 * @param jar The jarArchive
	 * @param dir The main dir containing things that must be added
	 * @throws Exception In case of issues with the files
	 */
	private static void addFiles(JavaArchive jar, File dir,String destFolder) throws Exception  {

		if (!dir.isDirectory()) {
			throw new Exception("not a directory");
		}
		for (File f : dir.listFiles()) {


			if (f.isFile()) {
				jar.addAsResource(f, destFolder + "/" + f.getName());
			} else {

				addFiles(jar, f, destFolder+"/"+f.getName());
			}
		}
	}

	@Deployment(name="asdc-controller",testable=true)
	public static Archive<?> createAsdcControllerWarDeployment () throws Exception {
		System.out.println("Deploying ASDC Controller WAR with additional resources on default server");

		WebArchive warArchive = (WebArchive)ArquillianPackagerForITCases.createPackageFromExistingOne("../../asdc-controller/target/", "asdc-controller*.war", "asdc-controller.war");

		// Add the current test class
		JavaArchive testclasses = ShrinkWrap.create (JavaArchive.class, "testClasses.jar");

		testclasses.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator");

		addFiles(testclasses,new File(Thread.currentThread().getContextClassLoader().getResource("resource-examples/asdc").getFile()),"resource-examples/asdc");

		System.out.println(testclasses.toString(true));
		warArchive.addAsLibraries(testclasses);



		// BE CAREFUL a settings.xml file must be located in ${home.user}/.m2/settings.xml
		warArchive.addAsLibraries(Maven.resolver()
				.resolve("org.mockito:mockito-all:1.10.19")
				.withoutTransitivity ()
				.asFile ());

		//warArchive.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator");
		//addFiles(warArchive,new File(ASDCITCase.class.getClassLoader().getResource("resource-examples").getPath()),"resource-examples");

		// Take one war randomly to make arquilian happy
		Testable.archiveToTest(warArchive);


		System.out.println(warArchive.toString(true));

		return warArchive;
	}

	@BeforeClass
	public static final void waitBeforeStart() throws InterruptedException,
			IOException,
			URISyntaxException,
			NoSuchAlgorithmException {
		System.out.println("Executing " + ASDCITCase.class.getName());
	}

	@AfterClass
	public static final void waitAfterStart() throws InterruptedException,
			IOException,
			URISyntaxException,
			NoSuchAlgorithmException {
		System.out.println("Waiting 60000ms " + ASDCITCase.class.getName());
		Thread.sleep(60000);
	}

	/**
	 * Be careful when using that notification fake structure, the UUID of notif artifacts MUST be different.
	 * There is a static Map behind the scene.
	 */
	private JsonNotificationData notifDataWithoutModuleInfo;
	private DistributionClientEmulator distribClientWithoutModuleInfo;

	private JsonNotificationData notifDataV1, notifDataV2, notifDataV3, notifDataV4, notifDataV5,notifDataDNS,notifDataVFW;
	private DistributionClientEmulator distribClientV1, distribClientV2, distribClientV3, distribClientV4, distribClientV5, distribClientV1ForSameNotif, distribClientDNS,distribClientVFW;


	@Before
	public final void beforeEachTest() throws IOException {

		distribClientV1= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1");
		distribClientV1ForSameNotif= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1");
		notifDataV1 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V1");

		// This is a duplicate in version 2 of the version 1
		distribClientV2= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V2");
		notifDataV2 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V2");

		distribClientV3= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V3");
		notifDataV3 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V3");

		// This is a duplicate in version 4 of the version 3
		distribClientV4= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V4");
		notifDataV4 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V4");

		// This notification is to test the deployment of volume with nested + an artifact not used (should send notification with DEPLOY_ERROR
		distribClientV5= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V5");
		notifDataV5 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V5");


		distribClientWithoutModuleInfo= new DistributionClientEmulator("/resource-examples/asdc/notif-without-modules-metadata");
		notifDataWithoutModuleInfo = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/notif-without-modules-metadata");


		distribClientDNS= new DistributionClientEmulator("/resource-examples/asdc/demo-dns-V1");
		notifDataDNS = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-dns-V1");


		distribClientVFW= new DistributionClientEmulator("/resource-examples/asdc/demo-vfw-V1");
		notifDataVFW = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-vfw-V1");


	}

	@Test
	@OperateOnDeployment("asdc-controller")
	public void testNotifWithoutModuleInfo () throws NoSuchAlgorithmException,
			IOException,
			URISyntaxException,
			ArtifactInstallerException, ASDCControllerException, ASDCParametersException {



		ASDCController asdcController = new ASDCController("asdc-controller1", distribClientWithoutModuleInfo);
		asdcController.initASDC();
		asdcController.treatNotification(notifDataWithoutModuleInfo);

		assertTrue(distribClientWithoutModuleInfo.getDistributionMessageReceived().size() > 0);

		int badDeployment=0;
		for (IDistributionStatusMessage message:distribClientWithoutModuleInfo.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			if(message.getStatus().equals(DistributionStatusEnum.DEPLOY_ERROR)) {
				badDeployment++;
			}
		}
		assertTrue(badDeployment == 3);

		// Check if something has been recorder in DB, as it should not
		CatalogDatabase catalogDB = new CatalogDatabase();

		HeatTemplate heatTemplate = catalogDB.getHeatTemplate("Whot-nimbus-oam_v1.0.yaml", "1.0", "resourceName-1");
		assertNull(heatTemplate);
	}

	private void validateVnfResource(JsonNotificationData inputNotification, List<IVfModuleData> moduleList) {

		CatalogDatabase catalogDB = new CatalogDatabase();


		for (IResourceInstance resource:inputNotification.getResources()) {
			VnfResource vnfResourceDB = catalogDB.getVnfResource(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName(), inputNotification.getServiceVersion());
			assertNotNull(vnfResourceDB);

			assertTrue(vnfResourceDB.getAsdcUuid().equals(resource.getResourceUUID()));
			assertTrue(vnfResourceDB.getDescription().equals(inputNotification.getServiceDescription()));
			assertTrue(vnfResourceDB.getModelInvariantUuid().equals(resource.getResourceInvariantUUID()));
			assertTrue(vnfResourceDB.getModelVersion().equals(resource.getResourceVersion()));
			assertTrue(vnfResourceDB.getOrchestrationMode().equals("HEAT"));
			assertTrue(vnfResourceDB.getVersion().equals(inputNotification.getServiceVersion()));
			assertTrue(vnfResourceDB.getVnfType().equals(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()));
			assertTrue(vnfResourceDB.getModelCustomizationName().equals(resource.getResourceInstanceName()));
			assertTrue(vnfResourceDB.getModelName().equals(resource.getResourceName()));
			assertTrue(vnfResourceDB.getServiceModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID()));

			for (IVfModuleData module:moduleList) {

				VfModule vfModuleDB = catalogDB.getVfModuleModelName(module.getVfModuleModelName(),inputNotification.getServiceVersion());
				assertNotNull(vfModuleDB);
				assertTrue(module.getVfModuleModelName().equals(vfModuleDB.getModelName()));

				assertTrue((inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()+"::"+vfModuleDB.getModelName()).equals(vfModuleDB.getType()));
				assertTrue(vnfResourceDB.getId()!=0);
				assertNotNull(vfModuleDB.getVnfResourceId());

				assertTrue(vnfResourceDB.getId()==vfModuleDB.getVnfResourceId().intValue());

				for (String artifactUUID:module.getArtifacts()) {
					IArtifactInfo artifact = null;
					for (IArtifactInfo artifactTemp:resource.getArtifacts()) {
						if (artifactTemp.getArtifactUUID().equals(artifactUUID)) {
							artifact = artifactTemp;
							break;
						}
					}
					assertNotNull(artifact);

					switch (artifact.getArtifactType()) {
						case ASDCConfiguration.HEAT:
							HeatTemplate heatTemplateDB= catalogDB.getHeatTemplate(vfModuleDB.getTemplateId());
							assertNotNull(heatTemplateDB);
							assertTrue(heatTemplateDB.getAsdcResourceName().equals(resource.getResourceName()));
							assertTrue(heatTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
							assertTrue(heatTemplateDB.getDescription().equals(artifact.getArtifactDescription()));
							assertTrue(heatTemplateDB.getTemplateBody() != null && !heatTemplateDB.getTemplateBody().isEmpty());
							assertTrue(heatTemplateDB.getParameters().size()>0);

							assertTrue(heatTemplateDB.getTemplateName().equals(artifact.getArtifactName()));

							if (artifact.getArtifactTimeout() != null) {
								assertTrue(heatTemplateDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue());
							} else {
								assertTrue(heatTemplateDB.getTimeoutMinutes()== 240);
							}
							assertTrue(heatTemplateDB.getVersion().equals(artifact.getArtifactVersion()));

							assertFalse(heatTemplateDB.getTemplateBody().contains("file:///"));
							break;
						case ASDCConfiguration.HEAT_ENV:

							HeatEnvironment heatEnvironmentDB = catalogDB.getHeatEnvironment(artifact.getArtifactName(), artifact.getArtifactVersion(), inputNotification.getServiceName()+"/"+resource.getResourceInstanceName());

							assertNotNull(heatEnvironmentDB);
							assertTrue((vfModuleDB.getVolEnvironmentId() != null && vfModuleDB.getVolEnvironmentId().intValue() == heatEnvironmentDB.getId())
									|| (vfModuleDB.getEnvironmentId() != null && vfModuleDB.getEnvironmentId() == heatEnvironmentDB.getId()));

							assertTrue(heatEnvironmentDB.getAsdcResourceName().equals(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()));

							assertTrue(heatEnvironmentDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
							assertTrue(heatEnvironmentDB.getDescription().equals(artifact.getArtifactDescription()));
							assertTrue(heatEnvironmentDB.getVersion().equals(artifact.getArtifactVersion()));
							assertTrue(heatEnvironmentDB.getName().equals(artifact.getArtifactName()));
							assertTrue(heatEnvironmentDB.getEnvironment() != null);
							assertFalse(heatEnvironmentDB.getEnvironment().contains("file:///"));

							break;
						case ASDCConfiguration.HEAT_NESTED:
							Map<String,Object> listNestedDBMainHeat=new HashMap<String,Object>();
							Map<String,Object> listNestedDBVolHeat=new HashMap<String,Object>();

							if (vfModuleDB.getTemplateId() != null) {
								listNestedDBMainHeat = catalogDB.getNestedTemplates(vfModuleDB.getTemplateId());
							}
							if (vfModuleDB.getVolTemplateId() != null) {
								listNestedDBVolHeat = catalogDB.getNestedTemplates(vfModuleDB.getVolTemplateId());
							}

							assertTrue(listNestedDBMainHeat.size() > 0 || listNestedDBVolHeat.size() > 0);


							assertTrue(listNestedDBMainHeat.get(artifact.getArtifactName()) != null
									|| listNestedDBVolHeat.get(artifact.getArtifactName()) != null);

							HeatTemplate rightNestedTemplateDB = catalogDB.getHeatTemplate(artifact.getArtifactName(), artifact.getArtifactVersion(), resource.getResourceName());
							assertNotNull(rightNestedTemplateDB);
							assertTrue(catalogDB.getNestedHeatTemplate(vfModuleDB.getTemplateId(), rightNestedTemplateDB.getId()) != null || catalogDB.getNestedHeatTemplate(vfModuleDB.getVolTemplateId(), rightNestedTemplateDB.getId()) != null);

							assertTrue(rightNestedTemplateDB.getAsdcResourceName().equals(resource.getResourceName()));
							assertTrue(rightNestedTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
							assertTrue(rightNestedTemplateDB.getDescription().equals(artifact.getArtifactDescription()));
							assertTrue(rightNestedTemplateDB.getTemplateBody() != null && !rightNestedTemplateDB.getTemplateBody().isEmpty());
							assertTrue(rightNestedTemplateDB.getTemplateName().equals(artifact.getArtifactName()));

							if (artifact.getArtifactTimeout() != null) {
								assertTrue(rightNestedTemplateDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue());
							} else {
								assertTrue(rightNestedTemplateDB.getTimeoutMinutes()== 240);
							}
							assertTrue(rightNestedTemplateDB.getVersion().equals(artifact.getArtifactVersion()));
							assertFalse(rightNestedTemplateDB.getTemplateBody().contains("file:///"));

							break;
						case ASDCConfiguration.HEAT_VOL:
							HeatTemplate heatTemplateVolDB = catalogDB.getHeatTemplate(vfModuleDB.getVolTemplateId());
							assertNotNull(heatTemplateVolDB);

							assertTrue(heatTemplateVolDB.getAsdcResourceName().equals(resource.getResourceName()));
							assertTrue(heatTemplateVolDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
							assertTrue(heatTemplateVolDB.getDescription().equals(artifact.getArtifactDescription()));
							assertTrue(heatTemplateVolDB.getTemplateBody() != null && !heatTemplateVolDB.getTemplateBody().isEmpty());
							assertTrue(heatTemplateVolDB.getTemplateName().equals(artifact.getArtifactName()));

							if (artifact.getArtifactTimeout() != null) {
								assertTrue(heatTemplateVolDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue());
							} else {
								assertTrue(heatTemplateVolDB.getTimeoutMinutes()== 240);
							}
							assertTrue(heatTemplateVolDB.getVersion().equals(artifact.getArtifactVersion()));
							assertFalse(heatTemplateVolDB.getTemplateBody().contains("file:///"));

							break;
						case ASDCConfiguration.HEAT_ARTIFACT:
							Map<String,HeatFiles> heatFilesDB= catalogDB.getHeatFilesForVfModule(vfModuleDB.getId());
							assertTrue(heatFilesDB.size()>0);
							HeatFiles rightHeatFilesDB=heatFilesDB.get( artifact.getArtifactName());
							assertNotNull(rightHeatFilesDB);

							assertTrue(rightHeatFilesDB.getAsdcResourceName().equals(resource.getResourceName()));
							assertTrue(rightHeatFilesDB.getAsdcUuid().equals(artifact.getArtifactUUID()));
							assertTrue(rightHeatFilesDB.getDescription().equals(artifact.getArtifactDescription()));
							assertTrue(rightHeatFilesDB.getFileBody() != null && !rightHeatFilesDB.getFileBody().isEmpty());
							assertTrue(rightHeatFilesDB.getFileName().equals( artifact.getArtifactName()));
							assertTrue(rightHeatFilesDB.getVersion().equals(artifact.getArtifactVersion()));

							break;
						default:
							break;

					}
				}

			}

		}

		Service service = catalogDB.getServiceByUUID(inputNotification.getServiceUUID());
		assertNotNull(service);
		assertTrue(service.getCreated() !=null && service.getCreated().getTime()>0);
		assertTrue(service.getDescription().equals(inputNotification.getServiceDescription()));
		assertTrue(service.getId()>0);
		assertTrue(service.getModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID()));
		assertTrue(service.getServiceName().equals(inputNotification.getServiceName()));
		assertTrue(service.getServiceNameVersionId().equals(inputNotification.getServiceUUID()));
		assertTrue(service.getVersion().equals(inputNotification.getServiceVersion()));

	}

	@Test
	@OperateOnDeployment("asdc-controller")
	public void testNotifsDeployment () throws NoSuchAlgorithmException,
			IOException,
			URISyntaxException,
			ArtifactInstallerException, ASDCControllerException, ASDCParametersException {



		ASDCController asdcControllerV1 = new ASDCController("asdc-controller1", distribClientV1);
		asdcControllerV1.initASDC();
		asdcControllerV1.treatNotification(notifDataV1);

		assertTrue(distribClientV1.getDistributionMessageReceived().size() > 0);
		for (IDistributionStatusMessage message:distribClientV1.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
		}

		this.validateVnfResource(notifDataV1,distribClientV1.getListVFModuleMetaData());



		// Try again to load the same notif
		ASDCController asdcControllerNewNotif = new ASDCController("asdc-controller1", distribClientV1ForSameNotif);
		asdcControllerNewNotif.initASDC();
		asdcControllerNewNotif.treatNotification(notifDataV1);

		for (IDistributionStatusMessage message:distribClientV1ForSameNotif.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			assertTrue(message.getStatus().equals(DistributionStatusEnum.ALREADY_DEPLOYED) || message.getStatus().equals(DistributionStatusEnum.ALREADY_DOWNLOADED));
		}


		// Try again to load same notif but in V2
		ASDCController asdcControllerV2 = new ASDCController("asdc-controller1", distribClientV2);
		asdcControllerV2.initASDC();
		asdcControllerV2.treatNotification(notifDataV2);

		for (IDistributionStatusMessage message:distribClientV2.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
		}

		this.validateVnfResource(notifDataV2,distribClientV2.getListVFModuleMetaData());


		// Try again to load same notif + Script + Volume artifacts and in service V3
		ASDCController asdcControllerV3 = new ASDCController("asdc-controller1", distribClientV3);
		asdcControllerV3.initASDC();
		asdcControllerV3.treatNotification(notifDataV3);

		for (IDistributionStatusMessage message:distribClientV3.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
		}

		this.validateVnfResource(notifDataV3,distribClientV3.getListVFModuleMetaData());

		// Try again to load same notif + Script + Volume artifacts and in service V4
		ASDCController asdcControllerV4 = new ASDCController("asdc-controller1", distribClientV4);
		asdcControllerV4.initASDC();
		asdcControllerV4.treatNotification(notifDataV4);

		for (IDistributionStatusMessage message:distribClientV4.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
		}

		this.validateVnfResource(notifDataV4,distribClientV4.getListVFModuleMetaData());


		// Try again with service V5 (Nested template attached to Volume + HEat artifact not used by module),
		//this should force the notification DEPLOY_ERROR to be sent for this artifact
		ASDCController asdcControllerV5 = new ASDCController("asdc-controller1", distribClientV5);
		asdcControllerV5.initASDC();
		asdcControllerV5.treatNotification(notifDataV5);

		for (IDistributionStatusMessage message:distribClientV5.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
			if ("cloud-nimbus.sh".equals(message.getArtifactURL())) {
				assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_ERROR) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
			} else {
				assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
			}
		}

		this.validateVnfResource(notifDataV5,distribClientV5.getListVFModuleMetaData());


		// Try again with demo DNS
		ASDCController asdcControllerDNS = new ASDCController("asdc-controller1", distribClientDNS);
		asdcControllerDNS.initASDC();
		asdcControllerDNS.treatNotification(notifDataDNS);

		for (IDistributionStatusMessage message:distribClientDNS.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name());
				assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
		}

		this.validateVnfResource(notifDataDNS,distribClientDNS.getListVFModuleMetaData());

		// Try again with demo VFW
		ASDCController asdcControllerVFW = new ASDCController("asdc-controller1", distribClientVFW);
		asdcControllerVFW.initASDC();
		asdcControllerVFW.treatNotification(notifDataVFW);

		for (IDistributionStatusMessage message : distribClientVFW.getDistributionMessageReceived()) {
			System.out.println("Message received, URL:" + message.getArtifactURL() + ", Value:" + message.getStatus().name());
			assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK)
						|| message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK));
		}

		this.validateVnfResource(notifDataVFW, distribClientVFW.getListVFModuleMetaData());

	}
}