-
Notifications
You must be signed in to change notification settings - Fork 17
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 #72 from tillias/dev
Name for target node in release path is not displayed #70
- Loading branch information
Showing
4 changed files
with
174 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
version: '2' | ||
version: '3.1' | ||
services: | ||
microcatalog-postgresql: | ||
image: postgres:12.3 | ||
# volumes: | ||
# - ~/volumes/jhipster/microcatalog/postgresql/:/var/lib/postgresql/data/ | ||
environment: | ||
- POSTGRES_USER=microcatalog | ||
- POSTGRES_PASSWORD= | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
db: | ||
image: postgres | ||
restart: always | ||
ports: | ||
- 5432:5432 | ||
environment: | ||
POSTGRES_PASSWORD: kEt#uR6M | ||
adminer: | ||
image: adminer | ||
restart: always | ||
ports: | ||
- 9080:8080 |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# =================================================================== | ||
# Spring Boot configuration for the "heroku" profile. | ||
# | ||
# This configuration overrides the application.yml file. | ||
# =================================================================== | ||
|
||
# =================================================================== | ||
# Standard Spring Boot properties. | ||
# Full reference is available at: | ||
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html | ||
# =================================================================== | ||
|
||
spring: | ||
liquibase: | ||
enabled: true | ||
datasource: | ||
type: com.zaxxer.hikari.HikariDataSource | ||
driver-class-name: org.postgresql.Driver | ||
url: ${JDBC_DATABASE_URL} | ||
username: ${JDBC_DATABASE_USERNAME} | ||
password: ${JDBC_DATABASE_PASSWORD} | ||
hikari: | ||
poolName: Hikari | ||
auto-commit: false | ||
jpa: | ||
database-platform: io.github.jhipster.domain.util.FixedPostgreSQL10Dialect | ||
show-sql: false | ||
h2: | ||
console: | ||
enabled: false | ||
mail: | ||
host: localhost | ||
port: 25 | ||
username: | ||
password: | ||
thymeleaf: | ||
cache: true | ||
|
||
server: | ||
port: 8080 | ||
compression: | ||
enabled: true | ||
mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json | ||
min-response-size: 1024 | ||
|
||
jhipster: | ||
http: | ||
cache: # Used by the CachingHttpHeadersFilter | ||
timeToLiveInDays: 1461 | ||
cache: # Cache configuration | ||
ehcache: # Ehcache configuration | ||
time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache | ||
max-entries: 1000 # Number of objects in each cache entry | ||
security: | ||
authentication: | ||
jwt: | ||
# This token must be encoded using Base64 and be at least 256 bits long (you can type `openssl rand -base64 64` on your command line to generate a 512 bits one) | ||
# As this is the PRODUCTION configuration, you MUST change the default key, and store it securely: | ||
# - In the JHipster Registry (which includes a Spring Cloud Config server) | ||
# - In a separate `application-prod.yml` file, in the same folder as your executable JAR file | ||
# - In the `JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64_SECRET` environment variable | ||
base64-secret: YzljOTRhYTYwMDkwM2RhYjIxOGU2MTNjMDRjMDIyMjJjNjUyMzlmNzM5MjU1MzY3ZDI4NWFkY2YxNTM1YmI3N2EyZjRiNGE3OGZlYzcxNjJkYmRiNDNlNGFjYzI2YWZjMWNiYzI3NjE1NmVlMWJhMWVjNzZhNzhhNDY4Yzg0MzA= | ||
# Token is valid 24 hours | ||
token-validity-in-seconds: 86400 | ||
token-validity-in-seconds-for-remember-me: 2592000 | ||
mail: # specific JHipster mail property, for standard properties see MailProperties | ||
base-url: http://my-server-url-to-change # Modify according to your server's URL | ||
metrics: | ||
logs: # Reports metrics in the logs | ||
enabled: false | ||
report-frequency: 60 # in seconds | ||
logging: | ||
use-json-format: false # By default, logs are not in Json format | ||
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration | ||
enabled: false | ||
host: localhost | ||
port: 5000 | ||
queue-size: 512 | ||
audit-events: | ||
retention-period: 30 # Number of days before audit events are deleted. |
77 changes: 77 additions & 0 deletions
77
src/test/java/com/github/microcatalog/web/rest/errors/custom/ReleasePathAdviceTraitTest.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,77 @@ | ||
package com.github.microcatalog.web.rest.errors.custom; | ||
|
||
import com.github.microcatalog.service.custom.exceptions.CircularDependenciesException; | ||
import com.github.microcatalog.service.custom.exceptions.SelfCircularException; | ||
import com.github.microcatalog.utils.MicroserviceBuilder; | ||
import org.assertj.core.api.InstanceOfAssertFactories; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
import org.springframework.http.HttpEntity; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.context.request.NativeWebRequest; | ||
import org.zalando.problem.Problem; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.entry; | ||
import static org.mockito.Mockito.spy; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class ReleasePathAdviceTraitTest { | ||
|
||
private final ReleasePathAdviceTrait cut = spy(ReleasePathAdviceTrait.class); | ||
|
||
@Mock | ||
private NativeWebRequest webRequest; | ||
|
||
@Test | ||
void handleSelfCircularException() { | ||
|
||
final SelfCircularException exception = | ||
new SelfCircularException("Test message", new MicroserviceBuilder().withId(1L).build()); | ||
ResponseEntity<Problem> response = cut.handleSelfCircularException(exception, webRequest); | ||
|
||
assertThat(response).isNotNull() | ||
.extracting(HttpEntity::getBody).isNotNull(); | ||
|
||
assertThat(response.getStatusCodeValue()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.value()); | ||
|
||
assertThat(response.getBody()).isNotNull() | ||
.extracting(Problem::getParameters, InstanceOfAssertFactories.map(String.class, Object.class)) | ||
.contains( | ||
entry(ReleasePathAdviceTrait.HEADER_KEY, exception.getClass().getName()), | ||
entry(ReleasePathAdviceTrait.MESSAGE_KEY, "Test message"), | ||
entry(ReleasePathAdviceTrait.PAYLOAD_KEY, "id = 1, name = null") | ||
); | ||
} | ||
|
||
@Test | ||
void handleCircularDependenciesException() { | ||
final CircularDependenciesException exception = | ||
new CircularDependenciesException("Test message", new HashSet<>(Arrays.asList( | ||
new MicroserviceBuilder().withId(1L).build(), | ||
new MicroserviceBuilder().withId(2L).build(), | ||
new MicroserviceBuilder().withId(3L).build() | ||
))); | ||
|
||
ResponseEntity<Problem> response = cut.handleCircularDependenciesException(exception, webRequest); | ||
|
||
assertThat(response).isNotNull() | ||
.extracting(HttpEntity::getBody).isNotNull(); | ||
|
||
assertThat(response.getStatusCodeValue()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.value()); | ||
|
||
assertThat(response.getBody()).isNotNull() | ||
.extracting(Problem::getParameters, InstanceOfAssertFactories.map(String.class, Object.class)) | ||
.contains( | ||
entry(ReleasePathAdviceTrait.HEADER_KEY, exception.getClass().getName()), | ||
entry(ReleasePathAdviceTrait.MESSAGE_KEY, "Test message"), | ||
entry(ReleasePathAdviceTrait.PAYLOAD_KEY, "1,2,3") | ||
); | ||
} | ||
} |