Skip to content

Commit

Permalink
feat : polish r2dbc and upgrade postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Dec 3, 2024
1 parent 8cb9087 commit a729e0d
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion r2dbc/boot-jooq-r2dbc-sample/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'
services:

postgresqldb:
image: postgres:16.6-alpine
image: postgres:17.2-alpine
environment:
- POSTGRES_USER=appuser
- POSTGRES_PASSWORD=secret
Expand Down
4 changes: 2 additions & 2 deletions r2dbc/boot-jooq-r2dbc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
MYSQL: mysql:8.0.33
MARIADB: mariadb:10.11
-->
<containerImage>postgres:16.3-alpine</containerImage>
<containerImage>postgres:17.2-alpine</containerImage>
</database>
<flyway>
<!--
Expand Down Expand Up @@ -332,7 +332,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.25.0</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

@SpringBootApplication(exclude = {JooqAutoConfiguration.class})
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class JooqR2dbcApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(JooqR2dbcApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.jooq.r2dbc;

import com.example.jooq.r2dbc.common.ContainerConfig;
import org.springframework.boot.SpringApplication;

class TestJooqR2dbcApplication {

public static void main(String[] args) {
SpringApplication.from(JooqR2dbcApplication::main).with(ContainerConfig.class).run(args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static com.example.jooq.r2dbc.utils.AppConstants.PROFILE_TEST;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;

import com.example.jooq.r2dbc.TestApplication;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
Expand All @@ -12,7 +11,7 @@
import org.springframework.test.web.reactive.server.WebTestClient;

@ActiveProfiles({PROFILE_TEST})
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = TestApplication.class)
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = ContainerConfig.class)
@AutoConfigureWebTestClient
public abstract class AbstractIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.jooq.r2dbc;
package com.example.jooq.r2dbc.common;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
Expand All @@ -9,18 +8,14 @@
import org.testcontainers.utility.MountableFile;

@TestConfiguration(proxyBeanMethods = false)
public class TestApplication {
public class ContainerConfig {

@Bean
@ServiceConnection
PostgreSQLContainer<?> postgreSQLContainer() {
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.3-alpine"))
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:17.2-alpine"))
.withCopyFileToContainer(
MountableFile.forClasspathResource("init.sql"),
"/docker-entrypoint-initdb.d/init.sql");
}

public static void main(String[] args) {
SpringApplication.from(Application::main).with(TestApplication.class).run(args);
}
}
2 changes: 1 addition & 1 deletion r2dbc/boot-r2dbc-sample/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'
services:

postgresqldb:
image: postgres:16.6-alpine
image: postgres:17.2-alpine
hostname: postgresqldb
extra_hosts: [ 'host.docker.internal:host-gateway' ]
environment:
Expand Down
2 changes: 1 addition & 1 deletion r2dbc/boot-r2dbc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.25.0</version>
<style>AOSP</style>
</googleJavaFormat>
<importOrder/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class R2dbcApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(R2dbcApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.bootr2dbc;

import com.example.bootr2dbc.common.ContainerConfig;
import org.springframework.boot.SpringApplication;

public class TestR2dbcApplication {

public static void main(String[] args) {
SpringApplication.from(R2dbcApplication::main).with(ContainerConfig.class).run(args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static com.example.bootr2dbc.utils.AppConstants.PROFILE_TEST;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;

import com.example.bootr2dbc.TestApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -13,7 +12,7 @@
@ActiveProfiles({PROFILE_TEST})
@SpringBootTest(
webEnvironment = RANDOM_PORT,
classes = {TestApplication.class})
classes = {ContainerConfig.class})
@AutoConfigureWebTestClient
public abstract class AbstractIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package com.example.bootr2dbc;
package com.example.bootr2dbc.common;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
public class TestApplication {
public class ContainerConfig {

@Bean
@ServiceConnection
PostgreSQLContainer<?> postgreSQLContainer() {
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.3-alpine"));
}

public static void main(String[] args) {
SpringApplication.from(Application::main).with(TestApplication.class).run(args);
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:17.2-alpine"));
}
}

0 comments on commit a729e0d

Please sign in to comment.