Skip to content

Commit b850e90

Browse files
Add tests which exercise more complex JUnit extensions (and all fail, so all disabled)
Co-Authored-By: Alexey Loubyansky <[email protected]>
1 parent 772d5e1 commit b850e90

File tree

66 files changed

+2117
-246
lines changed

Some content is hidden

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

66 files changed

+2117
-246
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.awaitility.core.ConditionTimeoutException;
1414
import org.junit.jupiter.api.Test;
1515

16-
import io.quarkus.test.devmode.util.DevModeTestUtils;
16+
import io.quarkus.test.devmode.util.DevModeClient;
1717

1818
public class FastJarFormatWorksTest extends QuarkusGradleWrapperTestBase {
1919

@@ -31,14 +31,16 @@ public void testFastJarFormatWorks() throws Exception {
3131

3232
File output = new File(projectDir, "build/output.log");
3333
output.createNewFile();
34+
35+
DevModeClient devModeClient = new DevModeClient();
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(() -> devModeClient.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(devModeClient.getHttpResponse("/hello")).isEqualTo("hello");
5153
} finally {
5254
process.destroy();
5355
}

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.awaitility.core.ConditionTimeoutException;
1414
import org.junit.jupiter.api.Test;
1515

16-
import io.quarkus.test.devmode.util.DevModeTestUtils;
16+
import io.quarkus.test.devmode.util.DevModeClient;
1717

1818
public class LegacyJarFormatWorksTest extends QuarkusGradleWrapperTestBase {
1919

@@ -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+
DevModeClient devModeClient = new DevModeClient();
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(() -> devModeClient.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(devModeClient.getHttpResponse("/hello")).isEqualTo("hello");
5052
} finally {
5153
process.destroy();
5254
}

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.awaitility.core.ConditionTimeoutException;
1414
import org.junit.jupiter.api.Test;
1515

16-
import io.quarkus.test.devmode.util.DevModeTestUtils;
16+
import io.quarkus.test.devmode.util.DevModeClient;
1717

1818
public class MultiModuleUberJarTest extends QuarkusGradleWrapperTestBase {
1919

@@ -30,14 +30,16 @@ public void testUberJarForMultiModule() throws Exception {
3030

3131
File output = new File(projectDir, "application/build/output.log");
3232
output.createNewFile();
33+
DevModeClient devModeClient = new DevModeClient();
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(() -> devModeClient.isCode("/hello", 200));
4143
return null;
4244
}, output, ConditionTimeoutException.class);
4345

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.awaitility.core.ConditionTimeoutException;
1515
import org.junit.jupiter.api.Test;
1616

17-
import io.quarkus.test.devmode.util.DevModeTestUtils;
17+
import io.quarkus.test.devmode.util.DevModeClient;
1818

1919
public class MutableJarFormatBootsInDevModeTest extends QuarkusGradleWrapperTestBase {
2020

@@ -32,14 +32,16 @@ public void testFastJarFormatWorks() throws Exception {
3232

3333
File output = new File(projectDir, "build/output.log");
3434
output.createNewFile();
35+
DevModeClient devModeClient = new DevModeClient();
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(() -> devModeClient.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(devModeClient.getHttpResponse("/hello")).isEqualTo("hello");
5254
} finally {
5355
process.destroy();
5456
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import io.quarkus.devtools.project.BuildTool;
2424
import io.quarkus.devtools.project.QuarkusProjectHelper;
2525
import io.quarkus.devtools.project.SourceType;
26-
import io.quarkus.test.devmode.util.DevModeTestUtils;
26+
import io.quarkus.test.devmode.util.DevModeClient;
2727

2828
public class QuarkusPluginFunctionalTest extends QuarkusGradleDevToolsTestBase {
2929

@@ -84,7 +84,7 @@ public void canDetectClassChangeWhenBuilding() throws Exception {
8484

8585
final File greetingResourceFile = projectRoot.toPath().resolve("src/main/java/org/acme/foo/GreetingResource.java")
8686
.toFile();
87-
DevModeTestUtils.filter(greetingResourceFile, ImmutableMap.of("\"/greeting\"", "\"/test/hello\""));
87+
DevModeClient.filter(greetingResourceFile, ImmutableMap.of("\"/greeting\"", "\"/test/hello\""));
8888

8989
BuildResult secondBuild = runGradleWrapper(projectRoot, "quarkusBuild");
9090
assertThat(BuildResult.isSuccessful(secondBuild.getTasks().get(":quarkusBuild"))).isTrue();

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.awaitility.core.ConditionTimeoutException;
1414
import org.junit.jupiter.api.Test;
1515

16-
import io.quarkus.test.devmode.util.DevModeTestUtils;
16+
import io.quarkus.test.devmode.util.DevModeClient;
1717

1818
public class UberJarFormatWorksTest extends QuarkusGradleWrapperTestBase {
1919

@@ -29,14 +29,16 @@ public void testUberJarFormatWorks() throws Exception {
2929

3030
File output = new File(projectDir, "build/output.log");
3131
output.createNewFile();
32+
DevModeClient devModeClient = new DevModeClient();
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(() -> devModeClient.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(devModeClient.getHttpResponse("/hello")).isEqualTo("hello");
4951
} finally {
5052
process.destroy();
5153
}

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525

2626
import io.quarkus.gradle.BuildResult;
2727
import io.quarkus.gradle.QuarkusGradleWrapperTestBase;
28-
import io.quarkus.test.devmode.util.DevModeTestUtils;
28+
import io.quarkus.test.devmode.util.DevModeClient;
2929

3030
public abstract class QuarkusDevGradleTestBase extends QuarkusGradleWrapperTestBase {
3131

3232
private Future<?> quarkusDev;
3333
protected File projectDir;
3434

35+
protected DevModeClient devModeClient = new DevModeClient();
36+
3537
@Override
3638
protected void setupTestCommand() {
3739
gradleNoWatchFs(false);
@@ -67,9 +69,9 @@ public void main() throws Exception {
6769
}
6870

6971
// Kill all processes that were (indirectly) spawned by the current process.
70-
List<ProcessHandle> childProcesses = DevModeTestUtils.killDescendingProcesses();
72+
List<ProcessHandle> childProcesses = DevModeClient.killDescendingProcesses();
7173

72-
DevModeTestUtils.awaitUntilServerDown();
74+
devModeClient.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 devModeClient.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 devModeClient.getHttpResponse(path, false, getQuarkusDevBrokenReason(), timeout, tu);
163165
}
164166

165167
private Supplier<String> getQuarkusDevBrokenReason() {
@@ -172,7 +174,7 @@ protected void replace(String srcFile, Map<String, String> tokens) {
172174
final File source = new File(getProjectDir(), srcFile);
173175
assertThat(source).exists();
174176
try {
175-
DevModeTestUtils.filter(source, tokens);
177+
DevModeClient.filter(source, tokens);
176178
} catch (IOException e) {
177179
throw new IllegalStateException("Failed to replace tokens in " + source, e);
178180
}

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
import org.junit.jupiter.api.Test;
1010

1111
import io.quarkus.gradle.BuildResult;
12-
import io.quarkus.test.devmode.util.DevModeTestUtils;
12+
import io.quarkus.test.devmode.util.DevModeClient;
1313

1414
public class BasicJavaNativeBuildIT extends QuarkusNativeGradleITBase {
1515

1616
public static final String NATIVE_IMAGE_NAME = "foo-1.0.0-SNAPSHOT-runner";
17+
private DevModeClient devModeClient = new DevModeClient();
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 = devModeClient.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 = devModeClient.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 = devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.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(() -> devModeClient.getHttpResponse("/app/hello").contains("carambar"));
4746
}
4847
}

0 commit comments

Comments
 (0)