-
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.
chore: updates codestarts and adds tests
- Loading branch information
1 parent
abf8462
commit 2213658
Showing
56 changed files
with
6,374 additions
and
4,531 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.github.mcollovati</groupId> | ||
<artifactId>quarkus-hilla-tests</artifactId> | ||
<version>24.7-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>codestart-tests</artifactId> | ||
<name>Quarkus - Hilla - Codestart Tests</name> | ||
|
||
<properties> | ||
<vaadin-maven-plugin.phase>none</vaadin-maven-plugin.phase> | ||
</properties> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.mcollovati</groupId> | ||
<artifactId>quarkus-hilla</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.mcollovati</groupId> | ||
<artifactId>quarkus-hilla-react</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-devtools-testing</artifactId> | ||
<version>${quarkus.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
68 changes: 68 additions & 0 deletions
68
...test/java/com/github/mcollovati/quarkus/hilla/codestart/QuarkusHillaLitCodestartTest.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,68 @@ | ||
/* | ||
* Copyright 2025 Marco Collovati, Dario Götze | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.github.mcollovati.quarkus.hilla.codestart; | ||
|
||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.JAVA; | ||
|
||
public class QuarkusHillaLitCodestartTest { | ||
|
||
@RegisterExtension | ||
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder() | ||
.languages(JAVA) | ||
.setupStandaloneExtensionTest("com.github.mcollovati:quarkus-hilla") | ||
.build(); | ||
|
||
@Test | ||
void testContent() throws Throwable { | ||
codestartTest.checkGeneratedSource("org.acme.Application"); | ||
codestartTest.checkGeneratedSource("org.acme.services.HelloWorldService"); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "src/main/frontend/views/helloworld/hello-world-view.ts") | ||
.exists() | ||
.content() | ||
.contains("await HelloWorldService.sayHello("); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "src/main/frontend/views/main-layout.ts") | ||
.exists(); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "src/main/frontend/routes.ts") | ||
.exists(); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "pom.xml") | ||
.exists() | ||
.content() | ||
.contains("<artifactId>vaadin-bom</artifactId>"); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "package.json") | ||
.exists() | ||
.content() | ||
.contains("@vaadin/router") | ||
.doesNotContain("@vaadin/hilla-file-router", "@vaadin/react-components", "@vaadin/hilla-react-signals"); | ||
codestartTest.assertThatGeneratedFile(JAVA, "package-lock.json").exists(); | ||
codestartTest.assertThatGeneratedFile(JAVA, "vite.config.ts").exists(); | ||
codestartTest.assertThatGeneratedFile(JAVA, "types.d.ts").exists(); | ||
codestartTest.assertThatGeneratedFile(JAVA, "tsconfig.json").exists(); | ||
} | ||
|
||
@Test | ||
void buildAllProjects() throws Throwable { | ||
codestartTest.buildAllProjects(); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...st/java/com/github/mcollovati/quarkus/hilla/codestart/QuarkusHillaReactCodestartTest.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,67 @@ | ||
/* | ||
* Copyright 2025 Marco Collovati, Dario Götze | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.github.mcollovati.quarkus.hilla.codestart; | ||
|
||
import io.quarkus.devtools.project.BuildTool; | ||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.JAVA; | ||
|
||
public class QuarkusHillaReactCodestartTest { | ||
|
||
@RegisterExtension | ||
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder() | ||
.languages(JAVA) | ||
.buildTool(BuildTool.MAVEN) | ||
.setupStandaloneExtensionTest("com.github.mcollovati:quarkus-hilla-react") | ||
.build(); | ||
|
||
@Test | ||
void testContent() throws Throwable { | ||
codestartTest.checkGeneratedSource("org.acme.Application"); | ||
codestartTest.checkGeneratedSource("org.acme.services.HelloWorldService"); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "src/main/frontend/views/@index.tsx") | ||
.exists() | ||
.content() | ||
.contains("await HelloWorldService.sayHello("); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "src/main/frontend/views/@layout.tsx") | ||
.exists(); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "pom.xml") | ||
.exists() | ||
.content() | ||
.contains("<artifactId>vaadin-bom</artifactId>"); | ||
codestartTest | ||
.assertThatGeneratedFile(JAVA, "package.json") | ||
.exists() | ||
.content() | ||
.contains("@vaadin/hilla-file-router", "@vaadin/react-components", "@vaadin/hilla-react-signals") | ||
.doesNotContain("@vaadin/router"); | ||
codestartTest.assertThatGeneratedFile(JAVA, "package-lock.json").exists(); | ||
codestartTest.assertThatGeneratedFile(JAVA, "vite.config.ts").exists(); | ||
codestartTest.assertThatGeneratedFile(JAVA, "types.d.ts").exists(); | ||
codestartTest.assertThatGeneratedFile(JAVA, "tsconfig.json").exists(); | ||
} | ||
|
||
@Test | ||
void buildAllProjects() throws Throwable { | ||
codestartTest.buildAllProjects(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...__/QuarkusHillaLitCodestartTest/testContent/src_main_java_ilove_quark_us_Application.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,15 @@ | ||
package ilove.quark.us; | ||
|
||
import com.vaadin.flow.component.page.AppShellConfigurator; | ||
import com.vaadin.flow.theme.Theme; | ||
|
||
/** | ||
* The entry point of the Spring Boot application. | ||
* | ||
* Use the @PWA annotation make the application installable on phones, tablets | ||
* and some desktop browsers. | ||
* | ||
*/ | ||
@Theme(value = "qh-codestart") | ||
public class Application implements AppShellConfigurator { | ||
} |
12 changes: 5 additions & 7 deletions
12
...ava/org/acme/endpoints/HelloEndpoint.java → ..._quark_us_services_HelloWorldService.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
15 changes: 15 additions & 0 deletions
15
.../QuarkusHillaReactCodestartTest/testContent/src_main_java_ilove_quark_us_Application.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,15 @@ | ||
package ilove.quark.us; | ||
|
||
import com.vaadin.flow.component.page.AppShellConfigurator; | ||
import com.vaadin.flow.theme.Theme; | ||
|
||
/** | ||
* The entry point of the Spring Boot application. | ||
* | ||
* Use the @PWA annotation make the application installable on phones, tablets | ||
* and some desktop browsers. | ||
* | ||
*/ | ||
@Theme(value = "qh-codestart") | ||
public class Application implements AppShellConfigurator { | ||
} |
17 changes: 17 additions & 0 deletions
17
...actCodestartTest/testContent/src_main_java_ilove_quark_us_services_HelloWorldService.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 ilove.quark.us.services; | ||
|
||
import com.vaadin.flow.server.auth.AnonymousAllowed; | ||
import com.vaadin.hilla.BrowserCallable; | ||
|
||
@BrowserCallable | ||
@AnonymousAllowed | ||
public class HelloWorldService { | ||
|
||
public String sayHello(String name) { | ||
if (name.isEmpty()) { | ||
return "Hello stranger"; | ||
} else { | ||
return "Hello " + 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
5 changes: 0 additions & 5 deletions
5
lit/runtime/src/main/codestarts/quarkus/quakus-hilla-maven-codestart/base/frontend/index.ts
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
lit/runtime/src/main/codestarts/quarkus/quakus-hilla-maven-codestart/base/frontend/routes.ts
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...src/main/codestarts/quarkus/quakus-hilla-maven-codestart/base/frontend/views/main-view.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.