You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by afs <gi...@git.apache.org> on 2016/10/15 19:02:31 UTC

[GitHub] jena pull request #179: Reorganise control of a test Fuseki server for HTTP ...

GitHub user afs opened a pull request:

    https://github.com/apache/jena/pull/179

    Reorganise control of a test Fuseki server for HTTP API testing.

    JENA-1245
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena http_testing

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/179.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #179
    
----
commit 6d63d21dbf6b2163a1e7ad79aee87b0bcb7c90f9
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-15T17:29:30Z

    Split ServerTest into ServerCtl and ServerTestData.

commit 355d4c4dc4e878033cc6a7c03bf77c46f96ee90a
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-15T17:35:20Z

    Align to redesigned Fuseki tests (ServerCtl).

commit dc27c2b0a503ff04bd7dcd9787d49b2ae714c020
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-15T19:00:16Z

    Remove extends.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #179: Reorganise control of a test Fuseki server for HTTP ...

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/179#discussion_r83655593
  
    --- Diff: jena-fuseki1/src/test/java/org/apache/jena/fuseki/ServerCtl.java ---
    @@ -18,39 +18,113 @@
     
     package org.apache.jena.fuseki;
     
    +import static org.apache.jena.fuseki.ServerCtl.ServerScope.CLASS ;
    +import static org.apache.jena.fuseki.ServerCtl.ServerScope.SUITE ;
    +import static org.apache.jena.fuseki.ServerCtl.ServerScope.TEST ;
    +
    +import java.io.IOException ;
    +import java.net.ServerSocket ;
    +import java.util.concurrent.atomic.AtomicInteger ;
    +
     import org.apache.http.client.HttpClient ;
     import org.apache.http.impl.client.CloseableHttpClient ;
     import org.apache.jena.atlas.io.IO ;
    +import org.apache.jena.fuseki.server.DatasetRegistry ;
     import org.apache.jena.riot.web.HttpOp ;
    +import org.apache.jena.sparql.core.DatasetGraph ;
    +import org.apache.jena.sparql.core.DatasetGraphFactory ;
    +import org.apache.jena.sparql.modify.request.Target ;
    +import org.apache.jena.sparql.modify.request.UpdateDrop ;
    +import org.apache.jena.system.Txn ;
    +import org.apache.jena.update.Update ;
    +import org.apache.jena.update.UpdateExecutionFactory ;
    +import org.apache.jena.update.UpdateProcessor ;
     
    +/**
    + * Manage a single server for use wth tests. It supports three modes:
    + * <ul>
    + * <li>One server for a whole test suite
    + * <li>One server per test class
    + * <li>One server per individual test
    + * </ul>
    + * One server per individual test can be troublesome due to connections not closing down
    + * fast enough (left in TCP state {@code TIME_WAIT} which is 2 minutes) and also can be slow.
    + * One server per test class is a good compromise. 
    + * <p> The data in the server is always reseet between tests.
    + * <p>
    + * Using a connection pooling HttpClient (see {@link HttpOp#createPoolingHttpClient()}) is important,
    + * both for test performance and for reducing the TCP connection load on the operarting system.  
    + * <p>
    + * Usage:
    + * </p>
    + * <p>
    + * In the test suite, put:
    + * 
    + * <pre>
    + *  {@literal @BeforeClass} static public void beforeSuiteClass() { ServerCtl.ctlBeforeTestSuite(); } 
    + *  {@literal @AfterClass}  static public void afterSuiteClass()  { ServerCtl.ctlAfterTestSuite(); }
    + * </pre>
    + * <p>
    + * In the test class, put:
    + * <pre>
    + * {@literal @BeforeClass} public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
    --- End diff --
    
    Mm, those are all true points. Okay, it still might be nice to offer an `abstract` class to inherit this stuff from, no big deal. Certainly something we could fool around with later if we want to.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #179: Reorganise control of a test Fuseki server for HTTP API tes...

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/179
  
    `AbstractFusekiTest` -- it isn't so simple though as there is only one super class and it ends up competing for that. And the Auth tests need to be different again.
    
    So this PR is just Fuseki1, Fuseki2 and applied to our own code. Each Fuseki has its own needs.  jena-jdbc-drive-remote is the one instance of something using a Fuseki as a test server while not testing Fuseki.  When I realized that, it became clear why the idea of only one framework for both uses was proving a bit messy.
    
    A framework to use Fuseki for testing use of SPARQL protocols can go in the embedded server (= no file footprint).
    
    Testing Fuseki2 does need the full server, file footprint and all.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #179: Reorganise control of a test Fuseki server for HTTP API tes...

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/179
  
    Commit 7c3a5cf applies the test sever style to Fuseki2. It also makes naming consistent across Fuseki1 and Fuseki2.  
    
     jena-jdbc-driver-remote has not been switched to using Fuseki2 yet. The "auth" tests will need changes and having them in a separate commit will be make them more easily reversible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #179: Reorganise control of a test Fuseki server for HTTP ...

Posted by afs <gi...@git.apache.org>.
Github user afs closed the pull request at:

    https://github.com/apache/jena/pull/179


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #179: Reorganise control of a test Fuseki server for HTTP ...

Posted by afs <gi...@git.apache.org>.
GitHub user afs reopened a pull request:

    https://github.com/apache/jena/pull/179

    Reorganise control of a test Fuseki server for HTTP API testing.

    JENA-1245
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena http_testing

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/179.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #179
    
----
commit 6d63d21dbf6b2163a1e7ad79aee87b0bcb7c90f9
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-15T17:29:30Z

    Split ServerTest into ServerCtl and ServerTestData.

commit 355d4c4dc4e878033cc6a7c03bf77c46f96ee90a
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-15T17:35:20Z

    Align to redesigned Fuseki tests (ServerCtl).

commit dc27c2b0a503ff04bd7dcd9787d49b2ae714c020
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-15T19:00:16Z

    Remove extends.

commit 7c3a5cfd683426cc02b671c129878c45a6aebb30
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-16T14:53:34Z

    Port ServerCtl to Fuseki2. Make naming and use consistent

commit 080ff1dbd115270d4bb59b5847b98f73edf76444
Author: Andy Seaborne <an...@apache.org>
Date:   2016-10-16T18:41:46Z

    Typo

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #179: Reorganise control of a test Fuseki server for HTTP ...

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/179#discussion_r83656694
  
    --- Diff: jena-fuseki1/src/test/java/org/apache/jena/fuseki/ServerCtl.java ---
    @@ -18,39 +18,113 @@
     
     package org.apache.jena.fuseki;
     
    +import static org.apache.jena.fuseki.ServerCtl.ServerScope.CLASS ;
    +import static org.apache.jena.fuseki.ServerCtl.ServerScope.SUITE ;
    +import static org.apache.jena.fuseki.ServerCtl.ServerScope.TEST ;
    +
    +import java.io.IOException ;
    +import java.net.ServerSocket ;
    +import java.util.concurrent.atomic.AtomicInteger ;
    +
     import org.apache.http.client.HttpClient ;
     import org.apache.http.impl.client.CloseableHttpClient ;
     import org.apache.jena.atlas.io.IO ;
    +import org.apache.jena.fuseki.server.DatasetRegistry ;
     import org.apache.jena.riot.web.HttpOp ;
    +import org.apache.jena.sparql.core.DatasetGraph ;
    +import org.apache.jena.sparql.core.DatasetGraphFactory ;
    +import org.apache.jena.sparql.modify.request.Target ;
    +import org.apache.jena.sparql.modify.request.UpdateDrop ;
    +import org.apache.jena.system.Txn ;
    +import org.apache.jena.update.Update ;
    +import org.apache.jena.update.UpdateExecutionFactory ;
    +import org.apache.jena.update.UpdateProcessor ;
     
    +/**
    + * Manage a single server for use wth tests. It supports three modes:
    + * <ul>
    + * <li>One server for a whole test suite
    + * <li>One server per test class
    + * <li>One server per individual test
    + * </ul>
    + * One server per individual test can be troublesome due to connections not closing down
    + * fast enough (left in TCP state {@code TIME_WAIT} which is 2 minutes) and also can be slow.
    + * One server per test class is a good compromise. 
    + * <p> The data in the server is always reseet between tests.
    + * <p>
    + * Using a connection pooling HttpClient (see {@link HttpOp#createPoolingHttpClient()}) is important,
    + * both for test performance and for reducing the TCP connection load on the operarting system.  
    + * <p>
    + * Usage:
    + * </p>
    + * <p>
    + * In the test suite, put:
    + * 
    + * <pre>
    + *  {@literal @BeforeClass} static public void beforeSuiteClass() { ServerCtl.ctlBeforeTestSuite(); } 
    + *  {@literal @AfterClass}  static public void afterSuiteClass()  { ServerCtl.ctlAfterTestSuite(); }
    + * </pre>
    + * <p>
    + * In the test class, put:
    + * <pre>
    + * {@literal @BeforeClass} public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
    --- End diff --
    
    Actually, maybe this would make a good JUnit [ClassRule](https://github.com/junit-team/junit4/wiki/Rules#classrule). Not suggesting we worry too much about that now or block anything for it-- just thinking about next steps.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #179: Reorganise control of a test Fuseki server for HTTP API tes...

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/179
  
    This is the first part of reorganizing the test server. Changes are made to Fuseki1, and to jena-jdbc-driver-remote, which uses a Fuseki1 server for its testing.
    
    The changes for jena-jdbc-driver-remote mean it should just be a change of dependency to switch to using Fuseki2.
    
    This PR is not yet complete - it shows how the test setup work for Fuseki1. The same changes will be made to Fuseki2, then switch jena-jdbc-driver-remote.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #179: Reorganise control of a test Fuseki server for HTTP API tes...

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/179
  
    (Wrong button again)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #179: Reorganise control of a test Fuseki server for HTTP ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/179


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---