-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35259 from mkouba/component-continous-test-fix-02
QuarkusComponentTest: another fix for continuous testing integration
- Loading branch information
Showing
5 changed files
with
102 additions
and
10 deletions.
There are no files selected for viewing
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
41 changes: 41 additions & 0 deletions
41
...tests/devmode/src/test/java/io/quarkus/test/component/ComponentContinuousTestingTest.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,41 @@ | ||
package io.quarkus.test.component; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.ContinuousTestingTestUtils; | ||
import io.quarkus.test.ContinuousTestingTestUtils.TestStatus; | ||
import io.quarkus.test.QuarkusDevModeTest; | ||
|
||
public class ComponentContinuousTestingTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusDevModeTest config = new QuarkusDevModeTest() | ||
.withApplicationRoot( | ||
root -> root.addClass(ComponentFoo.class).add(new StringAsset(ContinuousTestingTestUtils.appProperties()), | ||
"application.properties")) | ||
.setTestArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(ComponentUT.class)); | ||
|
||
@Test | ||
public void test() { | ||
ContinuousTestingTestUtils utils = new ContinuousTestingTestUtils(); | ||
TestStatus ts = utils.waitForNextCompletion(); | ||
assertEquals(0L, ts.getTestsFailed()); | ||
assertEquals(1L, ts.getTestsPassed()); | ||
assertEquals(0L, ts.getTestsSkipped()); | ||
|
||
config.modifySourceFile(ComponentFoo.class, s -> s.replace("return bar;", "return bar + bar;")); | ||
|
||
ts = utils.waitForNextCompletion(); | ||
assertEquals(1L, ts.getTestsFailed()); | ||
assertEquals(0L, ts.getTestsPassed()); | ||
assertEquals(0L, ts.getTestsSkipped()); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
integration-tests/devmode/src/test/java/io/quarkus/test/component/ComponentFoo.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,17 @@ | ||
package io.quarkus.test.component; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@Singleton | ||
public class ComponentFoo { | ||
|
||
@ConfigProperty(name = "bar", defaultValue = "baz") | ||
String bar; | ||
|
||
String ping() { | ||
return bar; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
integration-tests/devmode/src/test/java/io/quarkus/test/component/ComponentUT.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,21 @@ | ||
package io.quarkus.test.component; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
@QuarkusComponentTest | ||
@TestConfigProperty(key = "bar", value = "qux") | ||
public class ComponentUT { | ||
|
||
@Inject | ||
ComponentFoo foo; | ||
|
||
@Test | ||
public void test() { | ||
assertEquals("qux", foo.ping()); | ||
} | ||
|
||
} |
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