Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed swagger-ui urls in README and in show-urls.sh script. Enabled actuator mappings. #46

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Where `database-mode` is one of:

Finally, you can use the Swagger UI provided by the services to create customers and orders, and view the order history:

* `http://localhost:8081/swagger-ui.html` - Create a customer
* `http://localhost:8083/swagger-ui.html` - Create an order
* `http://localhost:8082/swagger-ui.html` - View the customer and the order
* `http://localhost:8081/swagger-ui/index.html` - Create a customer
* `http://localhost:8083/swagger-ui/index.html` - Create an order
* `http://localhost:8082/swagger-ui/index.html` - View the customer and the order

(Hint: best to open these URLs in separate tabs)

Expand Down
4 changes: 3 additions & 1 deletion customers-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

management.endpoints.web.exposure.include=*
2 changes: 2 additions & 0 deletions e2e-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ dependencies {
testCompile "junit:junit:4.12"
testCompile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"

testCompile "io.eventuate.util:eventuate-util-test:$eventuateUtilVersion"
}

test {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.chrisrichardson.eventstore.examples.customersandorders.e2etests;

import io.eventuate.util.test.async.UrlTesting;
import net.chrisrichardson.eventstore.examples.customersandorders.common.domain.Money;
import net.chrisrichardson.eventstore.examples.customersandorders.commontest.AbstractCustomerAndOrdersIntegrationTest;
import net.chrisrichardson.eventstore.examples.customersandorders.customers.webapi.CreateCustomerRequest;
Expand All @@ -8,6 +9,7 @@
import net.chrisrichardson.eventstore.examples.customersandorders.orders.webapi.CreateOrderResponse;
import net.chrisrichardson.eventstore.examples.customersandorders.ordershistory.webapi.CustomerView;
import net.chrisrichardson.eventstore.examples.customersandorders.ordershistory.webapi.OrderView;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -18,6 +20,8 @@
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

@RunWith(SpringJUnit4ClassRunner.class)
Expand All @@ -43,6 +47,17 @@ private String baseUrlOrderHistory(String path) {
@Autowired
RestTemplate restTemplate;

@Test
public void testSwaggerUiUrls() throws IOException {
testSwaggerUiUrl(8081);
testSwaggerUiUrl(8082);
testSwaggerUiUrl(8083);
}

private void testSwaggerUiUrl(int port) throws IOException {
UrlTesting.assertUrlStatusIsOk("localhost", port, "/swagger-ui/index.html");
}

private CustomerView getCustomer(String customerId) {
try {
ResponseEntity<CustomerView> getCustomer =
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ eventuateMavenRepoUrl=https://dl.bintray.com/eventuateio-oss/eventuate-maven-rc,

springBootVersion=2.3.5.RELEASE

eventuateUtilVersion=0.10.0.RELEASE
eventuateUtilVersion=0.12.0.RELEASE
eventuateExamplesBaseImageVersion=BUILD-5

eventuateCommonVersion=0.14.0.RELEASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ logging.level.io.eventuate.activity=DEBUG

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/customers_and_orders
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/customers_and_orders

management.endpoints.web.exposure.include=*
4 changes: 3 additions & 1 deletion orders-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

management.endpoints.web.exposure.include=*
8 changes: 4 additions & 4 deletions show-urls.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#! /bin/bash -e

./wait-for-services.sh ${DOCKER_HOST_IP:localhost} 8081 8082 8083
./wait-for-services.sh ${DOCKER_HOST_IP:localhost} /actuator/health 8081 8082 8083

echo The microservices are running
echo You can visit these URLS
echo http://localhost:8081/swagger-ui.html - Customer service
echo http:/localhost:8083/swagger-ui.html - Order Service
echo http://localhost:8082/swagger-ui.html - Order History Service
echo http://localhost:8081/swagger-ui/index.html - Customer service
echo http:/localhost:8083/swagger-ui/index.html - Order Service
echo http://localhost:8082/swagger-ui/index.html - Order History Service