You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/08/23 12:06:38 UTC

[3/3] git commit: MARMOTTA-287: Added/Implemented (some of the) Sesame Store Tests MARMOTTA-39: reverted implementation as it conflicts with Sesame (see also MARMOTTA-205)

MARMOTTA-287: Added/Implemented (some of the) Sesame Store Tests
MARMOTTA-39: reverted implementation as it conflicts with Sesame
  (see also MARMOTTA-205)


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

Branch: refs/heads/develop
Commit: 0b5ef8023fa369caecc4f064ca345e54e4696ce3
Parents: f23adb0
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Aug 23 11:58:49 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Aug 23 12:05:30 2013 +0200

----------------------------------------------------------------------
 .../commons/sesame/model/LiteralCommons.java    |   3 +-
 .../sesame/model/LiteralCommonsTest.java        |   1 +
 libraries/kiwi/kiwi-triplestore/pom.xml         |   7 +-
 .../marmotta/kiwi/sail/KiWiValueFactory.java    |  33 +++--
 .../marmotta/kiwi/test/RepositoryTest.java      |   4 +-
 .../test/sesame/KiWiSailConcurrencyTest.java    | 144 +++++++++++++++++++
 .../kiwi/test/sesame/KiWiSailInterruptTest.java | 122 ++++++++++++++++
 .../kiwi/test/sesame/KiWiStoreTest.java         | 124 ++++++++++++++++
 parent/pom.xml                                  |   8 +-
 9 files changed, 431 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/LiteralCommons.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/LiteralCommons.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/LiteralCommons.java
index ce26c26..5749e37 100644
--- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/LiteralCommons.java
+++ b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/model/LiteralCommons.java
@@ -170,7 +170,8 @@ public class LiteralCommons {
         } else if(Boolean.class.isAssignableFrom(javaClass) || boolean.class.isAssignableFrom(javaClass)) {
             return Namespaces.NS_XSD+"boolean";
         } else {
-            return Namespaces.NS_XSD+"string";
+            // FIXME: MARMOTTA-39 (no default datatype before RDF-1.1)
+            return null; //Namespaces.NS_XSD+"string";
         }
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
index b9cdd4b..4ac7a06 100644
--- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
+++ b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/sesame/model/LiteralCommonsTest.java
@@ -133,6 +133,7 @@ public class LiteralCommonsTest {
 
     }
     
+    @Test
     public void testGetRDFLangStringType() throws Exception {
     	Assert.assertEquals(RDF.LANGSTRING.stringValue(), LiteralCommons.getRDFLangStringType());
 	}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/libraries/kiwi/kiwi-triplestore/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/pom.xml b/libraries/kiwi/kiwi-triplestore/pom.xml
index cfa62d2..493383a 100644
--- a/libraries/kiwi/kiwi-triplestore/pom.xml
+++ b/libraries/kiwi/kiwi-triplestore/pom.xml
@@ -36,7 +36,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
-                <version>2.4</version>
                 <executions>
                     <execution>
                         <goals>
@@ -177,6 +176,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.openrdf.sesame</groupId>
+            <artifactId>sesame-store-testsuite</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
             <groupId>com.google.code.tempus-fugit</groupId>
             <artifactId>tempus-fugit</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
index f3766d3..a1ff121 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
@@ -17,7 +17,6 @@
  */
 package org.apache.marmotta.kiwi.sail;
 
-import com.google.common.collect.Queues;
 import org.apache.commons.lang3.LocaleUtils;
 import org.apache.marmotta.commons.locking.ObjectLocks;
 import org.apache.marmotta.commons.sesame.model.LiteralCommons;
@@ -35,7 +34,6 @@ import org.slf4j.LoggerFactory;
 import javax.xml.datatype.XMLGregorianCalendar;
 import java.sql.SQLException;
 import java.util.*;
-import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -337,7 +335,7 @@ public class KiWiValueFactory implements ValueFactory {
         if(object instanceof XMLGregorianCalendar) {
             return createLiteral((XMLGregorianCalendar)object);
         } else {
-            return createLiteral(object,null,null);
+            return createLiteral(object,null,LiteralCommons.getXSDType(object.getClass()));
         }
     }
 
@@ -348,7 +346,9 @@ public class KiWiValueFactory implements ValueFactory {
      */
     @Override
     public Literal createLiteral(String label) {
-        return createLiteral(label, null, LiteralCommons.getXSDType(String.class));
+        // FIXME: MARMOTTA-39 (no default datatype before RDF-1.1)
+        // return createLiteral(label, null, LiteralCommons.getXSDType(String.class));
+        return createLiteral(label, null, null);
     }
 
     /**
@@ -360,7 +360,9 @@ public class KiWiValueFactory implements ValueFactory {
      */
     @Override
     public Literal createLiteral(String label, String language) {
-        return createLiteral(label,language,LiteralCommons.getRDFLangStringType());
+        // FIXME: MARMOTTA-39 (no rdf:langString before RDF-1.1)
+        // return createLiteral(label,language,LiteralCommons.getRDFLangStringType());
+        return createLiteral(label, language, null);
     }
 
     /**
@@ -395,9 +397,11 @@ public class KiWiValueFactory implements ValueFactory {
             locale  = null;
 
         if (lang != null) {
-            type = LiteralCommons.getRDFLangStringType();
-        } else if(type == null) {
-            type = LiteralCommons.getXSDType(value.getClass());
+            // FIXME: MARMOTTA-39 (no rdf:langString)
+            // type = LiteralCommons.getRDFLangStringType();
+        } else if (type == null) {
+            // FIXME: MARMOTTA-39 (no default datatype before RDF-1.1)
+            // type = LiteralCommons.getXSDType(value.getClass());
         }
         String key = LiteralCommons.createCacheKey(value.toString(),locale,type);
         LiteralKey lkey = new LiteralKey(value,type,lang);
@@ -411,14 +415,21 @@ public class KiWiValueFactory implements ValueFactory {
             if(result != null) {
                 return result;
             } else {
-                final KiWiUriResource rtype = (KiWiUriResource)createURI(type);
+                final KiWiUriResource rtype = type==null?null:(KiWiUriResource)createURI(type);
 
-                KiWiConnection connection = aqcuireConnection();
+                final KiWiConnection connection = aqcuireConnection();
                 try {
 
 
                     // differentiate between the different types of the value
-                    if(value instanceof Date || type.equals(Namespaces.NS_XSD+"dateTime")) {
+                    if (type == null) {
+                        // FIXME: MARMOTTA-39 (this is to avoid a NullPointerException in the following if-clauses)
+                        result = connection.loadLiteral(value.toString(), lang, rtype);
+
+                        if(result == null) {
+                            result = new KiWiStringLiteral(value.toString(), locale, rtype);
+                        }
+                    } else if(value instanceof Date || type.equals(Namespaces.NS_XSD+"dateTime")) {
                         // parse if necessary
                         final Date dvalue;
                         if(value instanceof Date) {

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
index 4dd543b..59507c2 100644
--- a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
+++ b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java
@@ -334,7 +334,9 @@ public class RepositoryTest {
             );
 
             // test if the result has the expected size
-            Assert.assertEquals(31, resources.size());
+            // FIXME: MARMOTTA-39 (no xsd:string, so one resource is "missing")
+            // Assert.assertEquals(31, resources.size());
+            Assert.assertEquals(30, resources.size());
 
             // test if the result contains all resources that have been used as subject
             Assert.assertThat(resources, hasItems(

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailConcurrencyTest.java b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailConcurrencyTest.java
new file mode 100644
index 0000000..646407d
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailConcurrencyTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.kiwi.test.sesame;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.marmotta.kiwi.config.KiWiConfiguration;
+import org.apache.marmotta.kiwi.persistence.KiWiDialect;
+import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
+import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
+import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
+import org.apache.marmotta.kiwi.sail.KiWiStore;
+import org.apache.marmotta.kiwi.test.helper.DBConnectionChecker;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.openrdf.sail.Sail;
+import org.openrdf.sail.SailConcurrencyTest;
+import org.openrdf.sail.SailException;
+
+/**
+ * Run the Sesame {@link SailConcurrencyTest} suite.
+ * <p/>
+ * Except for in-memory databases like H2 or Derby, database URLs must be passed as
+ * system property, or otherwise the test is skipped for this database. Available system properties:
+ * <ul>
+ *     <li>PostgreSQL:
+ *     <ul>
+ *         <li>postgresql.url, e.g. jdbc:postgresql://localhost:5433/kiwitest?prepareThreshold=3</li>
+ *         <li>postgresql.user (default: lmf)</li>
+ *         <li>postgresql.pass (default: lmf)</li>
+ *     </ul>
+ *     </li>
+ *     <li>MySQL:
+ *     <ul>
+ *         <li>mysql.url, e.g. jdbc:mysql://localhost:3306/kiwitest?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull</li>
+ *         <li>mysql.user (default: lmf)</li>
+ *         <li>mysql.pass (default: lmf)</li>
+ *     </ul>
+ *     </li>
+ *     <li>H2:
+ *     <ul>
+ *         <li>h2.url, e.g. jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10</li>
+ *         <li>h2.user (default: lmf)</li>
+ *         <li>h2.pass (default: lmf)</li>
+ *     </ul>
+ *     </li>
+ * </ul>
+ * @author Jakob Frank <ja...@apache.org>
+ */
+@RunWith(Parameterized.class)
+public class KiWiSailConcurrencyTest extends SailConcurrencyTest {
+
+    /**
+     * Return database configurations if the appropriate parameters have been set.
+     *
+     * @return an array (database name, url, user, password)
+     */
+    @Parameterized.Parameters(name="Database Test {index}: {0} at {1}")
+    public static Iterable<Object[]> databases() {
+        String[] databases = {"H2", "PostgreSQL", "MySQL"};
+
+        List<Object[]> result = new ArrayList<Object[]>(databases.length);
+        for(String database : databases) {
+            if(System.getProperty(database.toLowerCase()+".url") != null) {
+                result.add(new Object[] {
+                        database,
+                        System.getProperty(database.toLowerCase()+".url"),
+                        System.getProperty(database.toLowerCase()+".user","lmf"),
+                        System.getProperty(database.toLowerCase()+".pass","lmf")
+                });
+            }
+        }
+        return result;
+    }
+
+    private final String jdbcPass;
+    private final String jdbcUrl;
+    private final String jdbcUser;
+    private final KiWiDialect dialect;
+    
+    public KiWiSailConcurrencyTest(String database, String jdbcUrl, String jdbcUser, String jdbcPass) {
+        super(String.format("%s (%S)", KiWiSailConcurrencyTest.class.getSimpleName(), database));
+        this.jdbcPass = jdbcPass;
+        this.jdbcUrl = jdbcUrl;
+        this.jdbcUser = jdbcUser;
+
+        if("H2".equals(database)) {
+            this.dialect = new H2Dialect();
+        } else if("MySQL".equals(database)) {
+            this.dialect = new MySQLDialect();
+        } else if("PostgreSQL".equals(database)) {
+            this.dialect = new PostgreSQLDialect();
+        } else {
+            Assert.fail("unknown database dialect: " + database);
+            throw new AssertionError();
+        }
+        
+        DBConnectionChecker.checkDatabaseAvailability(jdbcUrl, jdbcUser, jdbcPass, this.dialect);
+    }
+    
+    @Override
+    protected Sail createSail() throws SailException {
+        KiWiStore store = new KiWiStore(new KiWiConfiguration("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred"));
+        return store;
+    }
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+    
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    @Override
+    @Test
+    public void testGetContextIDs() throws Exception {
+        super.testGetContextIDs();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailInterruptTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailInterruptTest.java b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailInterruptTest.java
new file mode 100644
index 0000000..af9dc47
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiSailInterruptTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.kiwi.test.sesame;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.marmotta.kiwi.config.KiWiConfiguration;
+import org.apache.marmotta.kiwi.persistence.KiWiDialect;
+import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
+import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
+import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
+import org.apache.marmotta.kiwi.sail.KiWiStore;
+import org.apache.marmotta.kiwi.test.helper.DBConnectionChecker;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.openrdf.sail.Sail;
+import org.openrdf.sail.SailException;
+import org.openrdf.sail.SailInterruptTest;
+
+/**
+ * Run the Sesame {@link SailInterruptTest} suite.
+ * @author Jakob Frank <ja...@apache.org>
+ *
+ */
+@RunWith(Parameterized.class)
+public class KiWiSailInterruptTest extends SailInterruptTest {
+
+    /**
+     * Return database configurations if the appropriate parameters have been set.
+     *
+     * @return an array (database name, url, user, password)
+     */
+    @Parameterized.Parameters(name="Database Test {index}: {0} at {1}")
+    public static Iterable<Object[]> databases() {
+        String[] databases = {"H2", "PostgreSQL", "MySQL"};
+
+        List<Object[]> result = new ArrayList<Object[]>(databases.length);
+        for(String database : databases) {
+            if(System.getProperty(database.toLowerCase()+".url") != null) {
+                result.add(new Object[] {
+                        database,
+                        System.getProperty(database.toLowerCase()+".url"),
+                        System.getProperty(database.toLowerCase()+".user","lmf"),
+                        System.getProperty(database.toLowerCase()+".pass","lmf")
+                });
+            }
+        }
+        return result;
+    }
+
+    private final String jdbcPass;
+    private final String jdbcUrl;
+    private final String jdbcUser;
+    private final KiWiDialect dialect;
+    
+    public KiWiSailInterruptTest(String database, String jdbcUrl, String jdbcUser, String jdbcPass) {
+        super(String.format("%s (%S)", KiWiSailInterruptTest.class.getSimpleName(), database));
+        
+        this.jdbcPass = jdbcPass;
+        this.jdbcUrl = jdbcUrl;
+        this.jdbcUser = jdbcUser;
+
+        if("H2".equals(database)) {
+            this.dialect = new H2Dialect();
+        } else if("MySQL".equals(database)) {
+            this.dialect = new MySQLDialect();
+        } else if("PostgreSQL".equals(database)) {
+            this.dialect = new PostgreSQLDialect();
+        } else {
+            Assert.fail("unknown database dialect: " + database);
+            throw new AssertionError();
+        }
+        
+        DBConnectionChecker.checkDatabaseAvailability(jdbcUrl, jdbcUser, jdbcPass, this.dialect);
+    }
+    
+    
+    
+    @Override
+    protected Sail createSail() throws SailException {
+        KiWiStore store = new KiWiStore(new KiWiConfiguration("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred"));
+        return store;
+    }
+    
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+    
+    @Override
+    @After
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    @Override
+    @Test
+    public void testQueryInterrupt() throws Exception {
+        super.testQueryInterrupt();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiStoreTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiStoreTest.java b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiStoreTest.java
new file mode 100644
index 0000000..11c9f75
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiStoreTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.kiwi.test.sesame;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.marmotta.kiwi.config.KiWiConfiguration;
+import org.apache.marmotta.kiwi.persistence.KiWiDialect;
+import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
+import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
+import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
+import org.apache.marmotta.kiwi.sail.KiWiStore;
+import org.apache.marmotta.kiwi.test.helper.DBConnectionChecker;
+import org.junit.Assert;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.openrdf.sail.RDFStoreTest;
+import org.openrdf.sail.Sail;
+import org.openrdf.sail.SailException;
+
+/**
+ * Run the Sesame {@link RDFStoreTest} suite.
+ * <p/>
+ * Except for in-memory databases like H2 or Derby, database URLs must be passed as
+ * system property, or otherwise the test is skipped for this database. Available system properties:
+ * <ul>
+ *     <li>PostgreSQL:
+ *     <ul>
+ *         <li>postgresql.url, e.g. jdbc:postgresql://localhost:5433/kiwitest?prepareThreshold=3</li>
+ *         <li>postgresql.user (default: lmf)</li>
+ *         <li>postgresql.pass (default: lmf)</li>
+ *     </ul>
+ *     </li>
+ *     <li>MySQL:
+ *     <ul>
+ *         <li>mysql.url, e.g. jdbc:mysql://localhost:3306/kiwitest?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull</li>
+ *         <li>mysql.user (default: lmf)</li>
+ *         <li>mysql.pass (default: lmf)</li>
+ *     </ul>
+ *     </li>
+ *     <li>H2:
+ *     <ul>
+ *         <li>h2.url, e.g. jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10</li>
+ *         <li>h2.user (default: lmf)</li>
+ *         <li>h2.pass (default: lmf)</li>
+ *     </ul>
+ *     </li>
+ * </ul>
+ * @author Jakob Frank <ja...@apache.org>
+ */
+@RunWith(Parameterized.class)
+public class KiWiStoreTest extends RDFStoreTest {
+
+    /**
+     * Return database configurations if the appropriate parameters have been set.
+     *
+     * @return an array (database name, url, user, password)
+     */
+    @Parameterized.Parameters(name="Database Test {index}: {0} at {1}")
+    public static Iterable<Object[]> databases() {
+        String[] databases = {"H2", "PostgreSQL", "MySQL"};
+
+        List<Object[]> result = new ArrayList<Object[]>(databases.length);
+        for(String database : databases) {
+            if(System.getProperty(database.toLowerCase()+".url") != null) {
+                result.add(new Object[] {
+                        database,
+                        System.getProperty(database.toLowerCase()+".url"),
+                        System.getProperty(database.toLowerCase()+".user","lmf"),
+                        System.getProperty(database.toLowerCase()+".pass","lmf")
+                });
+            }
+        }
+        return result;
+    }
+
+    private final String jdbcPass;
+    private final String jdbcUrl;
+    private final String jdbcUser;
+    private final KiWiDialect dialect;
+    
+    public KiWiStoreTest(String database, String jdbcUrl, String jdbcUser, String jdbcPass) {
+        this.jdbcPass = jdbcPass;
+        this.jdbcUrl = jdbcUrl;
+        this.jdbcUser = jdbcUser;
+
+        if("H2".equals(database)) {
+            this.dialect = new H2Dialect();
+        } else if("MySQL".equals(database)) {
+            this.dialect = new MySQLDialect();
+        } else if("PostgreSQL".equals(database)) {
+            this.dialect = new PostgreSQLDialect();
+        } else {
+            Assert.fail("unknown database dialect: " + database);
+            throw new AssertionError();
+        }
+        
+        DBConnectionChecker.checkDatabaseAvailability(jdbcUrl, jdbcUser, jdbcPass, this.dialect);
+    }
+    
+    @Override
+    protected Sail createSail() throws SailException {
+        KiWiStore store = new KiWiStore(new KiWiConfiguration("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred"));
+        store.initialize();
+        return store;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0b5ef802/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b000174..6774a67 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1152,8 +1152,14 @@
                 <groupId>org.openrdf.sesame</groupId>
                 <artifactId>sesame-sparql-testsuite</artifactId>
                 <version>${sesame.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.openrdf.sesame</groupId>
+                <artifactId>sesame-store-testsuite</artifactId>
+                <version>${sesame.version}</version>
+                <scope>test</scope>
             </dependency>
-
             <!-- RDFa Parser -->
             <dependency>
                 <groupId>org.semarglproject</groupId>