From 86e19e5b6b185a50480bbc5a1aeb69754bca265c Mon Sep 17 00:00:00 2001 From: Justin Phillips Date: Wed, 3 Apr 2019 16:40:40 -0400 Subject: [PATCH 1/2] Fixed typos in readme. --- README.md | 39 +++++++++---------- ...mpose-pairwise-account-cmd-transaction.yml | 0 ...ose-pairwise-account-query-transaction.yml | 0 ...ml => docker-compose-subdomain-testing.yml | 0 .../AccountSagaManagerConfiguration.java | 2 + .../MockTransactionRepository.java | 2 +- 6 files changed, 21 insertions(+), 22 deletions(-) rename docker-compose-pair-wise-account-cmd-transaction.yml => docker-compose-pairwise-account-cmd-transaction.yml (100%) rename docker-compose-pair-wise-account-query-transaction.yml => docker-compose-pairwise-account-query-transaction.yml (100%) rename docker-compose-sub-domain-testing.yml => docker-compose-subdomain-testing.yml (100%) diff --git a/README.md b/README.md index 48288a17..83e19004 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The Banking Microservices Tutorial project is a small system used to show how mi

Routing configuration of gateways.

## Configuration -The services can be configured in three ways, a local default configuration under each project resources/application.yml, a development coniguration under +The services can be configured in three ways, a local default configuration under each project resources/application.yml, a development configuration under resources/application-dev.yml, and the centralized configuration service. ## Requirements @@ -45,15 +45,15 @@ See each services readme for detailed requirement information # Start the backing services: service discovery, configuration, authentication, edge service docker-compose up --build # After verifying everything spun up correctly tear it down. -# Press Control C to shutdown the docker containers +# Press Control C to shut down the docker containers ``` ## Running with Mocks To download the Mock images and test running on your machine use the following commands. ```bash -docker-compose -f docker-compose-sub-domain-testing.yml up +docker-compose -f docker-compose-subdomain-testing.yml up # After verifying everything spun up correctly tear it down. -# Press Control C to shutdown the docker containers +# Press Control C to shut down the docker containers ``` ## Running the PACT Broker @@ -61,7 +61,7 @@ Exercise the PACT Broker service. ```bash docker-compose -f ./docker/pact-broker/docker-compose.yml up # After verifying everything spun up correctly tear it down. -# Press Control C to shutdown the docker containers +# Press Control C to shut down the docker containers ``` ## Rebuild Containers @@ -73,8 +73,8 @@ docker-compose build The following guides are meant to get your environment up and running tests, not necessarily a guide to the most effective way to execute the tests while you are developing them. ## Windows Users -The following examples use shell scripts, simply replace the `.sh` extentions in the examples with -`.bat` in order to execute them in Command Prompt or PowerShell. +The following examples use shell scripts, just replace the `.sh` extensions in the examples with +`.bat` to execute them in Command Prompt or PowerShell. ## Running Unit and Integration Tests The Gradle task 'test' executes the JUnit tests for each project. @@ -89,10 +89,8 @@ You can find a JaCoCo coverage report under the "coverage" in transaction servic ## Running Service Isolation Tests The documentation [here](documentation/http_stubbed_isolation_tests.md) provides a guide on creating new isolation tests with HTTP stubs. ### Running Service Isolation Tests with All External Dependencies Mocked -Mocking all external dependencies to the services allows for very rapid execution of tests and -alleviates the need for configuring or utilizing resources for the external dependencies. -In memory databases are used in the place of Mongo, though the the same Mongo code dependencies -are used to connect to these in-memory databases. HTTP mock server stubs are used to provide stubbed responses for external services. +Mocking all external dependencies to the services allows for very rapid execution of tests and alleviates the need for configuring or utilizing resources for the external dependencies. +In memory databases are used in the place of Mongo, though the same Mongo code dependencies are used to connect to these in-memory databases. HTTP mock server stubs are used to provide stubbed responses for external services. ![Externally Mocked Services](documentation/images/external-mocks.png) Docker is not required to run these tests as all external dependencies are mocked. ```bash @@ -101,9 +99,9 @@ sh ./scripts/run-isolation-tests-mocked.sh ### Running Service Isolation Tests with External Databases, Caches, and Etc... Here only the calls to other services are mocked, but external dependencies like databases, caches, -and discovery services are deployed. For this guide we will run the Transaction service isolation tests. +and discovery services are deployed. For this guide, we will run the Transaction service isolation tests. We use Docker Compose to stand up Mongo. Transactions is the only service demoed here because in an actual product you will most likely have a cloud -deployment infrastructure where you can dynamically configure the HTTP stubs, here we simply use a Docker Compose configuration. +deployment infrastructure where you can dynamically configure the HTTP stubs, here we use a Docker Compose configuration. ![Externally Mocked Services](documentation/images/isolation-mocks.png) Start the services database using the backing services. ```bash @@ -152,12 +150,12 @@ Note, if you want to examine the individual PACTs, these are generated in `tests ## Running Service Integration Tests ### Sub-Domain Service Integration Testing -To run the sub-domain service integration tests, all of the dependencies must be available for the given service under test. For this case we will be running integration tests for the Account sub-domain, which means that the gateway for the People domain will be mocked, but all Account related services should be up. +To run the sub-domain service integration tests, all of the dependencies must be available for the given service under test. For this case, we will be running integration tests for the Account sub-domain, which means that the gateway for the People domain will be mocked, but all Account related services should be up. ![Sub-Domain Integration Testing](documentation/images/subdomain-integration-testing.png) Use docker to stand up the supporting services, databases, and etc... ```bash -docker-compose -f docker-compose-sub-domain-testing.yml up +docker-compose -f docker-compose-subdomain-testing.yml up ``` Once the services stabilize, you should see a message like `o.a.a.c.AxonServerConnectionManager - Re-subscribing commands and queries`, at this point you can open a new terminal and run the tests. ```bash @@ -165,19 +163,18 @@ sh ./scripts/run-sub-domain-integration-tests.sh ``` Take down the services in the other terminal window. ```bash -docker-compose -f docker-compose-sub-domain-testing.yml down +docker-compose -f docker-compose-subdomain-testing.yml down ``` ### Pairwise Service Integration Testing To run the pairwise service integration tests you will need to have the appropriately configured environment for the particular tests. Here, we demo pairwise testing of the Account Transactions and Account Cmd pair, with all other domain services mocked, -notice that unlike subdomain testing, the domain gateway is not present. This type of testing requires much configuration and thus should -be used for complicated interactions between two services, not for every service pair. +notice that unlike subdomain testing, the domain gateway is not present. This type of testing requires many configurations and thus should be used for complicated interactions between two services, not for every service pair. ![Sub-Domain Integration Testing](documentation/images/service-integration-pairwise-testing.png) -Use docker to stand up the supporting services, databases, and etc... +Use docker to stand up the supporting services, databases, etc... ```bash -docker-compose -f docker-compose-pair-wise-account-cmd-transaction.yml up +docker-compose -f docker-compose-pairwise-account-cmd-transaction.yml up ``` Once the services stabilize, you should see a message like `o.a.a.c.AxonServerConnectionManager - Re-subscribing commands and queries`, at this point you can open a new terminal and run the tests. ```bash @@ -185,7 +182,7 @@ sh ./scripts/run-transaction-pairwise-tests-with-cmd.sh ``` Take down the services in the other terminal window. ```bash -docker-compose -f docker-compose-pair-wise-account-cmd-transaction.yml down +docker-compose -f docker-compose-pairwise-account-cmd-transaction.yml down ``` # API Documentation: diff --git a/docker-compose-pair-wise-account-cmd-transaction.yml b/docker-compose-pairwise-account-cmd-transaction.yml similarity index 100% rename from docker-compose-pair-wise-account-cmd-transaction.yml rename to docker-compose-pairwise-account-cmd-transaction.yml diff --git a/docker-compose-pair-wise-account-query-transaction.yml b/docker-compose-pairwise-account-query-transaction.yml similarity index 100% rename from docker-compose-pair-wise-account-query-transaction.yml rename to docker-compose-pairwise-account-query-transaction.yml diff --git a/docker-compose-sub-domain-testing.yml b/docker-compose-subdomain-testing.yml similarity index 100% rename from docker-compose-sub-domain-testing.yml rename to docker-compose-subdomain-testing.yml diff --git a/domain-services/account-cmd/src/main/java/com/ultimatesoftware/banking/account/cmd/configuration/AccountSagaManagerConfiguration.java b/domain-services/account-cmd/src/main/java/com/ultimatesoftware/banking/account/cmd/configuration/AccountSagaManagerConfiguration.java index f1d1013f..dfe308cf 100644 --- a/domain-services/account-cmd/src/main/java/com/ultimatesoftware/banking/account/cmd/configuration/AccountSagaManagerConfiguration.java +++ b/domain-services/account-cmd/src/main/java/com/ultimatesoftware/banking/account/cmd/configuration/AccountSagaManagerConfiguration.java @@ -1,8 +1,10 @@ package com.ultimatesoftware.banking.account.cmd.configuration; import com.ultimatesoftware.banking.account.cmd.sagas.TransactionSaga; +import com.ultimatesoftware.banking.api.configuration.ConfigurationConstants; import com.ultimatesoftware.banking.api.configuration.SagaManagerConfiguration; import io.micronaut.context.annotation.Infrastructure; +import io.micronaut.context.annotation.Requires; import io.micronaut.discovery.event.ServiceStartedEvent; import io.micronaut.runtime.event.annotation.EventListener; import org.axonframework.axonserver.connector.AxonServerConfiguration; diff --git a/domain-services/account-transactions/src/main/java/com/ultimatesoftware/banking/account/transactions/repositories/MockTransactionRepository.java b/domain-services/account-transactions/src/main/java/com/ultimatesoftware/banking/account/transactions/repositories/MockTransactionRepository.java index 92cb9ae1..57fc29d5 100644 --- a/domain-services/account-transactions/src/main/java/com/ultimatesoftware/banking/account/transactions/repositories/MockTransactionRepository.java +++ b/domain-services/account-transactions/src/main/java/com/ultimatesoftware/banking/account/transactions/repositories/MockTransactionRepository.java @@ -15,7 +15,7 @@ @Primary @Singleton -@Requires(env = ConfigurationConstants.EXTERNAL_MOCKS) +@Requires(env = ConfigurationConstants.INTERNAL_MOCKS) public class MockTransactionRepository extends MockRepository { public MockTransactionRepository() { From 82605dd71365a432c3e2821e23787a006b7ff4d4 Mon Sep 17 00:00:00 2001 From: Justin Phillips Date: Wed, 3 Apr 2019 16:41:17 -0400 Subject: [PATCH 2/2] Removed typo in readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83e19004..a3f29e72 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ See each services readme for detailed requirement information # Running the Project ## Start the Microservices -** Build JARs for each project (You will need to build a JAR anytime changes are made to a project, then rebuild either the container or all containers) +Build JARs for each project (You will need to build a JAR anytime changes are made to a project, then rebuild either the container or all containers) ```bash # Assemble the binaries ./gradlew assemble