forked from spring-petclinic/spring-petclinic-microservices
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from Ivan-Bobrov/feature/53-blocked-threads-in…
…tegration-points Feature/53 blocked threads integration points
- Loading branch information
Showing
27 changed files
with
313 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"latencyActive": true, | ||
"latencyRangeStart" : 1000, | ||
"latencyRangeEnd" : 10000 | ||
"latencyRangeStart" : 5000, | ||
"latencyRangeEnd" : 15000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...pi-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/CourseDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.springframework.samples.petclinic.api.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class CourseDetails { | ||
|
||
private Integer id; | ||
|
||
private String name; | ||
|
||
private String description; | ||
|
||
private Integer instructorId; | ||
|
||
private InstructorDetails instructorDetails; | ||
} |
17 changes: 17 additions & 0 deletions
17
...ateway/src/main/java/org/springframework/samples/petclinic/api/dto/InstructorDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.springframework.samples.petclinic.api.dto; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Data | ||
public class InstructorDetails { | ||
private Integer id = null; | ||
|
||
private String firstName = null; | ||
|
||
private String lastName = null; | ||
|
||
private List<Specialty> specialties = new ArrayList<>(); | ||
} |
8 changes: 8 additions & 0 deletions
8
...ic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/dto/Specialty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.springframework.samples.petclinic.api.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class Specialty { | ||
private String name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...-api-gateway/src/main/resources/static/scripts/course-details/course-details.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
angular.module('courseDetails') | ||
.component('courseDetails', { | ||
templateUrl: 'scripts/course-details/course-details.template.html', | ||
controller: 'CourseDetailsController' | ||
}); |
10 changes: 10 additions & 0 deletions
10
...api-gateway/src/main/resources/static/scripts/course-details/course-details.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
angular.module('courseDetails') | ||
.controller('CourseDetailsController', ['$http', '$stateParams', function ($http, $stateParams) { | ||
var self = this; | ||
|
||
$http.get('api/gateway/courses/' + $stateParams.courseId).then(function (resp) { | ||
self.course = resp.data; | ||
}); | ||
}]); |
11 changes: 11 additions & 0 deletions
11
...-petclinic-api-gateway/src/main/resources/static/scripts/course-details/course-details.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
angular.module('courseDetails', ['ui.router']) | ||
.config(['$stateProvider', function ($stateProvider) { | ||
$stateProvider | ||
.state('courseDetails', { | ||
parent: 'app', | ||
url: '/courses/details/:courseId', | ||
template: '<course-details></course-details>' | ||
}) | ||
}]); |
23 changes: 23 additions & 0 deletions
23
...api-gateway/src/main/resources/static/scripts/course-details/course-details.template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<h2>Course Details</h2> | ||
|
||
<table class="table table-striped"> | ||
<tr> | ||
<th>Name</th> | ||
<td>{{$ctrl.course.name}}</td> | ||
</tr> | ||
<tr> | ||
<th>Description</th> | ||
<td>{{$ctrl.course.description}}</td> | ||
</tr> | ||
<tr> | ||
<th>Instructor</th> | ||
<td> {{$ctrl.course.instructorDetails.firstName}} {{$ctrl.course.instructorDetails.lastName}}</td> | ||
</tr> | ||
|
||
</table> | ||
|
||
|
||
|
||
|
||
|
||
|
7 changes: 7 additions & 0 deletions
7
...clinic-api-gateway/src/main/resources/static/scripts/course-list/course-list.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
angular.module('courseList') | ||
.component('courseList', { | ||
templateUrl: 'scripts/course-list/course-list.template.html', | ||
controller: 'CourseListController' | ||
}); |
10 changes: 10 additions & 0 deletions
10
...linic-api-gateway/src/main/resources/static/scripts/course-list/course-list.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
angular.module('courseList') | ||
.controller('CourseListController', ['$http', function ($http) { | ||
var self = this; | ||
|
||
$http.get('api/customer/courses').then(function (resp) { | ||
self.courses = resp.data; | ||
}); | ||
}]); |
11 changes: 11 additions & 0 deletions
11
spring-petclinic-api-gateway/src/main/resources/static/scripts/course-list/course-list.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
angular.module('courseList', ['ui.router']) | ||
.config(['$stateProvider', function ($stateProvider) { | ||
$stateProvider | ||
.state('courses', { | ||
parent: 'app', | ||
url: '/courses', | ||
template: '<course-list></course-list>' | ||
}) | ||
}]); |
26 changes: 26 additions & 0 deletions
26
...linic-api-gateway/src/main/resources/static/scripts/course-list/course-list.template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<h2>Courses</h2> | ||
|
||
<form onsubmit="javascript:void(0)" style="max-width: 20em; margin-top: 2em;"> | ||
<div class="form-group"> | ||
<input type="text" class="form-control" placeholder="Search Filter" ng-model="$ctrl.query" /> | ||
</div> | ||
</form> | ||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Course No</th> | ||
<th>Course Name</th> | ||
</tr> | ||
</thead> | ||
|
||
<tr ng-repeat="course in $ctrl.courses | filter:$ctrl.query track by course.id"> | ||
<td>{{course.id}}</td> | ||
<td> | ||
<a ui-sref="courseDetails({ courseId: course.id })"> | ||
{{course.name}} | ||
</a> | ||
</td> | ||
|
||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...s-service/src/main/java/org/springframework/samples/petclinic/customers/model/Course.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.springframework.samples.petclinic.customers.model; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.core.style.ToStringCreator; | ||
|
||
@Entity | ||
@Table(name = "courses") | ||
public class Course { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Getter | ||
private Integer id; | ||
|
||
@Getter | ||
@Setter | ||
@Column(name = "name") | ||
@NotBlank | ||
private String name; | ||
|
||
@Getter | ||
@Setter | ||
@Column(name = "description") | ||
@NotBlank | ||
private String description; | ||
|
||
@Getter | ||
@Setter | ||
@Column(name = "instructor") | ||
private int instructorId; | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringCreator(this) | ||
.append("id", this.getId()) | ||
.append("name", this.getName()) | ||
.append("description", this.getDescription()) | ||
.toString(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...src/main/java/org/springframework/samples/petclinic/customers/model/CourseRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.springframework.samples.petclinic.customers.model; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
/** | ||
* Repository class for <code>Course</code> domain objects All method names are compliant with Spring Data naming | ||
* 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 | ||
*/ | ||
public interface CourseRepository extends JpaRepository<Course, Integer> {} |
34 changes: 34 additions & 0 deletions
34
...ice/src/main/java/org/springframework/samples/petclinic/customers/web/CourseResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.springframework.samples.petclinic.customers.web; | ||
|
||
import io.micrometer.core.annotation.Timed; | ||
import jakarta.validation.constraints.Min; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.samples.petclinic.customers.model.Course; | ||
import org.springframework.samples.petclinic.customers.model.CourseRepository; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@RequestMapping("/courses") | ||
@RestController | ||
@Timed("petclinic.course") | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
class CourseResource { | ||
|
||
record CourseDto (int id, String name){} | ||
private final CourseRepository courseRepository; | ||
|
||
@GetMapping(value = "/{courseId}") | ||
public Optional<Course> findCourse(@PathVariable("courseId") @Min(1) int courseId) { | ||
return courseRepository.findById(courseId); | ||
} | ||
|
||
@GetMapping | ||
public List<CourseDto> findAll() { | ||
return courseRepository.findAll().stream().map(course -> new CourseDto(course.getId(), course.getName())).toList(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.