@@ -90,107 +90,6 @@ public void TestHello() {
9090 System .out .println ("Test 2 passed" );
9191 }
9292
93- @ Test
94- @ Tag ("IntegrationTest" )
95- @ Order (3 )
96- public void TestSTFMVP () throws Exception {
97- Region regionGl = Region .AWS_GLOBAL ;
98- IamClient iam = IamClient .builder ()
99- .region (regionGl )
100- .credentialsProvider (EnvironmentVariableCredentialsProvider .create ())
101- .build ();
102- Scanner sc = new Scanner (System .in );
103- boolean action = false ;
104- String polJSON = "{\n " +
105- " \" Version\" : \" 2012-10-17\" ,\n " +
106- " \" Statement\" : [\n " +
107- " {\n " +
108- " \" Sid\" : \" \" ,\n " +
109- " \" Effect\" : \" Allow\" ,\n " +
110- " \" Principal\" : {\n " +
111- " \" Service\" : \" states.amazonaws.com\" \n " +
112- " },\n " +
113- " \" Action\" : \" sts:AssumeRole\" \n " +
114- " }\n " +
115- " ]\n " +
116- "}" ;
117-
118- System .out .println (StepFunctionsScenario .DASHES );
119- System .out .println ("Create an activity." );
120- String activityArn = StepFunctionsScenario .createActivity (sfnClient , activityNameSC );
121- System .out .println ("The ARN of the activity is " + activityArn );
122- System .out .println (StepFunctionsScenario .DASHES );
123- InputStream input = StepFunctionsScenario .class .getClassLoader ()
124- .getResourceAsStream ("chat_sfn_state_machine.json" );
125- ObjectMapper mapper = new ObjectMapper ();
126- JsonNode jsonNode = mapper .readValue (input , JsonNode .class );
127- String jsonString = mapper .writeValueAsString (jsonNode );
128-
129- // Modify the Resource node.
130- ObjectMapper objectMapper = new ObjectMapper ();
131- JsonNode root = objectMapper .readTree (jsonString );
132- ((ObjectNode ) root .path ("States" ).path ("GetInput" )).put ("Resource" , activityArn );
133-
134- // Convert the modified Java object back to a JSON string.
135- String stateDefinition = objectMapper .writeValueAsString (root );
136- System .out .println (stateDefinition );
137-
138- System .out .println (StepFunctionsScenario .DASHES );
139- System .out .println ("Create a state machine." );
140- String roleARN = StepFunctionsScenario .createIAMRole (iam , roleNameSC , polJSON );
141- String stateMachineArn = StepFunctionsScenario .createMachine (sfnClient , roleARN , stateMachineNameSC ,
142- stateDefinition );
143- System .out .println ("The ARN of the state machine is " + stateMachineArn );
144- System .out .println (StepFunctionsScenario .DASHES );
145-
146- System .out .println (StepFunctionsScenario .DASHES );
147- System .out .println ("Describe the state machine." );
148- StepFunctionsScenario .describeStateMachine (sfnClient , stateMachineArn );
149- System .out .println ("What should ChatSFN call you?" );
150- String userName = "Foo" ;
151- System .out .println ("Hello " + userName );
152- System .out .println (StepFunctionsScenario .DASHES );
153-
154- System .out .println (StepFunctionsScenario .DASHES );
155- // The json information to pass to the StartExecution call.
156- String executionJson = "{ \" name\" : \" " + userName + "\" }" ;
157- System .out .println (executionJson );
158- System .out .println ("Start execution of the state machine and interact with it." );
159- String runArn = StepFunctionsScenario .startWorkflow (sfnClient , stateMachineArn , executionJson );
160- System .out .println ("The ARN of the state machine execution is " + runArn );
161- List <String > myList ;
162- while (!action ) {
163- myList = StepFunctionsScenario .getActivityTask (sfnClient , activityArn );
164- System .out .println ("ChatSFN: " + myList .get (1 ));
165- System .out .println (userName + " please specify a value." );
166- String myAction = "done" ;
167- action = true ;
168-
169- System .out .println ("You have selected " + myAction );
170- String taskJson = "{ \" action\" : \" " + myAction + "\" }" ;
171- System .out .println (taskJson );
172- StepFunctionsScenario .sendTaskSuccess (sfnClient , myList .get (0 ), taskJson );
173- }
174- System .out .println (StepFunctionsScenario .DASHES );
175-
176- System .out .println (StepFunctionsScenario .DASHES );
177- System .out .println ("Describe the execution." );
178- StepFunctionsScenario .describeExe (sfnClient , runArn );
179- System .out .println (StepFunctionsScenario .DASHES );
180-
181- System .out .println (StepFunctionsScenario .DASHES );
182- System .out .println ("Delete the activity." );
183- StepFunctionsScenario .deleteActivity (sfnClient , activityArn );
184- System .out .println (StepFunctionsScenario .DASHES );
185-
186- System .out .println (StepFunctionsScenario .DASHES );
187- System .out .println ("Delete the state machines." );
188- StepFunctionsScenario .deleteMachine (sfnClient , stateMachineArn );
189- System .out .println (StepFunctionsScenario .DASHES );
190-
191- System .out .println ("Test 4 passed" );
192- }
193-
19493 private static String getSecretValues () {
19594 SecretsManagerClient secretClient = SecretsManagerClient .builder ()
19695 .region (Region .US_EAST_1 )
0 commit comments