Skip to content

Conversation

@scmacdon
Copy link
Contributor

@scmacdon scmacdon commented Jan 29, 2021

Checklist:

  • The submitter has added unit tests for all code paths, run all of them, and they all pass.

  • The submitter has run a linter on the code, and all of the submitter's team's minimum rules pass.

  • The submitter has added the team's minimum usage documentation to the code.

  • The submitter has had the code reviewed, and the submitter has incorporated any and all resulting review comments.

  • The submitter has had their Editor edit all comments and strings, and the submitter has incorporated any and all resulting edits.

  • The submitter has added all of the submitter's team's related API reporting metadata - metadata.yaml.

  • The PR has been tested to ensure there are no TAG issues.

@scmacdon scmacdon self-assigned this Jan 29, 2021
@scmacdon scmacdon added the Java label Jan 29, 2021
@scmacdon scmacdon changed the title Add AWS Step Function Java V2 Examples Add AWS Step Functions Java V2 Examples Jan 29, 2021
System.exit(1);
}

String jsonFile = args[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the most interesting part of this example is what exactly is in the JSON file. Instead of an argument, can it be created in the code? It can be as simple as the one in the Getting Started docs:

{ "Comment": "A Hello World example of the Amazon States Language using Pass states", "StartAt": "Hello", "States": { "Hello": { "Type": "Pass", "Result": "Hello", "Next": "World" }, "World": { "Type": "Pass", "Result": "World", "End": true } } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I referenced clearly where the user can get a JSON file for use with this example.

}

// snippet-start:[stepfunctions.java2.list_activities.main]
public static void getActivites(SfnClient sfnClient) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the method name to listActivities? GET and LIST operations have different expected behaviors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>transcribe</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@scmacdon scmacdon removed the on review label Feb 3, 2021
@scmacdon scmacdon assigned brmur and unassigned scmacdon Feb 3, 2021

- **jsonFileSM** – A JSON file that represents the Amazon States Language definition of the state machine and used in the **CreateStateMachine** test.

- **roleARN** – The Amazon Resource Name (ARN) of the IAM role to use for this state machine and used in the **CreateStateMachine** test.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IAM ->AWS Identity and Access Management (IAM)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

" CreateStateMachine <jsonFile> <roleARN> <stateMachineName>\n\n" +
"Where:\n" +
" jsonFile - A JSON file that represents the Amazon States Language definition of the state machine.\n\n" +
" roleARN - The Amazon Resource Name (ARN) of the IAM role to use for this state machine.\n" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IAM -> AWS Identity and Access Management (IAM)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -0,0 +1,79 @@
# AWS Step Functions Java code examples

This README discusses how to run and test the Java code examples for AWS Step Functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS Step Functions -> Step Functions

(subsequent use)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep first occurrence AWS Step Functions


This README discusses how to run and test the Java code examples for AWS Step Functions.

## Running the AWS Step Functions Java files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS Step Functions -> Step Functions

(subsequent use)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

see [Get started with the AWS SDK for Java 2.x](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html).


## Testing the AWS Step Functions Java files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS Step Functions -> Step Functions

(subsequent use)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


## Testing the AWS Step Functions Java files

You can test the Java code examples for AWS Step Functions by running a test file named **StepFunctionsTest**. This file uses JUnit 5 to run the JUnit tests and is located in the **src/test/java** folder. For more information, see [https://junit.org/junit5/](https://junit.org/junit5/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS Step Functions -> Step Functions

(subsequent use)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

**WARNING**: _Running these JUnit tests manipulates real Amazon resources and may incur charges on your account._

### Properties file
Before running the AWS Step Functions JUnit tests, you must define values in the **config.properties** file located in the **resources** folder. This file contains values that are required to run the JUnit tests. For example, you define an alarm name for various tests. If you do not define all values, the JUnit tests fail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS Step Functions -> Step Functions

(subsequent use)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


DynamoDbTable<Work> workTable = enhancedClient.table("Work", TableSchema.fromBean(Work.class));

//Get the WOrk object
Copy link
Contributor

@brmur brmur Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//Get the WOrk -> // Get the work

  • add period.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return;
}

//load a properties file from class path, inside static method
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//load -> // Load

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

public class StepFunctionsTest {

private static SfnClient sfnClient;
private static String stateMachineArn = ""; // gets dynamically set in a test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// gets dynamically set in a test-> // Gets dynamically set in a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

.partitionValue(id)
.build();

// Get the item by using the key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add period.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


private static SfnClient sfnClient;
private static String stateMachineArn = ""; // gets dynamically set in a test
private static String exeArn = ""; // gets dynamically set in a test
Copy link
Contributor

@brmur brmur Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// gets dynamically set in a test-> // Gets dynamically set in a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return "";
}

// Update the archive column by using the Enhanced Client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add period.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@brmur brmur merged commit 852407d into awsdocs:master Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants