Skip to content

Commit ae760b6

Browse files
committed
Add tests which exercise more complex JUnit extensions (and all fail, so all disabled)
1 parent 591eed0 commit ae760b6

File tree

63 files changed

+2094
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2094
-223
lines changed

integration-tests/gradle/src/test/java/io/quarkus/gradle/FastJarFormatWorksTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ public void testFastJarFormatWorks() throws Exception {
3131

3232
File output = new File(projectDir, "build/output.log");
3333
output.createNewFile();
34+
35+
DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
3436
Process process = launch(jar, output);
3537
try {
3638
//Wait until server up
3739
dumpFileContentOnFailure(() -> {
3840
await()
3941
.pollDelay(1, TimeUnit.SECONDS)
4042
.atMost(1, TimeUnit.MINUTES)
41-
.until(() -> DevModeTestUtils.isCode("/hello", 200));
43+
.until(() -> devModeTestUtils.isCode("/hello", 200));
4244
return null;
4345
}, output, ConditionTimeoutException.class);
4446

@@ -47,7 +49,7 @@ public void testFastJarFormatWorks() throws Exception {
4749
assertThat(logs).contains("INFO").contains("cdi, resteasy");
4850

4951
// test that the application name and version are properly set
50-
assertThat(DevModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
52+
assertThat(devModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
5153
} finally {
5254
process.destroy();
5355
}

integration-tests/gradle/src/test/java/io/quarkus/gradle/LegacyJarFormatWorksTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ public void testLegacyJarFormatWorks() throws Exception {
3131
File output = new File(projectDir, "build/output.log");
3232
output.createNewFile();
3333
Process process = launch(runnerJar, output);
34+
DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
35+
3436
try {
3537
//Wait until server up
3638
dumpFileContentOnFailure(() -> {
3739
await()
3840
.pollDelay(1, TimeUnit.SECONDS)
3941
.atMost(1, TimeUnit.MINUTES)
40-
.until(() -> DevModeTestUtils.isCode("/hello", 200));
42+
.until(() -> devModeTestUtils.isCode("/hello", 200));
4143
return null;
4244
}, output, ConditionTimeoutException.class);
4345

@@ -46,7 +48,7 @@ public void testLegacyJarFormatWorks() throws Exception {
4648
assertThat(logs).contains("INFO").contains("cdi, resteasy");
4749

4850
// test that the application name and version are properly set
49-
assertThat(DevModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
51+
assertThat(devModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
5052
} finally {
5153
process.destroy();
5254
}

integration-tests/gradle/src/test/java/io/quarkus/gradle/MultiModuleUberJarTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ public void testUberJarForMultiModule() throws Exception {
3030

3131
File output = new File(projectDir, "application/build/output.log");
3232
output.createNewFile();
33+
DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
34+
3335
Process process = launch(jar, output);
3436
try {
3537
// Wait until server up
3638
dumpFileContentOnFailure(() -> {
3739
await()
3840
.pollDelay(1, TimeUnit.SECONDS)
3941
.atMost(1, TimeUnit.MINUTES)
40-
.until(() -> DevModeTestUtils.isCode("/hello", 200));
42+
.until(() -> devModeTestUtils.isCode("/hello", 200));
4143
return null;
4244
}, output, ConditionTimeoutException.class);
4345

integration-tests/gradle/src/test/java/io/quarkus/gradle/MutableJarFormatBootsInDevModeTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ public void testFastJarFormatWorks() throws Exception {
3232

3333
File output = new File(projectDir, "build/output.log");
3434
output.createNewFile();
35+
DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
36+
3537
Process process = launch(jar, output, Collections.singletonMap("QUARKUS_LAUNCH_DEVMODE", "true"));
3638
try {
3739
//Wait until server up
3840
dumpFileContentOnFailure(() -> {
3941
await()
4042
.pollDelay(1, TimeUnit.SECONDS)
4143
.atMost(1, TimeUnit.MINUTES)
42-
.until(() -> DevModeTestUtils.isCode("/hello", 200));
44+
.until(() -> devModeTestUtils.isCode("/hello", 200));
4345
return null;
4446
}, output, ConditionTimeoutException.class);
4547

@@ -48,7 +50,7 @@ public void testFastJarFormatWorks() throws Exception {
4850
assertThat(logs).contains("INFO").contains("cdi, resteasy");
4951

5052
// test that the application name and version are properly set
51-
assertThat(DevModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
53+
assertThat(devModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
5254
} finally {
5355
process.destroy();
5456
}

integration-tests/gradle/src/test/java/io/quarkus/gradle/UberJarFormatWorksTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ public void testUberJarFormatWorks() throws Exception {
2929

3030
File output = new File(projectDir, "build/output.log");
3131
output.createNewFile();
32+
DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
33+
3234
Process process = launch(jar, output);
3335
try {
3436
// Wait until server up
3537
dumpFileContentOnFailure(() -> {
3638
await()
3739
.pollDelay(1, TimeUnit.SECONDS)
3840
.atMost(1, TimeUnit.MINUTES)
39-
.until(() -> DevModeTestUtils.isCode("/hello", 200));
41+
.until(() -> devModeTestUtils.isCode("/hello", 200));
4042
return null;
4143
}, output, ConditionTimeoutException.class);
4244

@@ -45,7 +47,7 @@ public void testUberJarFormatWorks() throws Exception {
4547
assertThat(logs).contains("INFO").contains("cdi, resteasy");
4648

4749
// test that the application name and version are properly set
48-
assertThat(DevModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
50+
assertThat(devModeTestUtils.getHttpResponse("/hello")).isEqualTo("hello");
4951
} finally {
5052
process.destroy();
5153
}

integration-tests/gradle/src/test/java/io/quarkus/gradle/devmode/QuarkusDevGradleTestBase.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public abstract class QuarkusDevGradleTestBase extends QuarkusGradleWrapperTestB
3232
private Future<?> quarkusDev;
3333
protected File projectDir;
3434

35+
protected DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
36+
3537
@Override
3638
protected void setupTestCommand() {
3739
gradleNoWatchFs(false);
@@ -69,7 +71,7 @@ public void main() throws Exception {
6971
// Kill all processes that were (indirectly) spawned by the current process.
7072
List<ProcessHandle> childProcesses = DevModeTestUtils.killDescendingProcesses();
7173

72-
DevModeTestUtils.awaitUntilServerDown();
74+
devModeTestUtils.awaitUntilServerDown();
7375

7476
// sanity: forcefully terminate left-over processes
7577
childProcesses.forEach(ProcessHandle::destroyForcibly);
@@ -151,15 +153,15 @@ protected void beforeQuarkusDev() throws Exception {
151153
protected abstract void testDevMode() throws Exception;
152154

153155
protected String getHttpResponse() {
154-
return DevModeTestUtils.getHttpResponse(getQuarkusDevBrokenReason());
156+
return devModeTestUtils.getHttpResponse(getQuarkusDevBrokenReason());
155157
}
156158

157159
protected String getHttpResponse(String path) {
158160
return getHttpResponse(path, devModeTimeoutSeconds(), TimeUnit.SECONDS);
159161
}
160162

161163
protected String getHttpResponse(String path, long timeout, TimeUnit tu) {
162-
return DevModeTestUtils.getHttpResponse(path, false, getQuarkusDevBrokenReason(), timeout, tu);
164+
return devModeTestUtils.getHttpResponse(path, false, getQuarkusDevBrokenReason(), timeout, tu);
163165
}
164166

165167
private Supplier<String> getQuarkusDevBrokenReason() {

integration-tests/gradle/src/test/java/io/quarkus/gradle/nativeimage/BasicJavaNativeBuildIT.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
public class BasicJavaNativeBuildIT extends QuarkusNativeGradleITBase {
1515

1616
public static final String NATIVE_IMAGE_NAME = "foo-1.0.0-SNAPSHOT-runner";
17+
private DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
1718

1819
@Test
1920
public void shouldBuildNativeImage() throws Exception {
@@ -33,7 +34,7 @@ public void shouldBuildNativeImage() throws Exception {
3334
assertThat(nativeImagePath).exists();
3435
Process nativeImageProcess = runNativeImage(nativeImagePath.toAbsolutePath().toString());
3536
try {
36-
final String response = DevModeTestUtils.getHttpResponse("/hello");
37+
final String response = devModeTestUtils.getHttpResponse("/hello");
3738
assertThat(response)
3839
.withFailMessage("Response %s for /hello was expected to contain the hello, but didn't", response)
3940
.contains("hello");
@@ -63,7 +64,7 @@ public void shouldBuildNativeImageWithCustomName() throws Exception {
6364
assertThat(nativeImagePath).exists();
6465
Process nativeImageProcess = runNativeImage(nativeImagePath.toAbsolutePath().toString());
6566
try {
66-
final String response = DevModeTestUtils.getHttpResponse("/hello");
67+
final String response = devModeTestUtils.getHttpResponse("/hello");
6768
assertThat(response)
6869
.withFailMessage("Response %s for /hello was expected to contain the hello, but didn't", response)
6970
.contains("hello");
@@ -93,7 +94,7 @@ public void shouldBuildNativeImageWithCustomNameWithoutSuffix() throws Exception
9394
assertThat(nativeImagePath).exists();
9495
Process nativeImageProcess = runNativeImage(nativeImagePath.toAbsolutePath().toString());
9596
try {
96-
final String response = DevModeTestUtils.getHttpResponse("/hello");
97+
final String response = devModeTestUtils.getHttpResponse("/hello");
9798
assertThat(response)
9899
.withFailMessage("Response %s for /hello was expected to contain the hello, but didn't", response)
99100
.contains("hello");

integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinDevModeIT.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.junit.jupiter.api.Test;
1414

1515
import io.quarkus.maven.it.RunAndCheckMojoTestBase;
16-
import io.quarkus.test.devmode.util.DevModeTestUtils;
1716

1817
public class KotlinDevModeIT extends RunAndCheckMojoTestBase {
1918

@@ -30,7 +29,7 @@ public void testThatTheApplicationIsReloadedOnKotlinChange() throws MavenInvocat
3029
// Wait until we get "uuid"
3130
await()
3231
.pollDelay(1, TimeUnit.SECONDS)
33-
.atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains(uuid));
32+
.atMost(1, TimeUnit.MINUTES).until(() -> devModeTestUtils.getHttpResponse("/app/hello").contains(uuid));
3433

3534
await()
3635
.pollDelay(1, TimeUnit.SECONDS)
@@ -42,7 +41,7 @@ public void testThatTheApplicationIsReloadedOnKotlinChange() throws MavenInvocat
4241
// Wait until we get "carambar"
4342
await()
4443
.pollDelay(1, TimeUnit.SECONDS)
45-
.atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("carambar"));
44+
.atMost(1, TimeUnit.MINUTES).until(() -> devModeTestUtils.getHttpResponse("/app/hello").contains("carambar"));
4645

4746
File greetingService = new File(testDir, "src/main/kotlin/org/acme/GreetingService.kt");
4847
String newUuid = UUID.randomUUID().toString();
@@ -51,7 +50,7 @@ public void testThatTheApplicationIsReloadedOnKotlinChange() throws MavenInvocat
5150
// Wait until we get "newUuid"
5251
await()
5352
.pollDelay(1, TimeUnit.SECONDS)
54-
.atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello/bean").contains(newUuid));
53+
.atMost(1, TimeUnit.MINUTES).until(() -> devModeTestUtils.getHttpResponse("/app/hello/bean").contains(newUuid));
5554
}
5655

5756
@Test
@@ -68,11 +67,11 @@ public void testThatTheApplicationIsReloadedOnKotlinChangeWithCustomCompilerArgs
6867
// Wait until we get "uuid"
6968
await()
7069
.pollDelay(1, TimeUnit.SECONDS)
71-
.atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains(uuid));
70+
.atMost(1, TimeUnit.MINUTES).until(() -> devModeTestUtils.getHttpResponse("/app/hello").contains(uuid));
7271
await()
7372
.pollDelay(1, TimeUnit.SECONDS)
7473
.atMost(1, TimeUnit.MINUTES)
75-
.until(() -> DevModeTestUtils.getHttpResponse("/graphql/schema.graphql").contains("[Banana!]!"));
74+
.until(() -> devModeTestUtils.getHttpResponse("/graphql/schema.graphql").contains("[Banana!]!"));
7675
}
7776

7877
@Test
@@ -94,7 +93,7 @@ public void testExternalKotlinReloadableArtifacts() throws Exception {
9493
await()
9594
.pollDelay(100, TimeUnit.MILLISECONDS)
9695
.atMost(1, TimeUnit.MINUTES)
97-
.until(() -> DevModeTestUtils.getHttpResponse("/hello").contains("Hello"));
96+
.until(() -> devModeTestUtils.getHttpResponse("/hello").contains("Hello"));
9897

9998
final File greetingKotlin = externalJarDir.toPath().resolve("src").resolve("main")
10099
.resolve("kotlin").resolve("org").resolve("acme").resolve("lib")
@@ -117,7 +116,7 @@ public void testExternalKotlinReloadableArtifacts() throws Exception {
117116
await()
118117
.pollDelay(100, TimeUnit.MILLISECONDS)
119118
.atMost(1, TimeUnit.MINUTES)
120-
.until(() -> DevModeTestUtils.getHttpResponse("/hello").contains("Bonjour"));
119+
.until(() -> devModeTestUtils.getHttpResponse("/hello").contains("Bonjour"));
121120

122121
// Change bonjour() method content in Greeting.kt
123122
filter(greetingKotlin, Map.of("Bonjour", "Bonjour!"));
@@ -129,6 +128,6 @@ public void testExternalKotlinReloadableArtifacts() throws Exception {
129128
await()
130129
.pollDelay(100, TimeUnit.MILLISECONDS)
131130
.atMost(1, TimeUnit.MINUTES)
132-
.until(() -> DevModeTestUtils.getHttpResponse("/hello").contains("BONJOUR!"));
131+
.until(() -> devModeTestUtils.getHttpResponse("/hello").contains("BONJOUR!"));
133132
}
134133
}

integration-tests/kotlin/src/test/java/io/quarkus/kotlin/maven/it/KotlinRemoteDevModeIT.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.junit.jupiter.api.Test;
1313

1414
import io.quarkus.maven.it.RunAndCheckWithAgentMojoTestBase;
15-
import io.quarkus.test.devmode.util.DevModeTestUtils;
1615

1716
public class KotlinRemoteDevModeIT extends RunAndCheckWithAgentMojoTestBase {
1817

@@ -31,7 +30,7 @@ public void testThatTheApplicationIsReloadedOnKotlinChange()
3130
// Wait until we get "uuid"
3231
await()
3332
.pollDelay(1, TimeUnit.SECONDS)
34-
.atMost(3, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains(uuid));
33+
.atMost(3, TimeUnit.MINUTES).until(() -> devModeTestUtils.getHttpResponse("/app/hello").contains(uuid));
3534

3635
await()
3736
.pollDelay(1, TimeUnit.SECONDS)
@@ -43,6 +42,6 @@ public void testThatTheApplicationIsReloadedOnKotlinChange()
4342
// Wait until we get "carambar"
4443
await()
4544
.pollDelay(1, TimeUnit.SECONDS)
46-
.atMost(3, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("carambar"));
45+
.atMost(3, TimeUnit.MINUTES).until(() -> devModeTestUtils.getHttpResponse("/app/hello").contains("carambar"));
4746
}
4847
}

integration-tests/maven/src/test/java/io/quarkus/maven/it/BuildIT.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
@DisableForNative
2929
class BuildIT extends MojoTestBase {
3030

31+
private DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
32+
3133
private RunningInvoker running;
3234
private File testDir;
3335

@@ -206,7 +208,7 @@ private void launch(TestContext context, String path, File testDir, String outpu
206208
List.of())
207209
.start();
208210
try {
209-
Assertions.assertEquals(expectedMessage, DevModeTestUtils.getHttpResponse(path));
211+
Assertions.assertEquals(expectedMessage, devModeTestUtils.getHttpResponse(path));
210212
} finally {
211213
process.destroy();
212214
}

integration-tests/maven/src/test/java/io/quarkus/maven/it/CodeGenIT.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import io.quarkus.maven.it.verifier.MavenProcessInvocationResult;
1515
import io.quarkus.maven.it.verifier.RunningInvoker;
16-
import io.quarkus.test.devmode.util.DevModeTestUtils;
1716

1817
/**
1918
* <p>
@@ -28,7 +27,7 @@ public class CodeGenIT extends RunAndCheckMojoTestBase {
2827
public void shouldCompileAndRunWithCodegenEnabled() throws MavenInvocationException, FileNotFoundException {
2928
testDir = initProject("projects/proto-gen");
3029
run(true);
31-
assertThat(DevModeTestUtils.getHttpResponse("/hello")).isEqualTo("Hello, World!");
30+
assertThat(devModeTestUtils.getHttpResponse("/hello")).isEqualTo("Hello, World!");
3231
}
3332

3433
@Test

integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
@DisableForNative
5050
public class CreateProjectMojoIT extends QuarkusPlatformAwareMojoTestBase {
5151

52+
private DevModeTestUtils devModeTestUtils = new DevModeTestUtils();
53+
5254
private Invoker invoker;
5355
private RunningInvoker running;
5456
private File testDir;
@@ -588,13 +590,13 @@ public void generateNewProjectAndRun() throws Exception {
588590
mvnRunProps.setProperty("debug", "false");
589591
running.execute(Arrays.asList("compile", "quarkus:dev"), Collections.emptyMap(), mvnRunProps);
590592

591-
String resp = DevModeTestUtils.getHttpResponse();
593+
String resp = devModeTestUtils.getHttpResponse();
592594

593595
assertThat(resp).containsIgnoringCase("Congratulations!").containsIgnoringCase("application")
594596
.containsIgnoringCase("org.acme")
595597
.containsIgnoringCase("1.0.0-SNAPSHOT");
596598

597-
String greeting = DevModeTestUtils.getHttpResponse("/hello");
599+
String greeting = devModeTestUtils.getHttpResponse("/hello");
598600
assertThat(greeting).containsIgnoringCase("hello");
599601
}
600602

0 commit comments

Comments
 (0)