diff --git a/pipeline/.gitignore b/pipeline/.gitignore index c9771109..451b6983 100644 --- a/pipeline/.gitignore +++ b/pipeline/.gitignore @@ -33,4 +33,7 @@ build/ .vscode/* ## Don't Ignore Templates -!.vscode/*.template \ No newline at end of file +!.vscode/*.template + +### SQLite local dev database ### +*.db \ No newline at end of file diff --git a/pipeline/.vscode/launch.json.template b/pipeline/.vscode/launch.json.template index d0ae26c1..811969ca 100644 --- a/pipeline/.vscode/launch.json.template +++ b/pipeline/.vscode/launch.json.template @@ -9,7 +9,7 @@ "projectName": "pipeline", "console": "internalConsole", "env": { - "SPRING_PROFILES_ACTIVE": "default,h2InMemory" + "SPRING_PROFILES_ACTIVE": "default,sqlite" } }, { @@ -20,7 +20,7 @@ "projectName": "pipeline", "console": "internalConsole", "env": { - "SPRING_PROFILES_ACTIVE": "basicAuth,h2InMemory" + "SPRING_PROFILES_ACTIVE": "basicAuth,sqlite" } } ] diff --git a/pipeline/pom.xml b/pipeline/pom.xml index b6abdaf0..64c606af 100644 --- a/pipeline/pom.xml +++ b/pipeline/pom.xml @@ -50,10 +50,15 @@ - com.h2database - h2 + org.xerial + sqlite-jdbc + 3.47.2.0 runtime + + org.hibernate.orm + hibernate-community-dialects + org.projectlombok lombok @@ -318,7 +323,7 @@ default - h2InMemory + sqlite diff --git a/pipeline/src/main/resources/application-test.yaml b/pipeline/src/main/resources/application-test.yaml index 89a9863a..b0d26a6e 100644 --- a/pipeline/src/main/resources/application-test.yaml +++ b/pipeline/src/main/resources/application-test.yaml @@ -2,26 +2,23 @@ spring: datasource: - url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - driverClassName: org.h2.Driver - username: sa + url: jdbc:sqlite:file::memory:?cache=shared + driver-class-name: org.sqlite.JDBC + username: password: - + jpa: hibernate: ddl-auto: create-drop show-sql: false - database-platform: org.hibernate.dialect.H2Dialect - - h2: - console: - enabled: true - path: /h2-console + database-platform: org.hibernate.community.dialect.SQLiteDialect - autoconfigure: - exclude: - - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration - - org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration + security: + oauth2: + resourceserver: + jwt: + issuer-uri: https://mock-issuer.test + jwk-set-uri: https://mock-jwk-set-uri.test feature-flags: provider: diff --git a/pipeline/src/main/resources/application.yaml b/pipeline/src/main/resources/application.yaml index fee52c16..1a135b87 100644 --- a/pipeline/src/main/resources/application.yaml +++ b/pipeline/src/main/resources/application.yaml @@ -23,20 +23,16 @@ spring: spring: config: activate: - on-profile: h2InMemory + on-profile: sqlite datasource: - url: jdbc:h2:mem:mydb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - driverClassName: org.h2.Driver - username: sa + url: jdbc:sqlite:./pipeline.db + driver-class-name: org.sqlite.JDBC + username: password: jpa: hibernate: ddl-auto: update show-sql: false - database-platform: org.hibernate.dialect.H2Dialect - h2: - console: - enabled: true - path: /h2-console + database-platform: org.hibernate.community.dialect.SQLiteDialect diff --git a/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java b/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java index 011d3aa3..ab60fa52 100644 --- a/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java +++ b/pipeline/src/test/java/com/autobuild/pipeline/integrationtest/security/SecurityConfigTest.java @@ -9,7 +9,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; @@ -29,16 +28,7 @@ */ @SpringBootTest @AutoConfigureMockMvc -@ActiveProfiles("demo") -@TestPropertySource(properties = { - "spring.security.oauth2.resourceserver.jwt.issuer-uri=https://mock-issuer.test", - "spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://mock-jwk-set-uri.test", - "spring.datasource.url=jdbc:h2:mem:testdb", - "spring.datasource.driverClassName=org.h2.Driver", - "spring.datasource.username=sa", - "spring.datasource.password=", - "spring.jpa.hibernate.ddl-auto=create-drop" -}) +@ActiveProfiles("test") class SecurityConfigTest { @Autowired