For testing with Fuseki, then the embedded version is useful as used in
the integration tests - it does not need any static resources (web
pages), just a dataset and a name for the URL.
e.g. use in:
https://github.com/apache/jena/blob/master/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
@BeforeClass / @AfterClass / @Before is a balance between perfect
isolation. One server per test suite, each test clears the dataset.
HTTP server ports do not do away immediately on shutdown (the kernel
clears up asynchronously) leading failure to start up the next server.
Also, be careful about the HTTP client or a lot of tests run will lead
to port exhaustion, again because kernel resources are freed
asynchronously. This is more likely on ASF Jenkins because the machines
are loaded so the kernel is more behind clearing up. It has caused us a
lot of problems before.
ServerCtl predates embedded Fuseki and also the integration tests.
fuseki.embedded.FusekiTestServer is "ServerCtl" ported to embedded
Fuseki. And the RDFConnections tests were actually written before
FusekiTestServer.
----
For a plain HTTP server, direct use of Jetty works well. As Fuseki uses
Jetty anyway, there is code to show how to set it up purely embedded, no
static resources, web.xml needed. See end of FusekiEmbeddedServer.
Used this way, it starts and stops quite quickly making use from the IDE
tests more pleasant.
Andy
On 08/01/17 00:20, A. Soroka wrote:
Fuseki uses:
https://github.com/apache/jena/blob/master/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/ServerCtl.java
Personally, if I was not working directly in the Jena code base and I only
needed one server (as opposed to multiple servers, per test or per test class
or the like) I would probably turn to Cargo:
https://codehaus-cargo.github.io/cargo/Home.html
which has a Maven plugin.
---
A. Soroka
The University of Virginia Library
On Jan 7, 2017, at 6:35 PM, Claude Warren <[email protected]> wrote:
I know that there is at least one test that starts and shuts down a server
during testing. (Fuseki? Elephas?) Can someone point me to the code that
is used to do that? I need to do something similar for Cassandra testing.
Claude
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren