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/05/05 20:42:43 UTC

[01/11] git commit: cosmetic details in the ldpath admin pages

Repository: marmotta
Updated Branches:
  refs/heads/develop c8bd0c019 -> b5cfb0a5d


cosmetic details in the ldpath admin pages


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

Branch: refs/heads/develop
Commit: e9d8aada2d374d667408df095ae2c2bae67885ca
Parents: c8bd0c0
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Apr 10 09:46:26 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Apr 10 09:46:26 2014 +0200

----------------------------------------------------------------------
 .../src/main/resources/kiwi-module.properties                | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/e9d8aada/platform/marmotta-ldpath/src/main/resources/kiwi-module.properties
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/resources/kiwi-module.properties b/platform/marmotta-ldpath/src/main/resources/kiwi-module.properties
index 6cfc446..b3258cf 100644
--- a/platform/marmotta-ldpath/src/main/resources/kiwi-module.properties
+++ b/platform/marmotta-ldpath/src/main/resources/kiwi-module.properties
@@ -16,7 +16,7 @@
 # limitations under the License.
 #
 
-name=LD Path Querying
+name = LDPath
 
 container = Query and Update
 
@@ -34,11 +34,9 @@ adminpages= /admin/about.html, /admin/ldpath.html, /admin/functions.html
 adminpage.0.title=About
 adminpage.0.link=/admin/about.html
 
-adminpage.1.title=Query Interface
+adminpage.1.title=Query
 adminpage.1.link=/admin/ldpath.html
 
-adminpage.2.title=Function Set
+adminpage.2.title=Functions
 adminpage.2.link=/admin/functions.html
 
-
-


[09/11] git commit: moved to commons the quick (and dirty) trick to encode latin1 string from freebase

Posted by wi...@apache.org.
moved to commons the quick (and dirty) trick to encode latin1 string from freebase


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

Branch: refs/heads/develop
Commit: b00e935d0fce5944367ed6f41f8ae108e008edf3
Parents: c5f0d76
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Apr 24 20:16:07 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Apr 24 20:16:07 2014 +0200

----------------------------------------------------------------------
 .../marmotta/commons/util/StringUtils.java      | 40 ++++++++++++++++++++
 .../ldclient/ldclient-provider-freebase/pom.xml |  4 ++
 .../provider/freebase/FreebaseProvider.java     | 20 ++--------
 3 files changed, 47 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/b00e935d/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/StringUtils.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/StringUtils.java
new file mode 100644
index 0000000..3e597c4
--- /dev/null
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/util/StringUtils.java
@@ -0,0 +1,40 @@
+package org.apache.marmotta.commons.util;
+
+/**
+ * Some util string functions
+ *
+ * @author Sergio Fernández
+ */
+public class StringUtils {
+
+    private StringUtils() {
+
+    }
+
+    public static String fixLatin1(String str) {
+        //TODO: find a way to re-code properly the literal
+        //http://www.ic.unicamp.br/~stolfi/EXPORT/www/ISO-8859-1-Encoding.html
+        str = str.replaceAll("\\\\xe1", "á");
+        str = str.replaceAll("\\\\xe2", "â");
+        str = str.replaceAll("\\\\xe3", "ã");
+        str = str.replaceAll("\\\\xe4", "ä");
+        str = str.replaceAll("\\\\xe7", "ç");
+        str = str.replaceAll("\\\\xe8", "è");
+        str = str.replaceAll("\\\\xe9", "é");
+        str = str.replaceAll("\\\\xea", "ê");
+        str = str.replaceAll("\\\\xeb", "ë");
+        str = str.replaceAll("\\\\xed", "í");
+        str = str.replaceAll("\\\\xee", "î");
+        str = str.replaceAll("\\\\xef", "ï");
+        str = str.replaceAll("\\\\xf3", "ó");
+        str = str.replaceAll("\\\\xf4", "ô");
+        str = str.replaceAll("\\\\xf6", "ö");
+        str = str.replaceAll("\\\\xf9", "ù");
+        str = str.replaceAll("\\\\xfb", "û");
+        str = str.replaceAll("\\\\xfc", "ü");
+        str = str.replaceAll("\\\\xfa", "ú");
+        str = str.replaceAll("\\\\x", ""); //FIXME: wrong, wrong, wrong!
+        return str;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b00e935d/libraries/ldclient/ldclient-provider-freebase/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-freebase/pom.xml b/libraries/ldclient/ldclient-provider-freebase/pom.xml
index 39f9848..5cba92c 100644
--- a/libraries/ldclient/ldclient-provider-freebase/pom.xml
+++ b/libraries/ldclient/ldclient-provider-freebase/pom.xml
@@ -42,6 +42,10 @@
             <groupId>org.openrdf.sesame</groupId>
             <artifactId>sesame-rio-turtle</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>marmotta-commons</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b00e935d/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java b/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
index ef3652b..fe39296 100644
--- a/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
+++ b/libraries/ldclient/ldclient-provider-freebase/src/main/java/org/apache/marmotta/ldclient/provider/freebase/FreebaseProvider.java
@@ -183,7 +183,7 @@ public class FreebaseProvider extends AbstractHttpProvider {
                             } else if (o.contains("\\u")) {
                                 o = StringEscapeUtils.unescapeJava(o);
                             } else if (o.contains("\\x")) {
-                                o = fixLatin1(o);
+                                o = org.apache.marmotta.commons.util.StringUtils.fixLatin1(o);
                             }
                             sb.append("    " + p + "    " + o + tripleMatcher.group(3));
                             sb.append("\n");
@@ -213,7 +213,7 @@ public class FreebaseProvider extends AbstractHttpProvider {
 
         //wrong charset
         if (literal.contains("\\x")) {
-            literal = fixLatin1(literal);
+            literal = org.apache.marmotta.commons.util.StringUtils.fixLatin1(literal);
         }
 
         //wrong unicode encoding
@@ -224,18 +224,4 @@ public class FreebaseProvider extends AbstractHttpProvider {
         return literal;
     }
 
-    private String fixLatin1(String str) {
-        //TODO: find a way to re-code properly the literal
-        //http://www.ic.unicamp.br/~stolfi/EXPORT/www/ISO-8859-1-Encoding.html
-        str = str.replaceAll("\\\\xe1", "á");
-        str = str.replaceAll("\\\\xe3", "ã");
-        str = str.replaceAll("\\\\xe7", "ç");
-        str = str.replaceAll("\\\\xe9", "é");
-        str = str.replaceAll("\\\\xed", "í");
-        str = str.replaceAll("\\\\xf3", "ó");
-        str = str.replaceAll("\\\\xfa", "ú");
-        str = str.replaceAll("\\\\x", ""); //FIXME: wrong, wrong, wrong!
-        return str;
-    }
-
-}
\ No newline at end of file
+}


[06/11] git commit: MARMOTTA-438: more work on test suite execution

Posted by wi...@apache.org.
MARMOTTA-438: more work on test suite execution


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

Branch: refs/heads/develop
Commit: 49b6b3c0dcc89731c423cb01ac7e14b4f19e5a20
Parents: c3b393e
Author: Sergio Fernández <wi...@apache.org>
Authored: Tue Apr 15 16:31:38 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Tue Apr 15 16:31:38 2014 +0200

----------------------------------------------------------------------
 .../platform/ldp/services/LdpServiceImpl.java   |  1 +
 .../ldp/testsuite/LdpTestCaseRunner.java        | 20 ++++-
 .../platform/ldp/testsuite/LdpTestCases.java    |  2 +-
 .../ldp/testsuite/LdpTestCasesRunner.java       | 82 +++++++++++---------
 4 files changed, 66 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/49b6b3c0/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
index 75d7923..8d28aae 100644
--- a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
+++ b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/services/LdpServiceImpl.java
@@ -44,6 +44,7 @@ import org.openrdf.rio.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
 import javax.ws.rs.core.EntityTag;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/49b6b3c0/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
index 79a6079..3c2f36b 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
@@ -70,14 +70,30 @@ public class LdpTestCaseRunner extends Runner {
         notifier.fireTestFinished(getDescription());
     }
 
+    /**
+     * Actual test case run method, which build the test case execution
+     * on the fly based on
+     */
     private void run() {
         Assume.assumeNotNull(baseUrl);
         assertNotNull(testCase);
         assertNotNull(testCase.getUri());
         String context = buildContext(testCase);
-        log.info("Executing LDP Test Case {} over context {}...", testCase.getUri().getLocalName(), context);
+        log.warn("Executing LDP Test Case {} over context {}...", testCase.getUri().getLocalName(), context);
 
-        //TODO: actual test case execution
+        //basic pre-checking
+        //RestAssured.expect().statusCode(200).get(baseUrl); //TODO: clarify this (root container?)
+        RestAssured.expect().statusCode(404).get(context);
+
+        //load all information of the test cases
+        readTestCase(testCase);
+
+        //actual test case execution
+
+    }
+
+    private void readTestCase(LdpTestCase testCase) {
+        //TODO: read all details
     }
 
     private String buildContext(LdpTestCase testCase) {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/49b6b3c0/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
index c60aba4..ace1b23 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
@@ -53,7 +53,7 @@ public class LdpTestCases {
 
         @Override
         protected void before() throws Throwable {
-            marmotta = new JettyMarmotta("/marmotta-ldp", LdpWebService.class);
+            marmotta = new JettyMarmotta("/marmotta", LdpWebService.class);
             RestAssured.baseURI = "http://localhost";
             RestAssured.port = marmotta.getPort();
             RestAssured.basePath = marmotta.getContext();

http://git-wip-us.apache.org/repos/asf/marmotta/blob/49b6b3c0/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
index f9fc57a..4cb18a7 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
@@ -18,6 +18,7 @@
 package org.apache.marmotta.platform.ldp.testsuite;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.marmotta.platform.ldp.webservices.LdpWebService;
 import org.junit.rules.TestRule;
 import org.junit.runner.Runner;
 import org.junit.runner.notification.RunNotifier;
@@ -37,6 +38,7 @@ import java.io.IOException;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -50,9 +52,28 @@ public class LdpTestCasesRunner extends Suite {
 
     private LdpTestCases.MarmottaResource marmotta;
 
+    private Repository repo;
+
+    private List<Runner> runners;
+
     public LdpTestCasesRunner(Class<?> klass) throws Throwable {
-        super(klass, buildTestCasesFromManifest());
+        super(klass, Collections.EMPTY_LIST);
+
+        //load test cases manifest
+        repo = loadManifest();
 
+        //get children runners for each test cases from manifest
+        RepositoryConnection conn = repo.getConnection();
+        try {
+            conn.begin();
+            runners = buildTestCasesFromManifest(conn);
+            log.info("Initialized LDP test suite with {} test cases", runners.size());
+            conn.commit();
+        } finally {
+            conn.close();
+        }
+
+        //get embedded marmotta from rules
         //TODO: it should be an easier way to do it...
         for (TestRule rule : this.classRules()) {
             if (LdpTestCases.MarmottaResource.class.equals(rule.getClass())) {
@@ -63,55 +84,44 @@ public class LdpTestCasesRunner extends Suite {
     }
 
     @Override
+    protected List<Runner> getChildren() {
+        return Collections.unmodifiableList(runners);
+    }
+
+    @Override
     protected void runChild(Runner runner, RunNotifier notifier) {
         if (runner instanceof LdpTestCaseRunner) {
-            ((LdpTestCaseRunner)runner).setBaseUrl(marmotta.baseUrl);
+            ((LdpTestCaseRunner)runner).setBaseUrl(marmotta.baseUrl + LdpWebService.PATH);
         }
         super.runChild(runner, notifier);
     }
 
-    private static List<Runner> buildTestCasesFromManifest() throws Throwable {
-        List<Runner> runners = new ArrayList<>();
-
+    private Repository loadManifest() throws RepositoryException, RDFParseException, IOException {
         String path = LdpTestCases.ROOT_PATH + LdpTestCases.MANIFEST_CACHE + ".ttl";
+        return LdpTestCasesUtils.loadData(path, RDFFormat.TURTLE);
+    }
+
+    private static List<Runner> buildTestCasesFromManifest(RepositoryConnection conn) throws Throwable {
+        List<Runner> runners = new ArrayList<>();
         try {
-            Repository repo = LdpTestCasesUtils.loadData(path, RDFFormat.TURTLE);
-            RepositoryConnection conn = repo.getConnection();
+            String testCasesQuery = LdpTestCasesUtils.getNormativeNamespacesSparql()+ "\n"
+                    + "SELECT ?tc WHERE { ?tc a td:TestCase }";
+            TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, testCasesQuery);
+            TupleQueryResult results = tupleQuery.evaluate();
             try {
-                conn.begin();
-
-                String testCasesQuery = LdpTestCasesUtils.getNormativeNamespacesSparql()+ "\n"
-                        + "SELECT ?tc WHERE { ?tc a td:TestCase }";
-                TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, testCasesQuery);
-                TupleQueryResult results = tupleQuery.evaluate();
-                try {
-                    while (results.hasNext()) {
-                        BindingSet bindings = results.next();
-                        LdpTestCase testCase = new LdpTestCase((URI)bindings.getValue("tc"));
-                        runners.add(new LdpTestCaseRunner(testCase));
-                    }
-                } finally {
-                    results.close();
+                while (results.hasNext()) {
+                    BindingSet bindings = results.next();
+                    LdpTestCase testCase = new LdpTestCase((URI)bindings.getValue("tc"));
+                    runners.add(new LdpTestCaseRunner(testCase));
                 }
-                conn.commit();
-            } catch (RepositoryException e) {
-                log.error("Error loading test cases: {}", e.getMessage(), e);
-                return runners;
-            } catch (QueryEvaluationException | MalformedQueryException e) {
-                log.error("Error performing test cases' query: {}", e.getMessage(), e);
-                return runners;
             } finally {
-                conn.close();
+                results.close();
             }
-        } catch (RDFParseException | IOException e) {
-            log.error("Error loading test cases: {}", e.getMessage(), e);
-            return runners;
         } catch (RepositoryException e) {
-            log.error("Error connecting with the repository: {}", e.getMessage(), e);
-            return runners;
+            log.error("Error loading test cases: {}", e.getMessage(), e);
+        } catch (QueryEvaluationException | MalformedQueryException e) {
+            log.error("Error performing test cases' query: {}", e.getMessage(), e);
         }
-
-        log.info("Initialized LDP test suite with {} test cases", runners.size());
         return runners;
     }
 


[02/11] git commit: updated the tomcatversion used for the installer

Posted by wi...@apache.org.
updated the tomcatversion used for the installer


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

Branch: refs/heads/develop
Commit: 477ccd3de5adc7778be641ba87527fc3b13f5eb1
Parents: e9d8aad
Author: Sergio Fernández <wi...@apache.org>
Authored: Fri Apr 11 16:25:48 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Fri Apr 11 16:25:48 2014 +0200

----------------------------------------------------------------------
 launchers/marmotta-installer/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/477ccd3d/launchers/marmotta-installer/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-installer/pom.xml b/launchers/marmotta-installer/pom.xml
index ec13351..9c57a19 100644
--- a/launchers/marmotta-installer/pom.xml
+++ b/launchers/marmotta-installer/pom.xml
@@ -36,7 +36,7 @@
         <stagingDir>${project.build.directory}/installer</stagingDir>
 
         <!-- these are replaced in installer files -->
-        <TOMCAT_VERSION>7.0.39</TOMCAT_VERSION>
+        <TOMCAT_VERSION>7.0.53</TOMCAT_VERSION>
         <MARMOTTA_VERSION>${project.version}</MARMOTTA_VERSION>
         <MARMOTTA_ROOT>${project.basedir}/../../</MARMOTTA_ROOT>
     </properties>
@@ -259,7 +259,7 @@
                                     <url>http://archive.apache.org/dist/tomcat/tomcat-7/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.zip</url>
                                     <unpack>false</unpack>
                                     <outputDirectory>${stagingDir}/lib</outputDirectory>
-                                    <md5>30c6adc5b537be4bd098a4b30b5385a5</md5>
+                                    <md5>e819542bf313c3a5e0c1ad03c15880b6</md5>
                                 </configuration>
                             </execution>
                         </executions>


[10/11] git commit: MARMOTTA-438: removed test cases retrieval

Posted by wi...@apache.org.
MARMOTTA-438: removed test cases retrieval


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

Branch: refs/heads/develop
Commit: ecebad15349eb8f917fa2dca340b4e29c04358df
Parents: b00e935
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon May 5 20:39:09 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon May 5 20:39:09 2014 +0200

----------------------------------------------------------------------
 platform/marmotta-ldp/pom.xml | 19 -------------------
 1 file changed, 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/ecebad15/platform/marmotta-ldp/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/pom.xml b/platform/marmotta-ldp/pom.xml
index f0e7dd5..fcc3879 100644
--- a/platform/marmotta-ldp/pom.xml
+++ b/platform/marmotta-ldp/pom.xml
@@ -66,25 +66,6 @@
 
         <plugins>
             <plugin>
-                <groupId>com.googlecode.maven-download-plugin</groupId>
-                <artifactId>maven-download-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>download-ldp-test-cases</id>
-                        <phase>process-test-resources</phase>
-                        <goals>
-                            <goal>wget</goal>
-                        </goals>
-                        <configuration>
-                            <url>http://www.w3.org/2012/pyRdfa/extract?uri=https%3A%2F%2Fdvcs.w3.org%2Fhg%2Fldpwg%2Fraw-file%2Fdefault%2FTest%2520Cases%2FLDP%2520Test%2520Cases.html&amp;format=turtle&amp;rdfagraph=output&amp;vocab_expansion=false&amp;rdfa_lite=false&amp;embedded_rdf=true&amp;space_preserve=true&amp;vocab_cache=true&amp;vocab_cache_report=false&amp;vocab_cache_refresh=false</url>
-                            <unpack>false</unpack>
-                            <outputDirectory>${project.build.testOutputDirectory}/testsuite/</outputDirectory>
-                            <outputFileName>LDP-Test-Cases-WD-live.ttl</outputFileName>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
                 <groupId>org.apache.marmotta</groupId>
                 <artifactId>buildinfo-maven-plugin</artifactId>
                 <configuration>


[11/11] git commit: MARMOTTA-438: removed test suite until the official one is ready to be integrated

Posted by wi...@apache.org.
MARMOTTA-438: removed test suite until the official one is ready to be integrated


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

Branch: refs/heads/develop
Commit: b5cfb0a5d23eea132925ca166b563a8d493ab3f4
Parents: ecebad1
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon May 5 20:42:07 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon May 5 20:42:07 2014 +0200

----------------------------------------------------------------------
 .../platform/ldp/testsuite/LdpManifestTest.java |  73 --------
 .../platform/ldp/testsuite/LdpTestCase.java     | 183 -------------------
 .../ldp/testsuite/LdpTestCaseRunner.java        | 111 -----------
 .../platform/ldp/testsuite/LdpTestCases.java    |  71 -------
 .../ldp/testsuite/LdpTestCasesRunner.java       | 128 -------------
 .../ldp/testsuite/LdpTestCasesUtils.java        | 130 -------------
 6 files changed, 696 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/b5cfb0a5/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpManifestTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpManifestTest.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpManifestTest.java
deleted file mode 100644
index b9102a4..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpManifestTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.platform.ldp.testsuite;
-
-import org.junit.*;
-import org.openrdf.model.Statement;
-import org.openrdf.model.vocabulary.RDF;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.RepositoryResult;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFParseException;
-
-import java.io.IOException;
-
-/**
- * LDP Test Cases Manifest test
- *
- * @author Sergio Fernández
- */
-public class LdpManifestTest {
-
-    protected Repository repo;
-
-    @Before
-    public final void before() throws RepositoryException, RDFParseException, IOException {
-        String path = LdpTestCases.ROOT_PATH + LdpTestCases.MANIFEST_CACHE + ".ttl";
-        repo = LdpTestCasesUtils.loadData(path, RDFFormat.TURTLE);
-        Assume.assumeNotNull(repo);
-    }
-
-    @After
-    public final void after() throws RepositoryException {
-        if (repo != null) {
-            repo.shutDown();
-            repo = null;
-        }
-    }
-
-    @Test
-    public void testNotEmpty() throws RepositoryException, RDFParseException, IOException {
-        RepositoryConnection conn = repo.getConnection();
-        try {
-            conn.begin();
-            //ValueFactory vf = conn.getValueFactory();
-            Assert.assertFalse(conn.isEmpty());
-            RepositoryResult<Statement> statements = conn.getStatements(null, RDF.TYPE, conn.getValueFactory().createURI("http://www.w3.org/2006/03/test-description#", "TestCase"), false);
-            Assert.assertTrue(statements.hasNext());
-            statements.close();
-            //TODO: check test cases are actually there
-        } finally {
-            conn.commit();
-            conn.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b5cfb0a5/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
deleted file mode 100644
index e293d71..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.platform.ldp.testsuite;
-
-import org.openrdf.model.URI;
-
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * LDP Test Case
- *
- * @author Sergio Fernández
- * @see <a href="http://www.w3.org/TR/ldp-test-cases/#test-case-description">LDP Tests Cases</a>
- */
-public class LdpTestCase /* extends TestCase */ {
-
-    /**
-     * Test Case Uniform Resource Identifier
-     */
-    private URI uri;
-
-    /**
-     * rdfs:label. The human-readable label of the test.
-     */
-    private String label;
-
-    /**
-     * dc:title. The name of the test.
-     */
-    private String title;
-
-    /**
-     * dc:description. The description of the test.
-     */
-    private String description;
-
-    /**
-     * dc:contributor. The person (foaf:Person) contributing the test.
-     */
-    private URI contributor;
-
-    /**
-     * td:reviewStatus. The status of the test; possible status are: td:unreviewed, td:approved or td:rejected.
-     */
-    private URI reviewStatus;
-
-    //td:specificationReference. An excerpt (tn:Excerpt) of the specification that is relevant to the test.
-
-    /**
-     * td:input. An input (tn:TestInput) used in the test.
-     */
-    private URI input;
-
-    /**
-     * td:precondition. A precondition that must be satisfied before running the test.
-     */
-    private URI precondition;
-
-    /**
-     * tn:output. An output (tn:TestOutput) to be produced by the test.
-     */
-    private URI output;
-
-    /**
-     * tn:testProcess. The list of steps (tn:Step) to be performed during the test.
-     */
-    private List<URI> testProcess;
-
-    /**
-     * tn:testAssertion. An assertion (tn:TestAssertion) to be performed over the test output.
-     */
-    private URI testAssertion;
-
-    public LdpTestCase(URI uri) {
-        this.uri = uri;
-    }
-
-    public URI getUri() {
-        return uri;
-    }
-
-    public void setUri(URI uri) {
-        this.uri = uri;
-    }
-
-    public String getLabel() {
-        return label;
-    }
-
-    public void setLabel(String label) {
-        this.label = label;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public URI getContributor() {
-        return contributor;
-    }
-
-    public void setContributor(URI contributor) {
-        this.contributor = contributor;
-    }
-
-    public URI getReviewStatus() {
-        return reviewStatus;
-    }
-
-    public void setReviewStatus(URI reviewStatus) {
-        this.reviewStatus = reviewStatus;
-    }
-
-    public URI getInput() {
-        return input;
-    }
-
-    public void setInput(URI input) {
-        this.input = input;
-    }
-
-    public URI getPrecondition() {
-        return precondition;
-    }
-
-    public void setPrecondition(URI precondition) {
-        this.precondition = precondition;
-    }
-
-    public URI getOutput() {
-        return output;
-    }
-
-    public void setOutput(URI output) {
-        this.output = output;
-    }
-
-    public List<URI> getTestProcess() {
-        return testProcess;
-    }
-
-    public void setTestProcess(List<URI> testProcess) {
-        this.testProcess = testProcess;
-    }
-
-    public URI getTestAssertion() {
-        return testAssertion;
-    }
-
-    public void setTestAssertion(URI testAssertion) {
-        this.testAssertion = testAssertion;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b5cfb0a5/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
deleted file mode 100644
index 3c2f36b..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.platform.ldp.testsuite;
-
-import com.jayway.restassured.RestAssured;
-import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
-import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
-import org.apache.marmotta.platform.ldp.webservices.LdpWebService;
-import org.junit.*;
-import org.junit.rules.TestName;
-import org.junit.runner.Description;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.Suite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.UriBuilder;
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * LDP Test Case JUnit Runner
- *
- * @author Sergio Fernández
- */
-public class LdpTestCaseRunner extends Runner {
-
-    private static Logger log = LoggerFactory.getLogger(LdpTestCaseRunner.class);
-
-    private final LdpTestCase testCase;
-
-    private String baseUrl;
-
-    public LdpTestCaseRunner(LdpTestCase testCase) {
-        this.testCase = testCase;
-    }
-
-    @Override
-    public Description getDescription() {
-        return Description.createSuiteDescription(testCase.getUri().getLocalName());
-    }
-
-    @Override
-    public void run(RunNotifier notifier) {
-        notifier.fireTestRunStarted(getDescription());
-        try {
-            run();
-        } catch (Exception e) {
-            //TODO
-            //notifier.fireTestFailure(e);
-        }
-        notifier.fireTestFinished(getDescription());
-    }
-
-    /**
-     * Actual test case run method, which build the test case execution
-     * on the fly based on
-     */
-    private void run() {
-        Assume.assumeNotNull(baseUrl);
-        assertNotNull(testCase);
-        assertNotNull(testCase.getUri());
-        String context = buildContext(testCase);
-        log.warn("Executing LDP Test Case {} over context {}...", testCase.getUri().getLocalName(), context);
-
-        //basic pre-checking
-        //RestAssured.expect().statusCode(200).get(baseUrl); //TODO: clarify this (root container?)
-        RestAssured.expect().statusCode(404).get(context);
-
-        //load all information of the test cases
-        readTestCase(testCase);
-
-        //actual test case execution
-
-    }
-
-    private void readTestCase(LdpTestCase testCase) {
-        //TODO: read all details
-    }
-
-    private String buildContext(LdpTestCase testCase) {
-        return baseUrl + "/" + testCase.getUri().getLocalName().toLowerCase();
-    }
-
-    public String getBaseUrl() {
-        return baseUrl;
-    }
-
-    public void setBaseUrl(String baseUrl) {
-        this.baseUrl = baseUrl;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b5cfb0a5/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
deleted file mode 100644
index ace1b23..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.platform.ldp.testsuite;
-
-import com.jayway.restassured.RestAssured;
-import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
-import org.apache.marmotta.platform.ldp.webservices.LdpWebService;
-import org.junit.ClassRule;
-import org.junit.rules.ExternalResource;
-import org.junit.runner.RunWith;
-
-import javax.ws.rs.core.UriBuilder;
-
-/**
- * LDP Test Cases
- *
- * @author Sergio Fernández
- *
- * @see <a href="https://dvcs.w3.org/hg/ldpwg/raw-file/default/Test%20Cases/LDP%20Test%20Cases.html">LDP Test Cases</a>
- */
-@RunWith(LdpTestCasesRunner.class)
-public class LdpTestCases {
-
-    public final static String ROOT_PATH = "/testsuite/";
-
-    public final static String BASE = "http://www.w3.org/TR/ldp-test-cases/";
-
-    public final static String MANIFEST_CACHE = "LDP-Test-Cases-WD-live";
-
-    @ClassRule
-    public static ExternalResource marmotta = new MarmottaResource();
-
-    public static class MarmottaResource extends ExternalResource {
-
-        JettyMarmotta marmotta;
-
-        String baseUrl;
-
-        @Override
-        protected void before() throws Throwable {
-            marmotta = new JettyMarmotta("/marmotta", LdpWebService.class);
-            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();
-        }
-
-        @Override
-        protected void after() {
-            //marmotta.shutdown();
-            marmotta = null;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b5cfb0a5/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
deleted file mode 100644
index 4cb18a7..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.platform.ldp.testsuite;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.marmotta.platform.ldp.webservices.LdpWebService;
-import org.junit.rules.TestRule;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.Suite;
-import org.junit.runners.model.FrameworkField;
-import org.openrdf.model.URI;
-import org.openrdf.query.*;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * LDP Test Cases JUnit Runner
- *
- * @author Sergio Fernández
- */
-public class LdpTestCasesRunner extends Suite {
-
-    private static Logger log = LoggerFactory.getLogger(LdpTestCasesRunner.class);
-
-    private LdpTestCases.MarmottaResource marmotta;
-
-    private Repository repo;
-
-    private List<Runner> runners;
-
-    public LdpTestCasesRunner(Class<?> klass) throws Throwable {
-        super(klass, Collections.EMPTY_LIST);
-
-        //load test cases manifest
-        repo = loadManifest();
-
-        //get children runners for each test cases from manifest
-        RepositoryConnection conn = repo.getConnection();
-        try {
-            conn.begin();
-            runners = buildTestCasesFromManifest(conn);
-            log.info("Initialized LDP test suite with {} test cases", runners.size());
-            conn.commit();
-        } finally {
-            conn.close();
-        }
-
-        //get embedded marmotta from rules
-        //TODO: it should be an easier way to do it...
-        for (TestRule rule : this.classRules()) {
-            if (LdpTestCases.MarmottaResource.class.equals(rule.getClass())) {
-                marmotta = (LdpTestCases.MarmottaResource)rule;
-                break;
-            }
-        }
-    }
-
-    @Override
-    protected List<Runner> getChildren() {
-        return Collections.unmodifiableList(runners);
-    }
-
-    @Override
-    protected void runChild(Runner runner, RunNotifier notifier) {
-        if (runner instanceof LdpTestCaseRunner) {
-            ((LdpTestCaseRunner)runner).setBaseUrl(marmotta.baseUrl + LdpWebService.PATH);
-        }
-        super.runChild(runner, notifier);
-    }
-
-    private Repository loadManifest() throws RepositoryException, RDFParseException, IOException {
-        String path = LdpTestCases.ROOT_PATH + LdpTestCases.MANIFEST_CACHE + ".ttl";
-        return LdpTestCasesUtils.loadData(path, RDFFormat.TURTLE);
-    }
-
-    private static List<Runner> buildTestCasesFromManifest(RepositoryConnection conn) throws Throwable {
-        List<Runner> runners = new ArrayList<>();
-        try {
-            String testCasesQuery = LdpTestCasesUtils.getNormativeNamespacesSparql()+ "\n"
-                    + "SELECT ?tc WHERE { ?tc a td:TestCase }";
-            TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, testCasesQuery);
-            TupleQueryResult results = tupleQuery.evaluate();
-            try {
-                while (results.hasNext()) {
-                    BindingSet bindings = results.next();
-                    LdpTestCase testCase = new LdpTestCase((URI)bindings.getValue("tc"));
-                    runners.add(new LdpTestCaseRunner(testCase));
-                }
-            } finally {
-                results.close();
-            }
-        } catch (RepositoryException e) {
-            log.error("Error loading test cases: {}", e.getMessage(), e);
-        } catch (QueryEvaluationException | MalformedQueryException e) {
-            log.error("Error performing test cases' query: {}", e.getMessage(), e);
-        }
-        return runners;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b5cfb0a5/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesUtils.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesUtils.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesUtils.java
deleted file mode 100644
index 9270da7..0000000
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesUtils.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.platform.ldp.testsuite;
-
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFParseException;
-import org.openrdf.sail.memory.MemoryStore;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Utils functions for the test cases
- *
- * @author Sergio Fernández
- */
-public class LdpTestCasesUtils {
-
-    /**
-     * Load test cases' data
-     *
-     * @param path path to the manifest file
-     * @param format serialization format used in the manifest file
-     * @return In-Memory repository with the data
-     * @throws org.openrdf.rio.RDFParseException
-     * @throws org.openrdf.repository.RepositoryException
-     * @throws java.io.IOException
-     */
-    public static Repository loadData(String path, RDFFormat format) throws RDFParseException, RepositoryException, IOException {
-        Repository repo = new SailRepository(new MemoryStore());
-        repo.initialize();
-        RepositoryConnection conn = repo.getConnection();
-        try {
-            conn.begin();
-            conn.clear();
-            InputStream is = LdpTestCasesUtils.class.getResourceAsStream(path);
-            if (is == null) {
-                throw new IOException("Manifest file not found at: " + path);
-            } else {
-                try {
-                    conn.add(is, LdpTestCases.BASE, RDFFormat.TURTLE);
-                } finally {
-                    is.close();
-                }
-            }
-            addNormativeNamespaces(conn);
-            conn.commit();
-        } finally {
-            conn.close();
-        }
-        return repo;
-    }
-
-    /**
-     * Get normative namespaces
-     *
-     * @throws IOException
-     * @throws RepositoryException
-     *
-     * @see <a href="https://dvcs.w3.org/hg/ldpwg/raw-file/default/Test%20Cases/LDP%20Test%20Cases.html#h3_namespaces-used">Sec. 4.1 Namespaces used</a>
-     */
-    public static Map<String,String> getNormativeNamespaces() throws IOException {
-        String path = LdpTestCases.ROOT_PATH + "namespaces.properties";
-        Map<String,String> prefixes = new HashMap<>();
-        Properties properties = new Properties();
-        properties.load(LdpTestCasesUtils.class.getResourceAsStream(path));
-        for(String key : properties.stringPropertyNames()) {
-            String value = properties.getProperty(key);
-            prefixes.put(key, value);
-        }
-        return Collections.unmodifiableMap(prefixes);
-    }
-
-    /**
-     * Get normative namespaces with SPARQL syntax
-     *
-     * @throws IOException
-     */
-    public static String getNormativeNamespacesSparql() throws IOException {
-        StringBuffer sb = new StringBuffer();
-        Map<String, String> normativeNamespaces = getNormativeNamespaces();
-        for (Map.Entry<String, String> entry : normativeNamespaces.entrySet()) {
-            //PREFIX dc: <http://purl.org/dc/terms/>
-            sb.append("PREFIX ");
-            sb.append(entry.getKey());
-            sb.append(": <");
-            sb.append(entry.getValue());
-            sb.append("> \n");
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Add normative namespaces
-     *
-     * @param conn target connection
-     * @throws IOException
-     * @throws RepositoryException
-     */
-    public static void addNormativeNamespaces(RepositoryConnection conn) throws IOException, RepositoryException {
-        Map<String, String> normativeNamespaces = getNormativeNamespaces();
-        for (Map.Entry<String, String> entry : normativeNamespaces.entrySet()) {
-            conn.setNamespace(entry.getValue(), entry.getKey());
-        }
-    }
-
-}


[04/11] git commit: preventing potential portability issues on ldclient tests

Posted by wi...@apache.org.
preventing potential portability issues on ldclient tests


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

Branch: refs/heads/develop
Commit: e680766665f68cb092a48384386f12989f1ddd59
Parents: def9d41
Author: Sergio Fernández <wi...@apache.org>
Authored: Tue Apr 15 14:50:59 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Tue Apr 15 14:50:59 2014 +0200

----------------------------------------------------------------------
 .../apache/marmotta/ldclient/test/provider/ProviderTestBase.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/e6807666/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/provider/ProviderTestBase.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/provider/ProviderTestBase.java b/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/provider/ProviderTestBase.java
index df0936c..1ff772f 100644
--- a/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/provider/ProviderTestBase.java
+++ b/libraries/ldclient/ldclient-core/src/test/java/org/apache/marmotta/ldclient/test/provider/ProviderTestBase.java
@@ -98,7 +98,7 @@ public class ProviderTestBase {
 
         // run a SPARQL test to see if the returned data is correct
         InputStream sparql = this.getClass().getResourceAsStream(sparqlFile);
-        BooleanQuery testLabel = connection.prepareBooleanQuery(QueryLanguage.SPARQL, IOUtils.toString(sparql));
+        BooleanQuery testLabel = connection.prepareBooleanQuery(QueryLanguage.SPARQL, IOUtils.toString(sparql, "UTF-8"));
         Assert.assertTrue("SPARQL test query failed", testLabel.evaluate());
 
         if(log.isDebugEnabled()) {


[07/11] git commit: reverted c3b393eb64a351211e52417b79aa074a0887138e

Posted by wi...@apache.org.
reverted c3b393eb64a351211e52417b79aa074a0887138e


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

Branch: refs/heads/develop
Commit: db70ff70997681ad7c1229bbc07cafc908682152
Parents: 49b6b3c
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 16 11:04:30 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 16 11:04:30 2014 +0200

----------------------------------------------------------------------
 launchers/marmotta-webapp/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/db70ff70/launchers/marmotta-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/pom.xml b/launchers/marmotta-webapp/pom.xml
index 91d7dda..fb87868 100644
--- a/launchers/marmotta-webapp/pom.xml
+++ b/launchers/marmotta-webapp/pom.xml
@@ -204,6 +204,7 @@
         <profile>
             <id>kiwi</id>
             <activation>
+                <activeByDefault>true</activeByDefault>
                 <property>
                     <name>marmotta.backend</name>
                     <value>kiwi</value>


[03/11] git commit: MARMOTTA-438: improved resource management to have the base url from each test case

Posted by wi...@apache.org.
MARMOTTA-438: improved resource management to have the base url from each test case


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

Branch: refs/heads/develop
Commit: def9d41f9a911032c6833c9747c6e7d6b8ca8d9e
Parents: 477ccd3
Author: Sergio Fernández <wi...@apache.org>
Authored: Mon Apr 14 18:32:09 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Mon Apr 14 18:32:09 2014 +0200

----------------------------------------------------------------------
 .../platform/ldp/testsuite/LdpTestCase.java     |  4 +-
 .../ldp/testsuite/LdpTestCaseRunner.java        | 44 ++++++++++++++++--
 .../platform/ldp/testsuite/LdpTestCases.java    | 49 ++++++++------------
 .../ldp/testsuite/LdpTestCasesRunner.java       | 38 +++++++++++----
 4 files changed, 88 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/def9d41f/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
index 176494b..e293d71 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCase.java
@@ -88,10 +88,8 @@ public class LdpTestCase /* extends TestCase */ {
      */
     private URI testAssertion;
 
-    public LdpTestCase(URI uri, String label) {
-        //super(label);
+    public LdpTestCase(URI uri) {
         this.uri = uri;
-        this.label = label;
     }
 
     public URI getUri() {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/def9d41f/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
index 051952b..79a6079 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCaseRunner.java
@@ -17,11 +17,24 @@
 
 package org.apache.marmotta.platform.ldp.testsuite;
 
+import com.jayway.restassured.RestAssured;
+import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
+import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.apache.marmotta.platform.ldp.webservices.LdpWebService;
+import org.junit.*;
+import org.junit.rules.TestName;
 import org.junit.runner.Description;
 import org.junit.runner.Runner;
 import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.Suite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import static org.junit.Assert.assertEquals;
+import javax.ws.rs.core.UriBuilder;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import static org.junit.Assert.assertNotNull;
 
 /**
  * LDP Test Case JUnit Runner
@@ -30,7 +43,11 @@ import static org.junit.Assert.assertEquals;
  */
 public class LdpTestCaseRunner extends Runner {
 
-    private LdpTestCase testCase;
+    private static Logger log = LoggerFactory.getLogger(LdpTestCaseRunner.class);
+
+    private final LdpTestCase testCase;
+
+    private String baseUrl;
 
     public LdpTestCaseRunner(LdpTestCase testCase) {
         this.testCase = testCase;
@@ -38,7 +55,7 @@ public class LdpTestCaseRunner extends Runner {
 
     @Override
     public Description getDescription() {
-        return Description.createSuiteDescription(testCase.getLabel());
+        return Description.createSuiteDescription(testCase.getUri().getLocalName());
     }
 
     @Override
@@ -54,8 +71,25 @@ public class LdpTestCaseRunner extends Runner {
     }
 
     private void run() {
-        assertEquals(testCase.getLabel().substring(3), testCase.getUri().getLocalName().substring(2));
-        //TODO: actual execution
+        Assume.assumeNotNull(baseUrl);
+        assertNotNull(testCase);
+        assertNotNull(testCase.getUri());
+        String context = buildContext(testCase);
+        log.info("Executing LDP Test Case {} over context {}...", testCase.getUri().getLocalName(), context);
+
+        //TODO: actual test case execution
+    }
+
+    private String buildContext(LdpTestCase testCase) {
+        return baseUrl + "/" + testCase.getUri().getLocalName().toLowerCase();
+    }
+
+    public String getBaseUrl() {
+        return baseUrl;
+    }
+
+    public void setBaseUrl(String baseUrl) {
+        this.baseUrl = baseUrl;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/def9d41f/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
index ddffa8f..c60aba4 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCases.java
@@ -18,17 +18,13 @@
 package org.apache.marmotta.platform.ldp.testsuite;
 
 import com.jayway.restassured.RestAssured;
-import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
 import org.apache.marmotta.platform.ldp.webservices.LdpWebService;
-import org.junit.*;
+import org.junit.ClassRule;
+import org.junit.rules.ExternalResource;
 import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.UriBuilder;
-import java.io.IOException;
-import java.net.URISyntaxException;
 
 /**
  * LDP Test Cases
@@ -46,35 +42,30 @@ public class LdpTestCases {
 
     public final static String MANIFEST_CACHE = "LDP-Test-Cases-WD-live";
 
-    private static Logger log = LoggerFactory.getLogger(LdpTestCases.class);
+    @ClassRule
+    public static ExternalResource marmotta = new MarmottaResource();
 
-    private static JettyMarmotta marmotta;
+    public static class MarmottaResource extends ExternalResource {
 
-    private static String baseUrl;
+        JettyMarmotta marmotta;
 
-    @BeforeClass
-    public static void setup() throws MarmottaImportException, URISyntaxException, IOException {
-        marmotta = new JettyMarmotta("/marmotta", LdpWebService.class);
-        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();
-    }
+        String baseUrl;
 
-    @Before
-    public void before() {
-        log.warn("before");
-    }
+        @Override
+        protected void before() throws Throwable {
+            marmotta = new JettyMarmotta("/marmotta-ldp", LdpWebService.class);
+            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();
+        }
 
-    @After
-    public void after() {
-        log.warn("after");
-    }
+        @Override
+        protected void after() {
+            //marmotta.shutdown();
+            marmotta = null;
+        }
 
-    @AfterClass
-    public static void shutdown() {
-        //marmotta.shutdown();
-        marmotta = null;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/def9d41f/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
index 31fee36..f9fc57a 100644
--- a/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
+++ b/platform/marmotta-ldp/src/test/java/org/apache/marmotta/platform/ldp/testsuite/LdpTestCasesRunner.java
@@ -17,8 +17,12 @@
 
 package org.apache.marmotta.platform.ldp.testsuite;
 
+import org.apache.commons.lang3.StringUtils;
+import org.junit.rules.TestRule;
 import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
 import org.junit.runners.Suite;
+import org.junit.runners.model.FrameworkField;
 import org.openrdf.model.URI;
 import org.openrdf.query.*;
 import org.openrdf.repository.Repository;
@@ -30,6 +34,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -42,11 +48,29 @@ public class LdpTestCasesRunner extends Suite {
 
     private static Logger log = LoggerFactory.getLogger(LdpTestCasesRunner.class);
 
+    private LdpTestCases.MarmottaResource marmotta;
+
     public LdpTestCasesRunner(Class<?> klass) throws Throwable {
         super(klass, buildTestCasesFromManifest());
+
+        //TODO: it should be an easier way to do it...
+        for (TestRule rule : this.classRules()) {
+            if (LdpTestCases.MarmottaResource.class.equals(rule.getClass())) {
+                marmotta = (LdpTestCases.MarmottaResource)rule;
+                break;
+            }
+        }
+    }
+
+    @Override
+    protected void runChild(Runner runner, RunNotifier notifier) {
+        if (runner instanceof LdpTestCaseRunner) {
+            ((LdpTestCaseRunner)runner).setBaseUrl(marmotta.baseUrl);
+        }
+        super.runChild(runner, notifier);
     }
 
-    private static List<Runner> buildTestCasesFromManifest() {
+    private static List<Runner> buildTestCasesFromManifest() throws Throwable {
         List<Runner> runners = new ArrayList<>();
 
         String path = LdpTestCases.ROOT_PATH + LdpTestCases.MANIFEST_CACHE + ".ttl";
@@ -56,20 +80,14 @@ public class LdpTestCasesRunner extends Suite {
             try {
                 conn.begin();
 
-                //TODO: this query is not final, it needs to evolve in parallel with the test cases
-                String testCasesQuery = LdpTestCasesUtils.getNormativeNamespacesSparql() + "\n" +
-                        "SELECT ?tc ?label \n" +
-                        "WHERE { \n" +
-                        "  ?tc a td:TestCase ; \n" +
-                        "      rdfs:label ?label . \n" +
-                        "}";
+                String testCasesQuery = LdpTestCasesUtils.getNormativeNamespacesSparql()+ "\n"
+                        + "SELECT ?tc WHERE { ?tc a td:TestCase }";
                 TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, testCasesQuery);
                 TupleQueryResult results = tupleQuery.evaluate();
                 try {
                     while (results.hasNext()) {
                         BindingSet bindings = results.next();
-                        LdpTestCase testCase = new LdpTestCase((URI)bindings.getValue("tc"), bindings.getValue("label").stringValue());
-                        //TODO: set more data to the test case
+                        LdpTestCase testCase = new LdpTestCase((URI)bindings.getValue("tc"));
                         runners.add(new LdpTestCaseRunner(testCase));
                     }
                 } finally {


[08/11] git commit: enabled testing by default in the embedded marmotta

Posted by wi...@apache.org.
enabled testing by default in the embedded marmotta


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

Branch: refs/heads/develop
Commit: c5f0d7675240bd378f8c7986d5dee0fac06cf956
Parents: db70ff7
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 16 12:25:50 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 16 12:25:50 2014 +0200

----------------------------------------------------------------------
 .../core/services/logging/LoggingServiceImpl.java    | 11 +++++++----
 .../platform/core/test/base/AbstractMarmotta.java    | 15 +++++++--------
 .../platform/core/test/base/EmbeddedMarmotta.java    |  9 +++++----
 .../platform/core/test/base/JettyMarmotta.java       |  6 ++----
 4 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/c5f0d767/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/logging/LoggingServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/logging/LoggingServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/logging/LoggingServiceImpl.java
index dc53656..3bd7ecc 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/logging/LoggingServiceImpl.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/logging/LoggingServiceImpl.java
@@ -143,23 +143,26 @@ public class LoggingServiceImpl implements LoggingService {
     }
 
     public void startEventHandler(@Observes LoggingStartEvent event) {
-        if(!configurationService.getBooleanConfiguration("testing.enabled")) {
+        if(!isTestEnvironment()) {
             log.warn("LOGGING: Switching to Apache Marmotta logging configuration; further output will be found in {}{}log{}*.log", configurationService.getHome(), File.separator, File.separator);
-
             configureLoggers();
         }
     }
 
     public void configurationEventHandler(@Observes ConfigurationChangedEvent event) {
-        if(!configurationService.getBooleanConfiguration("testing.enabled")) {
+        if(!isTestEnvironment()) {
             if (event.containsChangedKeyWithPrefix("logging.")) {
                 log.warn("LOGGING: Reloading logging configuration");
-
                 configureLoggers();
             }
         }
     }
 
+    private boolean isTestEnvironment() {
+        //TODO: Thread.currentThread().getContextClassLoader().getResource("/logback-test.xml") != null
+        //                                                    .getResource("/logback-testing.xml") != null
+        return configurationService.getBooleanConfiguration("testing.enabled", false);
+    }
 
     /**
      * Configure all loggers according to their configuration and set some reasonable fallback for the root level

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c5f0d767/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 b4fb48b..51ca188 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
@@ -36,9 +36,9 @@ import java.io.IOException;
 import java.util.HashMap;
 
 /**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
+ * Abstract Marmotta
+ *
+ * @author Sebastian Schaffert
  */
 public abstract class AbstractMarmotta {
 
@@ -52,7 +52,7 @@ public abstract class AbstractMarmotta {
     protected File home;
 
     protected AbstractMarmotta() {
-    	
+
         // initialise JNDI environment
         try {
             NamingManager.setInitialContextFactoryBuilder(new MarmottaInitialContextFactoryBuilder());
@@ -75,25 +75,23 @@ public abstract class AbstractMarmotta {
             log.error("error adding bean manager to JNDI",e);
         }
 
-
         // create temporary LMF home directory
         home = Files.createTempDir();
 
-        // create a temporary configuration with an in-memory database URL for h2
+        // create a temporary configuration with an in-memory database URL for H2
         override = new MapConfiguration(new HashMap<String,Object>());
         override.setProperty("database.h2.url","jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10");
         override.setProperty("logging.template", "/logback-testing.xml");
+        override.setProperty("testing.enabled", true);
 
         // initialise LMF using a temporary directory
         startupService = getService(MarmottaStartupService.class);
     }
 
-
     public <T> T getService(Class<T> serviceClass) {
         return container.instance().select(serviceClass).get();
     }
 
-
     public void shutdown() {
         // remove bean manager from JNDI
         cleanJNDI();
@@ -124,4 +122,5 @@ public abstract class AbstractMarmotta {
         }
 
     }
+
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c5f0d767/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedMarmotta.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedMarmotta.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedMarmotta.java
index a804bad..8d92592 100644
--- a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedMarmotta.java
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedMarmotta.java
@@ -21,10 +21,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * An embedded version of the LMF. Provides support to startup and shutdown the CDI container and the LMF for test cases.
- * After the embedded LMF has been used, it should always be shutdown before being reused.
- * <p/>
- * Author: Sebastian Schaffert
+ * An embedded version of the Marmotta. Provides support to startup and shutdown the CDI container
+ * and the Marmotta for test cases. After the embedded Marmotta has been used, it should always be
+ * shutdown before being reused.
+ *
+ * @author Sebastian Schaffert
  */
 public class EmbeddedMarmotta extends AbstractMarmotta {
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/c5f0d767/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 5004848..97a7ef1 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
@@ -56,8 +56,8 @@ public class JettyMarmotta extends AbstractMarmotta {
     
     private int port;
 
-	private String context;
-	
+    private String context;
+
     public JettyMarmotta(String context) {
         this(context, getRandomPort());
     }
@@ -86,7 +86,6 @@ public class JettyMarmotta extends AbstractMarmotta {
         this(override, context, getRandomPort(), webservices);
     }
 
-
     public JettyMarmotta(String context, Set<Class<?>> webservices) {
     	this(context, getRandomPort(), webservices);
     }
@@ -110,7 +109,6 @@ public class JettyMarmotta extends AbstractMarmotta {
         // create a new jetty & run it on port 8080
         jetty = new Server(this.port);
 
-
         TestInjectorFactory.setManager(container.getBeanManager());
 
         ServletContextHandler ctx = new ServletContextHandler(jetty, this.context);


[05/11] git commit: trying to enable kiwi backend when another profile (e.g. cleanall) is explicitly activated

Posted by wi...@apache.org.
trying to enable kiwi backend when another profile (e.g. cleanall) is explicitly activated


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

Branch: refs/heads/develop
Commit: c3b393eb64a351211e52417b79aa074a0887138e
Parents: e680766
Author: Sergio Fernández <wi...@apache.org>
Authored: Tue Apr 15 14:54:31 2014 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Tue Apr 15 14:54:31 2014 +0200

----------------------------------------------------------------------
 launchers/marmotta-webapp/pom.xml | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/c3b393eb/launchers/marmotta-webapp/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/pom.xml b/launchers/marmotta-webapp/pom.xml
index 3dc1aa2..91d7dda 100644
--- a/launchers/marmotta-webapp/pom.xml
+++ b/launchers/marmotta-webapp/pom.xml
@@ -204,7 +204,6 @@
         <profile>
             <id>kiwi</id>
             <activation>
-                <activeByDefault>true</activeByDefault>
                 <property>
                     <name>marmotta.backend</name>
                     <value>kiwi</value>
@@ -284,7 +283,6 @@
                     <groupId>com.thinkaurelius.titan</groupId>
                     <artifactId>titan-hbase</artifactId>
                     <version>${titan.version}</version>
-
                     <exclusions>
                         <exclusion>
                             <groupId>org.mortbay.jetty</groupId>