aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
blob: 2d58c7af699b7d51657cc398cdda23aef3274c6d (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
package org.openecomp.mso.bpmn.infrastructure.scripts

import static org.junit.Assert.*;
import static org.mockito.Mockito.*

import org.camunda.bpm.engine.delegate.DelegateExecution
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
import org.mockito.ArgumentCaptor
import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest
import org.openecomp.mso.bpmn.common.scripts.MsoUtils
import org.junit.Before
import org.junit.Ignore;
import org.junit.Test
import org.junit.runner.RunWith


@RunWith(MockitoJUnitRunner.class)
class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {

	def String volumeRollbackRequest = """
<rollbackVolumeGroupRequest>
   <volumeGroupRollback>
      <volumeGroupId>171907d6-cdf0-4e08-953d-81ee104005a7</volumeGroupId>
      <volumeGroupStackId>{{VOLUMEGROUPSTACKID}}</volumeGroupStackId>
      <cloudSiteId>mtwnj1a</cloudSiteId>
      <tenantId>c2141e3fcae940fcb4797ec9115e5a7a</tenantId>
      <volumeGroupCreated>true</volumeGroupCreated>
      <msoRequest>
         <requestId>230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5</requestId>
         <serviceInstanceId>88c871d6-be09-4982-8490-96b1d243fb34</serviceInstanceId>
      </msoRequest>
      <messageId>9a5a91e8-3b79-463c-81c3-874a78f5b567</messageId>
   </volumeGroupRollback>
   <skipAAI>true</skipAAI>
   <messageId>9a5a91e8-3b79-463c-81c3-874a78f5b567</messageId>
   <notificationUrl>http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567</notificationUrl>
</rollbackVolumeGroupRequest>
	"""
	
	def String volumeRollbackRequestWithStackId = """
<rollbackVolumeGroupRequest>
   <volumeGroupRollback>
      <volumeGroupId>171907d6-cdf0-4e08-953d-81ee104005a7</volumeGroupId>
      <volumeGroupStackId>mdt22avrr_volume01/0f1aaae8-efe3-45ce-83e1-bfad01db58d8</volumeGroupStackId>
      <cloudSiteId>mtwnj1a</cloudSiteId>
      <tenantId>c2141e3fcae940fcb4797ec9115e5a7a</tenantId>
      <volumeGroupCreated>true</volumeGroupCreated>
      <msoRequest>
         <requestId>230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5</requestId>
         <serviceInstanceId>88c871d6-be09-4982-8490-96b1d243fb34</serviceInstanceId>
      </msoRequest>
      <messageId>9a5a91e8-3b79-463c-81c3-874a78f5b567</messageId>
   </volumeGroupRollback>
   <skipAAI>true</skipAAI>
   <messageId>9a5a91e8-3b79-463c-81c3-874a78f5b567</messageId>
   <notificationUrl>http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567</notificationUrl>
</rollbackVolumeGroupRequest>
	"""
	
	
	
	@Before
	public void init()
	{
		MockitoAnnotations.initMocks(this)
	}
	
	@Test
	@Ignore // 1802 merge
	public void testBuildRollbackVolumeGroupRequestXml() {
		DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2()
		String xml = process.buildRollbackVolumeGroupRequestXml(
			"171907d6-cdf0-4e08-953d-81ee104005a7", 	// volumeGroupId
			"mtwnj1a", 									// cloudSiteId
			"c2141e3fcae940fcb4797ec9115e5a7a", 		// tenantId
			"230fd6ac-2a39-4be4-9b1e-7b7e1cc039b5", 	// requestId
			"88c871d6-be09-4982-8490-96b1d243fb34", 	// serviceInstanceId
			"9a5a91e8-3b79-463c-81c3-874a78f5b567", 	// messageId
			"http://msobpel-app-e2e.ecomp.cci.att.com:8080/mso/WorkflowMessage/VNFAResponse/9a5a91e8-3b79-463c-81c3-874a78f5b567")	// notificationUrl

		assertEquals(volumeRollbackRequest.replaceAll("\\s", ""), xml.replaceAll("\\s", ""))
	}
	
	
	@Test
	public void testUpdateRollbackVolumeGroupRequestXml() {
		DoCreateVfModuleVolumeV2 process = new DoCreateVfModuleVolumeV2()
		String updatedXml = process.updateRollbackVolumeGroupRequestXml(volumeRollbackRequest, "mdt22avrr_volume01/0f1aaae8-efe3-45ce-83e1-bfad01db58d8")
		assertEquals(volumeRollbackRequestWithStackId.replaceAll("\\s", ""), updatedXml.replaceAll("\\s", ""))
	}
}