-
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 #21162 from mkouba/issue-18525
Qute - scan "templates" directory in all application archives
- Loading branch information
Showing
4 changed files
with
179 additions
and
22 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
40 changes: 40 additions & 0 deletions
40
...ava/io/quarkus/qute/deployment/scanning/MultipleTemplatesDirectoryDuplicateFoundTest.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,40 @@ | ||
package io.quarkus.qute.deployment.scanning; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class MultipleTemplatesDirectoryDuplicateFoundTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(root -> root.addAsResource(new StringAsset("Hello!"), "templates/hello.html")) | ||
.withAdditionalDependency( | ||
d -> d.addAsResource(new StringAsset("Hi!"), "templates/hello.html")) | ||
.assertException(t -> { | ||
Throwable e = t; | ||
IllegalStateException ise = null; | ||
while (e != null) { | ||
if (e instanceof IllegalStateException) { | ||
ise = (IllegalStateException) e; | ||
break; | ||
} | ||
e = e.getCause(); | ||
} | ||
assertNotNull(ise); | ||
assertTrue(ise.getMessage().contains("Duplicate templates found:"), ise.getMessage()); | ||
assertTrue(ise.getMessage().contains("hello.html"), ise.getMessage()); | ||
}); | ||
|
||
@Test | ||
public void testValidation() { | ||
fail(); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...ent/src/test/java/io/quarkus/qute/deployment/scanning/MultipleTemplatesDirectoryTest.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,33 @@ | ||
package io.quarkus.qute.deployment.scanning; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.qute.Template; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class MultipleTemplatesDirectoryTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(root -> root.addAsResource(new StringAsset("Hello!"), "templates/hello.html")) | ||
.withAdditionalDependency(d -> d.addAsResource(new StringAsset("Hi!"), "templates/hi.html")); | ||
|
||
@Inject | ||
Template hello; | ||
|
||
@Inject | ||
Template hi; | ||
|
||
@Test | ||
public void testScanning() { | ||
assertEquals("Hello!", hello.render()); | ||
assertEquals("Hi!", hi.render()); | ||
} | ||
|
||
} |
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