diff --git a/backend/controller/cronjobs/cronjobs_integration_test.go b/backend/controller/cronjobs/cronjobs_integration_test.go index 5824acbbf..5cbc00977 100644 --- a/backend/controller/cronjobs/cronjobs_integration_test.go +++ b/backend/controller/cronjobs/cronjobs_integration_test.go @@ -54,6 +54,7 @@ func TestCron(t *testing.T) { t.Cleanup(func() { _ = os.Remove(tmpFile) }) in.Run(t, + in.WithLanguages("go", "java"), in.CopyModule("cron"), in.Deploy("cron"), func(t testing.TB, ic in.TestContext) { diff --git a/backend/controller/cronjobs/testdata/java/cron/ftl.toml b/backend/controller/cronjobs/testdata/java/cron/ftl.toml new file mode 100644 index 000000000..30bdab00f --- /dev/null +++ b/backend/controller/cronjobs/testdata/java/cron/ftl.toml @@ -0,0 +1,2 @@ +module = "cron" +language = "java" diff --git a/backend/controller/cronjobs/testdata/java/cron/pom.xml b/backend/controller/cronjobs/testdata/java/cron/pom.xml new file mode 100644 index 000000000..400f9432a --- /dev/null +++ b/backend/controller/cronjobs/testdata/java/cron/pom.xml @@ -0,0 +1,127 @@ + + + 4.0.0 + xyz.block.ftl.examples + cron + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + 3.13.0 + 2.0.0 + 17 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.12.3 + true + 3.2.5 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + xyz.block + ftl-java-runtime + 1.0-SNAPSHOT + + + io.quarkus + quarkus-kotlin + + + io.quarkus + quarkus-jackson + + + io.quarkus + quarkus-rest-jackson + + + io.quarkus + quarkus-junit5 + test + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + + + io.rest-assured + kotlin-extensions + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + native-image-agent + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + -parameters + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + diff --git a/backend/controller/cronjobs/testdata/java/cron/src/main/java/xyz/block/ftl/java/test/cron/TestCron.java b/backend/controller/cronjobs/testdata/java/cron/src/main/java/xyz/block/ftl/java/test/cron/TestCron.java new file mode 100644 index 000000000..f795d0f5b --- /dev/null +++ b/backend/controller/cronjobs/testdata/java/cron/src/main/java/xyz/block/ftl/java/test/cron/TestCron.java @@ -0,0 +1,29 @@ +package xyz.block.ftl.java.test.cron; + +import io.quarkus.logging.Log; +import xyz.block.ftl.Cron; +import xyz.block.ftl.Export; +import xyz.block.ftl.LeaseClient; +import xyz.block.ftl.Verb; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.time.Duration; + +public class TestCron { + + @Cron("* * * * * * *") + public void cron() throws Exception { + Files.writeString(Paths.get(System.getenv("DEST_FILE")), "Hello, world!"); + } + + @Cron("5m") + public void fiveMinutes() { + } + + @Cron("Sat") + public void saturday() { + + } + +} \ No newline at end of file