Skip to content

Commit f021aa3

Browse files
committed
Merge branch 'release/4.9.5'
2 parents 1b6b77c + 56ea01c commit f021aa3

File tree

17 files changed

+96
-85
lines changed

17 files changed

+96
-85
lines changed

store-base/store-build-chassis/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.3.0.RC1</version>
9+
<version>2.3.0.M4</version>
1010
<relativePath/> <!-- lookup parent from repository -->
1111
</parent>
1212

store-base/store-cloud-chassis/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.siriusxi.ms.store</groupId>
77
<artifactId>store-build-chassis</artifactId>
88
<version>1.0-SNAPSHOT</version>
9-
<relativePath>../store-build-chassis</relativePath>
9+
<relativePath>../../store-build-chassis/pom.xml</relativePath>
1010
</parent>
1111

1212
<artifactId>store-cloud-chassis</artifactId>
@@ -36,9 +36,14 @@
3636
</exclusion>
3737
</exclusions>
3838
</dependency>
39+
<dependency>
40+
<groupId>org.junit.jupiter</groupId>
41+
<artifactId>junit-jupiter-engine</artifactId>
42+
<scope>test</scope>
43+
</dependency>
3944
<dependency>
4045
<groupId>org.junit.platform</groupId>
41-
<artifactId>junit-platform-suite-api</artifactId>
46+
<artifactId>junit-platform-runner</artifactId>
4247
<scope>test</scope>
4348
</dependency>
4449
<dependency>

store-base/store-service-chassis/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>com.siriusxi.ms.store</groupId>
88
<artifactId>store-cloud-chassis</artifactId>
99
<version>1.0-SNAPSHOT</version>
10-
<relativePath>../store-cloud-chassis</relativePath>
10+
<relativePath>../../store-cloud-chassis/pom.xml</relativePath>
1111
</parent>
1212

1313
<artifactId>store-service-chassis</artifactId>

store-cloud-infra/edge-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.siriusxi.ms.store</groupId>
77
<artifactId>store-cloud-chassis</artifactId>
88
<version>1.0-SNAPSHOT</version>
9-
<relativePath>../store-base/store-cloud-chassis</relativePath>
9+
<relativePath>../../store-base/store-cloud-chassis/pom.xml</relativePath>
1010
</parent>
1111

1212
<groupId>com.siriusxi.cloud.infra</groupId>

store-cloud-infra/eureka-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.siriusxi.ms.store</groupId>
77
<artifactId>store-cloud-chassis</artifactId>
88
<version>1.0-SNAPSHOT</version>
9-
<relativePath>../store-base/store-cloud-chassis</relativePath>
9+
<relativePath>../../store-base/store-cloud-chassis/pom.xml</relativePath>
1010
</parent>
1111

1212
<groupId>com.siriusxi.cloud.infra</groupId>

store-common/store-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.siriusxi.ms.store</groupId>
99
<artifactId>store-build-chassis</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../store-base/store-build-chassis</relativePath>
11+
<relativePath>../../store-base/store-build-chassis/pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>store-api</artifactId>

store-common/store-utils/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.siriusxi.ms.store</groupId>
99
<artifactId>store-build-chassis</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../store-base/store-build-chassis</relativePath>
11+
<relativePath>../../store-base/store-build-chassis/pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>store-utils</artifactId>

store-services/product-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.siriusxi.ms.store</groupId>
99
<artifactId>store-service-chassis</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../store-base/store-service-chassis</relativePath>
11+
<relativePath>../../store-base/store-service-chassis/pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>product-service</artifactId>

store-services/product-service/src/test/java/com/siriusxi/ms/store/ps/ProductServiceApplicationTests.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public void duplicateError() {
8080
sendCreateProductEvent(productId);
8181
fail("Expected a MessagingException here!");
8282
} catch (MessagingException me) {
83-
if (me.getCause() instanceof InvalidInputException iie) {
84-
assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage());
83+
if (me.getCause() instanceof InvalidInputException iie){
84+
assertEquals("Duplicate key, Product Id: ".concat(String.valueOf(productId)), iie.getMessage());
8585
} else {
8686
fail("Expected a InvalidInputException as the root cause!");
8787
}
@@ -102,20 +102,21 @@ public void deleteProduct() {
102102

103103
@Test
104104
public void getProductInvalidParameterString() {
105-
106-
getAndVerifyProduct(BASE_URI + "/no-integer", BAD_REQUEST)
107-
.jsonPath("$.path").isEqualTo(BASE_URI + "no-integer")
105+
var uri = BASE_URI.concat("no-integer");
106+
getAndVerifyProduct(uri, BAD_REQUEST)
107+
.jsonPath("$.path").isEqualTo(uri)
108108
.jsonPath("$.message").isEqualTo("Type mismatch.");
109109
}
110110

111111
@Test
112112
public void getProductNotFound() {
113113

114114
int productIdNotFound = 13;
115+
115116
getAndVerifyProduct(productIdNotFound, NOT_FOUND)
116-
.jsonPath("$.path").isEqualTo(BASE_URI + productIdNotFound)
117+
.jsonPath("$.path").isEqualTo(BASE_URI.concat(String.valueOf(productIdNotFound)))
117118
.jsonPath("$.message")
118-
.isEqualTo("No product found for productId: " + productIdNotFound);
119+
.isEqualTo("No product found for productId: ".concat(String.valueOf(productIdNotFound)));
119120
}
120121

121122
@Test
@@ -124,13 +125,13 @@ public void getProductInvalidParameterNegativeValue() {
124125
int productIdInvalid = -1;
125126

126127
getAndVerifyProduct(productIdInvalid, UNPROCESSABLE_ENTITY)
127-
.jsonPath("$.path").isEqualTo(BASE_URI + productIdInvalid)
128-
.jsonPath("$.message").isEqualTo("Invalid productId: " + productIdInvalid);
128+
.jsonPath("$.path").isEqualTo(BASE_URI.concat(String.valueOf(productIdInvalid)))
129+
.jsonPath("$.message").isEqualTo("Invalid productId: ".concat(String.valueOf(productIdInvalid)));
129130
}
130131

131132
private WebTestClient.BodyContentSpec getAndVerifyProduct(
132133
int productId, HttpStatus expectedStatus) {
133-
return getAndVerifyProduct(BASE_URI + productId, expectedStatus);
134+
return getAndVerifyProduct(BASE_URI.concat(String.valueOf(productId)), expectedStatus);
134135
}
135136

136137
private WebTestClient.BodyContentSpec getAndVerifyProduct(
@@ -146,7 +147,10 @@ private WebTestClient.BodyContentSpec getAndVerifyProduct(
146147
}
147148

148149
private void sendCreateProductEvent(int productId) {
149-
Product product = new Product(productId, "Name " + productId, productId, "SA");
150+
var product = new Product(productId,
151+
"Name ".concat(String.valueOf(productId)),
152+
productId,
153+
"SA");
150154
Event<Integer, Product> event = new Event<>(CREATE, productId, product);
151155
input.send(new GenericMessage<>(event));
152156
}

store-services/recommendation-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.siriusxi.ms.store</groupId>
99
<artifactId>store-service-chassis</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../store-base/store-service-chassis</relativePath>
11+
<relativePath>../../store-base/store-service-chassis/pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>recommendation-service</artifactId>

store-services/review-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.siriusxi.ms.store</groupId>
99
<artifactId>store-service-chassis</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../store-base/store-service-chassis</relativePath>
11+
<relativePath>../../store-base/store-service-chassis/pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>review-service</artifactId>

store-services/review-service/src/test/java/com/siriusxi/ms/store/revs/ReviewServiceApplicationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.springframework.messaging.support.GenericMessage;
1616
import org.springframework.test.context.ActiveProfiles;
1717
import org.springframework.test.web.reactive.server.WebTestClient;
18-
import reactor.core.publisher.Mono;
1918

2019
import static com.siriusxi.ms.store.api.event.Event.Type.CREATE;
2120
import static com.siriusxi.ms.store.api.event.Event.Type.DELETE;

store-services/store-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.siriusxi.ms.store</groupId>
99
<artifactId>store-service-chassis</artifactId>
1010
<version>1.0-SNAPSHOT</version>
11-
<relativePath>../store-base/store-service-chassis</relativePath>
11+
<relativePath>../../store-base/store-service-chassis/pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>store-service</artifactId>

store-services/store-service/src/test/java/com/siriusxi/ms/store/pcs/IsSameEvent.java

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,64 @@
1717
@Log4j2
1818
class IsSameEvent extends TypeSafeMatcher<String> {
1919

20-
private final ObjectMapper mapper = new ObjectMapper();
20+
private final ObjectMapper mapper = new ObjectMapper();
2121

22-
private Event expectedEvent;
22+
private final Event expectedEvent;
2323

24+
private IsSameEvent(Event expectedEvent) {
25+
this.expectedEvent = expectedEvent;
26+
}
2427

25-
private IsSameEvent(Event expectedEvent) {
26-
this.expectedEvent = expectedEvent;
27-
}
28+
public static Matcher<String> sameEventExceptCreatedAt(Event expectedEvent) {
29+
return new IsSameEvent(expectedEvent);
30+
}
2831

29-
@Override
30-
protected boolean matchesSafely(String eventAsJson) {
32+
@Override
33+
protected boolean matchesSafely(String eventAsJson) {
3134

32-
if (expectedEvent == null) return false;
35+
if (expectedEvent == null) return false;
3336

34-
log.trace("Convert the following json string to a map: {}", eventAsJson);
35-
Map mapEvent = convertJsonStringToMap(eventAsJson);
36-
mapEvent.remove("eventCreatedAt");
37+
log.trace("Convert the following json string to a map: {}", eventAsJson);
38+
Map mapEvent = convertJsonStringToMap(eventAsJson);
39+
mapEvent.remove("eventCreatedAt");
3740

38-
Map mapExpectedEvent = getMapWithoutCreatedAt(expectedEvent);
41+
Map mapExpectedEvent = getMapWithoutCreatedAt(expectedEvent);
3942

40-
log.trace("Got the map: {}", mapEvent);
41-
log.trace("Compare to the expected map: {}", mapExpectedEvent);
42-
return mapEvent.equals(mapExpectedEvent);
43-
}
43+
log.trace("Got the map: {}", mapEvent);
44+
log.trace("Compare to the expected map: {}", mapExpectedEvent);
45+
return mapEvent.equals(mapExpectedEvent);
46+
}
4447

45-
@Override
46-
public void describeTo(Description description) {
47-
String expectedJson = convertObjectToJsonString(expectedEvent);
48-
description.appendText("expected to look like " + expectedJson);
49-
}
48+
@Override
49+
public void describeTo(Description description) {
50+
String expectedJson = convertObjectToJsonString(expectedEvent);
51+
description.appendText("expected to look like " + expectedJson);
52+
}
5053

51-
public static Matcher<String> sameEventExceptCreatedAt(Event expectedEvent) {
52-
return new IsSameEvent(expectedEvent);
53-
}
54+
private Map getMapWithoutCreatedAt(Event event) {
55+
Map mapEvent = convertObjectToMap(event);
56+
mapEvent.remove("eventCreatedAt");
57+
return mapEvent;
58+
}
5459

55-
private Map getMapWithoutCreatedAt(Event event) {
56-
Map mapEvent = convertObjectToMap(event);
57-
mapEvent.remove("eventCreatedAt");
58-
return mapEvent;
59-
}
60-
61-
private Map convertObjectToMap(Object object) {
62-
JsonNode node = mapper.convertValue(object, JsonNode.class);
63-
return mapper.convertValue(node, Map.class);
64-
}
60+
private Map convertObjectToMap(Object object) {
61+
JsonNode node = mapper.convertValue(object, JsonNode.class);
62+
return mapper.convertValue(node, Map.class);
63+
}
6564

66-
private String convertObjectToJsonString(Object object) {
67-
try {
68-
return mapper.writeValueAsString(object);
69-
} catch (JsonProcessingException e) {
70-
throw new RuntimeException(e);
71-
}
65+
private String convertObjectToJsonString(Object object) {
66+
try {
67+
return mapper.writeValueAsString(object);
68+
} catch (JsonProcessingException e) {
69+
throw new RuntimeException(e);
7270
}
71+
}
7372

74-
private Map convertJsonStringToMap(String eventAsJson) {
75-
try {
76-
return mapper.readValue(eventAsJson, new TypeReference<HashMap>(){});
77-
} catch (IOException e) {
78-
throw new RuntimeException(e);
79-
}
73+
private Map convertJsonStringToMap(String eventAsJson) {
74+
try {
75+
return mapper.readValue(eventAsJson, new TypeReference<HashMap>() {});
76+
} catch (IOException e) {
77+
throw new RuntimeException(e);
8078
}
81-
}
79+
}
80+
}

store-services/store-service/src/test/java/com/siriusxi/ms/store/pcs/MessagingTests.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import static org.springframework.http.HttpStatus.OK;
3434

3535
@SpringBootTest(
36-
webEnvironment = RANDOM_PORT,
37-
properties = {"eureka.client.enabled: false"})
36+
webEnvironment = RANDOM_PORT,
37+
properties = {"eureka.client.enabled: false"})
3838
class MessagingTests {
3939

4040
public static final String BASE_URL = "/store/api/v1/products/";
@@ -67,8 +67,7 @@ public void createCompositeProduct1() {
6767
new Event<>(
6868
CREATE,
6969
composite.productId(),
70-
new Product(
71-
composite.productId(), composite.name(), composite.weight(), null));
70+
new Product(composite.productId(), composite.name(), composite.weight(), null));
7271
assertThat(queueProducts, is(receivesPayloadThat(sameEventExceptCreatedAt(expectedEvent))));
7372

7473
// Assert none recommendations and review events
@@ -97,8 +96,7 @@ public void createCompositeProduct2() {
9796
new Event<>(
9897
CREATE,
9998
composite.productId(),
100-
new Product(
101-
composite.productId(), composite.name(), composite.weight(), null));
99+
new Product(composite.productId(), composite.name(), composite.weight(), null));
102100
assertThat(queueProducts, receivesPayloadThat(sameEventExceptCreatedAt(expectedProductEvent)));
103101

104102
// Assert one create recommendation event queued up
@@ -176,13 +174,16 @@ private void postAndVerifyProduct(ProductAggregate compositeProduct) {
176174
.uri(BASE_URL)
177175
.body(Mono.just(compositeProduct), ProductAggregate.class)
178176
.exchange()
179-
.expectStatus().isEqualTo(OK);
177+
.expectStatus()
178+
.isEqualTo(OK);
180179
}
181180

182181
private void deleteAndVerifyProduct(int productId) {
183-
client.delete()
184-
.uri(BASE_URL.concat(valueOf(productId)))
185-
.exchange()
186-
.expectStatus().isEqualTo(OK);
182+
client
183+
.delete()
184+
.uri(BASE_URL.concat(valueOf(productId)))
185+
.exchange()
186+
.expectStatus()
187+
.isEqualTo(OK);
187188
}
188189
}

store-services/store-service/src/test/java/com/siriusxi/ms/store/pcs/StoreServiceApplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import static org.springframework.http.MediaType.APPLICATION_JSON;
2525

2626
@SpringBootTest(
27-
webEnvironment = RANDOM_PORT,
28-
properties = {"eureka.client.enabled: false"})
27+
webEnvironment = RANDOM_PORT,
28+
properties = {"eureka.client.enabled: false"})
2929
class StoreServiceApplicationTests {
3030

3131
public static final String BASE_URL = "/store/api/v1/products/";
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.siriusxi.ms.store.pcs;
22

3+
import org.junit.platform.runner.JUnitPlatform;
34
import org.junit.platform.suite.api.SelectClasses;
45
import org.junit.platform.suite.api.SuiteDisplayName;
6+
import org.junit.runner.RunWith;
57

8+
//@RunWith(JUnitPlatform.class)
69
@SuiteDisplayName("Store Service Testing Suite")
710
@SelectClasses(value = {StoreServiceApplicationTests.class, MessagingTests.class})
8-
public class StoreServiceTestingSuite {}
11+
class StoreServiceTestingSuite {}

0 commit comments

Comments
 (0)