diff --git a/exercises/debug-activity/README.md b/exercises/debug-activity/README.md index 7033325..de7e538 100644 --- a/exercises/debug-activity/README.md +++ b/exercises/debug-activity/README.md @@ -182,7 +182,7 @@ in the Workflow code, rather than in an Activity, since that is typically not prone to failure and unlikely to affect whether the Workflow executes in a deterministic manner. This exercise implemented it in the Activity, since you can deploy a fix to Activity code without a risk of causing a -non-deterministic error. Later in this course, you'll learn how to safely +non-deterministic error. As you learned earlier in this course, there are also ways to safely deploy changes to Workflow Definitions. ### This is the end of the exercise. diff --git a/exercises/durable-execution/README.md b/exercises/durable-execution/README.md index 283b93d..e2345cc 100644 --- a/exercises/durable-execution/README.md +++ b/exercises/durable-execution/README.md @@ -20,7 +20,7 @@ skip this step. An instance of the Microservice is already running in your environment** 1. Navigate to the `utilities` directory at the root level of the course -2. Change directoryies into the `microservice directory` +2. Change directories into the `microservice directory` 1. `cd utilities/microservice` 3. Compile the microservice 1. `mvn clean compile` @@ -89,9 +89,10 @@ Before proceeding, make sure that there are no Workers running for this or any p 1. If your using the GitPod environment, you can run `ex1w` 4. In another terminal, execute the Workflow by running `mvn exec:java -Dexec.mainClass="translationworkflow.Starter" -Dexec.args="Stanislav sk"` (replace `Stanislav` with your first name) 1. If your using the GitPod environment, you can run `ex1st "Stanislav sk` -5. Observe the output in the terminal windows used by each worker. 6. As soon as you see a log message in one of the Worker terminals indicating that it has started the Timer, locate the terminal with the message `[ACTIVITY INVOKED]...` and press Ctrl-C in _that_ window to kill that Worker process. -6. Switch to the terminal window for the other Worker process. Within a few seconds, you should observe new output, indicating that it has resumed execution of the Workflow. -7. Once you see log output indicating that translation was successful, switch back to the terminal window where you started the Workflow. +5. Observe the output in the terminal windows used by each worker. +6. As soon as you see a log message in one of the Worker terminals indicating that it has started the Timer, locate the terminal with the message `[ACTIVITY INVOKED]...` and press Ctrl-C in _that_ window to kill that Worker process. +7. Switch to the terminal window for the other Worker process. Within a few seconds, you should observe new output, indicating that it has resumed execution of the Workflow. +8. Once you see log output indicating that translation was successful, switch back to the terminal window where you started the Workflow. After the final step, you should see the translated Hello and Goodbye messages, which confirms that Workflow Execution completed successfully despite the original Worker being killed. diff --git a/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationActivitiesImpl.java b/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationActivitiesImpl.java index 46ad777..d6138b1 100644 --- a/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationActivitiesImpl.java +++ b/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationActivitiesImpl.java @@ -1,7 +1,6 @@ package translationworkflow; import java.net.HttpURLConnection; -import java.net.ProtocolException; import java.net.URI; import java.net.URL; import java.net.URLEncoder; @@ -10,10 +9,7 @@ import java.io.IOException; import io.temporal.activity.Activity; import io.temporal.failure.ApplicationFailure; -import java.net.HttpURLConnection; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import translationworkflow.model.TranslationActivityInput; import translationworkflow.model.TranslationActivityOutput; diff --git a/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationWorkflowImpl.java b/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationWorkflowImpl.java index 1c0aa28..4859e4e 100644 --- a/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationWorkflowImpl.java +++ b/exercises/durable-execution/practice/src/main/java/translationworkflow/TranslationWorkflowImpl.java @@ -41,6 +41,7 @@ public TranslationWorkflowOutput sayHelloGoodbye(TranslationWorkflowInput input) // TODO: Add a log statement here at the debug level stating that the Activity is going // to be invoked. Be sure to include the word being translated and the language code. + TranslationActivityInput goodbyeInput = new TranslationActivityInput("goodbye", languageCode); TranslationActivityOutput goodbyeResult = activities.translateTerm(goodbyeInput); String goodbyeMessage = goodbyeResult.getTranslation() + ", " + name; diff --git a/exercises/durable-execution/solution/src/main/java/translationworkflow/TranslationActivitiesImpl.java b/exercises/durable-execution/solution/src/main/java/translationworkflow/TranslationActivitiesImpl.java index 41236d5..c2b922f 100644 --- a/exercises/durable-execution/solution/src/main/java/translationworkflow/TranslationActivitiesImpl.java +++ b/exercises/durable-execution/solution/src/main/java/translationworkflow/TranslationActivitiesImpl.java @@ -1,7 +1,6 @@ package translationworkflow; import java.net.HttpURLConnection; -import java.net.ProtocolException; import java.net.URI; import java.net.URL; import java.net.URLEncoder; @@ -10,7 +9,6 @@ import java.io.IOException; import io.temporal.activity.Activity; import io.temporal.failure.ApplicationFailure; -import java.net.HttpURLConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/exercises/testing-code/README.md b/exercises/testing-code/README.md index a49b409..4375a6f 100644 --- a/exercises/testing-code/README.md +++ b/exercises/testing-code/README.md @@ -49,9 +49,10 @@ translates the term "Hello" to German. Take a moment to study the test, which you'll find in the `TranslationActivitiesTest.java` file in the `src/test/java/translationworkflow` directory. Since the test runs the Activity, which in turn calls the microservice to do the translation, ensure -that your microservice is running as state above. Then run the test. +that your microservice is running as stated above. Then run the test. -1. Run the `mvn test` command to execute the provided test +1. `cd` into `exercises/testing-code/practice/` +2. Run the `mvn test` command to execute the provided test ## Part B: Write and Run Another Test for the Activity @@ -107,8 +108,8 @@ following steps: 1. Edit the `TranslationWorkflowTest.java` file in the `src/test/java/translationworkflow` directory 2. Add assertions for the following conditions to the `testSuccessfulTranslation` test - - The `helloMessage` field in the result is `Bonjour, Pierre` - - The `goodbyeMessage` field in the result is `Au revoir, Pierre` + - The `helloMessage` field in the output is `Bonjour, Pierre` + - The `goodbyeMessage` field in the output is `Au revoir, Pierre` 3. Save your changes 4. Run `mvn test`. This will fail, due to a bug in the Workflow Definition. 5. Find and fix the bug in the Workflow Definition