From 60c72fe31eb98892603d3a3d7ab020f195e40e55 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 3 Oct 2024 15:41:38 +1000 Subject: [PATCH] fix: remove JVM integration tests module This is not really needed anymore, as we have full integration tests --- .../ftl/deployment/JVMCodeGenerator.java | 7 +- .../java/integration-tests/pom.xml | 104 ------------------ .../src/main/ftl-module-schema/builtin.pb | Bin 832 -> 0 bytes .../src/main/ftl-module-schema/echo.pb | Bin 1440 -> 0 bytes .../src/main/ftl-module-schema/time.pb | Bin 695 -> 0 bytes .../runtime/it/FtlJavaRuntimeResource.java | 69 ------------ .../ftl/java/runtime/it/HelloClient.java | 8 -- .../block/ftl/java/runtime/it/MyTopic.java | 10 -- .../xyz/block/ftl/java/runtime/it/Person.java | 5 - .../src/main/resources/application.properties | 0 .../it/FtlJavaRuntimeResourceTest.java | 102 ----------------- jvm-runtime/ftl-runtime/java/pom.xml | 1 - 12 files changed, 6 insertions(+), 300 deletions(-) delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/pom.xml delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/builtin.pb delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/echo.pb delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/time.pb delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/FtlJavaRuntimeResource.java delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/HelloClient.java delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/MyTopic.java delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/Person.java delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/main/resources/application.properties delete mode 100644 jvm-runtime/ftl-runtime/java/integration-tests/src/test/java/xyz/block/ftl/java/runtime/it/FtlJavaRuntimeResourceTest.java diff --git a/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/JVMCodeGenerator.java b/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/JVMCodeGenerator.java index b88cd68f14..ec793af632 100644 --- a/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/JVMCodeGenerator.java +++ b/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/JVMCodeGenerator.java @@ -51,7 +51,12 @@ public boolean trigger(CodeGenContext context) throws CodeGenException { if (!fileName.endsWith(".pb")) { continue; } - var module = Module.parseFrom(Files.readAllBytes(file)); + Module module; + try { + module = Module.parseFrom(Files.readAllBytes(file)); + } catch (Exception e) { + throw new CodeGenException("Failed to parse " + file, e); + } for (var decl : module.getDeclsList()) { String packageName = PACKAGE_PREFIX + module.getName(); if (decl.hasTypeAlias()) { diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/pom.xml b/jvm-runtime/ftl-runtime/java/integration-tests/pom.xml deleted file mode 100644 index 2161409dc3..0000000000 --- a/jvm-runtime/ftl-runtime/java/integration-tests/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - - - xyz.block.ftl - ftl-java-runtime-parent - 1.0-SNAPSHOT - - ftl-jvm-runtime-integration-tests - Ftl JVM Runtime - Integration Tests - - - true - - - - - xyz.block.ftl - ftl-java-runtime - - - xyz.block.ftl - ftl-jvm-test-framework - test - - - io.rest-assured - rest-assured - test - - - - xyz.block.ftl - ftl-java-runtime-deployment - test - - - io.quarkus - quarkus-junit5-mockito - - - - - - - io.quarkus - quarkus-maven-plugin - - - - build - generate-code - generate-code-tests - - - - - - maven-failsafe-plugin - - - - integration-test - verify - - - - - - ${project.build.directory}/${project.build.finalName}-runner - org.jboss.logmanager.LogManager - ${maven.home} - - - - - - - - - native-image - - - native - - - - - - maven-surefire-plugin - - ${native.surefire.skip} - - - - - - false - true - - - - diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/builtin.pb b/jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/builtin.pb deleted file mode 100644 index 83a40d59ed78a6001fcd9193855beb39946e4846..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 832 zcma)4O>fgc5G9G7q-*EPO`5?8Xtm;kDLJ^DI0gmvz@b8skaDw=1zT!tv%5yh-$3f` z0Kp$**6TE_)B`7bX5Ku{dw#?kHlg87mt}gZ-liEftCp*Intc;oO8SF~SZXfkTB+i**$Q0b zvSH>~%Y1hT0joCHUVG0~lJ8j8Z&w{RyufD%Csq-ur0#csgbVC|CjV-cs)P&5DuooY!MOe!qx%wn zf6Qrt|Cwj%l4d#9xk?sn9DC%MXY4pX+7Z4&;xQ82hF}t(BWSSED#qZ{DuNLiU}Fj` z%#6L-7wQn)HOS8fHlJ%BKSXMq)H$N5q|p;m)Dhll+$nzU!@a;kHXnU#AyN1ei@ diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/echo.pb b/jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/echo.pb deleted file mode 100644 index 6f55e044cd45cffe47bed9cc276c5c3783b1e4c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1440 zcmcJP&q~8U5XMbgT8Ikms<5OWOZ1dO7J{vKR9it2D$zM0XN(AHrZ0AY{-_ap>ld{2(tQ=9Y#u6ku+Uns673q^;XqitBUhBaUC`H6H=5xINW3)q>VLm zxt~7_%e(VgS%7LS@nSHawDF^AD_XdL)H~3^$QoIf>PZ-L64rM`|5D9)9oKU&S4uC% zEKLMB4+{`MjTnUR7%ZUkH?VG9TUUy?=VXlEPg@@q^sbsp8*9iez~@sXGoA?I5yk=J yG-2d6Uob?5K>UnzNFcng_Y)g|;&R(~8~q(=V=m-`qlt1M2mR}}Qt1a?bkdsu diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/time.pb b/jvm-runtime/ftl-runtime/java/integration-tests/src/main/ftl-module-schema/time.pb deleted file mode 100644 index 5388d67667f6b803bee1b8617387572791565c8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 695 zcmd;L5K?x|Pf1lsPt8j$N-RlDQAny(a0~I#Q*iND@beE*aCPwv(Nkh6$;?gFI?Bj( zh> { -} \ No newline at end of file diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/MyTopic.java b/jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/MyTopic.java deleted file mode 100644 index 0e5ef1e996..0000000000 --- a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/MyTopic.java +++ /dev/null @@ -1,10 +0,0 @@ -package xyz.block.ftl.java.runtime.it; - -import xyz.block.ftl.Export; -import xyz.block.ftl.Topic; -import xyz.block.ftl.TopicDefinition; - -@Export -@TopicDefinition(value = "testTopic") -public interface MyTopic extends Topic { -} diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/Person.java b/jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/Person.java deleted file mode 100644 index d7233db37a..0000000000 --- a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/java/xyz/block/ftl/java/runtime/it/Person.java +++ /dev/null @@ -1,5 +0,0 @@ -package xyz.block.ftl.java.runtime.it; - -public record Person(String first, String last) { - -} diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/main/resources/application.properties b/jvm-runtime/ftl-runtime/java/integration-tests/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/jvm-runtime/ftl-runtime/java/integration-tests/src/test/java/xyz/block/ftl/java/runtime/it/FtlJavaRuntimeResourceTest.java b/jvm-runtime/ftl-runtime/java/integration-tests/src/test/java/xyz/block/ftl/java/runtime/it/FtlJavaRuntimeResourceTest.java deleted file mode 100644 index 036273e1c0..0000000000 --- a/jvm-runtime/ftl-runtime/java/integration-tests/src/test/java/xyz/block/ftl/java/runtime/it/FtlJavaRuntimeResourceTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package xyz.block.ftl.java.runtime.it; - -import java.nio.charset.StandardCharsets; -import java.util.function.Function; - -import jakarta.inject.Inject; - -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import ftl.builtin.HttpRequest; -import ftl.builtin.HttpResponse; -import ftl.echo.EchoClient; -import ftl.echo.EchoRequest; -import ftl.echo.EchoResponse; -import io.quarkus.test.common.WithTestResource; -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; -import io.restassured.http.ContentType; -import xyz.block.ftl.VerbClient; -import xyz.block.ftl.VerbClientDefinition; -import xyz.block.ftl.VerbClientSink; -import xyz.block.ftl.java.test.FTLManaged; -import xyz.block.ftl.java.test.internal.FTLTestResource; -import xyz.block.ftl.java.test.internal.TestVerbServer; - -@QuarkusTest -@WithTestResource(FTLTestResource.class) -public class FtlJavaRuntimeResourceTest { - - @FTLManaged - @Inject - PublishVerbClient myVerbClient; - - @FTLManaged - @Inject - HelloClient helloClient; - - @FTLManaged - @Inject - BytesClient bytesClient; - - @Test - public void testHelloEndpoint() { - TestVerbServer.registerFakeVerb("echo", "echo", new Function() { - @Override - public EchoResponse apply(EchoRequest s) { - return new EchoResponse(s.getName()); - } - }); - EchoClient echoClient = Mockito.mock(EchoClient.class); - Mockito.when(echoClient.call(Mockito.any())).thenReturn(new EchoResponse().setMessage("Stuart")); - Assertions.assertEquals("Hello Stuart", helloClient.call("Stuart")); - } - - @Test - @Disabled - public void testTopic() { - myVerbClient.call(new Person("Stuart", "Douglas")); - } - - @Test - public void testBytesSerialization() { - Assertions.assertArrayEquals(new byte[] { 1, 2 }, bytesClient.call(new byte[] { 1, 2 })); - } - - @Test - public void testHttpPost() { - RestAssured.with().body(new Person("Stuart", "Douglas")) - .contentType(ContentType.JSON) - .post("/test/post") - .then() - .statusCode(200) - .body(Matchers.equalTo("Hello Stuart Douglas")); - } - - @Test - public void testHttpBytes() { - - RestAssured.with().body("Stuart Douglas".getBytes(java.nio.charset.StandardCharsets.UTF_8)) - .contentType(ContentType.JSON) - .post("/test/bytes") - .then() - .statusCode(200) - .body(Matchers.equalTo("Hello Stuart Douglas")); - } - - @VerbClientDefinition(name = "publish") - interface PublishVerbClient extends VerbClientSink { - } - - @VerbClientDefinition(name = "bytes") - interface BytesClient extends VerbClient { - } - - @VerbClientDefinition(name = "bytesHttp") - interface BytesHTTPClient extends VerbClient, HttpResponse> { - } -} diff --git a/jvm-runtime/ftl-runtime/java/pom.xml b/jvm-runtime/ftl-runtime/java/pom.xml index e03d255a32..18a04d44b2 100644 --- a/jvm-runtime/ftl-runtime/java/pom.xml +++ b/jvm-runtime/ftl-runtime/java/pom.xml @@ -16,7 +16,6 @@ deployment runtime - integration-tests build-parent