├── .travis.yml
├── steeltoe-petclinic-customers-service
├── readme.md
├── Customers.Api
│ ├── appsettings.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── appsettings.Development.json
│ ├── DTOs
│ │ ├── PetType.cs
│ │ ├── PetRequest.cs
│ │ ├── PetDetails.cs
│ │ ├── OwnerRequest.cs
│ │ └── OwnerDetails.cs
│ ├── ResourceNotFoundException.cs
│ ├── appsettings.docker.json
│ ├── DateTimeConverter.cs
│ ├── Dockerfile
│ ├── Domain
│ │ ├── PetType.cs
│ │ ├── Pet.cs
│ │ └── Owner.cs
│ ├── Repository
│ │ ├── IOwners.cs
│ │ ├── IPets.cs
│ │ ├── Owners.cs
│ │ └── Pets.cs
│ ├── Infrastructure
│ │ └── SeedData.cs
│ ├── Steeltoe.Petclinic.Customers.Api.csproj
│ ├── Program.cs
│ └── Controllers
│ │ └── OwnersController.cs
├── Customers.ITest
│ ├── Steeltoe.Petclinic.Customers.ITest.csproj
│ └── CustomersAppFactory.cs
└── Customers.Test
│ ├── Steeltoe.Petclinic.Customers.Test.csproj
│ └── OwnerTest.cs
├── spring-petclinic-api-gateway
├── .gitignore
└── src
│ ├── test
│ ├── resources
│ │ └── bootstrap-test.yml
│ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── api
│ │ ├── ApiGatewayApplicationTests.java
│ │ └── application
│ │ └── VisitsServiceClientIntegrationTest.java
│ └── main
│ ├── wro
│ ├── wro.properties
│ └── wro.xml
│ ├── resources
│ ├── messages
│ │ ├── messages_en.properties
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── static
│ │ ├── images
│ │ │ ├── pets.png
│ │ │ ├── favicon.png
│ │ │ ├── platform-bg.png
│ │ │ ├── spring-pivotal-logo.png
│ │ │ ├── spring-logo-dataflow.png
│ │ │ └── spring-logo-dataflow-mobile.png
│ │ ├── fonts
│ │ │ ├── montserrat-webfont.eot
│ │ │ ├── montserrat-webfont.ttf
│ │ │ ├── montserrat-webfont.woff
│ │ │ ├── varela_round-webfont.eot
│ │ │ ├── varela_round-webfont.ttf
│ │ │ └── varela_round-webfont.woff
│ │ ├── scripts
│ │ │ ├── fragments
│ │ │ │ ├── welcome.html
│ │ │ │ ├── footer.html
│ │ │ │ └── nav.html
│ │ │ ├── visits
│ │ │ │ ├── visits.component.js
│ │ │ │ ├── visits.js
│ │ │ │ ├── visits.template.html
│ │ │ │ └── visits.controller.js
│ │ │ ├── pet-form
│ │ │ │ ├── pet-form.component.js
│ │ │ │ ├── pet-form.js
│ │ │ │ ├── pet-form.template.html
│ │ │ │ └── pet-form.controller.js
│ │ │ ├── vet-list
│ │ │ │ ├── vet-list.component.js
│ │ │ │ ├── vet-list.controller.js
│ │ │ │ ├── vet-list.js
│ │ │ │ └── vet-list.template.html
│ │ │ ├── owner-form
│ │ │ │ ├── owner-form.component.js
│ │ │ │ ├── owner-form.js
│ │ │ │ ├── owner-form.controller.js
│ │ │ │ └── owner-form.template.html
│ │ │ ├── owner-list
│ │ │ │ ├── owner-list.component.js
│ │ │ │ ├── owner-list.controller.js
│ │ │ │ ├── owner-list.js
│ │ │ │ └── owner-list.template.html
│ │ │ ├── owner-details
│ │ │ │ ├── owner-details.component.js
│ │ │ │ ├── owner-details.controller.js
│ │ │ │ ├── owner-details.js
│ │ │ │ └── owner-details.template.html
│ │ │ └── app.js
│ │ └── index.html
│ ├── bootstrap.yml
│ ├── logback-spring.xml
│ └── application.yml
│ ├── less
│ ├── responsive.less
│ ├── header.less
│ └── typography.less
│ └── java
│ └── org
│ └── springframework
│ └── samples
│ └── petclinic
│ └── api
│ ├── dto
│ ├── PetType.java
│ ├── Visits.java
│ ├── VisitDetails.java
│ ├── PetDetails.java
│ └── OwnerDetails.java
│ └── application
│ ├── CustomersServiceClient.java
│ └── VisitsServiceClient.java
├── spring-petclinic-vets-service
├── .gitignore
└── src
│ ├── main
│ ├── resources
│ │ ├── application.properties
│ │ ├── bootstrap.yml
│ │ ├── logback-spring.xml
│ │ └── db
│ │ │ ├── hsqldb
│ │ │ ├── data.sql
│ │ │ └── schema.sql
│ │ │ └── mysql
│ │ │ ├── data.sql
│ │ │ └── schema.sql
│ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── vets
│ │ ├── system
│ │ ├── CacheConfig.java
│ │ └── VetsProperties.java
│ │ ├── model
│ │ ├── VetRepository.java
│ │ └── Specialty.java
│ │ ├── VetsServiceApplication.java
│ │ └── web
│ │ └── VetResource.java
│ └── test
│ ├── resources
│ ├── bootstrap-test.yml
│ └── application-test.yml
│ └── java
│ └── org
│ └── springframework
│ └── samples
│ └── petclinic
│ └── vets
│ └── web
│ └── VetResourceTest.java
├── spring-petclinic-visits-service
└── src
│ ├── main
│ ├── resources
│ │ ├── application.properties
│ │ ├── db
│ │ │ ├── hsqldb
│ │ │ │ ├── data.sql
│ │ │ │ └── schema.sql
│ │ │ └── mysql
│ │ │ │ ├── data.sql
│ │ │ │ └── schema.sql
│ │ ├── bootstrap.yml
│ │ └── logback-spring.xml
│ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── visits
│ │ ├── VisitsServiceApplication.java
│ │ ├── model
│ │ ├── VisitRepository.java
│ │ └── Visit.java
│ │ └── web
│ │ └── VisitResource.java
│ └── test
│ ├── resources
│ ├── bootstrap-test.yml
│ └── application-test.yml
│ └── java
│ └── org
│ └── springframework
│ └── samples
│ └── petclinic
│ └── visits
│ └── web
│ └── VisitResourceTest.java
├── spring-petclinic-customers-service
└── src
│ ├── main
│ ├── resources
│ │ ├── application.properties
│ │ ├── bootstrap.yml
│ │ ├── logback-spring.xml
│ │ └── db
│ │ │ ├── hsqldb
│ │ │ ├── schema.sql
│ │ │ └── data.sql
│ │ │ └── mysql
│ │ │ ├── schema.sql
│ │ │ └── data.sql
│ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── customers
│ │ ├── web
│ │ ├── ResourceNotFoundException.java
│ │ ├── PetRequest.java
│ │ └── PetDetails.java
│ │ ├── CustomersServiceApplication.java
│ │ └── model
│ │ ├── OwnerRepository.java
│ │ ├── PetType.java
│ │ └── PetRepository.java
│ └── test
│ ├── resources
│ ├── bootstrap-test.yml
│ └── application-test.yml
│ └── java
│ └── org
│ └── springframework
│ └── samples
│ └── petclinic
│ └── customers
│ └── web
│ └── PetResourceTest.java
├── .vscode
└── settings.json
├── docker
├── prometheus
│ ├── Dockerfile
│ └── prometheus.yml
├── grafana
│ ├── Dockerfile
│ ├── provisioning
│ │ ├── dashboards
│ │ │ └── all.yml
│ │ └── datasources
│ │ │ └── all.yml
│ └── grafana.ini
└── Dockerfile
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── docs
├── application-screenshot.png
├── revised-architecture-diagram.png
├── grafana-custom-metrics-dashboard.png
└── microservices-architecture-diagram.jpg
├── .editorconfig
├── steeltoe-petclinic-vets-service
├── Vets.Api
│ ├── Infrastructure
│ │ ├── Repository
│ │ │ ├── IVets.cs
│ │ │ ├── IVetSpecialties.cs
│ │ │ ├── Vets.cs
│ │ │ └── VetSpecialties.cs
│ │ ├── Fill.cs
│ │ └── SeedData.cs
│ ├── appsettings.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── DTOs
│ │ ├── SpecialtyDetails.cs
│ │ └── VetDetails.cs
│ ├── appsettings.Development.json
│ ├── appsettings.docker.json
│ ├── Dockerfile
│ ├── Domain
│ │ ├── Vet.cs
│ │ ├── VetSpecialty.cs
│ │ └── Specialty.cs
│ ├── Steeltoe.Petclinic.Vets.Api.csproj
│ ├── Controllers
│ │ └── VetsController.cs
│ └── Program.cs
├── Vets.Test
│ ├── VetTests.cs
│ └── Steeltoe.Petclinic.Vets.Test.csproj
└── Vets.ITest
│ ├── Steeltoe.Petclinic.Vets.ITest.csproj
│ ├── VetsAppFactory.cs
│ └── Controllers
│ └── Vets.cs
├── spring-petclinic-admin-server
├── src
│ └── main
│ │ ├── resources
│ │ ├── bootstrap.yml
│ │ └── logback-spring.xml
│ │ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── admin
│ │ └── SpringBootAdminApplication.java
└── pom.xml
├── spring-petclinic-discovery-server
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── bootstrap.yml
│ │ └── java
│ │ │ └── org
│ │ │ └── springframework
│ │ │ └── samples
│ │ │ └── petclinic
│ │ │ └── discovery
│ │ │ └── DiscoveryServerApplication.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── discovery
│ │ └── DiscoveryServerApplicationTests.java
└── pom.xml
├── steeltoe-petclinic-visits-service
├── Visits.Api
│ ├── appsettings.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── appsettings.Development.json
│ ├── appsettings.docker.json
│ ├── DTOs
│ │ ├── VisitRequest.cs
│ │ └── VisitDetails.cs
│ ├── DateTimeConverter.cs
│ ├── Dockerfile
│ ├── Infrastructure
│ │ ├── Repository
│ │ │ ├── IVisits.cs
│ │ │ └── Visits.cs
│ │ ├── Fill.cs
│ │ ├── SeedData.cs
│ │ └── VisitsContext.cs
│ ├── Domain
│ │ └── Visit.cs
│ ├── Steeltoe.Petclinic.Visits.Api.csproj
│ └── Program.cs
├── Visits.Test
│ ├── VisitsTest.cs
│ └── Steeltoe.Petclinic.Visits.Test.csproj
└── Visits.ITest
│ ├── Steeltoe.Petclinic.Visits.ITest.csproj
│ ├── VisitsAppFactory.cs
│ └── Controllers
│ └── Visits.cs
├── spring-petclinic-config-server
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── bootstrap.yml
│ │ │ └── static
│ │ │ │ └── index.html
│ │ └── java
│ │ │ └── org
│ │ │ └── springframework
│ │ │ └── samples
│ │ │ └── petclinic
│ │ │ └── config
│ │ │ └── ConfigServerApplication.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── springframework
│ │ └── samples
│ │ └── petclinic
│ │ └── config
│ │ └── PetclinicConfigServerApplicationTests.java
└── pom.xml
└── LICENSE
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk: openjdk8
3 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/readme.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/.gitignore:
--------------------------------------------------------------------------------
1 | /.apt_generated/
2 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/.gitignore:
--------------------------------------------------------------------------------
1 | /.apt_generated/
2 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.configuration.updateBuildConfiguration": "automatic"
3 | }
--------------------------------------------------------------------------------
/docker/prometheus/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM prom/prometheus:v2.4.2
2 | ADD prometheus.yml /etc/prometheus/
3 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/test/resources/bootstrap-test.yml:
--------------------------------------------------------------------------------
1 | spring.cloud.config.enabled: false
2 | eureka.client.enabled: false
3 |
--------------------------------------------------------------------------------
/docs/application-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/docs/application-screenshot.png
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.profiles.active=production
2 | spring.cache.cache-names=vets
3 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/test/resources/bootstrap-test.yml:
--------------------------------------------------------------------------------
1 | spring.cloud.config.enabled: false
2 | eureka.client.enabled: false
3 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/test/resources/bootstrap-test.yml:
--------------------------------------------------------------------------------
1 | spring.cloud.config.enabled: false
2 | eureka.client.enabled: false
3 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/test/resources/bootstrap-test.yml:
--------------------------------------------------------------------------------
1 | spring.cloud.config.enabled: false
2 | eureka.client.enabled: false
3 |
--------------------------------------------------------------------------------
/docs/revised-architecture-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/docs/revised-architecture-diagram.png
--------------------------------------------------------------------------------
/docs/grafana-custom-metrics-dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/docs/grafana-custom-metrics-dashboard.png
--------------------------------------------------------------------------------
/docs/microservices-architecture-diagram.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/docs/microservices-architecture-diagram.jpg
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/wro/wro.properties:
--------------------------------------------------------------------------------
1 | #List of preProcessors
2 | preProcessors=lessCssImport
3 | #List of postProcessors
4 | postProcessors=less4j
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/messages/messages_en.properties:
--------------------------------------------------------------------------------
1 | # This file is intentionally empty. Message look-ups will fall back to the default "messages.properties" file.
--------------------------------------------------------------------------------
/docker/grafana/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM grafana/grafana:5.2.4
2 | ADD ./provisioning /etc/grafana/provisioning
3 | ADD ./grafana.ini /etc/grafana/grafana.ini
4 | ADD ./dashboards /var/lib/grafana/dashboards
5 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/images/pets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/images/pets.png
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/images/favicon.png
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/images/platform-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/images/platform-bg.png
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.eot
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.ttf
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/fonts/montserrat-webfont.woff
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.eot
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.ttf
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/images/spring-pivotal-logo.png
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/fonts/varela_round-webfont.woff
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow.png
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.4/maven-wrapper-0.5.4.jar
3 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # top-most EditorConfig file
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | insert_final_newline = true
8 | indent_style = space
9 |
10 | [*.{java,xml}]
11 | indent_size = 4
12 | trim_trailing_whitespace = true
13 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/spring-petclinic-microservices/HEAD/spring-petclinic-api-gateway/src/main/resources/static/images/spring-logo-dataflow-mobile.png
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/fragments/welcome.html:
--------------------------------------------------------------------------------
1 |
Welcome to Petclinic
2 |
3 |
4 |
5 |

6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/wro/wro.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | classpath:META-INF/resources/webjars/bootstrap/3.3.7-1/less/bootstrap.less
4 | /petclinic.less
5 |
6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.component.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('visits')
4 | .component('visits', {
5 | templateUrl: 'scripts/visits/visits.template.html',
6 | controller: 'VisitsController'
7 | });
8 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.component.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('petForm')
4 | .component('petForm', {
5 | templateUrl: 'scripts/pet-form/pet-form.template.html',
6 | controller: 'PetFormController'
7 | });
8 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.component.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('vetList')
4 | .component('vetList', {
5 | templateUrl: 'scripts/vet-list/vet-list.template.html',
6 | controller: 'VetListController'
7 | });
8 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
1 | spring.jpa.hibernate.ddl-auto: none
2 |
3 | spring:
4 | datasource:
5 | schema: classpath*:db/hsqldb/schema.sql
6 | data: classpath*:db/hsqldb/data.sql
7 |
8 | logging.level.org.springframework: INFO
9 |
10 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
1 | spring.jpa.hibernate.ddl-auto: none
2 |
3 | spring:
4 | datasource:
5 | schema: classpath*:db/hsqldb/schema.sql
6 | data: classpath*:db/hsqldb/data.sql
7 |
8 | logging.level.org.springframework: INFO
9 |
10 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.component.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerForm')
4 | .component('ownerForm', {
5 | templateUrl: 'scripts/owner-form/owner-form.template.html',
6 | controller: 'OwnerFormController'
7 | });
8 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.component.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerList')
4 | .component('ownerList', {
5 | templateUrl: 'scripts/owner-list/owner-list.template.html',
6 | controller: 'OwnerListController'
7 | });
8 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/test/resources/application-test.yml:
--------------------------------------------------------------------------------
1 | spring.jpa.hibernate.ddl-auto: none
2 |
3 | spring:
4 | datasource:
5 | schema: classpath*:db/hsqldb/schema.sql
6 | data: classpath*:db/hsqldb/data.sql
7 |
8 | vets:
9 | cache:
10 | ttl: 10
11 | heap-size: 10
12 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Infrastructure/Repository/IVets.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.Domain;
2 | using System.Collections.Generic;
3 |
4 | namespace Petclinic.Vets.Infrastructure.Repository
5 | {
6 | public interface IVets
7 | {
8 | IEnumerable FindAll();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/fragments/footer.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/db/hsqldb/data.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO visits VALUES (1, 7, '2013-01-01', 'rabies shot');
2 | INSERT INTO visits VALUES (2, 8, '2013-01-02', 'rabies shot');
3 | INSERT INTO visits VALUES (3, 8, '2013-01-03', 'neutered');
4 | INSERT INTO visits VALUES (4, 7, '2013-01-04', 'spayed');
5 |
--------------------------------------------------------------------------------
/docker/grafana/provisioning/dashboards/all.yml:
--------------------------------------------------------------------------------
1 | apiVersion: 1
2 |
3 | providers:
4 | - name: 'default'
5 | orgId: 1
6 | folder: ''
7 | type: file
8 | disableDeletion: false
9 | updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards
10 | options:
11 | path: /var/lib/grafana/dashboards
12 |
--------------------------------------------------------------------------------
/spring-petclinic-admin-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | uri: http://localhost:8888
5 | application:
6 | name: admin-server
7 | ---
8 | spring:
9 | profiles: docker
10 | cloud:
11 | config:
12 | failFast: true
13 | uri: http://config-server:8888
14 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | uri: http://localhost:8888
5 | application:
6 | name: api-gateway
7 | ---
8 | spring:
9 | profiles: docker
10 | cloud:
11 | config:
12 | failFast: true
13 | uri: http://config-server:8888
14 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.component.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerDetails')
4 | .component('ownerDetails', {
5 | templateUrl: 'scripts/owner-details/owner-details.template.html',
6 | controller: 'OwnerDetailsController'
7 | });
8 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | uri: http://localhost:8888
5 | application:
6 | name: vets-service
7 | ---
8 | spring:
9 | profiles: docker
10 | cloud:
11 | config:
12 | failFast: true
13 | uri: http://config-server:8888
14 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | uri: http://localhost:8888
5 | application:
6 | name: visits-service
7 | ---
8 | spring:
9 | profiles: docker
10 | cloud:
11 | config:
12 | failFast: true
13 | uri: http://config-server:8888
14 |
--------------------------------------------------------------------------------
/spring-petclinic-admin-server/src/main/resources/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/messages/messages.properties:
--------------------------------------------------------------------------------
1 | required=is required
2 | notFound=has not been found
3 | duplicate=is already in use
4 | nonNumeric=must be all numeric
5 | duplicateFormSubmission=Duplicate form submission is not allowed
6 | typeMismatch.date=invalid date
7 | typeMismatch.birthDate=invalid date
8 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | uri: http://localhost:8888
5 | application:
6 | name: customers-service
7 | ---
8 | spring:
9 | profiles: docker
10 | cloud:
11 | config:
12 | failFast: true
13 | uri: http://config-server:8888
14 |
--------------------------------------------------------------------------------
/spring-petclinic-discovery-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | uri: http://localhost:8888
5 | application:
6 | name: discovery-server
7 | ---
8 | spring:
9 | profiles: docker
10 | cloud:
11 | config:
12 | failFast: true
13 | uri: http://config-server:8888
14 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/resources/logback-spring.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/db/hsqldb/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE visits IF EXISTS;
2 |
3 | CREATE TABLE visits (
4 | id INTEGER IDENTITY PRIMARY KEY,
5 | pet_id INTEGER NOT NULL,
6 | visit_date DATE,
7 | description VARCHAR(8192)
8 | );
9 |
10 | CREATE INDEX visits_pet_id ON visits (pet_id);
11 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/db/mysql/data.sql:
--------------------------------------------------------------------------------
1 | INSERT IGNORE INTO visits VALUES (1, 7, '2010-03-04', 'rabies shot');
2 | INSERT IGNORE INTO visits VALUES (2, 8, '2011-03-04', 'rabies shot');
3 | INSERT IGNORE INTO visits VALUES (3, 8, '2009-06-04', 'neutered');
4 | INSERT IGNORE INTO visits VALUES (4, 7, '2008-09-04', 'spayed');
5 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/messages/messages_de.properties:
--------------------------------------------------------------------------------
1 | required=muss angegeben werden
2 | notFound=wurde nicht gefunden
3 | duplicate=ist bereits vergeben
4 | nonNumeric=darf nur numerisch sein
5 | duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt
6 | typeMismatch.date=ung�ltiges Datum
7 | typeMismatch.birthDate=ung�ltiges Datum
8 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Error",
6 | "System": "Error",
7 | "Microsoft": "Error",
8 | "Steeltoe": "Error"
9 | }
10 | },
11 | "AllowedHosts": "*",
12 | "UseMySql": false
13 | }
14 |
--------------------------------------------------------------------------------
/docker/grafana/provisioning/datasources/all.yml:
--------------------------------------------------------------------------------
1 | # config file version
2 | apiVersion: 1
3 |
4 | # list of datasources to insert/update depending what's available in the database
5 | datasources:
6 | - name: Prometheus
7 | type: prometheus
8 | access: proxy
9 | org_id: 1
10 | url: http://prometheus-server:9090
11 | is_default: true
12 | version: 1
13 | editable: true
14 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.controller.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('vetList')
4 | .controller('VetListController', ['$http', function ($http) {
5 | var self = this;
6 |
7 | $http.get('api/vet/vets').then(function (resp) {
8 | self.vetList = resp.data;
9 | });
10 | }]);
11 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.controller.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerList')
4 | .controller('OwnerListController', ['$http', function ($http) {
5 | var self = this;
6 |
7 | $http.get('api/customer/owners').then(function (resp) {
8 | self.owners = resp.data;
9 | });
10 | }]);
11 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "AllowedHosts": "*",
4 | "Logging": {
5 | "LogLevel": {
6 | "Default": "Information",
7 | "System": "Information",
8 | "Microsoft": "Information",
9 | "Steeltoe": "Information"
10 | }
11 | },
12 | "UseMySql": false
13 | }
14 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "AllowedHosts": "*",
4 | "Logging": {
5 | "LogLevel": {
6 | "Default": "Information",
7 | "System": "Information",
8 | "Microsoft": "Information",
9 | "Steeltoe": "Information"
10 | }
11 | },
12 | "UseMySql": false
13 | }
14 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Petclinic.Vets.Api": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "launchUrl": "swagger",
7 | "applicationUrl": "http://localhost:5001",
8 | "environmentVariables": {
9 | "ASPNETCORE_ENVIRONMENT": "Development"
10 | }
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Petclinic.Visits.Api": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "launchUrl": "swagger",
7 | "applicationUrl": "http://localhost:5002",
8 | "environmentVariables": {
9 | "ASPNETCORE_ENVIRONMENT": "Development"
10 | }
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('vetList', ['ui.router'])
4 | .config(['$stateProvider', function ($stateProvider) {
5 | $stateProvider
6 | .state('vets', {
7 | parent: 'app',
8 | url: '/vets',
9 | template: ''
10 | })
11 | }]);
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "spring_petclinic_customers_api": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "launchUrl": "swagger",
7 | "applicationUrl": "http://localhost:5000",
8 | "environmentVariables": {
9 | "ASPNETCORE_ENVIRONMENT": "Development"
10 | }
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerList', ['ui.router'])
4 | .config(['$stateProvider', function ($stateProvider) {
5 | $stateProvider
6 | .state('owners', {
7 | parent: 'app',
8 | url: '/owners',
9 | template: ''
10 | })
11 | }]);
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Infrastructure/Repository/IVetSpecialties.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.Domain;
2 | using System.Collections.Generic;
3 |
4 | namespace Petclinic.Vets.Infrastructure.Repository
5 | {
6 | public interface IVetSpecialties
7 | {
8 | IEnumerable FindAllBySpecialtyId(int specialtyId);
9 |
10 | IEnumerable FindAllByVetId(int vetId);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/spring-petclinic-config-server/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | server.port: 8888
2 | spring:
3 | cloud:
4 | config:
5 | server:
6 | git:
7 | uri: https://github.com/steeltoeoss-incubator/spring-petclinic-microservices-config
8 | # Use the File System Backend to avoid git pulling. Enable "native" profile in the Config Server.
9 | native:
10 | searchLocations: file:///${GIT_REPO}
11 |
12 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/DTOs/SpecialtyDetails.cs:
--------------------------------------------------------------------------------
1 | namespace Petclinic.Vets.DTOs
2 | {
3 | public class SpecialtyDetails
4 | {
5 | public int Id { get; set; }
6 | public string Name { get; set; }
7 |
8 | public SpecialtyDetails() { }
9 |
10 | public SpecialtyDetails(int id, string name)
11 | {
12 | Id = id;
13 | Name = name;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('visits', ['ui.router'])
4 | .config(['$stateProvider', function ($stateProvider) {
5 | $stateProvider
6 | .state('visits', {
7 | parent: 'app',
8 | url: '/owners/:ownerId/pets/:petId/visits',
9 | template: ''
10 | })
11 | }]);
12 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.controller.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerDetails')
4 | .controller('OwnerDetailsController', ['$http', '$stateParams', function ($http, $stateParams) {
5 | var self = this;
6 |
7 | $http.get('api/gateway/owners/' + $stateParams.ownerId).then(function (resp) {
8 | self.owner = resp.data;
9 | });
10 | }]);
11 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-details/owner-details.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerDetails', ['ui.router'])
4 | .config(['$stateProvider', function ($stateProvider) {
5 | $stateProvider
6 | .state('ownerDetails', {
7 | parent: 'app',
8 | url: '/owners/details/:ownerId',
9 | template: ''
10 | })
11 | }]);
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/resources/db/mysql/schema.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS petclinic;
2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc';
3 |
4 | USE petclinic;
5 |
6 | CREATE TABLE IF NOT EXISTS visits (
7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
8 | pet_id INT(4) UNSIGNED NOT NULL,
9 | visit_date DATE,
10 | description VARCHAR(8192),
11 | FOREIGN KEY (pet_id) REFERENCES pets(id)
12 | ) engine=InnoDB;
13 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/test/java/org/springframework/samples/petclinic/api/ApiGatewayApplicationTests.java:
--------------------------------------------------------------------------------
1 | package org.springframework.samples.petclinic.api;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 | import org.springframework.test.context.ActiveProfiles;
6 |
7 | @ActiveProfiles("test")
8 | @SpringBootTest
9 | class ApiGatewayApplicationTests {
10 |
11 | @Test
12 | void contextLoads() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Test/VetTests.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.Domain;
2 | using Xunit;
3 |
4 | namespace Petclinic.Vets.unit_test
5 | {
6 | [Collection("Vets Test Collection")]
7 | public class VetTests
8 | {
9 | public VetTests() { }
10 |
11 | [Fact(DisplayName = "Create vet")]
12 | public void NewOwner()
13 | {
14 | var vet = new Vet("AFirst", "ALast");
15 | Assert.NotNull(vet);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/vet-list/vet-list.template.html:
--------------------------------------------------------------------------------
1 | Veterinarians
2 |
3 |
4 |
5 | | Name |
6 | Specialties |
7 |
8 |
9 |
10 |
11 | | {{vet.firstName}} {{vet.lastName}} |
12 | {{specialty.name + ' '}} |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Error",
6 | "System": "Error",
7 | "Microsoft": "Error",
8 | "Steeltoe": "Trace"
9 | }
10 | },
11 |
12 | "Spring": {
13 | "Cloud": {
14 | "Config": {
15 | "Uri": "http://${SERVICE:CONFIG-SERVER:HOST?localhost}:8888",
16 | "FailFast": true
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Error",
6 | "System": "Error",
7 | "Microsoft": "Error",
8 | "Steeltoe": "Trace"
9 | }
10 | },
11 | "Spring": {
12 | "Cloud": {
13 | "Config": {
14 | "Uri": "http://${SERVICE:CONFIG-SERVER:HOST?localhost}:8888",
15 | "FailFast": true
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Error",
6 | "System": "Error",
7 | "Microsoft": "Error",
8 | "Steeltoe": "Trace"
9 | }
10 | },
11 |
12 | "Spring": {
13 | "Cloud": {
14 | "Config": {
15 | "Uri": "http://${SERVICE:CONFIG-SERVER:HOST?localhost}:8888",
16 | "FailFast": true
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/appsettings.docker.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Error",
6 | "System": "Error",
7 | "Microsoft": "Error",
8 | "Steeltoe": "Warning",
9 | "Petclinic.Vets": "Trace"
10 | }
11 | },
12 |
13 | "Spring": {
14 | "Cloud": {
15 | "Config": {
16 | "Uri": "http://config-server:8888",
17 | "FailFast": true
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/appsettings.docker.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Error",
6 | "System": "Error",
7 | //"Microsoft": "Error",
8 | "Steeltoe": "Warning",
9 | "Petclinic.Visits": "Trace"
10 | }
11 | },
12 |
13 | "Spring": {
14 | "Cloud": {
15 | "Config": {
16 | "Uri": "http://config-server:8888",
17 | "FailFast": true
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/DTOs/PetType.cs:
--------------------------------------------------------------------------------
1 | namespace Petclinic.Customers.DTOs
2 | {
3 | public class PetType
4 | {
5 |
6 | public PetType() { }
7 |
8 | public int Id { get; set; }
9 |
10 | public string Name { get; set; }
11 |
12 | public static PetType ToDTO(Domain.PetType petType)
13 | {
14 | return new PetType()
15 | {
16 | Id = petType.Id,
17 | Name = petType.Name
18 | };
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/ResourceNotFoundException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Petclinic.Customers
4 | {
5 | public class ResourceNotFoundException : Exception
6 | {
7 | public ResourceNotFoundException()
8 | {
9 | }
10 |
11 | public ResourceNotFoundException(string message) : base(message)
12 | {
13 | }
14 |
15 | public ResourceNotFoundException(string message, Exception inner)
16 | : base(message, inner)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/appsettings.docker.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://steeltoe.io/schema/latest/schema.json",
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Warning",
6 | "System": "Warning",
7 | "Microsoft": "Warning",
8 | "Steeltoe": "Warning",
9 | "Petclinic.Customers": "Information"
10 | }
11 | },
12 |
13 | "Spring": {
14 | "Cloud": {
15 | "Config": {
16 | "Uri": "http://config-server:8888",
17 | "FailFast": true
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Infrastructure/Repository/Vets.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.Domain;
2 | using System.Collections.Generic;
3 |
4 | namespace Petclinic.Vets.Infrastructure.Repository
5 | {
6 | public class Vets : IVets
7 | {
8 | private readonly VetsContext _dbContext;
9 |
10 | public Vets(VetsContext dbContext)
11 | {
12 | _dbContext = dbContext;
13 | }
14 |
15 | public IEnumerable FindAll()
16 | {
17 | return _dbContext.Vets;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster as builder
2 | WORKDIR /application
3 | COPY ["Steeltoe.Petclinic.Vets.Api.csproj", ""]
4 | RUN dotnet restore
5 | COPY . .
6 | RUN dotnet publish -c Release -o publish
7 |
8 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
9 | WORKDIR /application
10 |
11 | ARG EXPOSED_PORT=5000
12 | ENV PORT ${EXPOSED_PORT}
13 | EXPOSE ${EXPOSED_PORT}
14 |
15 | ENV ASPNETCORE_ENVIRONMENT docker
16 | ENV ENVIRONMENT docker
17 |
18 | COPY --from=builder application/publish .
19 | ENTRYPOINT ["dotnet", "vets-service.dll"]
20 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/DTOs/VisitRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Petclinic.Visits.DTOs
5 | {
6 | public class VisitRequest
7 | {
8 | public VisitRequest() { }
9 |
10 | [JsonConverter(typeof(DateTimeConverter))]
11 | public DateTime? VisitDate { get; set; }
12 |
13 | public string Description { get; set; }
14 |
15 | public override string ToString()
16 | {
17 | return $"visit request on {VisitDate} with description {Description}";
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/DateTimeConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Petclinic.Visits
6 | {
7 | public class DateTimeConverter : JsonConverter
8 | {
9 | public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => DateTime.Parse(reader.GetString());
10 |
11 | public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options) => writer.WriteStringValue(value?.ToString("yyyy-MM-dd"));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster as builder
2 | WORKDIR /application
3 | COPY ["Steeltoe.Petclinic.Visits.Api.csproj", ""]
4 | RUN dotnet restore
5 | COPY . .
6 | RUN dotnet publish -c Release -o publish
7 |
8 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
9 | WORKDIR /application
10 |
11 | ARG EXPOSED_PORT=5000
12 | ENV PORT ${EXPOSED_PORT}
13 | EXPOSE ${EXPOSED_PORT}
14 |
15 | ENV ASPNETCORE_ENVIRONMENT docker
16 | ENV ENVIRONMENT docker
17 |
18 | COPY --from=builder application/publish .
19 | ENTRYPOINT ["dotnet", "visits-service.dll"]
20 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/DateTimeConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Petclinic.Customers
6 | {
7 | public class DateTimeConverter : JsonConverter
8 | {
9 | public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => DateTime.Parse(reader.GetString());
10 |
11 | public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options) => writer.WriteStringValue(value?.ToString("yyyy-MM-dd"));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster as builder
2 | WORKDIR /application
3 | COPY ["Steeltoe.Petclinic.Customers.Api.csproj", ""]
4 | RUN dotnet restore
5 | COPY . .
6 | RUN dotnet publish -c Release -o publish
7 |
8 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
9 | WORKDIR /application
10 |
11 | ARG EXPOSED_PORT=5000
12 | ENV PORT ${EXPOSED_PORT}
13 | EXPOSE ${EXPOSED_PORT}
14 |
15 | ENV ASPNETCORE_ENVIRONMENT docker
16 | ENV ENVIRONMENT docker
17 |
18 | COPY --from=builder application/publish .
19 | ENTRYPOINT ["dotnet", "customers-service.dll"]
20 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2002-2020 the original author or authors.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Infrastructure/Repository/IVisits.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Visits.Domain;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace Petclinic.Visits.Infrastructure.Repository
7 | {
8 | public interface IVisits
9 | {
10 | Task> FindByPetIdAsync(int petId, CancellationToken cancellationToken = default);
11 |
12 | Task> FindByPetIdIn(IEnumerable petIds);
13 |
14 | Task SaveAsync(int petId, Visit visit, CancellationToken cancellationToken = default);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java:
--------------------------------------------------------------------------------
1 | package org.springframework.samples.petclinic.customers.web;
2 |
3 | import org.springframework.http.HttpStatus;
4 | import org.springframework.web.bind.annotation.ResponseStatus;
5 |
6 | @ResponseStatus(value = HttpStatus.NOT_FOUND)
7 | public class ResourceNotFoundException extends RuntimeException {
8 |
9 | /**
10 | *
11 | */
12 | private static final long serialVersionUID = 1L;
13 |
14 | public ResourceNotFoundException(String message) {
15 | super(message);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerForm', ['ui.router'])
4 | .config(['$stateProvider', function ($stateProvider) {
5 | $stateProvider
6 | .state('ownerNew', {
7 | parent: 'app',
8 | url: '/owners/new',
9 | template: ''
10 | })
11 | .state('ownerEdit', {
12 | parent: 'app',
13 | url: '/owners/:ownerId/edit',
14 | template: ''
15 | })
16 | }]);
17 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('petForm', ['ui.router'])
4 | .config(['$stateProvider', function ($stateProvider) {
5 | $stateProvider
6 | .state('petNew', {
7 | parent: 'app',
8 | url: '/owners/:ownerId/new-pet',
9 | template: ''
10 | })
11 | .state('petEdit', {
12 | parent: 'app',
13 | url: '/owners/:ownerId/pets/:petId',
14 | template: ''
15 | })
16 | }]);
17 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Domain/PetType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Petclinic.Customers.Domain
5 | {
6 | public partial class PetType
7 | {
8 | public PetType(string name, int id = default)
9 | {
10 | Id = id;
11 | Name = name ?? throw new ArgumentNullException(nameof(name));
12 | }
13 |
14 | protected PetType()
15 | {
16 | }
17 |
18 | public int Id { get; set; }
19 |
20 | public string Name { get; set; }
21 |
22 | public virtual ICollection Pets { get; set; } = new HashSet();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM openjdk:11-jre as builder
2 | WORKDIR /application
3 | ARG ARTIFACT_NAME
4 | COPY ${ARTIFACT_NAME}.jar application.jar
5 | RUN java -Djarmode=layertools -jar application.jar extract
6 |
7 | # wget is not installed on adoptopenjdk:11-jre-hotspot
8 | FROM adoptopenjdk:11-jre-hotspot
9 |
10 | WORKDIR /application
11 |
12 | ARG EXPOSED_PORT
13 | EXPOSE ${EXPOSED_PORT}
14 |
15 | ENV SPRING_PROFILES_ACTIVE docker,mysql
16 |
17 | COPY --from=builder application/dependencies/ ./
18 | COPY --from=builder application/spring-boot-loader/ ./
19 | COPY --from=builder application/snapshot-dependencies/ ./
20 | COPY --from=builder application/application/ ./
21 | ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
22 |
--------------------------------------------------------------------------------
/spring-petclinic-config-server/src/main/resources/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Spring Cloud Config Server
5 | The Spring Cloud Config Server provides an HTTP resource-based API for external yaml configuration for all the Spring Petclinic microservices
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | loadbalancer:
4 | ribbon:
5 | enabled: false
6 | gateway:
7 | routes:
8 | - id: vets-service
9 | uri: lb://vets-service
10 | predicates:
11 | - Path=/api/vet/**
12 | filters:
13 | - StripPrefix=2
14 | - id: visits-service
15 | uri: lb://visits-service
16 | predicates:
17 | - Path=/api/visit/**
18 | filters:
19 | - StripPrefix=2
20 | - id: customers-service
21 | uri: lb://customers-service
22 | predicates:
23 | - Path=/api/customer/**
24 | filters:
25 | - StripPrefix=2
26 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/db/hsqldb/data.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO vets VALUES (1, 'James', 'Carter');
2 | INSERT INTO vets VALUES (2, 'Helen', 'Leary');
3 | INSERT INTO vets VALUES (3, 'Linda', 'Douglas');
4 | INSERT INTO vets VALUES (4, 'Rafael', 'Ortega');
5 | INSERT INTO vets VALUES (5, 'Henry', 'Stevens');
6 | INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins');
7 |
8 | INSERT INTO specialties VALUES (1, 'radiology');
9 | INSERT INTO specialties VALUES (2, 'surgery');
10 | INSERT INTO specialties VALUES (3, 'dentistry');
11 |
12 | INSERT INTO vet_specialties VALUES (2, 1);
13 | INSERT INTO vet_specialties VALUES (3, 2);
14 | INSERT INTO vet_specialties VALUES (3, 3);
15 | INSERT INTO vet_specialties VALUES (4, 2);
16 | INSERT INTO vet_specialties VALUES (5, 1);
17 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Domain/Vet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Petclinic.Vets.Domain
5 | {
6 | public class Vet
7 | {
8 | public Vet(string firstName, string lastName, int id = default)
9 | {
10 | Id = id;
11 | FirstName = firstName ?? throw new ArgumentNullException(nameof(firstName));
12 | LastName = lastName ?? throw new ArgumentNullException(nameof(lastName));
13 | }
14 |
15 | public int Id { get; private set; }
16 |
17 | public string FirstName { get; private set; }
18 |
19 | public string LastName { get; private set; }
20 |
21 | public ICollection VetSpecialties{ get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Domain/VetSpecialty.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.Infrastructure;
2 | using System.Linq;
3 |
4 | namespace Petclinic.Vets.Domain
5 | {
6 | public class VetSpecialty
7 | {
8 | public VetSpecialty(int vetId, int specialtyId)
9 | {
10 | VetId = vetId;
11 | SpecialtyId = specialtyId;
12 | //Specialty = Fill.Specialties.FirstOrDefault(i => i.Id == specialtyId);
13 | //Vet = Fill.Vets.FirstOrDefault(i => i.Id == vetId);
14 | }
15 |
16 | public int VetId { get; private set; }
17 |
18 | public Vet Vet { get; set; }
19 |
20 | public int SpecialtyId { get; private set; }
21 |
22 | public Specialty Specialty { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/DTOs/PetRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Petclinic.Customers.DTOs
5 | {
6 | public class PetRequest
7 | {
8 | public PetRequest() { }
9 |
10 | public PetRequest(int id, DateTime? birthDate, string name, string petTypeId)
11 | {
12 | Id = id;
13 | BirthDate = birthDate;
14 | Name = name;
15 | TypeId = petTypeId;
16 | }
17 | public int Id { get; set; }
18 |
19 | [JsonConverter(typeof(DateTimeConverter))]
20 | public DateTime? BirthDate { get; set; }
21 |
22 | public string Name { get; set; }
23 |
24 | public string TypeId { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Domain/Visit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Petclinic.Visits.Domain
4 | {
5 | public partial class Visit
6 | {
7 | public Visit(int petId, DateTime? date, string description, int id = default)
8 | {
9 | Id = id;
10 | PetId = petId;
11 | Date = date;
12 | Description = description;
13 | }
14 |
15 | public int Id { get; private set; }
16 |
17 | public int PetId { get; private set; }
18 |
19 | public DateTime? Date { get; private set; }
20 |
21 | public string Description { get; private set; }
22 |
23 | public void SetPetId(int petId)
24 | {
25 | PetId = petId;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/DTOs/VetDetails.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 |
4 | namespace Petclinic.Vets.DTOs
5 | {
6 | public class VetDetails
7 | {
8 | public VetDetails() { }
9 |
10 | public VetDetails(int id, string firstName, string lastName, List specialties)
11 | {
12 | Id = id;
13 | FirstName = firstName;
14 | LastName = lastName;
15 | Specialties = specialties;
16 | }
17 |
18 | public int Id { get; set; }
19 |
20 | public string FirstName { get; set; }
21 |
22 | public string LastName { get; set; }
23 |
24 | public List Specialties { get; set; }
25 |
26 | public int NrOfSpecialties => Specialties?.Count() ?? 0;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Infrastructure/Fill.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Visits.Domain;
2 | using System;
3 | using System.Globalization;
4 |
5 | namespace Petclinic.Visits.Infrastructure
6 | {
7 | public static class Fill
8 | {
9 | public static Visit[] Visits => new[]
10 | {
11 | new Visit(7, DateTime.ParseExact("2013-01-01", "yyyy-MM-dd", CultureInfo.InvariantCulture), "rabies shot", id: 1),
12 | new Visit(8, DateTime.ParseExact("2013-01-02", "yyyy-MM-dd", CultureInfo.InvariantCulture), "rabies shot", id: 2),
13 | new Visit(8, DateTime.ParseExact("2013-01-03", "yyyy-MM-dd", CultureInfo.InvariantCulture), "neutered", id: 3),
14 | new Visit(7, DateTime.ParseExact("2013-01-04", "yyyy-MM-dd", CultureInfo.InvariantCulture), "spayed", id: 4)
15 | };
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Test/VisitsTest.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Visits.Domain;
2 | using Petclinic.Visits.Infrastructure;
3 | using System;
4 | using System.Linq;
5 | using Xunit;
6 |
7 | namespace Petclinic.Visits.Test
8 | {
9 | [Collection("Visits Test Collection")]
10 | public class VisitsTest
11 | {
12 | public VisitsTest() { }
13 |
14 | [Fact(DisplayName = "Create visit")]
15 | public void NewOwner()
16 | {
17 | var visit = new Visit(1, DateTime.Now, "a description");
18 | Assert.NotNull(visit);
19 | }
20 |
21 | [Fact(DisplayName = "Set petId")]
22 | public void SetPetIdsTest()
23 | {
24 | var visit = Fill.Visits.First();
25 | visit.SetPetId(2);
26 | Assert.Equal(2, visit.PetId);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/db/mysql/data.sql:
--------------------------------------------------------------------------------
1 | INSERT IGNORE INTO vets VALUES (1, 'James', 'Carter');
2 | INSERT IGNORE INTO vets VALUES (2, 'Helen', 'Leary');
3 | INSERT IGNORE INTO vets VALUES (3, 'Linda', 'Douglas');
4 | INSERT IGNORE INTO vets VALUES (4, 'Rafael', 'Ortega');
5 | INSERT IGNORE INTO vets VALUES (5, 'Henry', 'Stevens');
6 | INSERT IGNORE INTO vets VALUES (6, 'Sharon', 'Jenkins');
7 |
8 | INSERT IGNORE INTO specialties VALUES (1, 'radiology');
9 | INSERT IGNORE INTO specialties VALUES (2, 'surgery');
10 | INSERT IGNORE INTO specialties VALUES (3, 'dentistry');
11 |
12 | INSERT IGNORE INTO vet_specialties VALUES (2, 1);
13 | INSERT IGNORE INTO vet_specialties VALUES (3, 2);
14 | INSERT IGNORE INTO vet_specialties VALUES (3, 3);
15 | INSERT IGNORE INTO vet_specialties VALUES (4, 2);
16 | INSERT IGNORE INTO vet_specialties VALUES (5, 1);
17 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/DTOs/PetDetails.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Petclinic.Customers.DTOs
5 | {
6 | public class PetDetails
7 | {
8 | public int Id { get; set; }
9 |
10 | public string Name { get; set; }
11 |
12 | public string Owner { get; set; }
13 |
14 | [JsonConverter(typeof(DateTimeConverter))]
15 | public DateTime? BirthDate { get; set; }
16 |
17 | public PetType Type { get; set; }
18 |
19 | public PetDetails() { }
20 |
21 | public PetDetails(int id, string name, string owner, DateTime? birthDate, PetType petType)
22 | {
23 | Id = id;
24 | Name = name;
25 | Owner = owner;
26 | BirthDate = birthDate;
27 | Type = petType;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/db/mysql/schema.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS petclinic;
2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc';
3 |
4 | USE petclinic;
5 |
6 | CREATE TABLE IF NOT EXISTS vets (
7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
8 | first_name VARCHAR(30),
9 | last_name VARCHAR(30),
10 | INDEX(last_name)
11 | ) engine=InnoDB;
12 |
13 | CREATE TABLE IF NOT EXISTS specialties (
14 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
15 | name VARCHAR(80),
16 | INDEX(name)
17 | ) engine=InnoDB;
18 |
19 | CREATE TABLE IF NOT EXISTS vet_specialties (
20 | vet_id INT(4) UNSIGNED NOT NULL,
21 | specialty_id INT(4) UNSIGNED NOT NULL,
22 | FOREIGN KEY (vet_id) REFERENCES vets(id),
23 | FOREIGN KEY (specialty_id) REFERENCES specialties(id),
24 | UNIQUE (vet_id,specialty_id)
25 | ) engine=InnoDB;
26 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/resources/db/hsqldb/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE vet_specialties IF EXISTS;
2 | DROP TABLE vets IF EXISTS;
3 | DROP TABLE specialties IF EXISTS;
4 |
5 | CREATE TABLE vets (
6 | id INTEGER IDENTITY PRIMARY KEY,
7 | first_name VARCHAR(30),
8 | last_name VARCHAR(30)
9 | );
10 | CREATE INDEX vets_last_name ON vets (last_name);
11 |
12 | CREATE TABLE specialties (
13 | id INTEGER IDENTITY PRIMARY KEY,
14 | name VARCHAR(80)
15 | );
16 | CREATE INDEX specialties_name ON specialties (name);
17 |
18 | CREATE TABLE vet_specialties (
19 | vet_id INTEGER NOT NULL,
20 | specialty_id INTEGER NOT NULL
21 | );
22 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY (vet_id) REFERENCES vets (id);
23 | ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id);
24 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.template.html:
--------------------------------------------------------------------------------
1 | Visits
2 |
3 |
20 |
21 | Previous Visits
22 |
23 |
24 | | {{v.date}} |
25 | {{v.description}} |
26 |
27 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/less/responsive.less:
--------------------------------------------------------------------------------
1 | @media (max-width: 768px) {
2 | .navbar-toggle {
3 | position:absolute;
4 | z-index: 9999;
5 | left:0px;
6 | top:0px;
7 | }
8 |
9 | .navbar a.navbar-brand {
10 | display: block;
11 | margin: 0 auto 0 auto;
12 | width: 148px;
13 | height: 50px;
14 | float: none;
15 | background: url("../images/spring-logo-dataflow-mobile.png") 0 center no-repeat;
16 | }
17 |
18 | .homepage-billboard .homepage-subtitle {
19 | font-size: 21px;
20 | line-height: 21px;
21 | }
22 |
23 | .navbar a.navbar-brand span {
24 | display: none;
25 | }
26 |
27 | .navbar {
28 | border-top-width: 0;
29 | }
30 |
31 | .xd-container {
32 | margin-top: 20px;
33 | margin-bottom: 30px;
34 | }
35 |
36 | .index-page--subtitle {
37 | margin-top: 10px;
38 | margin-bottom: 30px;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Repository/IOwners.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Customers.Domain;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace Petclinic.Customers.Repository
7 | {
8 | public interface IOwners
9 | {
10 | Task Delete(Owner Owner, CancellationToken cancellationToken = default);
11 |
12 | Task> FindAll(CancellationToken cancellationToken = default);
13 |
14 | Task> FindAll(int page, int pageSize, CancellationToken cancellationToken = default);
15 |
16 | Task FindById(int id, CancellationToken cancellationToken = default);
17 |
18 | Task Save(Owner owner, CancellationToken cancellationToken = default);
19 |
20 | Task Update(Owner owner, Owner newOwnerVals, CancellationToken cancellationToken = default);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Repository/IPets.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Customers.Domain;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace Petclinic.Customers.Repository
7 | {
8 | public interface IPets
9 | {
10 | Task> FindAll(CancellationToken cancellationToken = default);
11 |
12 | Task> FindAll(int page, int pageSize, CancellationToken cancellationToken = default);
13 |
14 | Task FindById(int id, CancellationToken cancellationToken = default);
15 |
16 | Task FindPetTypeById(int id, CancellationToken cancellationToken = default);
17 |
18 | Task> FindPetTypes(CancellationToken cancellationToken = default);
19 |
20 | Task Save(Pet pet, CancellationToken cancellationToken = default);
21 |
22 | Task Update(Pet pet, CancellationToken cancellationToken = default);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/PetType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.api.dto;
17 |
18 | import lombok.Data;
19 |
20 | /**
21 | * @author Maciej Szarlinski
22 | */
23 | @Data
24 | public class PetType {
25 |
26 | private String name;
27 | }
28 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Infrastructure/SeedData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Threading;
3 |
4 | namespace Petclinic.Visits.Infrastructure
5 | {
6 | public static class SeedData
7 | {
8 | public static async void SeedAll(this VisitsContext dbContext, bool ensureDelete = false, bool ensureCreated = false, CancellationToken cancellationToken = default)
9 | {
10 | if (ensureDelete)
11 | {
12 | dbContext.Database.EnsureDeleted();
13 | }
14 |
15 | if (ensureCreated)
16 | {
17 | dbContext.Database.EnsureCreated();
18 | }
19 |
20 | if (!dbContext.Visits.Any())
21 | {
22 | foreach (var visit in Fill.Visits)
23 | {
24 | await dbContext.AddAsync(visit, cancellationToken);
25 | }
26 | }
27 |
28 | await dbContext.SaveChangesAsync(cancellationToken);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/resources/db/hsqldb/schema.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE pets IF EXISTS;
2 | DROP TABLE types IF EXISTS;
3 | DROP TABLE owners IF EXISTS;
4 |
5 | CREATE TABLE types (
6 | id INTEGER IDENTITY PRIMARY KEY,
7 | name VARCHAR(80)
8 | );
9 | CREATE INDEX types_name ON types (name);
10 |
11 | CREATE TABLE owners (
12 | id INTEGER IDENTITY PRIMARY KEY,
13 | first_name VARCHAR(30),
14 | last_name VARCHAR(30),
15 | address VARCHAR(255),
16 | city VARCHAR(80),
17 | telephone VARCHAR(20)
18 | );
19 | CREATE INDEX owners_last_name ON owners (last_name);
20 |
21 | CREATE TABLE pets (
22 | id INTEGER IDENTITY PRIMARY KEY,
23 | name VARCHAR(30),
24 | birth_date DATE,
25 | type_id INTEGER NOT NULL,
26 | owner_id INTEGER NOT NULL
27 | );
28 | ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners (id);
29 | ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types (id);
30 | CREATE INDEX pets_name ON pets (name);
31 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/resources/db/mysql/schema.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS petclinic;
2 | GRANT ALL PRIVILEGES ON petclinic.* TO pc@localhost IDENTIFIED BY 'pc';
3 |
4 | USE petclinic;
5 |
6 | CREATE TABLE IF NOT EXISTS types (
7 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
8 | name VARCHAR(80),
9 | INDEX(name)
10 | ) engine=InnoDB;
11 |
12 | CREATE TABLE IF NOT EXISTS owners (
13 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
14 | first_name VARCHAR(30),
15 | last_name VARCHAR(30),
16 | address VARCHAR(255),
17 | city VARCHAR(80),
18 | telephone VARCHAR(20),
19 | INDEX(last_name)
20 | ) engine=InnoDB;
21 |
22 | CREATE TABLE IF NOT EXISTS pets (
23 | id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
24 | name VARCHAR(30),
25 | birth_date DATE,
26 | type_id INT(4) UNSIGNED NOT NULL,
27 | owner_id INT(4) UNSIGNED NOT NULL,
28 | INDEX(name),
29 | FOREIGN KEY (owner_id) REFERENCES owners(id),
30 | FOREIGN KEY (type_id) REFERENCES types(id)
31 | ) engine=InnoDB;
32 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Domain/Specialty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Petclinic.Vets.Domain
5 | {
6 | public class Specialty : IComparable
7 | {
8 | public Specialty(string name, int id = default)
9 | {
10 | Id = id;
11 | Name = name ?? throw new ArgumentNullException(nameof(name));
12 | }
13 |
14 | public int Id { get; private set; }
15 |
16 | public string Name { get; private set; }
17 |
18 | public ICollection VetSpecialties { get; set; }
19 |
20 | public int CompareTo(object obj)
21 | {
22 | if (obj == null)
23 | {
24 | return 1;
25 | }
26 |
27 | if (obj is Specialty other)
28 | {
29 | return Id.CompareTo(other.Id);
30 | }
31 | else
32 | {
33 | throw new ArgumentException("Object is not a specialty");
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/docker/grafana/grafana.ini:
--------------------------------------------------------------------------------
1 | ##################### Spring Petclinic Microservices Grafana Configuration #####################
2 |
3 | # possible values : production, development
4 | app_mode = development
5 |
6 | #################################### Paths ####################################
7 | [paths]
8 | # folder that contains provisioning config files that grafana will apply on startup and while running.
9 | provisioning = /etc/grafana/provisioning
10 |
11 | #################################### Server ####################################
12 | [server]
13 | # enable gzip
14 | enable_gzip = true
15 |
16 | #################################### Anonymous Auth ##########################
17 | # Anonymous authentication has been enabled in the Petclinic sample with Admin role
18 | # Do not do that in Production environment
19 | [auth.anonymous]
20 | # enable anonymous access
21 | enabled = true
22 |
23 | # specify organization name that should be used for unauthenticated users
24 | org_name = Main Org.
25 |
26 | # specify role for unauthenticated users
27 | org_role = Admin
28 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Infrastructure/Repository/VetSpecialties.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Petclinic.Vets.Domain;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Petclinic.Vets.Infrastructure.Repository
7 | {
8 | public class VetSpecialties : IVetSpecialties
9 | {
10 | private readonly VetsContext _dbContext;
11 |
12 | public VetSpecialties(VetsContext dbContext)
13 | {
14 | _dbContext = dbContext;
15 | }
16 |
17 | public IEnumerable FindAllByVetId(int vetId)
18 | {
19 | return _dbContext.VetSpecialties
20 | .Include(vs => vs.Specialty)
21 | .Include(vs => vs.Vet)
22 | .Where(q => q.VetId == vetId);
23 | }
24 |
25 | public IEnumerable FindAllBySpecialtyId(int specialtyId)
26 | {
27 | return _dbContext.VetSpecialties.Where(q => q.SpecialtyId == specialtyId);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.ITest/Steeltoe.Petclinic.Customers.ITest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Petclinic.Customers.ITest
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/DTOs/OwnerRequest.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Customers.Domain;
2 |
3 | namespace Petclinic.Customers.DTOs
4 | {
5 | public class OwnerRequest
6 | {
7 | public OwnerRequest() { }
8 |
9 | public OwnerRequest(string firstName, string lastName, string address, string city, string telephone, int id = default)
10 | {
11 | Id = id;
12 | FirstName = firstName;
13 | LastName = lastName;
14 | Address = address;
15 | City = city;
16 | Telephone = telephone;
17 | }
18 |
19 | public int Id { get; set; }
20 |
21 | public string FirstName { get; set; }
22 |
23 | public string LastName { get; set; }
24 |
25 | public string Address { get; set; }
26 |
27 | public string City { get; set; }
28 |
29 | public string Telephone { get; set; }
30 |
31 | public Owner ToOwner()
32 | {
33 | return new Owner(FirstName, LastName, Address, City, Telephone, Id);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/docker/prometheus/prometheus.yml:
--------------------------------------------------------------------------------
1 | # my global config
2 | global:
3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
5 | # scrape_timeout is set to the global default (10s).
6 |
7 | # A scrape configuration containing exactly one endpoint to scrape:
8 | # Here it's Prometheus itself.
9 | scrape_configs:
10 | - job_name: prometheus
11 | static_configs:
12 | - targets: ['localhost:9090']
13 |
14 | - job_name: api-gateway
15 | metrics_path: /actuator/prometheus
16 | static_configs:
17 | - targets: ['api-gateway:8080']
18 |
19 | - job_name: customers-service
20 | metrics_path: /actuator/prometheus
21 | static_configs:
22 | - targets: ['customers-service:8081']
23 |
24 | - job_name: visits-service
25 | metrics_path: /actuator/prometheus
26 | static_configs:
27 | - targets: ['visits-service:8082']
28 |
29 | - job_name: vets-service
30 | metrics_path: /actuator/prometheus
31 | static_configs:
32 | - targets: ['vets-service:8083']
33 |
--------------------------------------------------------------------------------
/spring-petclinic-discovery-server/src/test/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplicationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.discovery;
17 |
18 | import org.junit.jupiter.api.Test;
19 | import org.springframework.boot.test.context.SpringBootTest;
20 |
21 | @SpringBootTest
22 | class DiscoveryServerApplicationTests {
23 |
24 | @Test
25 | void contextLoads() {
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/spring-petclinic-config-server/src/test/java/org/springframework/samples/petclinic/config/PetclinicConfigServerApplicationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.config;
17 |
18 | import org.junit.jupiter.api.Test;
19 | import org.springframework.boot.test.context.SpringBootTest;
20 |
21 | @SpringBootTest
22 | class PetclinicConfigServerApplicationTests {
23 |
24 | @Test
25 | void contextLoads() {
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Infrastructure/Fill.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.Domain;
2 | using System.Linq;
3 |
4 | namespace Petclinic.Vets.Infrastructure
5 | {
6 | public static class Fill
7 | {
8 | public static Vet[] Vets => new[]
9 | {
10 | new Vet("James", "Carter", 1),
11 | new Vet("Helen", "Leary", 2),
12 | new Vet("Linda", "Douglas", 3),
13 | new Vet("Rafael", "Ortega", 4),
14 | new Vet("Henry", "Stevens", 5),
15 | new Vet("Sharon", "Jenkins", 6)
16 | };
17 |
18 | public static VetSpecialty[] VetSpecialties => new[]
19 | {
20 | new VetSpecialty(2, 1),
21 | new VetSpecialty(3, 2),
22 | new VetSpecialty(3, 3),
23 | new VetSpecialty(4, 2),
24 | new VetSpecialty(5, 1)
25 | };
26 |
27 | public static Specialty[] Specialties => new[]
28 | {
29 | new Specialty("radiology", 1),
30 | new Specialty("surgery", 2),
31 | new Specialty("dentistry", 3)
32 | };
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/Visits.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.api.dto;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | import lombok.NoArgsConstructor;
22 | import lombok.Value;
23 |
24 | /**
25 | * @author Maciej Szarlinski
26 | */
27 | @Value
28 | public class Visits {
29 |
30 | private List items = new ArrayList<>();
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.ITest/Steeltoe.Petclinic.Visits.ITest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Petclinic.Visits.ITest
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/DTOs/VisitDetails.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Visits.Domain;
2 | using System;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Petclinic.Visits.DTOs
6 | {
7 | public class VisitDetails
8 | {
9 | public VisitDetails() { }
10 |
11 | public VisitDetails(int id, int petId, DateTime? date, string description)
12 | {
13 | Id = id;
14 | this.petId = petId;
15 | Date = date;
16 | this.description = description;
17 | }
18 |
19 | public int Id { get; set; }
20 |
21 | public int petId { get; set; }
22 |
23 | [JsonConverter(typeof(DateTimeConverter))]
24 | public DateTime? Date { get; set; }
25 |
26 | public string description { get; set; }
27 |
28 | public static VisitDetails FromVisit(Visit visit)
29 | {
30 | return new VisitDetails()
31 | {
32 | Id = visit.Id,
33 | petId = visit.PetId,
34 | Date = visit.Date,
35 | description = visit.Description
36 | };
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/VisitDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.api.dto;
17 |
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | /**
22 | * @author Maciej Szarlinski
23 | */
24 | @Data
25 | @NoArgsConstructor
26 | public class VisitDetails {
27 |
28 | private Integer id = null;
29 |
30 | private Integer petId = null;
31 |
32 | private String date = null;
33 |
34 | private String description = null;
35 | }
36 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-list/owner-list.template.html:
--------------------------------------------------------------------------------
1 | Owners
2 |
3 |
8 |
9 |
10 |
11 |
12 | | Name |
13 | Address |
14 | City |
15 | Telephone |
16 | Pets |
17 |
18 |
19 |
20 |
21 | |
22 |
23 | {{owner.firstName}} {{owner.lastName}}
24 |
25 | |
26 | {{owner.address}} |
27 | {{owner.city}} |
28 | {{owner.telephone}} |
29 | {{pet.name + ' '}} |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Test/Steeltoe.Petclinic.Visits.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Petclinic.Visits.Test
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 |
17 |
18 | all
19 | runtime; build; native; contentfiles; analyzers; buildtransitive
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/system/CacheConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.vets.system;
17 |
18 | import org.springframework.cache.annotation.EnableCaching;
19 | import org.springframework.context.annotation.Configuration;
20 | import org.springframework.context.annotation.Profile;
21 |
22 | /**
23 | * Cache could be disable in unit test.
24 | * @author Maciej Szarlinski
25 | */
26 | @Configuration
27 | @EnableCaching
28 | @Profile("production")
29 | class CacheConfig {
30 | }
31 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.ITest/Steeltoe.Petclinic.Vets.ITest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Petclinic.Vets.ITest
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/PetDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.api.dto;
17 |
18 | import lombok.Data;
19 |
20 | import java.util.ArrayList;
21 | import java.util.List;
22 |
23 | /**
24 | * @author Maciej Szarlinski
25 | */
26 | @Data
27 | public class PetDetails {
28 |
29 | private int id;
30 |
31 | private String name;
32 |
33 | private String birthDate;
34 |
35 | private PetType type;
36 |
37 | private final List visits = new ArrayList<>();
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/visits/visits.controller.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('visits')
4 | .controller('VisitsController', ['$http', '$state', '$stateParams', '$filter', function ($http, $state, $stateParams, $filter) {
5 | var self = this;
6 | var petId = $stateParams.petId || 0;
7 | var url = "api/visit/owners/" + ($stateParams.ownerId || 0) + "/pets/" + petId + "/visits";
8 | self.date = new Date();
9 | self.desc = "";
10 |
11 | $http.get(url).then(function (resp) {
12 | self.visits = resp.data;
13 | });
14 |
15 | self.submit = function () {
16 | var data = {
17 | date: $filter('date')(self.date, "yyyy-MM-dd"),
18 | description: self.desc
19 | };
20 |
21 | $http.post(url, data).then(function () {
22 | $state.go("owners", { ownerId: $stateParams.ownerId });
23 | }, function (response) {
24 | var error = response.data;
25 | alert(error.error + "\r\n" + error.errors.map(function (e) {
26 | return e.field + ": " + e.defaultMessage;
27 | }).join("\r\n"));
28 | });
29 | };
30 | }]);
31 |
--------------------------------------------------------------------------------
/spring-petclinic-config-server/src/main/java/org/springframework/samples/petclinic/config/ConfigServerApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.config;
17 |
18 | import org.springframework.boot.SpringApplication;
19 | import org.springframework.boot.autoconfigure.SpringBootApplication;
20 | import org.springframework.cloud.config.server.EnableConfigServer;
21 |
22 | /**
23 | * @author Maciej Szarlinski
24 | */
25 | @EnableConfigServer
26 | @SpringBootApplication
27 | public class ConfigServerApplication {
28 |
29 | public static void main(String[] args) {
30 | SpringApplication.run(ConfigServerApplication.class, args);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/system/VetsProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.vets.system;
17 |
18 | import lombok.Data;
19 |
20 | import org.springframework.boot.context.properties.ConfigurationProperties;
21 |
22 | /**
23 | * Typesafe custom configuration.
24 | *
25 | * @author Maciej Szarlinski
26 | */
27 | @Data
28 | @ConfigurationProperties(prefix = "vets")
29 | public class VetsProperties {
30 |
31 | private Cache cache;
32 |
33 | @Data
34 | public static class Cache {
35 |
36 | private int ttl;
37 |
38 | private int heapSize;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.ITest/VisitsAppFactory.cs:
--------------------------------------------------------------------------------
1 | using MartinCostello.Logging.XUnit;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Mvc.Testing;
4 | using Microsoft.Extensions.Hosting;
5 | using Microsoft.Extensions.Logging;
6 | using Xunit.Abstractions;
7 |
8 | namespace Petclinic.Visits.ITest
9 | {
10 | public class CustomersAppFactory : WebApplicationFactory, ITestOutputHelperAccessor where TStartup : class
11 | {
12 | public ITestOutputHelper OutputHelper { get; set; }
13 |
14 | public CustomersAppFactory() : base() { }
15 |
16 | protected override IHostBuilder CreateHostBuilder()
17 | {
18 | var builder = Program.CreateHostBuilder(new string[] { });
19 |
20 | builder.ConfigureLogging(logging =>
21 | {
22 | logging.ClearProviders(); // Remove other loggers
23 | logging.AddXUnit(OutputHelper); // Use the ITestOutputHelper instance
24 | });
25 |
26 | builder.UseEnvironment("Development");
27 |
28 | return builder;
29 | }
30 | protected override void ConfigureWebHost(IWebHostBuilder builder)
31 | {
32 | builder.ConfigureServices(services =>
33 | {
34 | });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.controller.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | angular.module('ownerForm')
4 | .controller('OwnerFormController', ["$http", '$state', '$stateParams', function ($http, $state, $stateParams) {
5 | var self = this;
6 |
7 | var ownerId = $stateParams.ownerId || 0;
8 |
9 | if (!ownerId) {
10 | self.owner = {};
11 | } else {
12 | $http.get("api/customer/owners/" + ownerId).then(function (resp) {
13 | self.owner = resp.data;
14 | });
15 | }
16 |
17 | self.submitOwnerForm = function () {
18 | var id = self.owner.id;
19 | var req;
20 | if (id) {
21 | req = $http.put("api/customer/owners/" + id, self.owner);
22 | } else {
23 | req = $http.post("api/customer/owners", self.owner);
24 | }
25 |
26 | req.then(function () {
27 | $state.go('owners');
28 | }, function (response) {
29 | var error = response.data;
30 | alert(error.error + "\r\n" + error.errors.map(function (e) {
31 | return e.field + ": " + e.defaultMessage;
32 | }).join("\r\n"));
33 | });
34 | };
35 | }]);
36 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.customers.web;
17 |
18 | import lombok.Data;
19 |
20 | import java.util.Date;
21 |
22 | import javax.validation.constraints.Size;
23 |
24 | import com.fasterxml.jackson.annotation.JsonFormat;
25 |
26 | /**
27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05.
28 | */
29 | @Data
30 | class PetRequest {
31 | private int id;
32 |
33 | @JsonFormat(pattern = "yyyy-MM-dd")
34 | private Date birthDate;
35 |
36 | @Size(min = 1)
37 | private String name;
38 |
39 | private int typeId;
40 | }
41 |
--------------------------------------------------------------------------------
/spring-petclinic-discovery-server/src/main/java/org/springframework/samples/petclinic/discovery/DiscoveryServerApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.discovery;
17 |
18 | import org.springframework.boot.SpringApplication;
19 | import org.springframework.boot.autoconfigure.SpringBootApplication;
20 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
21 |
22 | /**
23 | * @author Maciej Szarlinski
24 | */
25 | @EnableEurekaServer
26 | @SpringBootApplication
27 | public class DiscoveryServerApplication {
28 |
29 | public static void main(String[] args) {
30 | SpringApplication.run(DiscoveryServerApplication.class, args);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/VisitsServiceApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.visits;
17 |
18 | import org.springframework.boot.SpringApplication;
19 | import org.springframework.boot.autoconfigure.SpringBootApplication;
20 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
21 |
22 | /**
23 | * @author Maciej Szarlinski
24 | */
25 | @EnableDiscoveryClient
26 | @SpringBootApplication
27 | public class VisitsServiceApplication {
28 |
29 | public static void main(String[] args) {
30 | SpringApplication.run(VisitsServiceApplication.class, args);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.ITest/VetsAppFactory.cs:
--------------------------------------------------------------------------------
1 | using MartinCostello.Logging.XUnit;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Mvc.Testing;
4 | using Microsoft.Extensions.Hosting;
5 | using Microsoft.Extensions.Logging;
6 | using Xunit.Abstractions;
7 |
8 | namespace Petclinic.Vets.ITest
9 | {
10 | public class CustomersAppFactory : WebApplicationFactory, ITestOutputHelperAccessor where TStartup : class
11 | {
12 | public ITestOutputHelper OutputHelper { get; set; }
13 |
14 | public CustomersAppFactory() : base() { }
15 |
16 | protected override IHostBuilder CreateHostBuilder()
17 | {
18 | var builder = Program.CreateHostBuilder(new string[] { });
19 |
20 | builder.ConfigureLogging(logging =>
21 | {
22 | logging.ClearProviders(); // Remove other loggers
23 | logging.AddXUnit(OutputHelper); // Use the ITestOutputHelper instance
24 | });
25 |
26 | builder.UseEnvironment("Development");
27 |
28 | return builder;
29 | }
30 |
31 | protected override void ConfigureWebHost(IWebHostBuilder builder)
32 | {
33 | builder.ConfigureServices(services =>
34 | {
35 |
36 | });
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/CustomersServiceApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.customers;
17 |
18 | import org.springframework.boot.SpringApplication;
19 | import org.springframework.boot.autoconfigure.SpringBootApplication;
20 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
21 |
22 | /**
23 | * @author Maciej Szarlinski
24 | */
25 | @EnableDiscoveryClient
26 | @SpringBootApplication
27 | public class CustomersServiceApplication {
28 |
29 | public static void main(String[] args) {
30 | SpringApplication.run(CustomersServiceApplication.class, args);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.ITest/CustomersAppFactory.cs:
--------------------------------------------------------------------------------
1 | using MartinCostello.Logging.XUnit;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.AspNetCore.Mvc.Testing;
4 | using Microsoft.Extensions.Hosting;
5 | using Microsoft.Extensions.Logging;
6 | using Xunit.Abstractions;
7 |
8 | namespace Petclinic.Customers.ITest
9 | {
10 | public class CustomersAppFactory : WebApplicationFactory, ITestOutputHelperAccessor where TStartup : class
11 | {
12 | public ITestOutputHelper OutputHelper { get; set; }
13 |
14 | public CustomersAppFactory() : base() { }
15 |
16 | protected override IHostBuilder CreateHostBuilder()
17 | {
18 | var builder = Program.CreateHostBuilder(new string[] { });
19 |
20 | builder.ConfigureLogging(logging =>
21 | {
22 | logging.ClearProviders(); // Remove other loggers
23 | logging.AddXUnit(OutputHelper); // Use the ITestOutputHelper instance
24 | });
25 |
26 | builder.UseEnvironment("Development");
27 |
28 | return builder;
29 | }
30 | protected override void ConfigureWebHost(IWebHostBuilder builder)
31 | {
32 | builder.ConfigureServices(services =>
33 | {
34 |
35 | });
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/spring-petclinic-admin-server/src/main/java/org/springframework/samples/petclinic/admin/SpringBootAdminApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.admin;
17 |
18 | import de.codecentric.boot.admin.server.config.EnableAdminServer;
19 | import org.springframework.boot.SpringApplication;
20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
22 |
23 | @SpringBootApplication
24 | @EnableAdminServer
25 | @EnableDiscoveryClient
26 | public class SpringBootAdminApplication {
27 | public static void main(String[] args) {
28 | SpringApplication.run(SpringBootAdminApplication.class, args);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/app.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | /* App Module */
3 | var petClinicApp = angular.module('petClinicApp', [
4 | 'ui.router', 'layoutNav', 'layoutFooter', 'layoutWelcome',
5 | 'ownerList', 'ownerDetails', 'ownerForm', 'petForm', 'visits', 'vetList']);
6 |
7 | petClinicApp.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider', function(
8 | $stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
9 |
10 | // safari turns to be lazy sending the Cache-Control header
11 | $httpProvider.defaults.headers.common["Cache-Control"] = 'no-cache';
12 |
13 | $locationProvider.hashPrefix('!');
14 |
15 | $urlRouterProvider.otherwise('/welcome');
16 | $stateProvider
17 | .state('app', {
18 | abstract: true,
19 | url: '',
20 | template: ''
21 | })
22 | .state('welcome', {
23 | parent: 'app',
24 | url: '/welcome',
25 | template: ''
26 | });
27 | }]);
28 |
29 | ['welcome', 'nav', 'footer'].forEach(function(c) {
30 | var mod = 'layout' + c.toUpperCase().substring(0, 1) + c.substring(1);
31 | angular.module(mod, []);
32 | angular.module(mod).component(mod, {
33 | templateUrl: "scripts/fragments/" + c + ".html"
34 | });
35 | });
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Test/Steeltoe.Petclinic.Vets.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Petclinic.Vets.Test
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 |
17 |
18 | all
19 | runtime; build; native; contentfiles; analyzers; buildtransitive
20 |
21 |
22 |
23 | runtime; build; native; contentfiles; analyzers; buildtransitive
24 | all
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/VetRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.vets.model;
17 |
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 |
20 | /**
21 | * Repository class for Vet domain objects All method names are compliant with Spring Data naming
22 | * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
23 | *
24 | * @author Ken Krebs
25 | * @author Juergen Hoeller
26 | * @author Sam Brannen
27 | * @author Michael Isvy
28 | * @author Maciej Szarlinski
29 | */
30 | public interface VetRepository extends JpaRepository {
31 | }
32 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/OwnerRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.customers.model;
17 |
18 | import org.springframework.data.jpa.repository.JpaRepository;
19 |
20 | /**
21 | * Repository class for Owner domain objects All method names are compliant with Spring Data naming
22 | * conventions so this interface can easily be extended for Spring Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
23 | *
24 | * @author Ken Krebs
25 | * @author Juergen Hoeller
26 | * @author Sam Brannen
27 | * @author Michael Isvy
28 | * @author Maciej Szarlinski
29 | */
30 | public interface OwnerRepository extends JpaRepository { }
31 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Infrastructure/Repository/Visits.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Microsoft.Extensions.Logging;
3 | using Petclinic.Visits.Domain;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace Petclinic.Visits.Infrastructure.Repository
10 | {
11 | internal class Visits : IVisits
12 | {
13 | private readonly ILogger _logger;
14 | private readonly VisitsContext _dbContext;
15 |
16 | public Visits(ILogger logger, VisitsContext dbContext)
17 | {
18 | _logger = logger;
19 | _dbContext = dbContext;
20 | }
21 |
22 | public Task> FindByPetIdAsync(int petId, CancellationToken cancellationToken = default)
23 | {
24 | return _dbContext.Visits.Where(q => q.PetId == petId).ToListAsync(cancellationToken);
25 | }
26 |
27 | public Task> FindByPetIdIn(IEnumerable petIds)
28 | {
29 | return _dbContext.Visits.Where(q => petIds.Any(a => a == q.PetId)).ToListAsync();
30 | }
31 |
32 | public async Task SaveAsync(int petId, Visit visit, CancellationToken cancellationToken = default)
33 | {
34 | visit.SetPetId(petId);
35 |
36 | _dbContext.Visits.Add(visit);
37 | await _dbContext.SaveChangesAsync(cancellationToken);
38 | return visit;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/VetsServiceApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.vets;
17 |
18 | import org.springframework.boot.SpringApplication;
19 | import org.springframework.boot.autoconfigure.SpringBootApplication;
20 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
22 | import org.springframework.samples.petclinic.vets.system.VetsProperties;
23 |
24 | /**
25 | * @author Maciej Szarlinski
26 | */
27 | @EnableDiscoveryClient
28 | @SpringBootApplication
29 | @EnableConfigurationProperties(VetsProperties.class)
30 | public class VetsServiceApplication {
31 |
32 | public static void main(String[] args) {
33 | SpringApplication.run(VetsServiceApplication.class, args);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Domain/Pet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Petclinic.Customers.Domain
5 | {
6 | public partial class Pet
7 | {
8 | internal Pet()
9 | {
10 | }
11 |
12 | public Pet(string name, DateTime? birthDate, int petTypeId, int ownerId, int id = default)
13 | {
14 | Id = id;
15 | Name = name ?? throw new ArgumentNullException(nameof(name));
16 | BirthDate = birthDate;
17 | TypeId = petTypeId;
18 | OwnerId = ownerId;
19 | }
20 |
21 | public int Id { get; private set; }
22 |
23 | public string Name { get; private set; }
24 |
25 | public DateTime? BirthDate { get; private set; }
26 |
27 | public int TypeId { get; private set; }
28 |
29 | public int OwnerId { get; private set; }
30 |
31 | [JsonIgnore]
32 | public virtual Owner Owner { get; set; }
33 |
34 | [JsonIgnore]
35 | public virtual PetType PetType { get; set; }
36 |
37 | public override string ToString()
38 | {
39 | return $@"id:{Id}, name: {Name}, birthDate: {BirthDate}, type: {PetType}, owner: {Owner}";
40 | }
41 |
42 | public void SetBirthDate(DateTime? birthDate)
43 | {
44 | BirthDate = birthDate;
45 | }
46 |
47 | public void SetName(string name)
48 | {
49 | Name = name ?? throw new ArgumentNullException(nameof(name));
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/Infrastructure/SeedData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Threading;
3 |
4 | namespace Petclinic.Customers.Infrastructure
5 | {
6 | internal static class SeedData
7 | {
8 | public static async void SeedAll(this CustomersContext dbContext, bool ensureDelete = false, bool ensureCreated = false, CancellationToken cancellationToken = default)
9 | {
10 | if (ensureDelete)
11 | {
12 | dbContext.Database.EnsureDeleted();
13 | }
14 |
15 | if (ensureCreated)
16 | {
17 | dbContext.Database.EnsureCreated();
18 | }
19 |
20 | if (!dbContext.PetTypes.Any())
21 | {
22 | foreach (var petType in Fill.PetTypes)
23 | {
24 | await dbContext.AddAsync(petType, cancellationToken);
25 | }
26 | }
27 |
28 | if (!dbContext.Owners.Any())
29 | {
30 | foreach (var owner in Fill.Owners)
31 | {
32 | await dbContext.AddAsync(owner, cancellationToken);
33 | }
34 | }
35 |
36 | if (!dbContext.Pets.Any())
37 | {
38 | foreach (var pet in Fill.Pets)
39 | {
40 | await dbContext.AddAsync(pet, cancellationToken);
41 | }
42 | }
43 |
44 | await dbContext.SaveChangesAsync(cancellationToken);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.Api/Infrastructure/SeedData.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Threading;
3 |
4 | namespace Petclinic.Vets.Infrastructure
5 | {
6 | internal static class SeedData
7 | {
8 | public static async void SeedAll(this VetsContext dbContext, bool ensureDelete = false, bool ensureCreated = false, CancellationToken cancellationToken = default)
9 | {
10 | if (ensureDelete)
11 | {
12 | dbContext.Database.EnsureDeleted();
13 | }
14 |
15 | if (ensureCreated)
16 | {
17 | dbContext.Database.EnsureCreated();
18 | }
19 |
20 | if (!dbContext.Vets.Any())
21 | {
22 | foreach (var vet in Fill.Vets)
23 | {
24 | await dbContext.AddAsync(vet, cancellationToken);
25 | }
26 | }
27 |
28 | if (!dbContext.Specialties.Any())
29 | {
30 | foreach (var specialty in Fill.Specialties)
31 | {
32 | await dbContext.AddAsync(specialty, cancellationToken);
33 | }
34 | }
35 |
36 | if (!dbContext.VetSpecialties.Any())
37 | {
38 | foreach (var vetSpecialty in Fill.VetSpecialties)
39 | {
40 | await dbContext.AddAsync(vetSpecialty, cancellationToken);
41 | }
42 | }
43 |
44 | await dbContext.SaveChangesAsync(cancellationToken);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/OwnerDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.api.dto;
17 |
18 | import com.fasterxml.jackson.annotation.JsonIgnore;
19 | import lombok.Data;
20 |
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | import static java.util.stream.Collectors.toList;
25 |
26 | /**
27 | * @author Maciej Szarlinski
28 | */
29 | @Data
30 | public class OwnerDetails {
31 |
32 | private int id;
33 |
34 | private String firstName;
35 |
36 | private String lastName;
37 |
38 | private String address;
39 |
40 | private String city;
41 |
42 | private String telephone;
43 |
44 | private final List pets = new ArrayList<>();
45 |
46 | @JsonIgnore
47 | public List getPetIds() {
48 | return pets.stream()
49 | .map(PetDetails::getId)
50 | .collect(toList());
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/PetType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.customers.model;
17 |
18 | import javax.persistence.Column;
19 | import javax.persistence.Entity;
20 | import javax.persistence.GeneratedValue;
21 | import javax.persistence.GenerationType;
22 | import javax.persistence.Id;
23 | import javax.persistence.Table;
24 |
25 | /**
26 | * @author Juergen Hoeller
27 | * Can be Cat, Dog, Hamster...
28 | */
29 | @Entity
30 | @Table(name = "types")
31 | public class PetType {
32 | @Id
33 | @GeneratedValue(strategy = GenerationType.IDENTITY)
34 | private Integer id;
35 |
36 | @Column(name = "name")
37 | private String name;
38 |
39 | public Integer getId() {
40 | return id;
41 | }
42 |
43 | public void setId(final Integer id) {
44 | this.id = id;
45 | }
46 |
47 | public String getName() {
48 | return this.name;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/CustomersServiceClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.api.application;
17 |
18 | import lombok.RequiredArgsConstructor;
19 | import org.springframework.samples.petclinic.api.dto.OwnerDetails;
20 | import org.springframework.stereotype.Component;
21 | import org.springframework.web.client.RestTemplate;
22 | import org.springframework.web.reactive.function.client.WebClient;
23 | import reactor.core.publisher.Mono;
24 |
25 | /**
26 | * @author Maciej Szarlinski
27 | */
28 | @Component
29 | @RequiredArgsConstructor
30 | public class CustomersServiceClient {
31 |
32 | private final WebClient.Builder webClientBuilder;
33 |
34 | public Mono getOwner(final int ownerId) {
35 | return webClientBuilder.build().get()
36 | .uri("http://customers-service/owners/{ownerId}", ownerId)
37 | .retrieve()
38 | .bodyToMono(OwnerDetails.class);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/spring-petclinic-visits-service/src/main/java/org/springframework/samples/petclinic/visits/model/VisitRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.visits.model;
17 |
18 | import java.util.Collection;
19 | import java.util.List;
20 |
21 | import org.springframework.data.jpa.repository.JpaRepository;
22 |
23 | /**
24 | * Repository class for Visit domain objects All method names are compliant with Spring Data naming conventions so this interface can easily be extended for Spring
25 | * Data See here: http://static.springsource.org/spring-data/jpa/docs/current/reference/html/jpa.repositories.html#jpa.query-methods.query-creation
26 | *
27 | * @author Ken Krebs
28 | * @author Juergen Hoeller
29 | * @author Sam Brannen
30 | * @author Michael Isvy
31 | * @author Maciej Szarlinski
32 | */
33 | public interface VisitRepository extends JpaRepository {
34 |
35 | List findByPetId(int petId);
36 |
37 | List findByPetIdIn(Collection petIds);
38 | }
39 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Api/DTOs/OwnerDetails.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Customers.Domain;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace Petclinic.Customers.DTOs
6 | {
7 | public class OwnerDetails
8 | {
9 | public OwnerDetails() { }
10 |
11 | public OwnerDetails(int id, string firstName, string lastName, string address, string city, string telephone, List pets)
12 | {
13 | Id = id;
14 | FirstName = firstName;
15 | LastName = lastName;
16 | Address = address;
17 | City = city;
18 | Telephone = telephone;
19 | Pets = pets;
20 | }
21 |
22 | public int Id { get; set; }
23 |
24 | public string FirstName { get; set; }
25 |
26 | public string LastName { get; set; }
27 |
28 | public string Address { get; set; }
29 |
30 | public string City { get; set; }
31 |
32 | public string Telephone { get; set; }
33 |
34 | public List Pets { get; set; }
35 |
36 | public static OwnerDetails FromOwner(Owner owner)
37 | {
38 | return new OwnerDetails()
39 | {
40 | Id = owner.Id,
41 | FirstName = owner.FirstName,
42 | LastName = owner.LastName,
43 | Address = owner.Address,
44 | City = owner.City,
45 | Telephone = owner.Telephone,
46 | Pets = owner.Pets.Select(q => new PetDetails(q.Id, q.Name, owner.FirstName + " " + owner.LastName, q.BirthDate, PetType.ToDTO(q.PetType))).ToList()
47 | };
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-customers-service/Customers.Test/Steeltoe.Petclinic.Customers.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | Petclinic.Customers.Test
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | all
18 | runtime; build; native; contentfiles; analyzers; buildtransitive
19 |
20 |
21 | all
22 | runtime; build; native; contentfiles; analyzers; buildtransitive
23 |
24 |
25 |
26 | runtime; build; native; contentfiles; analyzers; buildtransitive
27 | all
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/web/VetResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.vets.web;
17 |
18 | import lombok.RequiredArgsConstructor;
19 |
20 | import java.util.List;
21 |
22 | import org.springframework.samples.petclinic.vets.model.Vet;
23 | import org.springframework.samples.petclinic.vets.model.VetRepository;
24 | import org.springframework.web.bind.annotation.GetMapping;
25 | import org.springframework.web.bind.annotation.RequestMapping;
26 | import org.springframework.web.bind.annotation.RestController;
27 |
28 | /**
29 | * @author Juergen Hoeller
30 | * @author Mark Fisher
31 | * @author Ken Krebs
32 | * @author Arjen Poutsma
33 | * @author Maciej Szarlinski
34 | */
35 | @RequestMapping("/vets")
36 | @RestController
37 | @RequiredArgsConstructor
38 | class VetResource {
39 |
40 | private final VetRepository vetRepository;
41 |
42 | @GetMapping
43 | public List showResourcesVetList() {
44 | return vetRepository.findAll();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/less/header.less:
--------------------------------------------------------------------------------
1 | .navbar {
2 | border-top: 4px solid #6db33f;
3 | background-color: #34302d;
4 | margin-bottom: 0px;
5 | border-bottom: 0;
6 | border-left: 0;
7 | border-right: 0;
8 | }
9 |
10 | .navbar a.navbar-brand {
11 | background: url("../images/spring-logo-dataflow.png") -1px -1px no-repeat;
12 | margin: 12px 0 6px;
13 | width: 229px;
14 | height: 46px;
15 | display: inline-block;
16 | text-decoration: none;
17 | padding: 0;
18 | }
19 |
20 | .navbar a.navbar-brand span {
21 | display: block;
22 | width: 229px;
23 | height: 46px;
24 | background: url("../images/spring-logo-dataflow.png") -1px -48px no-repeat;
25 | opacity: 0;
26 | -moz-transition: opacity 0.12s ease-in-out;
27 | -webkit-transition: opacity 0.12s ease-in-out;
28 | -o-transition: opacity 0.12s ease-in-out;
29 | }
30 |
31 | .navbar a:hover.navbar-brand span {
32 | opacity: 1;
33 | }
34 |
35 | .navbar li > a, .navbar-text {
36 | font-family: "montserratregular", sans-serif;
37 | text-shadow: none;
38 | font-size: 14px;
39 |
40 | /* line-height: 14px; */
41 | padding: 28px 20px;
42 | transition: all 0.15s;
43 | -webkit-transition: all 0.15s;
44 | -moz-transition: all 0.15s;
45 | -o-transition: all 0.15s;
46 | -ms-transition: all 0.15s;
47 | }
48 |
49 | .navbar li > a {
50 | text-transform: uppercase;
51 | }
52 |
53 | .navbar .navbar-text {
54 | margin-top: 0;
55 | margin-bottom: 0;
56 | }
57 | .navbar li:hover > a {
58 | color: #eeeeee;
59 | background-color: #6db33f;
60 | }
61 |
62 | .navbar-toggle {
63 | border-width: 0;
64 |
65 | .icon-bar + .icon-bar {
66 | margin-top: 3px;
67 | }
68 | .icon-bar {
69 | width: 19px;
70 | height: 3px;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/less/typography.less:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'varela_roundregular';
3 |
4 | src: url('../fonts/varela_round-webfont.eot');
5 | src: url('../fonts/varela_round-webfont.eot?#iefix') format('embedded-opentype'),
6 | url('../fonts/varela_round-webfont.woff') format('woff'),
7 | url('../fonts/varela_round-webfont.ttf') format('truetype'),
8 | url('../fonts/varela_round-webfont.svg#varela_roundregular') format('svg');
9 | font-weight: normal;
10 | font-style: normal;
11 | }
12 |
13 | @font-face {
14 | font-family: 'montserratregular';
15 | src: url('../fonts/montserrat-webfont.eot');
16 | src: url('../fonts/montserrat-webfont.eot?#iefix') format('embedded-opentype'),
17 | url('../fonts/montserrat-webfont.woff') format('woff'),
18 | url('../fonts/montserrat-webfont.ttf') format('truetype'),
19 | url('../fonts/montserrat-webfont.svg#montserratregular') format('svg');
20 | font-weight: normal;
21 | font-style: normal;
22 | }
23 |
24 | body, h1, h2, h3, p, input {
25 | margin: 0;
26 | font-weight: 400;
27 | font-family: "varela_roundregular", sans-serif;
28 | color: #34302d;
29 | }
30 |
31 | h1 {
32 | font-size: 24px;
33 | line-height: 30px;
34 | font-family: "montserratregular", sans-serif;
35 | }
36 |
37 | h2 {
38 | font-size: 18px;
39 | font-weight: 700;
40 | line-height: 24px;
41 | margin-bottom: 10px;
42 | font-family: "montserratregular", sans-serif;
43 | }
44 |
45 | h3 {
46 | font-size: 16px;
47 | line-height: 24px;
48 | margin-bottom: 10px;
49 | font-weight: 700;
50 | }
51 |
52 | p {
53 | //font-size: 15px;
54 | //line-height: 24px;
55 | }
56 |
57 | strong {
58 | font-weight: 700;
59 | font-family: "montserratregular", sans-serif;
60 | }
61 |
--------------------------------------------------------------------------------
/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.customers.web;
17 |
18 | import lombok.Data;
19 |
20 | import java.util.Date;
21 |
22 | import org.springframework.format.annotation.DateTimeFormat;
23 | import org.springframework.samples.petclinic.customers.model.Pet;
24 | import org.springframework.samples.petclinic.customers.model.PetType;
25 |
26 | /**
27 | * @author mszarlinski@bravurasolutions.com on 2016-12-05.
28 | */
29 | @Data
30 | class PetDetails {
31 |
32 | private long id;
33 |
34 | private String name;
35 |
36 | private String owner;
37 |
38 | @DateTimeFormat(pattern = "yyyy-MM-dd")
39 | private Date birthDate;
40 |
41 | private PetType type;
42 |
43 | PetDetails(Pet pet) {
44 | this.id = pet.getId();
45 | this.name = pet.getName();
46 | this.owner = pet.getOwner().getFirstName() + " " + pet.getOwner().getLastName();
47 | this.birthDate = pet.getBirthDate();
48 | this.type = pet.getType();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-visits-service/Visits.Api/Infrastructure/VisitsContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using Petclinic.Visits.Domain;
3 |
4 | namespace Petclinic.Visits.Infrastructure
5 | {
6 | public partial class VisitsContext : DbContext
7 | {
8 | public VisitsContext()
9 | {
10 | }
11 |
12 | public VisitsContext(DbContextOptions options)
13 | : base(options)
14 | {
15 | }
16 |
17 | public virtual DbSet Visits { get; set; }
18 |
19 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
20 | {
21 | optionsBuilder.EnableSensitiveDataLogging(true);
22 | }
23 |
24 | protected override void OnModelCreating(ModelBuilder modelBuilder)
25 | {
26 | modelBuilder.Entity(entity =>
27 | {
28 | entity.ToTable("visits");
29 |
30 | entity.HasIndex(e => e.PetId)
31 | .HasName("visits_pet_id");
32 |
33 | entity.Property(e => e.Id)
34 | .HasColumnName("id");
35 |
36 | entity.Property(e => e.Description)
37 | .HasColumnName("description")
38 | .HasMaxLength(8000)
39 | .IsUnicode(false);
40 |
41 | entity.Property(e => e.PetId).HasColumnName("pet_id");
42 |
43 | entity.Property(e => e.Date)
44 | .HasColumnName("visit_date")
45 | .HasColumnType("date");
46 | });
47 |
48 | OnModelCreatingPartial(modelBuilder);
49 | }
50 |
51 | partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Specialty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.springframework.samples.petclinic.vets.model;
17 |
18 | import javax.persistence.Column;
19 | import javax.persistence.Entity;
20 | import javax.persistence.GeneratedValue;
21 | import javax.persistence.GenerationType;
22 | import javax.persistence.Id;
23 | import javax.persistence.Table;
24 |
25 | /**
26 | * Models a {@link Vet Vet's} specialty (for example, dentistry).
27 | *
28 | * @author Juergen Hoeller
29 | */
30 | @Entity
31 | @Table(name = "specialties")
32 | public class Specialty {
33 | @Id
34 | @GeneratedValue(strategy = GenerationType.IDENTITY)
35 | private Integer id;
36 |
37 | @Column(name = "name")
38 | private String name;
39 |
40 | public Integer getId() {
41 | return id;
42 | }
43 |
44 | public void setId(final Integer id) {
45 | this.id = id;
46 | }
47 |
48 | public String getName() {
49 | return name;
50 | }
51 |
52 | public void setName(final String name) {
53 | this.name = name;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/owner-form/owner-form.template.html:
--------------------------------------------------------------------------------
1 | Owner
2 |
38 |
39 |
--------------------------------------------------------------------------------
/spring-petclinic-api-gateway/src/main/resources/static/scripts/pet-form/pet-form.template.html:
--------------------------------------------------------------------------------
1 | Pet
2 |
3 |
44 |
--------------------------------------------------------------------------------
/steeltoe-petclinic-vets-service/Vets.ITest/Controllers/Vets.cs:
--------------------------------------------------------------------------------
1 | using Petclinic.Vets.DTOs;
2 | using Petclinic.Vets.Infrastructure;
3 | using System;
4 | using System.Linq;
5 | using System.Net.Http;
6 | using System.Net.Http.Json;
7 | using System.Threading.Tasks;
8 | using Xunit;
9 | using Xunit.Abstractions;
10 |
11 | namespace Petclinic.Vets.ITest.Controllers
12 | {
13 | [Collection("Vets API Test Collection")]
14 | public class Vets : IClassFixture>, IDisposable
15 | {
16 | private readonly HttpClient _client;
17 | private readonly CustomersAppFactory _factory;
18 |
19 | public Vets(CustomersAppFactory factory, ITestOutputHelper outputHelper)
20 | {
21 | factory.OutputHelper = outputHelper;
22 | _factory = factory;
23 | _client = _factory.CreateClient();
24 | }
25 | public void Dispose()
26 | {
27 | //_client.Dispose();
28 | //_factory.OutputHelper = null;
29 | //_factory.Dispose();
30 | }
31 |
32 | [Fact(DisplayName = "GET Health")]
33 | public async Task Health()
34 | {
35 | var respObj = await _client.GetFromJsonAsync