Skip to content

Commit 582498a

Browse files
committed
updated the SDK build number
1 parent b8287ee commit 582498a

File tree

3 files changed

+24
-114
lines changed

3 files changed

+24
-114
lines changed

javav2/example_code/stepfunctions/pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>software.amazon.awssdk</groupId>
4040
<artifactId>bom</artifactId>
41-
<version>2.21.20</version>
41+
<version>2.29.45</version>
4242
<type>pom</type>
4343
<scope>import</scope>
4444
</dependency>
@@ -99,5 +99,13 @@
9999
<groupId>software.amazon.awssdk</groupId>
100100
<artifactId>sfn</artifactId>
101101
</dependency>
102+
<dependency>
103+
<groupId>software.amazon.awssdk</groupId>
104+
<artifactId>sso</artifactId>
105+
</dependency>
106+
<dependency>
107+
<groupId>software.amazon.awssdk</groupId>
108+
<artifactId>ssooidc</artifactId>
109+
</dependency>
102110
</dependencies>
103111
</project>

javav2/example_code/stepfunctions/src/main/java/com/example/stepfunctions/StepFunctionsScenario.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import software.amazon.awssdk.services.sfn.model.StartExecutionRequest;
3030
import software.amazon.awssdk.services.sfn.model.StartExecutionResponse;
3131
import software.amazon.awssdk.services.sfn.model.StateMachineType;
32+
33+
import java.io.File;
34+
import java.io.FileInputStream;
3235
import java.io.InputStream;
3336
import java.util.ArrayList;
3437
import java.util.List;
@@ -74,16 +77,18 @@ public static void main(String[] args) throws Exception {
7477
roleName - The name of the IAM role to create for this state machine.
7578
activityName - The name of an activity to create.
7679
stateMachineName - The name of the state machine to create.
80+
jsonFile - The location of the chat_sfn_state_machine.json file. You can located it in resources/sample_files.
7781
""";
7882

79-
if (args.length != 3) {
80-
System.out.println(usage);
81-
System.exit(1);
82-
}
83+
// if (args.length != 3) {
84+
// System.out.println(usage);
85+
// System.exit(1);
86+
// }
8387

84-
String roleName = args[0];
85-
String activityName = args[1];
86-
String stateMachineName = args[2];
88+
String roleName = "stepFunctionsRole380" ; //args[0];
89+
String activityName = "ScottActivity" ; //args[1];
90+
String stateMachineName = "Scott670Machine" ; //args[2];
91+
String jsonFile = "C:\\AWS\\chat.json" ;
8792
String polJSON = "{\n" +
8893
" \"Version\": \"2012-10-17\",\n" +
8994
" \"Statement\": [\n" +
@@ -121,12 +126,10 @@ public static void main(String[] args) throws Exception {
121126
System.out.println("The ARN of the activity is " + activityArn);
122127
System.out.println(DASHES);
123128

124-
// Get JSON to use for the state machine and place the activityArn value into
125-
// it.
126-
InputStream input = StepFunctionsScenario.class.getClassLoader()
127-
.getResourceAsStream("chat_sfn_state_machine.json");
129+
// Read the file using FileInputStream
130+
FileInputStream inputStream = new FileInputStream(jsonFile);
128131
ObjectMapper mapper = new ObjectMapper();
129-
JsonNode jsonNode = mapper.readValue(input, JsonNode.class);
132+
JsonNode jsonNode = mapper.readValue(inputStream, JsonNode.class);
130133
String jsonString = mapper.writeValueAsString(jsonNode);
131134

132135
// Modify the Resource node.

javav2/example_code/stepfunctions/src/test/java/StepFunctionsTest.java

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)