Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
afb2f96512
|
@ -5,17 +5,17 @@ import java.util.Optional;
|
||||||
|
|
||||||
public class LinesIntersectionService {
|
public class LinesIntersectionService {
|
||||||
|
|
||||||
public Optional<Point> calculateIntersectionPoint(float m1, float b1, float m2, float b2) {
|
public Optional<Point> calculateIntersectionPoint(double m1, double b1, double m2, double b2) {
|
||||||
|
|
||||||
if (m1 == m2) {
|
if (m1 == m2) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
float x = (b2 - b1) / (m1 - m2);
|
|
||||||
float y = m1 * x + b1;
|
|
||||||
|
|
||||||
Point point = new Point(Math.round(x), Math.round(y));
|
double x = (b2 - b1) / (m1 - m2);
|
||||||
|
double y = m1 * x + b1;
|
||||||
|
|
||||||
|
Point point = new Point();
|
||||||
|
point.setLocation(x, y);
|
||||||
return Optional.of(point);
|
return Optional.of(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,24 +14,24 @@ public class LinesIntersectionServiceUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void givenNotParallelLines_whenCalculatePoint_thenPresent() {
|
public void givenNotParallelLines_whenCalculatePoint_thenPresent() {
|
||||||
|
|
||||||
float m1 = 0;
|
double m1 = 0;
|
||||||
float b1 = 0;
|
double b1 = 0;
|
||||||
float m2 = 1;
|
double m2 = 1;
|
||||||
float b2 = -1;
|
double b2 = -1;
|
||||||
|
|
||||||
Optional<Point> point = service.calculateIntersectionPoint(m1, b1, m2, b2);
|
Optional<Point> point = service.calculateIntersectionPoint(m1, b1, m2, b2);
|
||||||
|
|
||||||
assertTrue(point.isPresent());
|
assertTrue(point.isPresent());
|
||||||
assertEquals(point.get().x, 1);
|
assertEquals(point.get().getX(), 1, 0.001);
|
||||||
assertEquals(point.get().y, 0);
|
assertEquals(point.get().getX(), 1, 0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenParallelLines_whenCalculatePoint_thenEmpty() {
|
public void givenParallelLines_whenCalculatePoint_thenEmpty() {
|
||||||
float m1 = 1;
|
double m1 = 1;
|
||||||
float b1 = 0;
|
double b1 = 0;
|
||||||
float m2 = 1;
|
double m2 = 1;
|
||||||
float b2 = -1;
|
double b2 = -1;
|
||||||
|
|
||||||
Optional<Point> point = service.calculateIntersectionPoint(m1, b1, m2, b2);
|
Optional<Point> point = service.calculateIntersectionPoint(m1, b1, m2, b2);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.baeldung.string.sorting;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class AnagramValidator {
|
||||||
|
|
||||||
|
public static boolean isValid(String text, String anagram) {
|
||||||
|
text = prepare(text);
|
||||||
|
anagram = prepare(anagram);
|
||||||
|
|
||||||
|
String sortedText = sort(text);
|
||||||
|
String sortedAnagram = sort(anagram);
|
||||||
|
|
||||||
|
return sortedText.equals(sortedAnagram);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String sort(String text) {
|
||||||
|
char[] chars = prepare(text).toCharArray();
|
||||||
|
|
||||||
|
Arrays.sort(chars);
|
||||||
|
return new String(chars);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String prepare(String text) {
|
||||||
|
return text.toLowerCase()
|
||||||
|
.trim()
|
||||||
|
.replaceAll("\\s+", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.baeldung.string.sorting;
|
||||||
|
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import com.baeldung.string.sorting.AnagramValidator;
|
||||||
|
|
||||||
|
class AnagramValidatorUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenValidAnagrams_whenSorted_thenEqual() {
|
||||||
|
boolean isValidAnagram = AnagramValidator.isValid("Avida Dollars", "Salvador Dali");
|
||||||
|
|
||||||
|
assertTrue(isValidAnagram);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenNotValidAnagrams_whenSorted_thenNotEqual() {
|
||||||
|
boolean isValidAnagram = AnagramValidator.isValid("abc", "def");
|
||||||
|
|
||||||
|
assertFalse(isValidAnagram);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.baeldung.string.sorting;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class SortStringUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenString_whenSort_thenSorted() {
|
||||||
|
String abcd = "bdca";
|
||||||
|
char[] chars = abcd.toCharArray();
|
||||||
|
|
||||||
|
Arrays.sort(chars);
|
||||||
|
String sorted = new String(chars);
|
||||||
|
|
||||||
|
assertThat(sorted).isEqualTo("abcd");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void givenString_whenSortJava8_thenSorted() {
|
||||||
|
String sorted = "bdca".chars()
|
||||||
|
.sorted()
|
||||||
|
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
|
||||||
|
.toString();
|
||||||
|
|
||||||
|
assertThat(sorted).isEqualTo("abcd");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,67 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>com.baeldung.samples</groupId>
|
|
||||||
<artifactId>jersey-client-rx</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.inject</groupId>
|
|
||||||
<artifactId>jersey-hk2</artifactId>
|
|
||||||
<version>2.27</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
|
||||||
<artifactId>jersey-client</artifactId>
|
|
||||||
<version>2.27</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.ext.rx</groupId>
|
|
||||||
<artifactId>jersey-rx-client-rxjava</artifactId>
|
|
||||||
<version>2.27</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.ext.rx</groupId>
|
|
||||||
<artifactId>jersey-rx-client-rxjava2</artifactId>
|
|
||||||
<version>2.27</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.tomakehurst</groupId>
|
|
||||||
<artifactId>wiremock</artifactId>
|
|
||||||
<version>1.58</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.vintage</groupId>
|
|
||||||
<artifactId>junit-vintage-engine</artifactId>
|
|
||||||
<version>5.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey.media</groupId>
|
|
||||||
<artifactId>jersey-media-json-jackson</artifactId>
|
|
||||||
<version>2.25</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
|
||||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
|
||||||
<version>2.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
|
||||||
<version>1.7.25</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.assertj</groupId>
|
|
||||||
<artifactId>assertj-core</artifactId>
|
|
||||||
<version>3.10.0</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
</project>
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Fluent, Reactive Jersey Client Orchestration #
|
|
||||||
|
|
||||||
### Sample code demonstrating the options for asynchronous, reactive RESTful service consumption with JAX-RS ###
|
|
1
pom.xml
1
pom.xml
|
@ -585,7 +585,6 @@
|
||||||
<module>spring-security-thymeleaf</module>
|
<module>spring-security-thymeleaf</module>
|
||||||
<module>persistence-modules/java-jdbi</module>
|
<module>persistence-modules/java-jdbi</module>
|
||||||
<module>jersey</module>
|
<module>jersey</module>
|
||||||
<module>jersey-client-rx</module>
|
|
||||||
<module>java-spi</module>
|
<module>java-spi</module>
|
||||||
<module>performance-tests</module>
|
<module>performance-tests</module>
|
||||||
<module>twilio</module>
|
<module>twilio</module>
|
||||||
|
|
|
@ -1,57 +1,75 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>spring-boot-persistence</artifactId>
|
||||||
|
<version>0.1.0</version>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>parent-boot-2</artifactId>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>spring-boot-persistence</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<relativePath>../parent-boot-2</relativePath>
|
||||||
<name>spring-boot-persistence</name>
|
</parent>
|
||||||
<description>This is a simple Spring Data Repositories test</description>
|
|
||||||
|
<dependencies>
|
||||||
<parent>
|
<dependency>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<groupId>com.baeldung</groupId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<exclusions>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<exclusion>
|
||||||
</parent>
|
<groupId>com.zaxxer</groupId>
|
||||||
|
<artifactId>HikariCP</artifactId>
|
||||||
<dependencies>
|
</exclusion>
|
||||||
<dependency>
|
</exclusions>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</dependency>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<dependency>
|
||||||
</dependency>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<dependency>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<groupId>com.h2database</groupId>
|
<scope>test</scope>
|
||||||
<artifactId>h2</artifactId>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
<dependency>
|
<groupId>org.apache.tomcat</groupId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<artifactId>tomcat-jdbc</artifactId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<version>${tomcat-jdbc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
<build>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<finalName>spring-boot-persistence</finalName>
|
<version>${mysql-connector-java.version}</version>
|
||||||
<resources>
|
</dependency>
|
||||||
<resource>
|
<dependency>
|
||||||
<directory>src/main/resources</directory>
|
<groupId>com.h2database</groupId>
|
||||||
<filtering>true</filtering>
|
<artifactId>h2</artifactId>
|
||||||
</resource>
|
<version>${h2database.version}</version>
|
||||||
</resources>
|
<scope>runtime</scope>
|
||||||
<plugins>
|
</dependency>
|
||||||
<plugin>
|
</dependencies>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<properties>
|
||||||
</plugin>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<plugin>
|
<java.version>1.8</java.version>
|
||||||
<groupId>pl.project13.maven</groupId>
|
<mysql-connector-java.version>8.0.12</mysql-connector-java.version>
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
<tomcat-jdbc.version>9.0.10</tomcat-jdbc.version>
|
||||||
<version>${git-commit-id-plugin.version}</version>
|
<h2database.version>1.4.197</h2database.version>
|
||||||
</plugin>
|
</properties>
|
||||||
</plugins>
|
|
||||||
</build>
|
<build>
|
||||||
|
<finalName>spring-boot-persistence</finalName>
|
||||||
<properties>
|
<resources>
|
||||||
<git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
|
<resource>
|
||||||
</properties>
|
<directory>src/main/resources</directory>
|
||||||
</project>
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.baeldung.tomcatconnectionpool.application;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableAutoConfiguration
|
||||||
|
@ComponentScan(basePackages={"com.baeldung.tomcatconnectionpool.application"})
|
||||||
|
@EnableJpaRepositories(basePackages="com.baeldung.tomcatconnectionpool.application.repositories")
|
||||||
|
@EnableTransactionManagement
|
||||||
|
@EntityScan(basePackages="com.baeldung.tomcatconnectionpool.application.entities")
|
||||||
|
public class SpringBootConsoleApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SpringBootConsoleApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.baeldung.tomcatconnectionpool.application.entities;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "customers")
|
||||||
|
public class Customer {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long id;
|
||||||
|
@Column(name = "first_name")
|
||||||
|
private String firstName;
|
||||||
|
@Column(name = "last_name")
|
||||||
|
private String lastName;
|
||||||
|
|
||||||
|
public Customer() {}
|
||||||
|
|
||||||
|
public Customer(String firstName, String lastName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastName(String lastName) {
|
||||||
|
this.lastName = lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstName() {
|
||||||
|
return firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstName(String firstName) {
|
||||||
|
this.firstName = firstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastName() {
|
||||||
|
return lastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + '}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.baeldung.tomcatconnectionpool.application.repositories;
|
||||||
|
|
||||||
|
import com.baeldung.tomcatconnectionpool.application.entities.Customer;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface CustomerRepository extends CrudRepository<Customer, Long> {
|
||||||
|
|
||||||
|
List<Customer> findByLastName(String lastName);
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.baeldung.tomcatconnectionpool.application.runners;
|
||||||
|
|
||||||
|
import com.baeldung.tomcatconnectionpool.application.entities.Customer;
|
||||||
|
import com.baeldung.tomcatconnectionpool.application.repositories.CustomerRepository;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class CommandLineCrudRunner implements CommandLineRunner {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CommandLineCrudRunner.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerRepository customerRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
customerRepository.save(new Customer("John", "Doe"));
|
||||||
|
customerRepository.save(new Customer("Jennifer", "Wilson"));
|
||||||
|
|
||||||
|
logger.info("Customers found with findAll():");
|
||||||
|
customerRepository.findAll().forEach(c -> logger.info(c.toString()));
|
||||||
|
|
||||||
|
logger.info("Customer found with findById(1L):");
|
||||||
|
Customer customer = customerRepository.findById(1L)
|
||||||
|
.orElseGet(() -> new Customer("Non-existing customer", ""));
|
||||||
|
logger.info(customer.toString());
|
||||||
|
|
||||||
|
logger.info("Customer found with findByLastName('Wilson'):");
|
||||||
|
customerRepository.findByLastName("Wilson").forEach(c -> {
|
||||||
|
logger.info(c.toString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,2 +1,16 @@
|
||||||
spring.jpa.show-sql=true
|
spring.datasource.tomcat.initial-size=15
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
spring.datasource.tomcat.max-wait=20000
|
||||||
|
spring.datasource.tomcat.max-active=50
|
||||||
|
spring.datasource.tomcat.max-idle=15
|
||||||
|
spring.datasource.tomcat.min-idle=8
|
||||||
|
spring.datasource.tomcat.default-auto-commit=true
|
||||||
|
spring.datasource.url=jdbc:h2:mem:test
|
||||||
|
spring.datasource.username=root
|
||||||
|
spring.datasource.password=
|
||||||
|
spring.datasource.driver-class-name=org.h2.Driver
|
||||||
|
|
||||||
|
spring.jpa.show-sql=false
|
||||||
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
|
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
|
||||||
|
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||||
|
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.baeldung.tomcatconnectionpool.test.application;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class SpringBootTomcatConnectionPoolIntegrationTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataSource dataSource;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenTomcatConnectionPoolInstance_whenCheckedPoolClassName_thenCorrect() {
|
||||||
|
assertThat(dataSource.getClass().getName()).isEqualTo("org.apache.tomcat.jdbc.pool.DataSource");
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,6 +76,49 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.inject</groupId>
|
||||||
|
<artifactId>jersey-hk2</artifactId>
|
||||||
|
<version>${jersey.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.ext.rx</groupId>
|
||||||
|
<artifactId>jersey-rx-client-rxjava</artifactId>
|
||||||
|
<version>${jersey.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.ext.rx</groupId>
|
||||||
|
<artifactId>jersey-rx-client-rxjava2</artifactId>
|
||||||
|
<version>${jersey.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tomakehurst</groupId>
|
||||||
|
<artifactId>wiremock</artifactId>
|
||||||
|
<version>1.58</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
|
<version>2.6.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.6.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
|
<version>1.7.25</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>3.10.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
@ -170,7 +213,7 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jersey.version>2.26</jersey.version>
|
<jersey.version>2.27</jersey.version>
|
||||||
<maven-war-plugin.version>3.2.0</maven-war-plugin.version>
|
<maven-war-plugin.version>3.2.0</maven-war-plugin.version>
|
||||||
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
||||||
<httpcore.version>4.4.9</httpcore.version>
|
<httpcore.version>4.4.9</httpcore.version>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.samples.jerseyrx;
|
package com.baeldung.clientrx;
|
||||||
|
|
||||||
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
Loading…
Reference in New Issue