-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: speedup integration test use sharedContainer
- Loading branch information
Showing
7 changed files
with
231 additions
and
158 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...ion-test/src/test/java/com/reajason/javaweb/integration/tomcat/Tomcat10ContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.reajason.javaweb.integration.tomcat; | ||
|
||
import com.reajason.javaweb.memsell.packer.Packer; | ||
import com.reajason.javaweb.memsell.tomcat.TomcatShell; | ||
import net.bytebuddy.jar.asm.Opcodes; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* @author ReaJason | ||
* @since 2024/12/4 | ||
*/ | ||
public class Tomcat10ContainerTest extends TomcatIntegrationTest { | ||
public static final String tomcat10ImageName = "tomcat:10.1-jre11"; | ||
@Container | ||
public final static GenericContainer<?> tomcat = new GenericContainer<>(tomcat10ImageName) | ||
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war") | ||
.waitingFor(Wait.forHttp("/app")) | ||
.withExposedPorts(8080); | ||
|
||
@ParameterizedTest(name = tomcat10ImageName + "|{0}Godzilla|JSP") | ||
@ValueSource(strings = {TomcatShell.JAKARTA_FILTER, TomcatShell.JAKARTA_LISTENER, TomcatShell.JAKARTA_VALVE}) | ||
void testGodzillaJSP(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V11, Packer.INSTANCE.JSP); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat10ImageName + "|{0}Command|JSP") | ||
@ValueSource(strings = {TomcatShell.JAKARTA_FILTER, TomcatShell.JAKARTA_LISTENER, TomcatShell.JAKARTA_VALVE}) | ||
void testCommandJSP(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V11, Packer.INSTANCE.JSP); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ion-test/src/test/java/com/reajason/javaweb/integration/tomcat/Tomcat11ContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.reajason.javaweb.integration.tomcat; | ||
|
||
import com.reajason.javaweb.memsell.packer.Packer; | ||
import com.reajason.javaweb.memsell.tomcat.TomcatShell; | ||
import net.bytebuddy.jar.asm.Opcodes; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* @author ReaJason | ||
* @since 2024/12/4 | ||
*/ | ||
public class Tomcat11ContainerTest extends TomcatIntegrationTest { | ||
public static final String tomcat11ImageName = "tomcat:11.0-jre17"; | ||
@Container | ||
public final static GenericContainer<?> tomcat = new GenericContainer<>(tomcat11ImageName) | ||
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war") | ||
.waitingFor(Wait.forHttp("/app")) | ||
.withExposedPorts(8080); | ||
|
||
@ParameterizedTest(name = tomcat11ImageName + "|{0}Godzilla|JSP") | ||
@ValueSource(strings = {TomcatShell.JAKARTA_FILTER, TomcatShell.JAKARTA_LISTENER, TomcatShell.JAKARTA_VALVE}) | ||
void testGodzillaJSP(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V17, Packer.INSTANCE.JSP); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat11ImageName + "|{0}Command|JSP") | ||
@ValueSource(strings = {TomcatShell.JAKARTA_FILTER, TomcatShell.JAKARTA_LISTENER, TomcatShell.JAKARTA_VALVE}) | ||
void testCommandJSP(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V17, Packer.INSTANCE.JSP); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...tion-test/src/test/java/com/reajason/javaweb/integration/tomcat/Tomcat6ContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.reajason.javaweb.integration.tomcat; | ||
|
||
import com.reajason.javaweb.memsell.packer.Packer; | ||
import com.reajason.javaweb.memsell.tomcat.TomcatShell; | ||
import net.bytebuddy.jar.asm.Opcodes; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* @author ReaJason | ||
* @since 2024/12/4 | ||
*/ | ||
public class Tomcat6ContainerTest extends TomcatIntegrationTest { | ||
public static final String tomcat6ImageName = "reajason/tomcat:6-jdk6"; | ||
|
||
@Container | ||
public final static GenericContainer<?> tomcat = new GenericContainer<>(tomcat6ImageName) | ||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war") | ||
.waitingFor(Wait.forHttp("/app")) | ||
.withExposedPorts(8080); | ||
|
||
@ParameterizedTest(name = tomcat6ImageName + "|{0}Godzilla|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testGodzillaJSP(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V1_6, Packer.INSTANCE.JSP); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat6ImageName + "|{0}Command|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testCommandJSP(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V1_6, Packer.INSTANCE.JSP); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...tion-test/src/test/java/com/reajason/javaweb/integration/tomcat/Tomcat7ContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.reajason.javaweb.integration.tomcat; | ||
|
||
import com.reajason.javaweb.memsell.packer.Packer; | ||
import com.reajason.javaweb.memsell.tomcat.TomcatShell; | ||
import net.bytebuddy.jar.asm.Opcodes; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* @author ReaJason | ||
* @since 2024/12/4 | ||
*/ | ||
public class Tomcat7ContainerTest extends TomcatIntegrationTest { | ||
public static final String tomcat7ImageName = "tomcat:7.0.85-jre7"; | ||
@Container | ||
public final static GenericContainer<?> tomcat = new GenericContainer<>(tomcat7ImageName) | ||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war") | ||
.waitingFor(Wait.forHttp("/app")) | ||
.withExposedPorts(8080); | ||
|
||
|
||
@ParameterizedTest(name = tomcat7ImageName + "|{0}Godzilla|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testGodzillaJSP(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V1_7, Packer.INSTANCE.JSP); | ||
} | ||
|
||
|
||
@ParameterizedTest(name = tomcat7ImageName + "|{0}Command|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testCommandJSP(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V1_7, Packer.INSTANCE.JSP); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...tion-test/src/test/java/com/reajason/javaweb/integration/tomcat/Tomcat8ContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.reajason.javaweb.integration.tomcat; | ||
|
||
import com.reajason.javaweb.memsell.packer.Packer; | ||
import com.reajason.javaweb.memsell.tomcat.TomcatShell; | ||
import net.bytebuddy.jar.asm.Opcodes; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* @author ReaJason | ||
* @since 2024/12/4 | ||
*/ | ||
public class Tomcat8ContainerTest extends TomcatIntegrationTest { | ||
public static final String tomcat8ImageName = "tomcat:8-jre8"; | ||
@Container | ||
public final static GenericContainer<?> tomcat = new GenericContainer<>(tomcat8ImageName) | ||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war") | ||
.waitingFor(Wait.forHttp("/app")) | ||
.withExposedPorts(8080); | ||
|
||
@ParameterizedTest(name = tomcat8ImageName + "|{0}Godzilla|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testGodzillaJSP(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V1_8, Packer.INSTANCE.JSP); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat8ImageName + "|{0}Godzilla|JS") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testGodzillaJS(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V1_8, Packer.INSTANCE.ScriptEngine); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat8ImageName + "|{0}Command|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testCommandJSP(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V1_8, Packer.INSTANCE.JSP); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat8ImageName + "|{0}Command|JS") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testCommandJS(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V1_8, Packer.INSTANCE.ScriptEngine); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...tion-test/src/test/java/com/reajason/javaweb/integration/tomcat/Tomcat9ContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.reajason.javaweb.integration.tomcat; | ||
|
||
import com.reajason.javaweb.memsell.packer.Packer; | ||
import com.reajason.javaweb.memsell.tomcat.TomcatShell; | ||
import net.bytebuddy.jar.asm.Opcodes; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.junit.jupiter.Container; | ||
|
||
/** | ||
* @author ReaJason | ||
* @since 2024/12/4 | ||
*/ | ||
public class Tomcat9ContainerTest extends TomcatIntegrationTest { | ||
public static final String tomcat9ImageName = "tomcat:9-jre9"; | ||
@Container | ||
public final static GenericContainer<?> tomcat = new GenericContainer<>(tomcat9ImageName) | ||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war") | ||
.waitingFor(Wait.forHttp("/app")) | ||
.withExposedPorts(8080); | ||
|
||
@ParameterizedTest(name = tomcat9ImageName + "|{0}Godzilla|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testGodzillaJSP(String shellType) { | ||
testGodzillaAssertOk(getUrl(tomcat), shellType, Opcodes.V9, Packer.INSTANCE.JSP); | ||
} | ||
|
||
@ParameterizedTest(name = tomcat9ImageName + "|{0}Command|JSP") | ||
@ValueSource(strings = {TomcatShell.FILTER, TomcatShell.LISTENER, TomcatShell.VALVE}) | ||
void testCommandJSP(String shellType) { | ||
testCommandAssertOk(getUrl(tomcat), shellType, Opcodes.V9, Packer.INSTANCE.JSP); | ||
} | ||
} |
Oops, something went wrong.