-
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 #15144 from mkouba/issue-15083
QuarkusTestProfile - make it possible to disable app lifecycle observers
- Loading branch information
Showing
14 changed files
with
206 additions
and
50 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
core/runtime/src/main/java/io/quarkus/runtime/test/TestApplicationClassPredicate.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,10 @@ | ||
package io.quarkus.runtime.test; | ||
|
||
import java.util.function.Predicate; | ||
|
||
/** | ||
* This predicate can be used to distinguish application classes in the test mode. | ||
*/ | ||
public interface TestApplicationClassPredicate extends Predicate<String> { | ||
|
||
} |
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
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
16 changes: 16 additions & 0 deletions
16
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestConfig.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,16 @@ | ||
package io.quarkus.arc.deployment; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
|
||
@ConfigGroup | ||
public class ArcTestConfig { | ||
|
||
/** | ||
* If set to true then disable {@code StartupEvent} and {@code ShutdownEvent} observers declared on application bean classes | ||
* during the tests. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean disableApplicationLifecycleObservers; | ||
|
||
} |
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
29 changes: 29 additions & 0 deletions
29
.../src/main/java/io/quarkus/arc/deployment/CompletedApplicationClassPredicateBuildItem.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,29 @@ | ||
package io.quarkus.arc.deployment; | ||
|
||
import java.util.function.Predicate; | ||
|
||
import org.jboss.jandex.DotName; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
/** | ||
* This build item hold the "final" predicate that is used to distinguish application classes from framework/library classes. | ||
*/ | ||
public final class CompletedApplicationClassPredicateBuildItem extends SimpleBuildItem implements Predicate<DotName> { | ||
|
||
private final Predicate<DotName> applicationClassPredicate; | ||
|
||
CompletedApplicationClassPredicateBuildItem(Predicate<DotName> applicationClassPredicate) { | ||
this.applicationClassPredicate = applicationClassPredicate; | ||
} | ||
|
||
public Predicate<DotName> getApplicationClassPredicate() { | ||
return applicationClassPredicate; | ||
} | ||
|
||
@Override | ||
public boolean test(DotName name) { | ||
return applicationClassPredicate.test(name); | ||
} | ||
|
||
} |
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
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
30 changes: 0 additions & 30 deletions
30
extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/LifecycleEventRunner.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...ime/src/main/java/io/quarkus/arc/runtime/test/PreloadedTestApplicationClassPredicate.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,23 @@ | ||
package io.quarkus.arc.runtime.test; | ||
|
||
import java.util.Set; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import io.quarkus.runtime.test.TestApplicationClassPredicate; | ||
|
||
@Singleton | ||
public class PreloadedTestApplicationClassPredicate implements TestApplicationClassPredicate { | ||
|
||
private volatile Set<String> applicationBeanClasses; | ||
|
||
@Override | ||
public boolean test(String name) { | ||
return applicationBeanClasses.contains(name); | ||
} | ||
|
||
public void setApplicationBeanClasses(Set<String> applicationBeanClasses) { | ||
this.applicationBeanClasses = applicationBeanClasses; | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.