diff --git a/convex-cli/pom.xml b/convex-cli/pom.xml
index b232b5033..db3965b2e 100644
--- a/convex-cli/pom.xml
+++ b/convex-cli/pom.xml
@@ -127,20 +127,6 @@
world.convex
convex-restapi
${convex.version}
-
-
- org.slf4j
- slf4j-simple
-
-
- log4j
- log4j
-
-
- com.bladejava
- blade-log
-
-
info.picocli
diff --git a/convex-core/src/test/java/convex/core/data/GenTestDataStructures.java b/convex-core/src/test/java/convex/core/data/GenTestDataStructures.java
index d6fd38299..54a77dab6 100644
--- a/convex-core/src/test/java/convex/core/data/GenTestDataStructures.java
+++ b/convex-core/src/test/java/convex/core/data/GenTestDataStructures.java
@@ -16,9 +16,11 @@
import convex.core.lang.RT;
import convex.test.generators.*;
+@SuppressWarnings("exports")
@RunWith(JUnitQuickcheck.class)
public class GenTestDataStructures {
+
@Property
public void empty(@From(DataStructureGen.class) ADataStructure<@From(ValueGen.class) ACell> a) {
long c = a.count();
diff --git a/convex-core/src/test/java/convex/core/lang/GenTestCore.java b/convex-core/src/test/java/convex/core/lang/GenTestCore.java
index cfd812e9e..077b09b5d 100644
--- a/convex-core/src/test/java/convex/core/lang/GenTestCore.java
+++ b/convex-core/src/test/java/convex/core/lang/GenTestCore.java
@@ -194,6 +194,7 @@ public void testLongFunctions(@From(LongGenerator.class) Long a) {
assertNull(RT.vec(a));
}
+ @SuppressWarnings("exports")
@Property
public void testCoreArgs(@From(VectorGen.class) AVector<@From(ValueGen.class) ACell> a) throws IOException {
Context ctx=new CoreTest().context();
diff --git a/convex-core/src/test/java/convex/core/lang/GenTestRT.java b/convex-core/src/test/java/convex/core/lang/GenTestRT.java
index 8c9ef6a47..930c452ef 100644
--- a/convex-core/src/test/java/convex/core/lang/GenTestRT.java
+++ b/convex-core/src/test/java/convex/core/lang/GenTestRT.java
@@ -19,6 +19,7 @@
@RunWith(JUnitQuickcheck.class)
public class GenTestRT {
+ @SuppressWarnings("exports")
@Property
public void setConversion(@From(CollectionGen.class) ACollection<@From(ValueGen.class) ACell> a) {
long ac = a.count();
@@ -35,6 +36,7 @@ public void strTest(@From(ValueGen.class) ACell b) {
assertNotNull(s);
}
+ @SuppressWarnings("exports")
@Property
public void conjTest(@From(CollectionGen.class) ACollection<@From(ValueGen.class) ACell> a, @From(ValueGen.class) ACell b) {
ACollection ac = a.conj(b);
diff --git a/convex-integration/pom.xml b/convex-integration/pom.xml
index eba4e0485..516a82a81 100644
--- a/convex-integration/pom.xml
+++ b/convex-integration/pom.xml
@@ -15,7 +15,7 @@
convex
0.7.14-SNAPSHOT
-
+
world.convex
@@ -32,10 +32,29 @@
convex-core
${convex.version}
+
+ world.convex
+ convex-restapi
+ ${convex.version}
+
+
world.convex
convex-java
${convex.version}
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.version}
+ test
+
+
+ org.slf4j
+ slf4j-nop
+ ${slf4j.version}
+
\ No newline at end of file
diff --git a/convex-java/src/test/java/convex/java/RemoteClientTest.java b/convex-integration/src/test/java/convex/java/RemoteClientTest.java
similarity index 100%
rename from convex-java/src/test/java/convex/java/RemoteClientTest.java
rename to convex-integration/src/test/java/convex/java/RemoteClientTest.java
diff --git a/convex-restapi/src/test/java/convex/restapi/RemoteClientTest.java b/convex-integration/src/test/java/convex/restapi/RemoteClientTest.java
similarity index 100%
rename from convex-restapi/src/test/java/convex/restapi/RemoteClientTest.java
rename to convex-integration/src/test/java/convex/restapi/RemoteClientTest.java
diff --git a/convex-java/src/main/java/module-info.java b/convex-java/src/main/java/module-info.java
index accab05fc..b35ba08f5 100644
--- a/convex-java/src/main/java/module-info.java
+++ b/convex-java/src/main/java/module-info.java
@@ -4,6 +4,6 @@
requires transitive convex.core;
requires json.simple;
- requires org.apache.httpcomponents.client5.httpclient5;
- requires org.apache.httpcomponents.core5.httpcore5;
+ requires transitive org.apache.httpcomponents.client5.httpclient5;
+ requires transitive org.apache.httpcomponents.core5.httpcore5;
}
\ No newline at end of file
diff --git a/convex-restapi/pom.xml b/convex-restapi/pom.xml
index ddd925ace..c0ebe5bde 100644
--- a/convex-restapi/pom.xml
+++ b/convex-restapi/pom.xml
@@ -122,5 +122,15 @@
${junit.version}
test
+
+ org.apache.httpcomponents.client5
+ httpclient5
+ ${hc.version}
+
+
+ org.apache.httpcomponents.client5
+ httpclient5-fluent
+ ${hc.version}
+
\ No newline at end of file
diff --git a/convex-restapi/src/main/java/convex/restapi/RESTServer.java b/convex-restapi/src/main/java/convex/restapi/RESTServer.java
index 454218164..331efacef 100644
--- a/convex-restapi/src/main/java/convex/restapi/RESTServer.java
+++ b/convex-restapi/src/main/java/convex/restapi/RESTServer.java
@@ -1,5 +1,6 @@
package convex.restapi;
+import java.io.Closeable;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -27,7 +28,7 @@
import io.javalin.openapi.plugin.redoc.ReDocPlugin;
import io.javalin.openapi.plugin.swagger.SwaggerPlugin;
-public class RESTServer {
+public class RESTServer implements Closeable {
protected static final Logger log = LoggerFactory.getLogger(RESTServer.class.getName());
protected final Server server;
@@ -58,7 +59,7 @@ private RESTServer(Server server) {
config.staticFiles.add(staticFiles -> {
staticFiles.hostedPath = "/";
staticFiles.location = Location.CLASSPATH; // Specify resources from classpath
- staticFiles.directory = "/public"; // Resource location in classpath
+ staticFiles.directory = "/convex/restapi/pub"; // Resource location in classpath
staticFiles.precompress = false; // if the files should be pre-compressed and cached in memory
// (optimization)
staticFiles.aliasCheck = null; // you can configure this to enable symlinks (=
@@ -108,7 +109,7 @@ protected void addOpenApiPlugins(JavalinConfig config) {
pluginConfig
.withDocumentationPath(docsPath)
.withDefinitionConfiguration((version, definition) -> {
- definition.withOpenApiInfo(info -> {
+ definition.withInfo(info -> {
info.setTitle("Convex REST API");
info.setVersion("0.7.0");
});
@@ -187,6 +188,10 @@ public void stop() {
app.stop();
// app.close(); // Gone In Javalin 6?
}
+
+ public void close() {
+ stop();
+ }
public Convex getConvex() {
return convex;
diff --git a/convex-restapi/src/main/java/convex/restapi/pub/package-info.java b/convex-restapi/src/main/java/convex/restapi/pub/package-info.java
new file mode 100644
index 000000000..7ea4fa1a3
--- /dev/null
+++ b/convex-restapi/src/main/java/convex/restapi/pub/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Package for static resources used by convex-restapi
+ */
+package convex.restapi.pub;
\ No newline at end of file
diff --git a/convex-restapi/src/main/java/module-info.java b/convex-restapi/src/main/java/module-info.java
index 7e13c74a5..2cbd9ab19 100644
--- a/convex-restapi/src/main/java/module-info.java
+++ b/convex-restapi/src/main/java/module-info.java
@@ -1,5 +1,4 @@
module convex.restapi {
- exports convex.restapi.api;
exports convex.restapi;
exports convex.restapi.model;
@@ -13,10 +12,13 @@
requires javalin.swagger.plugin;
// requires static com.fasterxml.jackson.databind;
requires jetty.servlet.api;
- requires kotlin.stdlib;
+ requires transitive kotlin.stdlib;
+ requires kotlin.reflect;
requires org.eclipse.jetty.server;
requires org.slf4j;
requires convex.java;
// requires org.junit.jupiter.api;
+
+ opens convex.restapi.pub;
}
\ No newline at end of file
diff --git a/convex-restapi/src/main/resources/public/css/pico.min.css b/convex-restapi/src/main/resources/convex/restapi/pub/css/pico.min.css
similarity index 100%
rename from convex-restapi/src/main/resources/public/css/pico.min.css
rename to convex-restapi/src/main/resources/convex/restapi/pub/css/pico.min.css
diff --git a/convex-restapi/src/main/resources/public/index.html b/convex-restapi/src/main/resources/convex/restapi/pub/index.html
similarity index 100%
rename from convex-restapi/src/main/resources/public/index.html
rename to convex-restapi/src/main/resources/convex/restapi/pub/index.html
diff --git a/convex-restapi/src/main/java/convex/restapi/Main.java b/convex-restapi/src/test/java/convex/restapi/test/Main.java
similarity index 57%
rename from convex-restapi/src/main/java/convex/restapi/Main.java
rename to convex-restapi/src/test/java/convex/restapi/test/Main.java
index 571bd49f2..ec006f557 100644
--- a/convex-restapi/src/main/java/convex/restapi/Main.java
+++ b/convex-restapi/src/test/java/convex/restapi/test/Main.java
@@ -1,16 +1,17 @@
-package convex.restapi;
+package convex.restapi.test;
import convex.peer.API;
import convex.peer.Server;
+import convex.restapi.RESTServer;
public class Main {
public static void main(String[] args) {
Server s=API.launchPeer();
System.out.println("Using Ed25519 seed: "+s.getKeyPair().getSeed());
- RESTServer rs=RESTServer.create(s);
- rs.start();
-
- System.out.println("Complete");
+ try (RESTServer rs=RESTServer.create(s)) {
+ rs.start();
+ System.out.println("Complete");
+ }
}
}
diff --git a/convex-restapi/src/test/java/convex/restapi/RESTAPITest.java b/convex-restapi/src/test/java/convex/restapi/test/RESTAPITest.java
similarity index 59%
rename from convex-restapi/src/test/java/convex/restapi/RESTAPITest.java
rename to convex-restapi/src/test/java/convex/restapi/test/RESTAPITest.java
index cb19629a9..984ce2331 100644
--- a/convex-restapi/src/test/java/convex/restapi/RESTAPITest.java
+++ b/convex-restapi/src/test/java/convex/restapi/test/RESTAPITest.java
@@ -1,11 +1,15 @@
-package convex.restapi;
+package convex.restapi.test;
+import java.io.IOException;
+
+import org.apache.hc.client5.http.fluent.Request;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import convex.peer.API;
import convex.peer.Server;
+import convex.restapi.RESTServer;
public class RESTAPITest {
static RESTServer server;
@@ -22,10 +26,16 @@ public static void init() {
@AfterAll
public static void cleanShutdown() {
- server.stop();
+ if (server!=null) {
+ server.stop();
+ }
}
@Test public void testDataAPI() {
}
+
+ @Test public void testSwagger() throws IOException {
+ Request.get("http://localhost:" + server.getPort()+"/swagger").execute().returnContent();
+ }
}
diff --git a/convex-restapi/src/test/java/convex/restapi/StressTest.java b/convex-restapi/src/test/java/convex/restapi/test/StressTest.java
similarity index 97%
rename from convex-restapi/src/test/java/convex/restapi/StressTest.java
rename to convex-restapi/src/test/java/convex/restapi/test/StressTest.java
index dd8ecacea..7d6e31b8b 100644
--- a/convex-restapi/src/test/java/convex/restapi/StressTest.java
+++ b/convex-restapi/src/test/java/convex/restapi/test/StressTest.java
@@ -1,4 +1,4 @@
-package convex.restapi;
+package convex.restapi.test;
import java.util.ArrayList;
import java.util.Map;
@@ -15,6 +15,7 @@
import convex.java.JSON;
import convex.peer.API;
import convex.peer.Server;
+import convex.restapi.RESTServer;
public class StressTest {