Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rvesse
Copy link
Member

@rvesse rvesse commented Oct 2, 2024

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.

GitHub issue resolved #2753


  • Tests are included.
  • Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

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.

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.
@rvesse rvesse added the enhancement Incrementally add new feature label Oct 2, 2024
@rvesse rvesse self-assigned this Oct 2, 2024
@rvesse rvesse marked this pull request as ready for review October 2, 2024 13:47
@@ -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}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* This is processed by {@link FusekiMain#buildServer}.
* This is processed by {@link FusekiMain#applyServerArgs}.

buildServer is removed by this PR.

Comment on lines +68 to +80
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());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

@afs afs Oct 7, 2024

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?

@afs
Copy link
Member

afs commented Oct 10, 2024

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?

@rvesse
Copy link
Member Author

rvesse commented Oct 10, 2024

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

@rvesse rvesse marked this pull request as draft October 10, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Incrementally add new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve ability to support custom arguments for Fuseki Servers
2 participants