forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into oidc-provider-discord
- Loading branch information
Showing
46 changed files
with
1,142 additions
and
128 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
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
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
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
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
31 changes: 31 additions & 0 deletions
31
...ions/qute/deployment/src/test/java/io/quarkus/qute/deployment/devmode/NoRestartRoute.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,31 @@ | ||
package io.quarkus.qute.deployment.devmode; | ||
|
||
import java.util.UUID; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import jakarta.inject.Inject; | ||
import jakarta.inject.Singleton; | ||
|
||
import io.quarkus.qute.Template; | ||
import io.quarkus.vertx.web.Route; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
@Singleton | ||
public class NoRestartRoute { | ||
|
||
private String id; | ||
|
||
@Inject | ||
Template norestart; | ||
|
||
@Route(path = "norestart") | ||
public void test(RoutingContext ctx) { | ||
ctx.end(norestart.data("foo", id).render()); | ||
} | ||
|
||
@PostConstruct | ||
void init() { | ||
id = UUID.randomUUID().toString(); | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
...yment/src/test/java/io/quarkus/qute/deployment/devmode/NoRestartTemplatesDevModeTest.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,42 @@ | ||
package io.quarkus.qute.deployment.devmode; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.restassured.response.Response; | ||
|
||
public class NoRestartTemplatesDevModeTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusDevModeTest config = new QuarkusDevModeTest() | ||
.withApplicationRoot(root -> root | ||
.addClass(NoRestartRoute.class) | ||
.addAsResource(new StringAsset( | ||
"Hello {foo}!"), | ||
"templates/norestart.html") | ||
.addAsResource(new StringAsset( | ||
"quarkus.qute.dev-mode.no-restart-templates=templates/norestart.html"), | ||
"application.properties")); | ||
|
||
@Test | ||
public void testNoRestartTemplates() { | ||
Response resp = given().get("norestart"); | ||
resp.then() | ||
.statusCode(200); | ||
String val = resp.getBody().asString(); | ||
assertTrue(val.startsWith("Hello ")); | ||
|
||
config.modifyResourceFile("templates/norestart.html", t -> t.concat("!!")); | ||
|
||
resp = given().get("norestart"); | ||
resp.then().statusCode(200); | ||
assertEquals(val + "!!", resp.getBody().asString()); | ||
} | ||
|
||
} |
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
24 changes: 24 additions & 0 deletions
24
extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/QuteDevModeConfig.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,24 @@ | ||
package io.quarkus.qute.runtime; | ||
|
||
import java.util.Optional; | ||
import java.util.regex.Pattern; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
|
||
@ConfigGroup | ||
public class QuteDevModeConfig { | ||
|
||
/** | ||
* By default, a template modification results in an application restart that triggers build-time validations. | ||
* <p> | ||
* This regular expression can be used to specify the templates for which the application is not restarted. | ||
* I.e. the templates are reloaded and only runtime validations are performed. | ||
* <p> | ||
* The matched input is the template path relative from the {@code templates} directory and the | ||
* {@code /} is used as a path separator. For example, {@code templates/foo.html}. | ||
*/ | ||
@ConfigItem | ||
public Optional<Pattern> noRestartTemplates; | ||
|
||
} |
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
extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/devmode/QuteSetup.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.qute.runtime.devmode; | ||
|
||
import java.util.Set; | ||
import java.util.function.Consumer; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.dev.spi.HotReplacementContext; | ||
import io.quarkus.dev.spi.HotReplacementSetup; | ||
import io.quarkus.qute.Engine; | ||
import io.quarkus.qute.runtime.TemplateProducer; | ||
|
||
public class QuteSetup implements HotReplacementSetup { | ||
|
||
@Override | ||
public void setupHotDeployment(HotReplacementContext context) { | ||
context.consumeNoRestartChanges(new Consumer<Set<String>>() { | ||
|
||
@Override | ||
public void accept(Set<String> files) { | ||
// Make sure all templates are reloaded | ||
Engine engine = Arc.container().instance(Engine.class).get(); | ||
engine.clearTemplates(); | ||
TemplateProducer templateProducer = Arc.container().instance(TemplateProducer.class).get(); | ||
templateProducer.clearInjectedTemplates(); | ||
} | ||
}); | ||
} | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
.../qute/runtime/src/main/resources/META-INF/services/io.quarkus.dev.spi.HotReplacementSetup
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
io.quarkus.qute.runtime.devmode.QuteErrorPageSetup | ||
io.quarkus.qute.runtime.devmode.QuteErrorPageSetup | ||
io.quarkus.qute.runtime.devmode.QuteSetup |
Oops, something went wrong.