Brief Table of Contents
Chapter 1 An introduction to microservices
1.1. WHAT ARE MICROSERVICES, AND WHY USE THEM?
1.1.1. Why use microservices?
1.1.2. What are microservices?
1.1.3. Continuous integration, deployment, and Docker
1.2. MICROSERVICE NETWORKS AND FEATURES
1.2.1. Microservice networks
1.2.2. Microservice features
1.3. MICROSERVICE ARCHITECTURE
1.3.1. Resource component
1.3.2. Business-domain component
1.3.3. Remote resources component
1.3.4. Persistence component
1.4. MICROSERVICE UNIT TESTING
1.4.1. Solitary unit tests
1.4.2. Sociable unit tests
Chapter 2 Application under test
2.1. GETTING STARTED
2.2. PREREQUISITES
2.2.1. Java Development Kit
2.2.2. Build tools
2.2.3.Environment variables
2.2.4. Integrated development environment (IDE)
2.3. ARCHITECTURE
2.3.1. The game service
2.3.2. The comments service
2.3.3. The video service
2.3.4. The aggregator service
2.3.5. Overall architecture
2.4. APPLICATION DESIGN PATTERNS
2.4.1. Anatomy
2.4.2. ECB pattern
2.4.3. Miscellaneous patterns
2.5. DESIGN DECISIONS
Chapter 3 Unit-testing microservices
3.1. UNIT TESTING TECHNIQUES
3.1.1. Sociable unit tests
3.1.2. Test doubles
3.1.3. Solitary unit tests
3.1.4. Unit testing in microservices
3.2. TOOLS
3.2.1. JUnit
3.2.2. AssertJ
3.2.3. Mockito
3.2.4. Build-script modifications
3.3. WRITING UNIT TESTS FOR THE GAMER APP
3.3.1. YouTubeVideoLinkCreator test
3.3.2. YouTubeLink test
3.3.3. Games test
3.3.4. GamesService test
3.3.5. GamesResource test
EXERCISES
Chapter 4 Component-testing microservices
4.1. THE ARQUILLIAN TEST FRAMEWORK
4.2. INTRODUCING THE @RUNWITH(ARQUILLIAN.CLASS) ANNOTATION
4.3. THE SHRINKWRAP UTILITY CLASS
4.3.1. Building an archive with ShrinkWrap
4.3.2. Adding content to the ShrinkWrap archive
4.3.3. Adding resources
4.3.4. Adding libraries and dependencies
4.3.5. Adding complex dependencies with the Maven resolver
4.3.6. Adding a service implementation
4.4. WRITE ONCE AND REUSE YOUR CODE
4.5. BUILD-SCRIPT MODIFICATIONS
4.5.1. Defining Maven dependencies
4.5.2. Defining Gradle dependencies
4.6. OVERRIDING THE DEFAULT ARQUILLIAN CONFIGURATION
4.6.1. The container definition
4.7. USING ARQUILLIAN REST EXTENSIONS
4.7.1. The Arquillian REST client extension
4.7.2. The Warp REST extension
4.8. TESTING SPRING APPLICATIONS USING ARQUILLIAN
4.8.1. The Arquillian Spring Framework extension
4.8.2. Testing Spring Boot applications
4.9. MORE-COMPLEX ARQUILLIAN TEST EXAMPLES
4.9.1. Testing the remote component
4.9.2. Testing the resource component
4.9.3. Testing the domain component
4.9.4. Testing the persistence component
EXERCISES
Chapter 5 Integration-testing microservices
5.1. INTEGRATION TESTING IN THE MICROSERVICES ARCHITECTURE
5.1.1. Gateway component layer
5.1.2. Data mappers and repositories
5.2. PERSISTENCE TESTING WITH THE ARQUILLIAN PERSISTENCEEXTENSION
5.2.1. Declarative approach
5.2.2. Programmatic approach
5.2.3. Persistence testing with NoSQLUnit
5.2.4. Persistence testing with Arquillian multideployment
5.2.5. Persistence testing with Arquillian sequence
5.2.6. Build-script modifications
5.3. WRITING INTEGRATION TESTS FOR THE GAMER APPLICATION
5.3.1. Testing the Comments class
5.3.2. Testing the CommentsGateway class
5.4. EXERCISES
Chapter 6 Contract tests
6.1. UNDERSTANDING CONTRACTS
6 1 1 Contracts and monolithic applications
6.1.2. Contracts and microservice applications
6.1.3. Verifying with integration tests
6.1.4. What are contract tests?
6.1.5. Who owns the contracts?
6.2. TOOLS
6.2.1. Pact
6.2.2. Pact in JVM languages
6.2.3. Integrating Pact JVM into the Arquillian ecosystem with Algeron
6.3. BUILD-SCRIPT MODIFICATIONS
6.3.1. Using Pact JVM for contract testing
6.3.2. Using Arquillian Algeron for contract testing
6.4. WRITING CONSUMER-DRIVEN CONTRACTS FOR THE GAMERAPPLICATION
6.4.1. Consumer side of the comments service
6.4.2. Provider side of the comments service
EXERCISE
Chapter 7 End-to-end testing
7.1. END-TO-END TESTS IN THE OVERALL TESTING PICTURE
7.2. END-TO-END TESTING TECHNIQUES
7.2.1. Vertical tests
7.2.2. Horizontal tests
7.3. INTRODUCTION TO END-TO-END TESTING TOOLS
7.3.1. Arquillian Cube
7.3.2. Arquillian Drone
7.3.3. Arquillian Graphene 2
7.3.4. JMeter
7.3.5. Cukes in Space
7.4. EXAMPLE END-TO-END TEST
7.4.1. Building the microservices
7.4.2. Adding the build dependencies and configuration
7.4.3. Adding @Deployment and @TargetsContainer to the test
7.4.4. Cross-origin resource sharing
7.4.5. Coping with a mixed environment using @ClassRule
7.4.6. Operating on the deployments with @OperateOnDeployment
7.4.7. Introducing @Drone, page objects, @Location, and the WebDriver
7.4.8. Working with page objects in a test
7.4.9. Running the test
7.5. EXERCISE
Chapter 8 Docker and testing
8.1. TOOLS IN THE DOCKER ECOSYSTEM
8.1.1. Docker
8.1.2. Docker Machine
8.1.3. Docker Compose
8.2. ARQUILLIAN CUBE
8.2.1. Setting up Arquillian Cube
8.2.2. Writing container tests
8.2.3. Writing integration tests
8.2.4. Writing end-to-end tests
8.3. REST API
8.4. ARQUILLIAN DRONE AND GRAPHENE
8.4.1. Integrating Arquillian Cube and Arquillian Drone
8.4.2. Integrating Arquillian Cube and Arquillian Graphene
8.5. PARALLELIZING TESTS
8.6. ARQUILLIAN CUBE AND ALGERON
8.7. USING THE CONTAINER-OBJECTS PATTERN
8.7.1. Using a flexible container-object DSL
8.8. DEPLOYMENT TESTS AND KUBERNETES
8.9. BUILD-SCRIPT MODIFICATIONS
8.9.1. Arquillian Cube Docker
8.9.2. Arquillian Cube Docker JUnit rule
8.9.3. Arquillian Cube Kubernetes
8.9.4. Arquillian Cube OpenShift
8.10. TESTING THE DOCKERFILE FOR THE VIDEO SERVICE
EXERCISE
Chapter 9 Service virtualization
9.1. WHAT IS SERVICE VIRTUALIZATION?
9.1.1. Why use service virtualization?
9.1.2. When to use service virtualization
9.2. MIMICKING SERVICE RESPONSES WITH HOVERFLY
9.2.1. Hoverfly modes
9.2.2. JUnit Hoverfly
9.2.3. Configuring Hoverfly
9.3. BUILD-SCRIPT MODIFICATIONS
9.4. USING SERVICE VIRTUALIZATION FOR THE GAMER APPLICATION
Chapter 10 Continuous delivery in microservices
10.1. WHAT IS CONTINUOUS DELIVERY?
10.2. CONTINUOUS DELIVERY AND THE MICROSERVICESARCHITECTURE
10.3. ORCHESTRATING CONTINUOUS DELIVERY
10.3.1. Working with Jenkins
10.3.2. The Jenkins pipeline
10.3.3. Deploying with certainty
10.4. JENKINS
10.4.1. Defining a pipeline
10.4.2. Example of a Jenkins pipeline
Appendix Masking multiple containers with Arquillian Chameleon