BAEL-4811 (#11597)
* BAEL-4811 * BAEL-4811 Add unit tests * JAVA-8794: Upgrade Spring Boot to 2.6.1 in the parent-boot-2 * JAVA-8794: Upgrade spring-mybatis dependencies * JAVA-8794: Make spring-boot-springdoc 2.6 compatible * JAVA-8794: Add spring.mongodb.embedded.version property * JAVA-8794: Upgrade spring-boot-environment cloud dependencies * JAVA-8794: Set spring.mvc.pathmatch.matching-strategy property * JAVA-8794: Update Spring Cloud dependencies * JAVA-8794: allow-circular-references in spring-cloud-ribbon-client * JAVA-8794: Replace deprecated ConfigFileApplicationContextInitializer * JAVA-8794: Fix spring-resttemplate pom * JAVA-8794: Use spring.mongodb.embedded.version=3.5.5 * JAVA-8794: Use spring.mongodb.embedded.version=3.5.5 * JAVA-8794: Fix circural dependencies in spring-security-web-boot-2 * JAVA-8794: Fix circural dependencies in spring-security-core * JAVA-8794: Fix quart schema initialization * JAVA-8794: Set spring.mvc.pathmatch.matching-strategy=ant-path-matcher * JAVA-8794: Leave spring-kafka on Spring Boot 2.5.4 * JAVA-8794: Set spring.mongodb.embedded.version=3.5.5 in spring-jenkins-pipeline * JAVA-8794: Update Spring Cloud version * JAVA-8794: Update spring-cloud-zuul dependencies * JAVA-8794: Update Spring Cloud version in spring-cloud-bus * JAVA-8794: Set spring.mongodb.embedded.version=3.5.5 in spring-boot-persistence-mongodb * JAVA-8794: Fix spring-data-jpa-query-2 dependencies * JAVA-8794: Fix circular dependency issue in spring-security-web-thymeleaf * JAVA-8794: Fix circular dependency issue in spring-session-redis * JAVA-8794: Fix circular dependency issue in spring-boot-libraries-2 * JAVA-8794: Update spring-cloud-starter version * JAVA-8794: Leave spring-zuul-rate-limiting on 2.4.7 * JAVA-8794: Ignore EnversFooBarAuditIntegrationTest * BAEL-4811 Fix formatting * BAEL-4811 Fix formatting Co-authored-by: Krzysiek <krzysztofwoyke@gmail.com> Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>
This commit is contained in:
parent
77dcb8853f
commit
08433b1631
|
@ -16,26 +16,31 @@ public class ArithmeticClientImpl {
|
||||||
|
|
||||||
public String sum(float number1, float number2) {
|
public String sum(float number1, float number2) {
|
||||||
HttpRequest<String> req = HttpRequest.GET("/math/sum/" + number1 + "/" + number2);
|
HttpRequest<String> req = HttpRequest.GET("/math/sum/" + number1 + "/" + number2);
|
||||||
return httpClient.retrieve(req).blockingFirst();
|
return httpClient.retrieve(req)
|
||||||
|
.blockingFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String subtract(float number1, float number2) {
|
public String subtract(float number1, float number2) {
|
||||||
HttpRequest<String> req = HttpRequest.GET("/math/subtract/" + number1 + "/" + number2);
|
HttpRequest<String> req = HttpRequest.GET("/math/subtract/" + number1 + "/" + number2);
|
||||||
return httpClient.retrieve(req).blockingFirst();
|
return httpClient.retrieve(req)
|
||||||
|
.blockingFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String multiply(float number1, float number2) {
|
public String multiply(float number1, float number2) {
|
||||||
HttpRequest<String> req = HttpRequest.GET("/math/multiply/" + number1 + "/" + number2);
|
HttpRequest<String> req = HttpRequest.GET("/math/multiply/" + number1 + "/" + number2);
|
||||||
return httpClient.retrieve(req).blockingFirst();
|
return httpClient.retrieve(req)
|
||||||
|
.blockingFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String divide(float number1, float number2) {
|
public String divide(float number1, float number2) {
|
||||||
HttpRequest<String> req = HttpRequest.GET("/math/divide/" + number1 + "/" + number2);
|
HttpRequest<String> req = HttpRequest.GET("/math/divide/" + number1 + "/" + number2);
|
||||||
return httpClient.retrieve(req).blockingFirst();
|
return httpClient.retrieve(req)
|
||||||
|
.blockingFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String memory() {
|
public String memory() {
|
||||||
HttpRequest<String> req = HttpRequest.GET("/math/memory");
|
HttpRequest<String> req = HttpRequest.GET("/math/memory");
|
||||||
return httpClient.retrieve(req).blockingFirst();
|
return httpClient.retrieve(req)
|
||||||
|
.blockingFirst();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,14 +40,14 @@ public class ArithmeticController {
|
||||||
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
|
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
|
||||||
String memoryStats = "";
|
String memoryStats = "";
|
||||||
|
|
||||||
String init = String.format("Initial: %.2f GB \n",
|
String init = String.format("Initial: %.2f GB \n", (double) memoryBean.getHeapMemoryUsage()
|
||||||
(double)memoryBean.getHeapMemoryUsage().getInit() /1073741824);
|
.getInit() / 1073741824);
|
||||||
String usedHeap = String.format("Used: %.2f GB \n",
|
String usedHeap = String.format("Used: %.2f GB \n", (double) memoryBean.getHeapMemoryUsage()
|
||||||
(double)memoryBean.getHeapMemoryUsage().getUsed() /1073741824);
|
.getUsed() / 1073741824);
|
||||||
String maxHeap = String.format("Max: %.2f GB \n",
|
String maxHeap = String.format("Max: %.2f GB \n", (double) memoryBean.getHeapMemoryUsage()
|
||||||
(double)memoryBean.getHeapMemoryUsage().getMax() /1073741824);
|
.getMax() / 1073741824);
|
||||||
String committed = String.format("Committed: %.2f GB \n",
|
String committed = String.format("Committed: %.2f GB \n", (double) memoryBean.getHeapMemoryUsage()
|
||||||
(double)memoryBean.getHeapMemoryUsage().getCommitted() /1073741824);
|
.getCommitted() / 1073741824);
|
||||||
memoryStats += init;
|
memoryStats += init;
|
||||||
memoryStats += usedHeap;
|
memoryStats += usedHeap;
|
||||||
memoryStats += maxHeap;
|
memoryStats += maxHeap;
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.junit.Test;
|
||||||
|
|
||||||
import com.baeldung.micronaut.vs.springboot.client.ArithmeticClientImpl;
|
import com.baeldung.micronaut.vs.springboot.client.ArithmeticClientImpl;
|
||||||
|
|
||||||
|
|
||||||
public class ArithmeticClientUnitTest {
|
public class ArithmeticClientUnitTest {
|
||||||
private EmbeddedServer server;
|
private EmbeddedServer server;
|
||||||
private ArithmeticClientImpl client;
|
private ArithmeticClientImpl client;
|
||||||
|
@ -21,7 +20,8 @@ public class ArithmeticClientUnitTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
server = ApplicationContext.run(EmbeddedServer.class);
|
server = ApplicationContext.run(EmbeddedServer.class);
|
||||||
client = server.getApplicationContext().getBean(ArithmeticClientImpl.class);
|
client = server.getApplicationContext()
|
||||||
|
.getBean(ArithmeticClientImpl.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
|
@ -42,7 +42,8 @@ public class ArithmeticController {
|
||||||
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
|
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
|
||||||
String memoryStats = "";
|
String memoryStats = "";
|
||||||
|
|
||||||
String init = String.format("Initial: %.2f GB \n",
|
String init = String.format(
|
||||||
|
"Initial: %.2f GB \n",
|
||||||
(double)memoryBean.getHeapMemoryUsage().getInit() /1073741824);
|
(double)memoryBean.getHeapMemoryUsage().getInit() /1073741824);
|
||||||
String usedHeap = String.format("Used: %.2f GB \n",
|
String usedHeap = String.format("Used: %.2f GB \n",
|
||||||
(double)memoryBean.getHeapMemoryUsage().getUsed() /1073741824);
|
(double)memoryBean.getHeapMemoryUsage().getUsed() /1073741824);
|
||||||
|
|
Loading…
Reference in New Issue