Skip to content

Commit 4511dad

Browse files
committed
Merge branch 'develop'
2 parents 1f5cba4 + db4c963 commit 4511dad

File tree

26 files changed

+356
-355
lines changed

26 files changed

+356
-355
lines changed

.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import java.net.*;
17-
import java.io.*;
18-
import java.nio.channels.*;
16+
1917
import java.util.Properties;
2018

2119
public class MavenWrapperDownloader {
@@ -25,7 +23,7 @@ public class MavenWrapperDownloader {
2523
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
2624
*/
2725
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28-
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
26+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
2927

3028
/**
3129
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
@@ -54,7 +52,7 @@ public static void main(String args[]) {
5452
// wrapperUrl parameter.
5553
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
5654
String url = DEFAULT_DOWNLOAD_URL;
57-
if(mavenWrapperPropertyFile.exists()) {
55+
if (mavenWrapperPropertyFile.exists()) {
5856
FileInputStream mavenWrapperPropertyFileInputStream = null;
5957
try {
6058
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
@@ -65,7 +63,7 @@ public static void main(String args[]) {
6563
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
6664
} finally {
6765
try {
68-
if(mavenWrapperPropertyFileInputStream != null) {
66+
if (mavenWrapperPropertyFileInputStream != null) {
6967
mavenWrapperPropertyFileInputStream.close();
7068
}
7169
} catch (IOException e) {
@@ -76,8 +74,8 @@ public static void main(String args[]) {
7674
System.out.println("- Downloading from: " + url);
7775

7876
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79-
if(!outputFile.getParentFile().exists()) {
80-
if(!outputFile.getParentFile().mkdirs()) {
77+
if (!outputFile.getParentFile().exists()) {
78+
if (!outputFile.getParentFile().mkdirs()) {
8179
System.out.println(
8280
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
8381
}

product-composite-service/pom.xml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
56

67
<parent>
7-
<groupId>com.siriusxi.ms.store</groupId>
8-
<artifactId>store-chassis</artifactId>
9-
<version>0.0.1-SNAPSHOT</version>
10-
</parent>
11-
12-
<artifactId>product-composite-service</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
14-
<name>Product Composite Service</name>
15-
<description>Product Composite Service Spring Boot based project</description>
16-
<packaging>jar</packaging>
8+
<groupId>com.siriusxi.ms.store</groupId>
9+
<artifactId>store-chassis</artifactId>
10+
<version>0.0.1-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>product-composite-service</artifactId>
14+
<version>0.0.1-SNAPSHOT</version>
15+
<name>Product Composite Service</name>
16+
<description>Product Composite Service Spring Boot based project</description>
17+
<packaging>jar</packaging>
1718
</project>

product-composite-service/src/main/java/com/siriusxi/ms/store/pcs/ProductCompositeServiceApplication.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
@ComponentScan("com.siriusxi.ms.store")
1111
public class ProductCompositeServiceApplication {
1212

13-
@Bean
14-
RestTemplate newRestClient() {
15-
return new RestTemplate();
16-
}
13+
public static void main(String[] args) {
14+
SpringApplication.run(ProductCompositeServiceApplication.class, args);
15+
}
1716

18-
public static void main(String[] args) {
19-
SpringApplication.run(ProductCompositeServiceApplication.class, args);
20-
}
17+
@Bean
18+
RestTemplate newRestClient() {
19+
return new RestTemplate();
20+
}
2121

2222
}

product-composite-service/src/main/java/com/siriusxi/ms/store/pcs/controller/ProductCompositeServiceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public ProductCompositeServiceImpl(ServiceUtil serviceUtil, ProductCompositeInte
3333
public ProductAggregate getProduct(int productId) {
3434

3535
var product = integration.getProduct(productId);
36-
if (product == null) throw new NotFoundException("No product found for productId: " + productId);
36+
if (product == null)
37+
throw new NotFoundException("No product found for productId: " + productId);
3738

3839
var recommendations = integration.getRecommendations(productId);
3940

@@ -57,7 +58,7 @@ private ProductAggregate createProductAggregate(Product product, List<Recommenda
5758
.collect(Collectors.toList());
5859

5960
// 3. Copy summary review info, if available
60-
List<ReviewSummary> reviewSummaries = (reviews == null) ? null :
61+
List<ReviewSummary> reviewSummaries = (reviews == null) ? null :
6162
reviews.stream()
6263
.map(r -> new ReviewSummary(r.getReviewId(), r.getAuthor(), r.getSubject()))
6364
.collect(Collectors.toList());

product-composite-service/src/main/java/com/siriusxi/ms/store/pcs/integration/ProductCompositeIntegration.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.siriusxi.ms.store.pcs.integration;
22

3+
import com.fasterxml.jackson.databind.ObjectMapper;
34
import com.siriusxi.ms.store.api.core.product.Product;
45
import com.siriusxi.ms.store.api.core.product.ProductService;
56
import com.siriusxi.ms.store.api.core.recommendation.Recommendation;
67
import com.siriusxi.ms.store.api.core.recommendation.RecommendationService;
78
import com.siriusxi.ms.store.api.core.review.Review;
89
import com.siriusxi.ms.store.api.core.review.ReviewService;
9-
10-
import com.fasterxml.jackson.databind.ObjectMapper;
10+
import com.siriusxi.ms.store.util.exceptions.InvalidInputException;
11+
import com.siriusxi.ms.store.util.exceptions.NotFoundException;
12+
import com.siriusxi.ms.store.util.http.HttpErrorInfo;
1113
import lombok.extern.log4j.Log4j2;
1214
import org.springframework.beans.factory.annotation.Autowired;
1315
import org.springframework.beans.factory.annotation.Value;
@@ -16,15 +18,11 @@
1618
import org.springframework.web.client.HttpClientErrorException;
1719
import org.springframework.web.client.RestTemplate;
1820

19-
import com.siriusxi.ms.store.util.exceptions.InvalidInputException;
20-
import com.siriusxi.ms.store.util.exceptions.NotFoundException;
21-
import com.siriusxi.ms.store.util.http.HttpErrorInfo;
22-
2321
import java.io.IOException;
2422
import java.util.ArrayList;
2523
import java.util.List;
2624

27-
import static java.lang.String.*;
25+
import static java.lang.String.valueOf;
2826
import static org.springframework.http.HttpMethod.GET;
2927

3028
@Component
@@ -48,24 +46,24 @@ public ProductCompositeIntegration(
4846
ObjectMapper mapper,
4947

5048
@Value("${app.product-service.host}") String productServiceHost,
51-
@Value("${app.product-service.port}") int productServicePort,
49+
@Value("${app.product-service.port}") int productServicePort,
5250

5351
@Value("${app.recommendation-service.host}") String recommendationServiceHost,
54-
@Value("${app.recommendation-service.port}") int recommendationServicePort,
52+
@Value("${app.recommendation-service.port}") int recommendationServicePort,
5553

5654
@Value("${app.review-service.host}") String reviewServiceHost,
57-
@Value("${app.review-service.port}") int reviewServicePort
55+
@Value("${app.review-service.port}") int reviewServicePort
5856
) {
5957

6058
this.restTemplate = restTemplate;
6159
this.mapper = mapper;
6260

6361
var http = "http://";
64-
productServiceUrl = http.concat(productServiceHost).concat(":").concat(valueOf(productServicePort))
62+
productServiceUrl = http.concat(productServiceHost).concat(":").concat(valueOf(productServicePort))
6563
.concat("/product/");
6664
recommendationServiceUrl = http.concat(recommendationServiceHost).concat(":")
6765
.concat(valueOf(recommendationServicePort)).concat("/recommendation?productId=");
68-
reviewServiceUrl = http.concat(reviewServiceHost).concat(":").concat(valueOf(reviewServicePort))
66+
reviewServiceUrl = http.concat(reviewServiceHost).concat(":").concat(valueOf(reviewServicePort))
6967
.concat("/review?productId=");
7068
}
7169

@@ -104,7 +102,8 @@ public List<Recommendation> getRecommendations(int productId) {
104102
log.debug("Will call getRecommendations API on URL: {}", url);
105103
List<Recommendation> recommendations = restTemplate
106104
.exchange(url, GET, null,
107-
new ParameterizedTypeReference<List<Recommendation>>() {})
105+
new ParameterizedTypeReference<List<Recommendation>>() {
106+
})
108107
.getBody();
109108

110109
log.debug("Found {} recommendations for a product with id: {}",
@@ -132,7 +131,8 @@ public List<Review> getReviews(int productId) {
132131
url,
133132
GET,
134133
null,
135-
new ParameterizedTypeReference<List<Review>>() {})
134+
new ParameterizedTypeReference<List<Review>>() {
135+
})
136136
.getBody();
137137

138138
log.debug("Found {} reviews for a product with id: {}",

product-composite-service/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@
3030
"type": "java.lang.Integer",
3131
"description": "Description for app.review-service.port."
3232
}
33-
] }
33+
]
34+
}

product-service/pom.xml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
56

67
<parent>
7-
<groupId>com.siriusxi.ms.store</groupId>
8-
<artifactId>store-chassis</artifactId>
9-
<version>0.0.1-SNAPSHOT</version>
10-
</parent>
11-
12-
<artifactId>product-service</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
14-
<name>Product Service</name>
15-
<description>Product Service Spring Boot based project</description>
16-
<packaging>jar</packaging>
8+
<groupId>com.siriusxi.ms.store</groupId>
9+
<artifactId>store-chassis</artifactId>
10+
<version>0.0.1-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>product-service</artifactId>
14+
<version>0.0.1-SNAPSHOT</version>
15+
<name>Product Service</name>
16+
<description>Product Service Spring Boot based project</description>
17+
<packaging>jar</packaging>
1718
</project>

product-service/src/main/java/com/siriusxi/ms/store/ps/ProductServiceApplication.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
@ComponentScan("com.siriusxi.ms.store")
99
public class ProductServiceApplication {
1010

11-
public static void main(String[] args) {
12-
SpringApplication.run(ProductServiceApplication.class, args);
13-
}
11+
public static void main(String[] args) {
12+
SpringApplication.run(ProductServiceApplication.class, args);
13+
}
1414

1515
}

product-service/src/main/java/com/siriusxi/ms/store/ps/controller/ProductServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public Product getProduct(int productId) {
2626

2727
if (productId < 1) throw new InvalidInputException("Invalid productId: " + productId);
2828

29-
if (productId == 13) throw new NotFoundException("No product found for productId: " + productId);
29+
if (productId == 13)
30+
throw new NotFoundException("No product found for productId: " + productId);
3031

3132
return new Product(productId, "name-" + productId, 123, serviceUtil.getServiceAddress());
3233
}

0 commit comments

Comments
 (0)