-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-2753: Improve customising Fuseki args #2754
base: main
Are you sure you want to change the base?
Conversation
Improves how Fuseki arguments are customised, in particular makes the ServerConfig class public adding the ability to store extra configuration on it. It also changes the previously private static applyServerArgs() method into a protected instance method so users can extend FusekiMain and override it to use that to customise the FusekiServer.Builder further. Unit tests are added that validate that custom arguments can now be passed through CLI inputs and used to influence the Server being built.
@@ -23,12 +23,15 @@ | |||
import org.apache.jena.graph.Graph; | |||
import org.apache.jena.sparql.core.DatasetGraph; | |||
|
|||
import java.util.HashMap; | |||
import java.util.Map; | |||
|
|||
/** | |||
* Setup details (command line, config file) from command line processing. | |||
* This is built by {@link FusekiMain#exec}. | |||
* This is processed by {@link FusekiMain#buildServer}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* This is processed by {@link FusekiMain#buildServer}. | |
* This is processed by {@link FusekiMain#applyServerArgs}. |
buildServer
is removed by this PR.
private void testForCmdException(List<String> arguments, String expectedMessage) { | ||
// when | ||
Throwable actual = null; | ||
try { | ||
buildServer(buildCmdLineArguments(arguments)); | ||
} catch (Exception e) { | ||
actual = e; | ||
} | ||
// then | ||
assertNotNull(actual); | ||
assertTrue("Expecting correct exception", (actual instanceof CmdException)); | ||
assertEquals("Expecting correct message", expectedMessage, actual.getMessage()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void testForCmdException(List<String> arguments, String expectedMessage) { | |
// when | |
Throwable actual = null; | |
try { | |
buildServer(buildCmdLineArguments(arguments)); | |
} catch (Exception e) { | |
actual = e; | |
} | |
// then | |
assertNotNull(actual); | |
assertTrue("Expecting correct exception", (actual instanceof CmdException)); | |
assertEquals("Expecting correct message", expectedMessage, actual.getMessage()); | |
} | |
private void testForCmdException(List<String> arguments, String expectedMessage) { | |
CmdException ex = assertThrows(CmdException.class, ()->buildServer(buildCmdLineArguments(arguments))); | |
assertEquals("Expecting correct message", expectedMessage, ex.getMessage()); | |
} |
mixing Junit 4 and junit5.
Not that this function is actually called from anywhere!
server.stop(); | ||
} | ||
|
||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be the only test and the rest of the code is taken from TestFusekiCmdArguments
.
Move TestFusekiCmdArguments
or DRY the code?
Release 5.2.0 is approaching. I have a discussion point #2753 (comment) which is about whether this feature now will fit into future possible changes and some code comments here. Would you prefer to wait or get into 5.2.0? |
See larger discussion response on #2753, let's leave this out for now and look at other options as we can workaround this for now |
Improves how Fuseki arguments are customised, in particular makes the
ServerConfig
class public adding the ability to store extra configuration on it.It also changes the previously
private static applyServerArgs()
method into a protected instance method so users can extendFusekiMain
and override it to use that to customise theFusekiServer.Builder
further.Unit tests are added that validate that custom arguments can now be passed through CLI inputs and used to influence the Server being built.
GitHub issue resolved #2753
By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.
See the Apache Jena "Contributing" guide.