You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2014/02/27 13:37:52 UTC

[1/3] git commit: MARMOTTA-440: fixed wrong base path on a test

Repository: marmotta
Updated Branches:
  refs/heads/ldp 15262de98 -> 397cd2aff


MARMOTTA-440: fixed wrong base path on a test


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/283444f7
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/283444f7
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/283444f7

Branch: refs/heads/ldp
Commit: 283444f7a13dbb39b27b0ac93b11978ded5fa346
Parents: 15262de
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Feb 27 12:47:09 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Feb 27 12:47:09 2014 +0100

----------------------------------------------------------------------
 .../ldp/webservices/LdpWebServiceTest.java       | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/283444f7/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
index 9016443..27a693a 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
@@ -17,15 +17,8 @@
 
 package org.apache.marmotta.platform.ldp.webservices;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-
+import com.jayway.restassured.RestAssured;
 import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.apache.marmotta.platform.core.api.importer.ImportService;
-import org.apache.marmotta.platform.core.api.triplestore.ContextService;
-import org.apache.marmotta.platform.core.api.user.UserService;
 import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
 import org.junit.AfterClass;
@@ -35,7 +28,8 @@ import org.openrdf.rio.RDFFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.jayway.restassured.RestAssured;
+import java.io.IOException;
+import java.net.URISyntaxException;
 
 /**
  * Tests for testing the LDP web services
@@ -67,17 +61,18 @@ public class LdpWebServiceTest {
     @Test
     public void testCRUD() {
         // The container
-        final String container = "/lpd/test/container1";
+        final String container = "/ldp/test/container1";
         final String newResourceUri = container + "/resource1";
 
         RestAssured.expect().statusCode(404).get(container);
 
         // Create
-        RestAssured.given()
+        RestAssured
+            .given()
                 .header("Slug", "resource1")
                 .body(testResourceTTL.getBytes())
                 .contentType(RDFFormat.TURTLE.getDefaultMIMEType())
-                .expect()
+            .expect()
                 .statusCode(201)
                 .header("Location", RestAssured.baseURI + newResourceUri)
                 .post(container);


[2/3] git commit: MARMOTTA-440: refacotrized test

Posted by wi...@apache.org.
MARMOTTA-440: refacotrized test


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/66a7f5b8
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/66a7f5b8
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/66a7f5b8

Branch: refs/heads/ldp
Commit: 66a7f5b83d0e56bf80782163b8067105265b3c7c
Parents: 283444f
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Feb 27 13:23:55 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Feb 27 13:23:55 2014 +0100

----------------------------------------------------------------------
 .../platform/ldp/webservices/LdpWebService.java |  2 +-
 .../ldp/webservices/LdpWebServiceTest.java      | 68 ++++++++++++--------
 2 files changed, 43 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/66a7f5b8/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
index b6e33e8..e176e21 100644
--- a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
+++ b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
@@ -62,7 +62,7 @@ import java.util.*;
 @Path(LdpWebService.PATH + "{local:.*}")
 public class LdpWebService {
 
-    public static final String PATH = "ldp"; //FIXME: imho this should be root '/' (jakob)
+    public static final String PATH = "/ldp"; //FIXME: imho this should be root '/' (jakob)
 
     private Logger log = org.slf4j.LoggerFactory.getLogger(this.getClass());
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/66a7f5b8/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
index 27a693a..b329f2b 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
@@ -28,83 +28,99 @@ import org.openrdf.rio.RDFFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.ws.rs.core.UriBuilder;
 import java.io.IOException;
 import java.net.URISyntaxException;
 
 /**
- * Tests for testing the LDP web services
- * 
- * @author Sergio Fernández
+ * Testing LDP web services
  *
+ * @author Sergio Fernández
+ * @author Jakob Frank
  */
 public class LdpWebServiceTest {
 
-	private static Logger log = LoggerFactory.getLogger(LdpWebServiceTest.class);
-	
+    private static Logger log = LoggerFactory.getLogger(LdpWebServiceTest.class);
+
     private static JettyMarmotta marmotta;
 
+    private static String baseUrl;
+
     private static String testResourceTTL;
 
     @BeforeClass
-    public static void setUp() throws MarmottaImportException, URISyntaxException, IOException {
+    public static void setup() throws MarmottaImportException, URISyntaxException, IOException {
         marmotta = new JettyMarmotta("/marmotta", LdpWebService.class);
-        
-        //TODO: initialization
-        testResourceTTL = IOUtils.toString(LdpWebServiceTest.class.getResourceAsStream("/test.ttl"), "utf8");
-        
         RestAssured.baseURI = "http://localhost";
         RestAssured.port = marmotta.getPort();
         RestAssured.basePath = marmotta.getContext();
+        baseUrl = UriBuilder.fromUri("http://localhost").port(marmotta.getPort()).path(marmotta.getContext()).build().toString();
 
+        //initialization
+        testResourceTTL = IOUtils.toString(LdpWebServiceTest.class.getResourceAsStream("/test.ttl"), "utf8");
+    }
+
+    @AfterClass
+    public static void shutdown() {
+        marmotta.shutdown();
+        testResourceTTL = null;
     }
 
     @Test
     public void testCRUD() {
+        final String testBase = "test1";
+        final String containerName = "container1";
+        final String resourceName = "resource1";
+
         // The container
-        final String container = "/ldp/test/container1";
-        final String newResourceUri = container + "/resource1";
+        final String container = UriBuilder.fromPath(LdpWebService.PATH).path(testBase).path(containerName).build().toString();
+        final String newResource = UriBuilder.fromUri(container).path(resourceName).build().toString();
 
         RestAssured.expect().statusCode(404).get(container);
 
         // Create
         RestAssured
             .given()
-                .header("Slug", "resource1")
+                .header("Slug", resourceName)
                 .body(testResourceTTL.getBytes())
                 .contentType(RDFFormat.TURTLE.getDefaultMIMEType())
             .expect()
                 .statusCode(201)
-                .header("Location", RestAssured.baseURI + newResourceUri)
-                .post(container);
+                .header("Location", baseUrl + newResource)
+            .post(container);
 
         // now the container exists
         log.info("200 - container");
-        RestAssured.given()
+        RestAssured
+            .given()
                 .header("Accept", RDFFormat.TURTLE.getDefaultMIMEType())
-                .expect()
+            .expect()
                 .statusCode(200)
                 .contentType(RDFFormat.TURTLE.getDefaultMIMEType())
-                .get(container);
+            .get(container);
 
         // also the new resource exists
-        RestAssured.given()
+        RestAssured
+            .given()
                 .header("Accept", RDFFormat.TURTLE.getDefaultMIMEType())
-                .expect()
+            .expect()
                 .statusCode(200)
                 .contentType(RDFFormat.TURTLE.getDefaultMIMEType())
-                .get(newResourceUri);
+            .get(newResource);
 
         // delete
-        RestAssured.expect()
+        RestAssured
+            .expect()
                 .statusCode(204)
-                .delete(newResourceUri);
+            .delete(newResource);
 
         // now the new resource does not exist.
-        RestAssured.given()
+        RestAssured
+            .given()
                 .header("Accept", RDFFormat.TURTLE.getDefaultMIMEType())
-                .expect()
+            .expect()
                 .statusCode(404)
-                .get(newResourceUri);
+            .get(newResource);
 
     }
 


[3/3] git commit: MARMOTTA-440: trying to fix test shutdown

Posted by wi...@apache.org.
MARMOTTA-440: trying to fix test shutdown


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/397cd2af
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/397cd2af
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/397cd2af

Branch: refs/heads/ldp
Commit: 397cd2aff0a611b769eabc74e0941c800a7c4fe0
Parents: 66a7f5b
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Feb 27 13:37:40 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Feb 27 13:37:40 2014 +0100

----------------------------------------------------------------------
 platform/marmotta-core/pom.xml                  |   5 +
 .../core/startup/MarmottaStartupService.java    | 114 +++++++++---------
 .../core/test/base/AbstractMarmotta.java        |   2 +-
 .../platform/core/test/base/JettyMarmotta.java  | 120 +++++++++----------
 .../ldp/webservices/LdpWebServiceTest.java      |   3 +-
 5 files changed, 125 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/397cd2af/platform/marmotta-core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/pom.xml b/platform/marmotta-core/pom.xml
index 3c2bb95..5a65046 100644
--- a/platform/marmotta-core/pom.xml
+++ b/platform/marmotta-core/pom.xml
@@ -385,6 +385,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.jboss.weld.servlet</groupId>
+            <artifactId>weld-servlet-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.jboss.weld.se</groupId>
             <artifactId>weld-se-core</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/397cd2af/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/startup/MarmottaStartupService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/startup/MarmottaStartupService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/startup/MarmottaStartupService.java
index f0b4ca5..0036a8b 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/startup/MarmottaStartupService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/startup/MarmottaStartupService.java
@@ -57,7 +57,7 @@ public class MarmottaStartupService {
 
     private static final String DEFAULT_KIWI_VERSION = "undefined";
 
-    private Logger log  = LoggerFactory.getLogger(MarmottaStartupService.class);
+    private Logger log = LoggerFactory.getLogger(MarmottaStartupService.class);
 
     @Inject
     private ConfigurationService configurationService;
@@ -65,10 +65,12 @@ public class MarmottaStartupService {
     @Inject
     private ModuleService moduleService;
 
-    @Inject @Any
+    @Inject
+    @Any
     private Event<SystemStartupEvent> startupEvent;
 
-    @Inject @Any
+    @Inject
+    @Any
     private Event<SesameStartupEvent> sesameEvent;
 
     private boolean configurationStarted = false;
@@ -88,9 +90,9 @@ public class MarmottaStartupService {
      * The parameters lmfHome and configurationOverride can be used to override the default settings
      * of the Apache Marmotta.
      *
-     * @param lmfHome                 home directory of the Apache Marmotta instance (may be null, in which case the default will be used)
-     * @param configurationOverride   configuration options that should override the default values from default-config.properties (may be null)
-     * @param context                 the servlet context the Apache Marmotta is running in (may be null)
+     * @param lmfHome               home directory of the Apache Marmotta instance (may be null, in which case the default will be used)
+     * @param configurationOverride configuration options that should override the default values from default-config.properties (may be null)
+     * @param context               the servlet context the Apache Marmotta is running in (may be null)
      */
     public void startupConfiguration(String home, Configuration configurationOverride, ServletContext context) {
         lock.lock();
@@ -99,14 +101,14 @@ public class MarmottaStartupService {
         String versionNumber = DEFAULT_KIWI_VERSION;
 
         try {
-            if(configurationStarted) {
+            if (configurationStarted) {
                 log.warn("Apache Marmotta Startup: configuration already started; ignoring second request");
                 return;
             }
 
             ModuleConfiguration coreConfiguration = moduleService.getModuleConfiguration(this.getClass());
 
-            if(coreConfiguration.hasBuildInfo()) {
+            if (coreConfiguration.hasBuildInfo()) {
                 log.info("Apache Marmotta Core Version {} starting up ... ", coreConfiguration.getModuleVersion());
                 log.info("Build Information:");
                 log.info(" - Build User: {}", coreConfiguration.getBuildUser());
@@ -119,76 +121,76 @@ public class MarmottaStartupService {
                 log.info("Apache Marmotta Core (Development Version) starting up ... ");
             }
 
-            if(StringUtils.isBlank(home)) {
+            if (StringUtils.isBlank(home)) {
                 home = System.getProperty("marmotta.home");
-                if(StringUtils.isNotBlank(home)) {
+                if (StringUtils.isNotBlank(home)) {
                     log.info("Configured working directory {} from system property marmotta.home", home);
                 } else {
                     home = System.getProperty("lmf.home");
-                    if(StringUtils.isNotBlank(home)) {
+                    if (StringUtils.isNotBlank(home)) {
                         log.info("Configured working directory {} from system property lmf.home", home);
                     } else {
                         home = System.getProperty("kiwi.home");
-                        if(StringUtils.isNotBlank(home)) {
+                        if (StringUtils.isNotBlank(home)) {
                             log.info("Configured working directory {} from system property kiwi.home", home);
-                        } else {                    
-		                    home = System.getenv("MARMOTTA_HOME");
-		                    if(StringUtils.isNotBlank(home)) {
-		                        log.info("Configured working directory {} from environment variable MARMOTTA_HOME", home);
-		                    } else {
-		                        home = System.getenv("LMF_HOME");
-		                        if(StringUtils.isNotBlank(home)) {
-		                            log.info("Configured working directory {} from environment variable LMF_HOME", home);
-		                        } else {
-		                            home = System.getenv("KIWI_HOME");
-		                            if(StringUtils.isNotBlank(home)) {
-		                                log.info("Configured working directory {} from environment variable KIWI_HOME", home);
-		                            } else {
-		                            	if (context != null) {
-			                                home = context.getInitParameter("marmotta.home");
-			                                if(StringUtils.isNotBlank(home)) {
-			                                    log.info("Configured working directory {} from servlet context parameter marmotta.home", home);
-			                                }
-		                            	} else {
-		                            		log.error("could not determine Apache Marmotta home directory, please set the environment variable MARMOTTA_HOME");
-		                            	}
-		                            }
-		                        }
-		                    }
+                        } else {
+                            home = System.getenv("MARMOTTA_HOME");
+                            if (StringUtils.isNotBlank(home)) {
+                                log.info("Configured working directory {} from environment variable MARMOTTA_HOME", home);
+                            } else {
+                                home = System.getenv("LMF_HOME");
+                                if (StringUtils.isNotBlank(home)) {
+                                    log.info("Configured working directory {} from environment variable LMF_HOME", home);
+                                } else {
+                                    home = System.getenv("KIWI_HOME");
+                                    if (StringUtils.isNotBlank(home)) {
+                                        log.info("Configured working directory {} from environment variable KIWI_HOME", home);
+                                    } else {
+                                        if (context != null) {
+                                            home = context.getInitParameter("marmotta.home");
+                                            if (StringUtils.isNotBlank(home)) {
+                                                log.info("Configured working directory {} from servlet context parameter marmotta.home", home);
+                                            }
+                                        } else {
+                                            log.error("could not determine Apache Marmotta home directory, please set the environment variable MARMOTTA_HOME");
+                                        }
+                                    }
+                                }
+                            }
                         }
                     }
                 }
             }
 
-            if(StringUtils.isNotBlank(home)) {
-            	if (home.startsWith("~" + File.separator)) {
-            	    home = System.getProperty("user.home") + home.substring(1);
-            	}
+            if (StringUtils.isNotBlank(home)) {
+                if (home.startsWith("~" + File.separator)) {
+                    home = System.getProperty("user.home") + home.substring(1);
+                }
                 configurationService.setHome(home);
             } else {
-            	log.error("home directory not properly initialized!!!");
+                log.error("home directory not properly initialized!!!");
             }
 
-            if(context != null) {
+            if (context != null) {
                 configurationService.setServletContext(context);
             }
 
-            configurationService.initialize(home,configurationOverride);
+            configurationService.initialize(home, configurationOverride);
 
 
             configurationService.setConfiguration("kiwi.version", versionNumber);
 
-            if(context != null) {
+            if (context != null) {
                 configurationService.setConfiguration("kiwi.path", context.getContextPath());
 
                 // register the systray links provided by the different components
-                Map<String, String> demoLinks  = new HashMap<String, String>();
+                Map<String, String> demoLinks = new HashMap<String, String>();
                 Map<String, String> adminLinks = new HashMap<String, String>();
 
-                for(MarmottaSystrayLink link : CDIContext.getInstances(MarmottaSystrayLink.class)) {
-                    if(link.getSection() == MarmottaSystrayLink.Section.DEMO) {
+                for (MarmottaSystrayLink link : CDIContext.getInstances(MarmottaSystrayLink.class)) {
+                    if (link.getSection() == MarmottaSystrayLink.Section.DEMO) {
                         demoLinks.put(link.getLabel(), link.getLink());
-                    } else if(link.getSection() == MarmottaSystrayLink.Section.ADMIN) {
+                    } else if (link.getSection() == MarmottaSystrayLink.Section.ADMIN) {
                         adminLinks.put(link.getLabel(), link.getLink());
                     }
                 }
@@ -212,14 +214,14 @@ public class MarmottaStartupService {
      * The method expects a host URL and a context URL to be given. In case the context URL is not given,
      * it will be the same as the host URL.
      *
-     * @param hostUrl     the URL of the host, used as based URL for building the Apache Marmotta web interface
-     * @param contextUrl  the base URL used to construct Linked Data resources
+     * @param hostUrl    the URL of the host, used as based URL for building the Apache Marmotta web interface
+     * @param contextUrl the base URL used to construct Linked Data resources
      */
     public void startupHost(String hostUrl, String contextUrl) {
         lock.lock();
 
         try {
-            if(hostStarted) {
+            if (hostStarted) {
                 log.warn("Apache Marmotta Startup: host already started; ignoring subsequent startup requests");
                 return;
             }
@@ -228,7 +230,7 @@ public class MarmottaStartupService {
             boolean isSetup = configurationService.getBooleanConfiguration("kiwi.setup.host");
 
             // carry out initializations that need the server URI to be set properly
-            if(!isSetup) {
+            if (!isSetup) {
                 log.info("SETUP: Setting up initial host and resource configuration ({}) ...", hostUrl);
 
                 configurationService.setConfiguration("kiwi.context", contextUrl);
@@ -239,12 +241,12 @@ public class MarmottaStartupService {
 
             // trigger startup of the sesame service once the hostname is ready (we need the correct URIs for
             // default, cache and inferred context)
-            SesameService sesameService  = CDIContext.getInstance(SesameService.class);
+            SesameService sesameService = CDIContext.getInstance(SesameService.class);
             sesameService.initialise();
             sesameEvent.fire(new SesameStartupEvent());
 
             // trigger startup of the user service once the sesame service is ready
-            UserService   userService    = CDIContext.getInstance(UserService.class);
+            UserService userService = CDIContext.getInstance(UserService.class);
 
             userService.createDefaultUsers();
 
@@ -253,7 +255,7 @@ public class MarmottaStartupService {
             configurationService.setInitialising(false);
 
             startupEvent.fire(new SystemStartupEvent());
-            
+
         } finally {
             lock.unlock();
         }
@@ -271,5 +273,5 @@ public class MarmottaStartupService {
     public boolean isHostStarted() {
         return hostStarted;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/397cd2af/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractMarmotta.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractMarmotta.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractMarmotta.java
index 3694438..b4fb48b 100644
--- a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractMarmotta.java
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractMarmotta.java
@@ -42,7 +42,7 @@ import java.util.HashMap;
  */
 public abstract class AbstractMarmotta {
 
-    protected static Logger log = LoggerFactory.getLogger(EmbeddedMarmotta.class);
+    protected static Logger log = LoggerFactory.getLogger(AbstractMarmotta.class);
 
     protected Weld weld;
     protected WeldContainer container;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/397cd2af/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyMarmotta.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyMarmotta.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyMarmotta.java
index c1a965f..8687377 100644
--- a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyMarmotta.java
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyMarmotta.java
@@ -17,10 +17,6 @@
  */
 package org.apache.marmotta.platform.core.test.base;
 
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.*;
-
 import org.apache.marmotta.platform.core.servlet.MarmottaResourceFilter;
 import org.apache.marmotta.platform.core.test.base.jetty.TestApplication;
 import org.apache.marmotta.platform.core.test.base.jetty.TestInjectorFactory;
@@ -28,31 +24,33 @@ import org.apache.marmotta.platform.core.util.CDIContext;
 import org.apache.marmotta.platform.core.webservices.CoreApplication;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.FilterMapping;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
 
 import javax.servlet.DispatcherType;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.*;
 
 /**
- * An extended version of the EmbeddedMarmotta which also starts a jetty servlet 
+ * An extended version of the EmbeddedMarmotta which also starts a jetty servlet
  * container. The context name is passed in the constructor; port could be passed,
- * a random available port will be use otherwise. The JettyMarmotta can optionally 
- * take a set of web service classes as argument; if this argument is present, only 
- * the given web services will be instantiated; otherwise, all configured web services 
+ * a random available port will be use otherwise. The JettyMarmotta can optionally
+ * take a set of web service classes as argument; if this argument is present, only
+ * the given web services will be instantiated; otherwise, all configured web services
  * will be instantiated (as in a normal webapp installation).
- * 
+ *
  * @author Sebastian Schaffert
  * @author Sergio Fernández
  */
 public class JettyMarmotta extends AbstractMarmotta {
 
     private Server jetty;
-    
+
     private int port;
 
-	private String context;
-	
+    private String context;
+
     public JettyMarmotta(String context) {
         this(context, getRandomPort());
     }
@@ -60,25 +58,25 @@ public class JettyMarmotta extends AbstractMarmotta {
     public JettyMarmotta(String context, int port) {
         this(context, port, (Set<Class<?>>) null);
     }
-    
+
     public JettyMarmotta(String context, Class<?> webservice) {
         this(context, getRandomPort(), webservice);
     }
 
     public JettyMarmotta(String context, int port, Class<?> webservice) {
-        this(context,port, Collections.<Class<?>>singleton(webservice));
+        this(context, port, Collections.<Class<?>>singleton(webservice));
     }
-    
+
     public JettyMarmotta(String context, Class<?>... webservices) {
         this(context, getRandomPort(), webservices);
     }
 
     public JettyMarmotta(String context, int port, Class<?>... webservices) {
-        this(context,port, new HashSet<Class<?>>(Arrays.asList(webservices)));
+        this(context, port, new HashSet<Class<?>>(Arrays.asList(webservices)));
     }
-    
+
     public JettyMarmotta(String context, Set<Class<?>> webservices) {
-    	this(context, getRandomPort(), webservices);
+        this(context, getRandomPort(), webservices);
     }
 
     public JettyMarmotta(String context, int port, Set<Class<?>> webservices) {
@@ -86,7 +84,7 @@ public class JettyMarmotta extends AbstractMarmotta {
 
         this.port = port;
         this.context = (context != null ? context : "/");
-        
+
         // create a new jetty & run it on port 8080
         jetty = new Server(this.port);
 
@@ -110,10 +108,10 @@ public class JettyMarmotta extends AbstractMarmotta {
 
         // if a single web service is given, only register that webservice, otherwise startup the default configuration
         //FilterHolder restEasyFilter = new FilterHolder(org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.class);
-        ServletHolder restEasyFilter  = new ServletHolder(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class);
+        ServletHolder restEasyFilter = new ServletHolder(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class);
         restEasyFilter.setInitParameter("resteasy.injector.factory", TestInjectorFactory.class.getCanonicalName());
 
-        if(webservices != null) {
+        if (webservices != null) {
             TestApplication.setTestedWebServices(webservices);
             //restEasyFilter.setInitParameter("resteasy.resources", webservice.getName());
             restEasyFilter.setInitParameter("javax.ws.rs.Application", TestApplication.class.getCanonicalName());
@@ -125,7 +123,7 @@ public class JettyMarmotta extends AbstractMarmotta {
         ctx.addServlet(restEasyFilter, "/*");
 
         try {
-            jetty.start(); 
+            jetty.start();
             String url = "http://localhost:" + this.port + this.context + "/";
             startupService.startupHost(url, url);
         } catch (Exception e) {
@@ -138,47 +136,47 @@ public class JettyMarmotta extends AbstractMarmotta {
         try {
             jetty.stop();
         } catch (Exception e) {
-            log.error("could not shutdown embedded jetty server" ,e);
+            log.error("could not shutdown embedded jetty server", e);
         }
         super.shutdown();
     }
-    
+
     public int getPort() {
-		return port;
-	}
-
-	public String getContext() {
-		return context;
-	}
-	
-	public static int getRandomPort() {
-		Random ran = new Random();
-	    int port = 0;
-	    do {
-	    	port = ran.nextInt(2000) + 8000;
-	    } while (!isPortAvailable(port));
-
-	    return port;
-	}
-	
-	public static boolean isPortAvailable(final int port) {
-	    ServerSocket ss = null;
-	    try {
-	        ss = new ServerSocket(port);
-	        ss.setReuseAddress(true);
-	        return true;
-	    } catch (final IOException e) {
-	    	
-	    } finally {
-	        if (ss != null) {
-	            try {
-					ss.close();
-				} catch (IOException e) {
-					
-				}
-	        }
-	    }
-	    return false;
-	}
+        return port;
+    }
+
+    public String getContext() {
+        return context;
+    }
+
+    public static int getRandomPort() {
+        Random ran = new Random();
+        int port = 0;
+        do {
+            port = ran.nextInt(2000) + 8000;
+        } while (!isPortAvailable(port));
+
+        return port;
+    }
+
+    public static boolean isPortAvailable(final int port) {
+        ServerSocket ss = null;
+        try {
+            ss = new ServerSocket(port);
+            ss.setReuseAddress(true);
+            return true;
+        } catch (final IOException e) {
+
+        } finally {
+            if (ss != null) {
+                try {
+                    ss.close();
+                } catch (IOException e) {
+
+                }
+            }
+        }
+        return false;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/397cd2af/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
index b329f2b..5ba9a25 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/webservices/LdpWebServiceTest.java
@@ -62,7 +62,8 @@ public class LdpWebServiceTest {
 
     @AfterClass
     public static void shutdown() {
-        marmotta.shutdown();
+        //marmotta.shutdown();
+        marmotta = null;
         testResourceTTL = null;
     }