-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add root path for Quinoa Web UI (#691)
* Add quarkus.quinoa.ui-root-path This adds the quarkus.quinoa.ui-root-path property which is the path for hosting the Web UI. The quarkus.quinoa.ignored-path-prefixes property is always relative to quarkus.quinoa.ui-root-path. The quarkus.http.non-application-root-path is not added to the default ignores if it is not relative to quarkus.http.root-path. * Add tests for ignored paths * Add integration test for quarkus.quinoa.ui-root-path * Add trailing slash to ui root path log * Fix ignored paths --------- Co-authored-by: Melloware <[email protected]>
- Loading branch information
Showing
16 changed files
with
434 additions
and
44 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
42 changes: 42 additions & 0 deletions
42
...est/java/io/quarkiverse/quinoa/test/QuinoaPathPrefixesRESTConfigRelativeRootPathTest.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.quarkiverse.quinoa.test; | ||
|
||
import static io.quarkiverse.quinoa.deployment.testing.QuinoaQuarkusUnitTest.getWebUITestDirPath; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkiverse.quinoa.deployment.testing.QuinoaQuarkusUnitTest; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class QuinoaPathPrefixesRESTConfigRelativeRootPathTest { | ||
|
||
private static final String NAME = "resteasy-reactive-path-config-relative-root-path"; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = QuinoaQuarkusUnitTest.create(NAME) | ||
.toQuarkusUnitTest() | ||
.overrideConfigKey("quarkus.http.root-path", "root/path") | ||
.overrideConfigKey("quarkus.rest.path", "foo/reactive") | ||
.overrideConfigKey("quarkus.resteasy.path", "foo/classic") | ||
.overrideConfigKey("quarkus.http.non-application-root-path", "bar/non") | ||
.overrideConfigKey("quarkus.quinoa.enable-spa-routing", "true") | ||
.assertLogRecords(l -> assertThat(l) | ||
.anyMatch(s -> s.getMessage() | ||
// note how /bar/non is part of the ignored paths | ||
// this is because bar/non is relative to the root path when it does not start with a slash | ||
// also note that quarkus.rest.path, and quarkus.resteasy.path are always relative to the root path even if they start with a slash | ||
.equals("Quinoa SPA routing handler is ignoring paths starting with: /foo/classic, /foo/reactive, /bar/non")) | ||
.anyMatch(s -> s.getMessage() | ||
.equals("Quinoa is available at: /root/path/"))); | ||
|
||
@Test | ||
public void testQuinoa() { | ||
assertThat(Path.of("target/quinoa/build/index.html")).isRegularFile() | ||
.hasContent("test"); | ||
assertThat(getWebUITestDirPath(NAME).resolve("node_modules/installed")).isRegularFile() | ||
.hasContent("hello"); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...nt/src/test/java/io/quarkiverse/quinoa/test/QuinoaPathPrefixesRESTConfigRootPathTest.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.quarkiverse.quinoa.test; | ||
|
||
import static io.quarkiverse.quinoa.deployment.testing.QuinoaQuarkusUnitTest.getWebUITestDirPath; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkiverse.quinoa.deployment.testing.QuinoaQuarkusUnitTest; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class QuinoaPathPrefixesRESTConfigRootPathTest { | ||
|
||
private static final String NAME = "resteasy-reactive-path-config-root-path"; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = QuinoaQuarkusUnitTest.create(NAME) | ||
.toQuarkusUnitTest() | ||
.overrideConfigKey("quarkus.http.root-path", "/root/path") | ||
.overrideConfigKey("quarkus.rest.path", "/foo/reactive") | ||
.overrideConfigKey("quarkus.resteasy.path", "/foo/classic") | ||
.overrideConfigKey("quarkus.http.non-application-root-path", "/bar/non") | ||
.overrideConfigKey("quarkus.quinoa.enable-spa-routing", "true") | ||
.assertLogRecords(l -> assertThat(l) | ||
.anyMatch(s -> s.getMessage() | ||
// note how /bar/non is not part of the ignored paths | ||
// this is because /bar/non is not relative to /root/path | ||
// also note that quarkus.rest.path, and quarkus.resteasy.path are always relative to the root path even if they start with a slash | ||
.equals("Quinoa SPA routing handler is ignoring paths starting with: /foo/classic, /foo/reactive")) | ||
.anyMatch(s -> s.getMessage() | ||
.equals("Quinoa is available at: /root/path/"))); | ||
|
||
@Test | ||
public void testQuinoa() { | ||
assertThat(Path.of("target/quinoa/build/index.html")).isRegularFile() | ||
.hasContent("test"); | ||
assertThat(getWebUITestDirPath(NAME).resolve("node_modules/installed")).isRegularFile() | ||
.hasContent("hello"); | ||
} | ||
} |
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.