Skip to content

Commit 02d2f03

Browse files
committed
working on familie-tilbake
1 parent 97e3f88 commit 02d2f03

4 files changed

Lines changed: 19 additions & 76 deletions

File tree

jdk_17_maven/cs/rest/familie-tilbake/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>3.1.4</version>
14+
<!-- <version>3.1.4</version>-->
15+
<!-- see https://stackoverflow.com/questions/74946784/java-lang-classnotfoundexception-jakarta-servlet-http-httpsessioncontext-with-s-->
16+
<version>3.2.0</version>
1517
<relativePath/> <!-- lookup parent from repository -->
1618
</parent>
1719

@@ -465,6 +467,8 @@
465467
<artifactId>spring-boot-maven-plugin</artifactId>
466468
<configuration>
467469
<mainClass>${main-class}</mainClass>
470+
<finalName>familie-tilbake</finalName>
471+
<classifier>sut</classifier>
468472
</configuration>
469473
<executions>
470474
<execution>

jdk_17_maven/em/embedded/rest/familie-tilbake/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<dependency>
1818
<groupId>org.springframework.boot</groupId>
1919
<artifactId>spring-boot-dependencies</artifactId>
20-
<version>3.1.4</version>
20+
<version>3.2.0</version>
2121
<type>pom</type>
2222
<scope>import</scope>
2323
</dependency>

jdk_17_maven/em/embedded/rest/familie-tilbake/src/main/java/em/embedded/familie/tilbake/EmbeddedEvoMasterController.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
import org.testcontainers.containers.GenericContainer;
1717

1818
import java.sql.Connection;
19+
import java.sql.DriverManager;
1920
import java.sql.SQLException;
2021
import java.util.Arrays;
22+
import java.util.Collections;
2123
import java.util.List;
2224
import java.util.Map;
2325

@@ -33,6 +35,7 @@ public class EmbeddedEvoMasterController extends EmbeddedSutController {
3335
.withEnv("POSTGRES_PASSWORD", POSTGRES_PASSWORD)
3436
.withEnv("POSTGRES_HOST_AUTH_METHOD", "trust") //to allow all connections without a password
3537
.withEnv("POSTGRES_DB", "familietilbake")
38+
.withTmpFs(Collections.singletonMap("/var/lib/postgresql/data", "rw"))
3639
.withExposedPorts(POSTGRES_PORT);
3740

3841
private ConfigurableApplicationContext ctx;
@@ -62,7 +65,7 @@ public static void main(String[] args) {
6265

6366
@Override
6467
public boolean isSutRunning() {
65-
return ctx.isRunning();
68+
return ctx!=null && ctx.isRunning();
6669
}
6770

6871
@Override
@@ -78,7 +81,7 @@ public List<AuthenticationDto> getInfoForAuthentication() {
7881
@Override
7982
public ProblemInfo getProblemInfo() {
8083
return new RestProblem(
81-
"http://localhost:" + getSutPort() + "/assets/swagger.json",
84+
"http://localhost:" + getSutPort() + "/v3/api-docs",
8285
null
8386
);
8487
}
@@ -94,8 +97,9 @@ public String startSut() {
9497

9598
String postgresURL = "jdbc:postgresql://" + postgresContainer.getHost() + ":" + postgresContainer.getMappedPort(POSTGRES_PORT) + "/familietilbake";
9699

97-
System.setProperty("AZURE_OPENID_CONFIG_TOKEN_ENDPOINT", "http://localhost:8080/");
98-
System.setProperty("UNLEASH_SERVER_API_URL", "http://localhost:8080/");
100+
System.setProperty("AZURE_APP_WELL_KNOWN_URL", "http://azure:8080/");
101+
System.setProperty("AZURE_OPENID_CONFIG_TOKEN_ENDPOINT", "http://foo:8080/");
102+
System.setProperty("UNLEASH_SERVER_API_URL", "http://bar:8080/");
99103
System.setProperty("UNLEASH_SERVER_API_TOKEN", "71c722758740d43341c295ffdc237bd3");
100104
System.setProperty("NAIS_APP_NAME", "familietilbake");
101105
System.setProperty("NAIS_CLUSTER_NAME", "dev-gcp");
@@ -112,14 +116,10 @@ public String startSut() {
112116
"--sentry.logging.enabled=false",
113117
"--sentry.environment=local",
114118
"--logging.level.root=OFF",
115-
"--logback.configurationFile=src/main/resources/logback.xml",
116-
"--logging.level.org.springframework=OFF",
117-
"--spring.main.web-application-type=none"
119+
"--logging.config=classpath:logback-spring.xml",
120+
"--logging.level.org.springframework=INFO"
118121
});
119122

120-
// https://www.baeldung.com/spring-boot-application-context-exception
121-
// spring.main.web-application-type=none
122-
123123
if (sqlConnection != null) {
124124
try {
125125
sqlConnection.close();
@@ -128,8 +128,8 @@ public String startSut() {
128128
}
129129
}
130130

131-
JdbcTemplate jdbc = ctx.getBean(JdbcTemplate.class);try {
132-
sqlConnection = jdbc.getDataSource().getConnection();
131+
try {
132+
sqlConnection = DriverManager.getConnection(postgresURL, "postgres", POSTGRES_PASSWORD);
133133
} catch (SQLException e) {
134134
throw new RuntimeException(e);
135135
}
@@ -148,13 +148,11 @@ protected int getSutPort() {
148148
@Override
149149
public void stopSut() {
150150
postgresContainer.stop();
151-
ctx.stop();
151+
if(ctx!=null) ctx.stop();
152152
}
153153

154154
@Override
155155
public void resetStateOfSUT() {
156-
// TODO: check and see for any necessary steps required
157-
DbCleaner.clearDatabase(sqlConnection, List.of(), DatabaseType.POSTGRES);
158156
}
159157

160158
@Override

jdk_17_maven/em/embedded/rest/familie-tilbake/src/main/resources/logback.xml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)