Resolves checkstyle errors for abstract-document abstract-factory acyclic-visitor adapter aggregator-microservices (#1080)
* Reduces checkstyle errors in abstract-document * Reduces checkstyle errors in abstract-factory * Reduces checkstyle errors in acyclic-visitor * Reduces checkstyle errors in adapter * Reduces checkstyle errors in aggregator-microservices
This commit is contained in:
committed by
Ilkka Seppälä
parent
390795154f
commit
1e76d91929
@ -24,14 +24,13 @@
|
||||
package com.iluwatar.aggregator.microservices;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* The aggregator aggregates calls on various micro-services, collects
|
||||
* data and further publishes them under a REST endpoint.
|
||||
* The aggregator aggregates calls on various micro-services, collects data and further publishes
|
||||
* them under a REST endpoint.
|
||||
*/
|
||||
@RestController
|
||||
public class Aggregator {
|
||||
|
@ -27,13 +27,13 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* Spring Boot EntryPoint Class
|
||||
* Spring Boot EntryPoint Class.
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* Program entry point.
|
||||
*
|
||||
* @param args command line args
|
||||
*/
|
||||
|
@ -28,7 +28,6 @@ import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -44,7 +43,9 @@ public class ProductInformationClientImpl implements ProductInformationClient {
|
||||
@Override
|
||||
public String getProductTitle() {
|
||||
String response = null;
|
||||
var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information")).build();
|
||||
var request =
|
||||
HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information"))
|
||||
.build();
|
||||
var client = HttpClient.newHttpClient();
|
||||
try {
|
||||
var httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
@ -28,7 +28,6 @@ import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -45,7 +44,9 @@ public class ProductInventoryClientImpl implements ProductInventoryClient {
|
||||
public Integer getProductInventories() {
|
||||
var response = "";
|
||||
|
||||
var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build();
|
||||
var request =
|
||||
HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories"))
|
||||
.build();
|
||||
var client = HttpClient.newHttpClient();
|
||||
try {
|
||||
var httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
@ -55,10 +56,10 @@ public class ProductInventoryClientImpl implements ProductInventoryClient {
|
||||
} catch (InterruptedException ie) {
|
||||
LOGGER.error("InterruptedException Occurred", ie);
|
||||
}
|
||||
if("".equalsIgnoreCase(response)) {
|
||||
return null;
|
||||
if ("".equalsIgnoreCase(response)) {
|
||||
return null;
|
||||
} else {
|
||||
return Integer.parseInt(response);
|
||||
return Integer.parseInt(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,5 +20,4 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
server.port=50004
|
@ -23,15 +23,15 @@
|
||||
|
||||
package com.iluwatar.aggregator.microservices;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Test Aggregation of domain objects
|
||||
*/
|
||||
|
Reference in New Issue
Block a user