Skip to content

Commit 8a615ff

Browse files
author
Omur
committed
convert to h2
1 parent 404bad5 commit 8a615ff

File tree

4 files changed

+76
-65
lines changed

4 files changed

+76
-65
lines changed

jdk_21_maven/cs/rest-gui/webgoat/pom.xml

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@
410410
<artifactId>spring-boot-properties-migrator</artifactId>
411411
<scope>runtime</scope>
412412
</dependency>
413+
<dependency>
414+
<groupId>com.h2database</groupId>
415+
<artifactId>h2</artifactId>
416+
<version>1.4.195</version>
417+
</dependency>
413418
</dependencies>
414419

415420
<repositories>
@@ -666,68 +671,69 @@
666671
</execution>
667672
</executions>
668673
</plugin>
669-
<plugin>
670-
<groupId>org.honton.chas</groupId>
671-
<artifactId>process-exec-maven-plugin</artifactId>
672-
<version>0.9.2</version>
673-
<executions>
674-
<execution>
675-
<id>start-jar</id>
676-
<goals>
677-
<goal>start</goal>
678-
</goals>
679-
<phase>pre-integration-test</phase>
674+
<!-- MODIFIED because of flakiness on the MACOS (failed: Process was not healthy even after 60 seconds) -->
675+
<!-- <plugin>-->
676+
<!-- <groupId>org.honton.chas</groupId>-->
677+
<!-- <artifactId>process-exec-maven-plugin</artifactId>-->
678+
<!-- <version>0.9.2</version>-->
679+
<!-- <executions>-->
680+
<!-- <execution>-->
681+
<!-- <id>start-jar</id>-->
682+
<!-- <goals>-->
683+
<!-- <goal>start</goal>-->
684+
<!-- </goals>-->
685+
<!-- <phase>pre-integration-test</phase>-->
680686

681-
<configuration>
682-
<workingDir>${project.build.directory}</workingDir>
683-
<environment>
684-
<WEBGOAT_SSLENABLED>${webgoat.sslenabled}</WEBGOAT_SSLENABLED>
685-
<WEBGOAT_HOST>127.0.0.1</WEBGOAT_HOST>
686-
<WEBGOAT_PORT>${webgoat.port}</WEBGOAT_PORT>
687-
<WEBGOAT_CONTEXT>${webgoat.context}</WEBGOAT_CONTEXT>
688-
<WEBWOLF_HOST>127.0.0.1</WEBWOLF_HOST>
689-
<WEBWOLF_PORT>${webwolf.port}</WEBWOLF_PORT>
690-
<WEBWOLF_CONTEXT>${webwolf.context}</WEBWOLF_CONTEXT>
691-
</environment>
692-
<arguments>
693-
<argument>java</argument>
694-
<argument>-jar</argument>
695-
<argument>-Dlogging.pattern.console=</argument>
696-
<argument>-Dwebgoat.server.directory=${java.io.tmpdir}/webgoat_${webgoat.port}</argument>
697-
<argument>-Dwebgoat.user.directory=${java.io.tmpdir}/webgoat_${webgoat.port}</argument>
698-
<argument>-Dspring.main.banner-mode=off</argument>
699-
<argument>--add-opens</argument>
700-
<argument>java.base/java.lang=ALL-UNNAMED</argument>
701-
<argument>--add-opens</argument>
702-
<argument>java.base/java.util=ALL-UNNAMED</argument>
703-
<argument>--add-opens</argument>
704-
<argument>java.base/java.lang.reflect=ALL-UNNAMED</argument>
705-
<argument>--add-opens</argument>
706-
<argument>java.desktop/java.beans=ALL-UNNAMED</argument>
707-
<argument>--add-opens</argument>
708-
<argument>java.base/sun.nio.ch=ALL-UNNAMED</argument>
709-
<argument>--add-opens</argument>
710-
<argument>java.base/java.io=ALL-UNNAMED</argument>
711-
<argument>--add-opens</argument>
712-
<argument>java.base/java.util=ALL-UNNAMED</argument>
713-
<!-- MODIFIED-->
714-
<argument>${project.build.directory}/webgoat-sut.jar</argument>
715-
<!-- MODIFIED-->
716-
</arguments>
717-
<waitForInterrupt>false</waitForInterrupt>
718-
<waitAfterLaunch>${waittimeForServerStart}</waitAfterLaunch>
719-
<healthCheckUrl>http://127.0.0.1:${webgoat.port}${webgoat.context}login</healthCheckUrl>
720-
</configuration>
721-
</execution>
722-
<execution>
723-
<id>stop-jar-process</id>
724-
<goals>
725-
<goal>stop-all</goal>
726-
</goals>
727-
<phase>post-integration-test</phase>
728-
</execution>
729-
</executions>
730-
</plugin>
687+
<!-- <configuration>-->
688+
<!-- <workingDir>${project.build.directory}</workingDir>-->
689+
<!-- <environment>-->
690+
<!-- <WEBGOAT_SSLENABLED>${webgoat.sslenabled}</WEBGOAT_SSLENABLED>-->
691+
<!-- <WEBGOAT_HOST>127.0.0.1</WEBGOAT_HOST>-->
692+
<!-- <WEBGOAT_PORT>${webgoat.port}</WEBGOAT_PORT>-->
693+
<!-- <WEBGOAT_CONTEXT>${webgoat.context}</WEBGOAT_CONTEXT>-->
694+
<!-- <WEBWOLF_HOST>127.0.0.1</WEBWOLF_HOST>-->
695+
<!-- <WEBWOLF_PORT>${webwolf.port}</WEBWOLF_PORT>-->
696+
<!-- <WEBWOLF_CONTEXT>${webwolf.context}</WEBWOLF_CONTEXT>-->
697+
<!-- </environment>-->
698+
<!-- <arguments>-->
699+
<!-- <argument>java</argument>-->
700+
<!-- <argument>-jar</argument>-->
701+
<!-- <argument>-Dlogging.pattern.console=</argument>-->
702+
<!-- <argument>-Dwebgoat.server.directory=${java.io.tmpdir}/webgoat_${webgoat.port}</argument>-->
703+
<!-- <argument>-Dwebgoat.user.directory=${java.io.tmpdir}/webgoat_${webgoat.port}</argument>-->
704+
<!-- <argument>-Dspring.main.banner-mode=off</argument>-->
705+
<!-- <argument>&#45;&#45;add-opens</argument>-->
706+
<!-- <argument>java.base/java.lang=ALL-UNNAMED</argument>-->
707+
<!-- <argument>&#45;&#45;add-opens</argument>-->
708+
<!-- <argument>java.base/java.util=ALL-UNNAMED</argument>-->
709+
<!-- <argument>&#45;&#45;add-opens</argument>-->
710+
<!-- <argument>java.base/java.lang.reflect=ALL-UNNAMED</argument>-->
711+
<!-- <argument>&#45;&#45;add-opens</argument>-->
712+
<!-- <argument>java.desktop/java.beans=ALL-UNNAMED</argument>-->
713+
<!-- <argument>&#45;&#45;add-opens</argument>-->
714+
<!-- <argument>java.base/sun.nio.ch=ALL-UNNAMED</argument>-->
715+
<!-- <argument>&#45;&#45;add-opens</argument>-->
716+
<!-- <argument>java.base/java.io=ALL-UNNAMED</argument>-->
717+
<!-- <argument>&#45;&#45;add-opens</argument>-->
718+
<!-- <argument>java.base/java.util=ALL-UNNAMED</argument>-->
719+
<!-- &lt;!&ndash; MODIFIED&ndash;&gt;-->
720+
<!-- <argument>${project.build.directory}/webgoat-sut.jar</argument>-->
721+
<!-- &lt;!&ndash; MODIFIED&ndash;&gt;-->
722+
<!-- </arguments>-->
723+
<!-- <waitForInterrupt>false</waitForInterrupt>-->
724+
<!-- <waitAfterLaunch>${waittimeForServerStart}</waitAfterLaunch>-->
725+
<!-- <healthCheckUrl>http://127.0.0.1:${webgoat.port}${webgoat.context}login</healthCheckUrl>-->
726+
<!-- </configuration>-->
727+
<!-- </execution>-->
728+
<!-- <execution>-->
729+
<!-- <id>stop-jar-process</id>-->
730+
<!-- <goals>-->
731+
<!-- <goal>stop-all</goal>-->
732+
<!-- </goals>-->
733+
<!-- <phase>post-integration-test</phase>-->
734+
<!-- </execution>-->
735+
<!-- </executions>-->
736+
<!-- </plugin>-->
731737
</plugins>
732738
</build>
733739
</profile>

jdk_21_maven/em/embedded/rest-gui/webgoat/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
<artifactId>jackson-datatype-jsr310</artifactId>
3131
<version>2.17.0</version>
3232
</dependency>
33+
<dependency>
34+
<groupId>com.h2database</groupId>
35+
<artifactId>h2</artifactId>
36+
<version>1.4.195</version>
37+
</dependency>
3338
</dependencies>
3439

3540

jdk_21_maven/em/embedded/rest-gui/webgoat/src/main/java/em/embedded/webgoat/EmbeddedEvoMasterController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public String startSut() {
6060
app.main(new String[]{
6161
"--server.port=0",
6262
"--spring.profiles.active=dev",
63+
"--spring.datasource.driver-class-name=org.h2.Driver",
64+
"--spring.datasource.url=jdbc:h2:mem:testdb;INIT=CREATE SCHEMA IF NOT EXISTS CONTAINER;DB_CLOSE_DELAY=-1;",
65+
"--spring.jpa.database-platform=org.hibernate.dialect.H2Dialect",
6366
"--spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true",
6467
"--spring.datasource.username=sa",
6568
"--spring.datasource.password",
@@ -83,7 +86,7 @@ public String startSut() {
8386
} catch (SQLException e) {
8487
e.printStackTrace();
8588
}
86-
dbSpecification = Arrays.asList(new DbSpecification(DatabaseType.OTHER, sqlConnection)
89+
dbSpecification = Arrays.asList(new DbSpecification(DatabaseType.H2, sqlConnection)
8790
.withInitSqlOnResourcePath("/data.sql"));
8891

8992

jdk_21_maven/em/embedded/rest-gui/webgoat/src/main/resources/data.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
TRUNCATE SCHEMA CONTAINER AND COMMIT
2-
3-
41
INSERT INTO CONTAINER.WEB_GOAT_USER (PASSWORD, ROLE, USERNAME) VALUES ('testuser', 'WEBGOAT_USER', 'testuser');
52
INSERT INTO CONTAINER.WEB_GOAT_USER (PASSWORD, ROLE, USERNAME) VALUES ('testuser', 'WEBGOAT_USER', 'testuser2');
63

0 commit comments

Comments
 (0)