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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to