@@ -69,115 +69,13 @@ class StepFunctionsKotlinTest {
6969 }
7070
7171 @Test
72- @Order(2 )
72+ @Order(1 )
7373 fun listStateMachines () =
7474 runBlocking {
7575 listMachines()
7676 println (" Test 4 passed" )
7777 }
7878
79- @Test
80- @Order(2 )
81- fun testMVP () =
82- runBlocking {
83- val sc = Scanner (System .`in `)
84- var action = false
85-
86- val polJSON = """ {
87- "Version": "2012-10-17",
88- "Statement": [
89- {
90- "Sid": "",
91- "Effect": "Allow",
92- "Principal": {
93- "Service": "states.amazonaws.com"
94- },
95- "Action": "sts:AssumeRole"
96- }
97- ]
98- }"""
99-
100- println (DASHES )
101- println (" List activities using a Paginator." )
102- listActivitesPagnator()
103- println (" Create an activity." )
104- val activityArn = createActivity(activityNameSC)
105- println (" The ARN of the Activity is $activityArn " )
106-
107- println (" List state machines using a paginator." )
108- listStatemachinesPagnator()
109- println (DASHES )
110-
111- // Get JSON to use for the state machine and place the activityArn value into it.
112- val stream = GetStream ()
113- val jsonString = stream.getStream()
114-
115- // Modify the Resource node.
116- val objectMapper = ObjectMapper ()
117- val root: JsonNode = objectMapper.readTree(jsonString)
118- (root.path(" States" ).path(" GetInput" ) as ObjectNode ).put(" Resource" , activityArn)
119-
120- // Convert the modified Java object back to a JSON string.
121- val stateDefinition = objectMapper.writeValueAsString(root)
122- println (stateDefinition)
123-
124- println (DASHES )
125- println (" Create a state machine." )
126- val roleARN = createIAMRole(roleNameSC, polJSON)
127- val stateMachineArn = createMachine(roleARN, stateMachineNameSC, stateDefinition)
128- println (" The ARN of the state machine is $stateMachineArn " )
129- println (" The ARN of the state machine is" )
130- println (DASHES )
131-
132- println (DASHES )
133- println (" Describe the state machine." )
134- describeStateMachine(stateMachineArn)
135- println (" What should ChatSFN call you?" )
136- val userName = " foo"
137- println (" Hello $userName " )
138- println (DASHES )
139-
140- println (DASHES )
141- // The JSON to pass to the StartExecution call.
142- val executionJson = " { \" name\" : \" $userName \" }"
143- println (executionJson)
144- println (" Start execution of the state machine and interact with it." )
145- val runArn = startWorkflow(stateMachineArn, executionJson)
146- println (" The ARN of the state machine execution is $runArn " )
147- var myList: List <String >
148- while (! action) {
149- myList = getActivityTask(activityArn)
150- println (" ChatSFN: " + myList[1 ])
151- println (" $userName please specify a value." )
152- val myAction = " done"
153- action = true
154- val taskJson = " { \" action\" : \" $myAction \" }"
155- println (taskJson)
156- sendTaskSuccess(myList[0 ], taskJson)
157- }
158- println (DASHES )
159-
160- println (DASHES )
161- println (" Describe the execution." )
162- describeExe(runArn)
163- println (DASHES )
164-
165- println (DASHES )
166- println (" Delete the activity." )
167- deleteActivity(activityArn)
168- println (DASHES )
169-
170- println (DASHES )
171- println (" Delete the state machines." )
172- deleteMachine(stateMachineArn)
173- println (DASHES )
174-
175- println (DASHES )
176- println (" The AWS Step Functions example scenario is complete." )
177- println (DASHES )
178- println (" Test 4 passed" )
179- }
180-
18179 private suspend fun getSecretValues (): String {
18280 val secretName = " test/stepfunctions"
18381 val valueRequest =
0 commit comments