Skip to content

Commit

Permalink
Add test application config
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-emilius committed Oct 30, 2024
1 parent 0ecfae0 commit c503d56
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@
import com.auth0.jwt.algorithms.Algorithm;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.http.MediaType;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import thesistrack.ls1.controller.payload.CreateApplicationPayload;
import thesistrack.ls1.controller.payload.CreateThesisPayload;
import thesistrack.ls1.controller.payload.ReplaceTopicPayload;
Expand All @@ -32,6 +26,7 @@
@AutoConfigureMockMvc
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Import(TestSecurityConfig.class)
@ActiveProfiles("test")
public abstract class BaseIntegrationTest {
@Autowired
private ApplicationRepository applicationRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
Expand All @@ -24,9 +25,9 @@

@TestConfiguration
@EnableWebSecurity
@EnableMethodSecurity
public class TestSecurityConfig {
@Bean
@Primary
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.cors(Customizer.withDefaults())
Expand All @@ -41,7 +42,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
}

@Bean
@Primary
public JwtDecoder jwtDecoder() {
return token -> {
var decodedJWT = JWT.decode(token);
Expand Down
69 changes: 69 additions & 0 deletions server/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
logging:
level:
liquibase: INFO
net.fortuna.ical4j.util.Configurator: INFO

spring:
datasource:
url: jdbc:postgresql://localhost:5432/thesis-track
username: thesis-track-postgres
password: thesis-track-postgres
driver-class-name: org.postgresql.Driver
liquibase:
enabled: true
change-log: db/changelog/db.changelog-master.xml
jpa:
open-in-view: true
hibernate:
ddl-auto: validate
show-sql: false
properties:
hibernate:
format_sql: false
thymeleaf:
prefix: classpath:/mail-templates/
suffix: .html
servlet:
multipart:
max-file-size: 20MB
max-request-size: 20MB
mail:
host: localhost
port: 25
properties:
mail:
transport:
protocol: smtp
smtp:
starttls:
enable: true

server:
servlet:
context-path: /api

thesis-track:
keycloak:
host: http://localhost:8081
realm-name: thesis-track
client-id: thesis-track-app
service-client:
id: thesis-track-service-client
secret: ""
student-group-name: thesis-students
calendar:
enabled: false
url: ""
username: ""
password: ""
client:
host: http://localhost:3000
mail:
enabled: false
sender: [email protected]
signature: ""
workspace-url: https://slack.com
bcc-recipients: ""
storage:
upload-location: uploads
scientific-writing-guide: ""

0 comments on commit c503d56

Please sign in to comment.