Skip to content

Commit

Permalink
feat : enable cache & devcontainers (#120)
Browse files Browse the repository at this point in the history
* feat : enable cache & devcontainers

* feat : update versions
  • Loading branch information
rajadilipkolli authored Sep 3, 2024
1 parent cd47d4a commit 73b23e1
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 37 deletions.
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "Java",
"image": "mcr.microsoft.com/devcontainers/java:21",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "false"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
},
"ghcr.io/devcontainers/features/docker-from-docker:1": {},
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"vscjava.vscode-java-pack",
"vmware.vscode-boot-dev-pack",
"vscjava.vscode-lombok",
"vscjava.vscode-gradle"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "java -version"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:

postgresqldb:
image: postgres:16.4-alpine
image: postgres:15.6-alpine
hostname: postgresqldb
container_name: postgresqldb
extra_hosts: [ 'host.docker.internal:host-gateway' ]
Expand Down
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,63 +63,63 @@
"vaadin": {
"dependencies": {
"@polymer/polymer": "3.5.1",
"@vaadin/bundles": "24.4.5",
"@vaadin/bundles": "24.4.7",
"@vaadin/common-frontend": "0.0.19",
"@vaadin/hilla-file-router": "24.4.6",
"@vaadin/hilla-frontend": "24.4.6",
"@vaadin/hilla-lit-form": "24.4.6",
"@vaadin/hilla-react-auth": "24.4.6",
"@vaadin/hilla-react-crud": "24.4.6",
"@vaadin/hilla-react-form": "24.4.6",
"@vaadin/hilla-react-i18n": "24.4.6",
"@vaadin/hilla-react-signals": "24.4.6",
"@vaadin/polymer-legacy-adapter": "24.4.5",
"@vaadin/hilla-file-router": "24.4.7",
"@vaadin/hilla-frontend": "24.4.7",
"@vaadin/hilla-lit-form": "24.4.7",
"@vaadin/hilla-react-auth": "24.4.7",
"@vaadin/hilla-react-crud": "24.4.7",
"@vaadin/hilla-react-form": "24.4.7",
"@vaadin/hilla-react-i18n": "24.4.7",
"@vaadin/hilla-react-signals": "24.4.7",
"@vaadin/polymer-legacy-adapter": "24.4.7",
"@vaadin/react-components": "24.4.5",
"@vaadin/react-components-pro": "24.4.4",
"@vaadin/router": "1.7.5",
"@vaadin/vaadin-development-mode-detector": "2.0.7",
"@vaadin/vaadin-lumo-styles": "24.4.5",
"@vaadin/vaadin-material-styles": "24.4.5",
"@vaadin/vaadin-themable-mixin": "24.4.5",
"@vaadin/vaadin-lumo-styles": "24.4.7",
"@vaadin/vaadin-material-styles": "24.4.7",
"@vaadin/vaadin-themable-mixin": "24.4.7",
"@vaadin/vaadin-usage-statistics": "2.1.2",
"construct-style-sheets-polyfill": "3.1.0",
"date-fns": "2.29.3",
"lit": "3.1.4",
"proj4": "2.11.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "6.23.1"
"react-router-dom": "6.26.1"
},
"devDependencies": {
"@babel/preset-react": "7.24.7",
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@types/react": "18.3.3",
"@types/react": "18.3.4",
"@types/react-dom": "18.3.0",
"@vaadin/hilla-generator-cli": "24.4.6",
"@vaadin/hilla-generator-core": "24.4.6",
"@vaadin/hilla-generator-plugin-backbone": "24.4.6",
"@vaadin/hilla-generator-plugin-barrel": "24.4.6",
"@vaadin/hilla-generator-plugin-client": "24.4.6",
"@vaadin/hilla-generator-plugin-model": "24.4.6",
"@vaadin/hilla-generator-plugin-push": "24.4.6",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.6",
"@vaadin/hilla-generator-utils": "24.4.6",
"@vaadin/hilla-generator-cli": "24.4.7",
"@vaadin/hilla-generator-core": "24.4.7",
"@vaadin/hilla-generator-plugin-backbone": "24.4.7",
"@vaadin/hilla-generator-plugin-barrel": "24.4.7",
"@vaadin/hilla-generator-plugin-client": "24.4.7",
"@vaadin/hilla-generator-plugin-model": "24.4.7",
"@vaadin/hilla-generator-plugin-push": "24.4.7",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.7",
"@vaadin/hilla-generator-utils": "24.4.7",
"@vitejs/plugin-react": "4.3.1",
"async": "3.2.5",
"glob": "10.4.1",
"async": "3.2.6",
"glob": "10.4.5",
"rollup-plugin-brotli": "3.1.0",
"rollup-plugin-visualizer": "5.12.0",
"strip-css-comments": "5.0.0",
"transform-ast": "2.4.4",
"typescript": "5.4.5",
"vite": "5.3.3",
"vite": "5.4.2",
"vite-plugin-checker": "0.6.4",
"workbox-build": "7.1.1",
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"hash": "9dc69ac3f9e3cdeab046131f0c0f21205ed27d79d52eff4c281f47f16eb68cc9"
"hash": "c00bef5ab041c72d3dc8f966da0b3fd5fda74440a353c1c87797fa835d111769"
},
"overrides": {
"@vaadin/bundles": "$@vaadin/bundles",
Expand Down
41 changes: 38 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<java.version>21</java.version>
<vaadin.version>24.4.11</vaadin.version>
<spring-modulith.version>1.2.3</spring-modulith.version>
<spring-modulith.version>1.3.0-M2</spring-modulith.version>
<org.mapstruct.version>1.6.0</org.mapstruct.version>

<spotless.version>2.43.0</spotless.version>
Expand All @@ -21,7 +21,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.3</version>
<version>3.4.0-M2</version>
</parent>

<dependencyManagement>
Expand Down Expand Up @@ -79,6 +79,14 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -133,6 +141,12 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.redis.testcontainers</groupId>
<artifactId>testcontainers-redis</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -178,7 +192,7 @@
<configuration>
<java>
<palantirJavaFormat>
<version>2.49.0</version>
<version>2.50.0</version>
</palantirJavaFormat>
<importOrder/>
<removeUnusedImports/>
Expand Down Expand Up @@ -232,4 +246,25 @@
</build>
</profile>
</profiles>

<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import java.util.List;
import org.springframework.boot.web.client.RestClientCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.client.RestClient;

@Configuration(proxyBeanMethods = false)
@EnableCaching
public class RestClientConfiguration {

@Bean
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/example/application/TestApplication.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.example.application;

import com.example.application.common.RedisContainersConfig;
import com.example.application.common.SQLContainersConfig;
import org.springframework.boot.SpringApplication;

class TestApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main)
.with(SQLContainersConfig.class)
.with(SQLContainersConfig.class, RedisContainersConfig.class)
.run(args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.springframework.test.web.servlet.MockMvc;

@ActiveProfiles({"supabase"})
@SpringBootTest(webEnvironment = RANDOM_PORT)
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = RedisContainersConfig.class)
@AutoConfigureMockMvc
public abstract class AbstractIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.application.common;

import com.redis.testcontainers.RedisStackContainer;
import org.springframework.boot.devtools.restart.RestartScope;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;

@TestConfiguration(proxyBeanMethods = false)
public class RedisContainersConfig {

@Bean
@ServiceConnection(name = "redis")
@RestartScope
RedisStackContainer redisStackContainer() {
return new RedisStackContainer(RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(RedisStackContainer.DEFAULT_TAG));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public class SQLContainersConfig {
@ServiceConnection
@RestartScope
PostgreSQLContainer<?> postgreSQLContainer() {
return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.4-alpine"));
return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("15.6-alpine"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

@WebMvcTest(controllers = NAVController.class)
Expand All @@ -19,7 +19,7 @@ class NavControllerTest {
@Autowired
private MockMvc mockMvc;

@MockBean
@MockitoBean
private MFSchemeNavService navService;

@Test
Expand Down

0 comments on commit 73b23e1

Please sign in to comment.