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 2014/04/09 13:02:08 UTC
[42/56] [abbrv] [partial] Reverting the erroneous merge by Sebastian
according to the instructions in INFRA-6876
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/AbstractFacadingTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/AbstractFacadingTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/AbstractFacadingTest.java
index 04762b4..befedc2 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/AbstractFacadingTest.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/AbstractFacadingTest.java
@@ -14,17 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading;
+import java.io.IOException;
+
+import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
+import org.apache.marmotta.kiwi.sail.KiWiStore;
import org.junit.After;
import org.junit.Before;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.rio.RDFParseException;
-import org.openrdf.sail.memory.MemoryStore;
-
-import java.io.IOException;
public abstract class AbstractFacadingTest {
@@ -32,7 +34,13 @@ public abstract class AbstractFacadingTest {
@Before
public void setup() throws RepositoryException, IOException, RDFParseException {
- repositoryRDF = new SailRepository(new MemoryStore());
+ // jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10
+ repositoryRDF = new SailRepository(
+ new KiWiStore(
+ "kiwiTest",
+ "jdbc:h2:mem:facading;MVCC=true;DB_CLOSE_ON_EXIT=TRUE;DB_CLOSE_DELAY=10",
+ "", "", new H2Dialect(),
+ "http://example.com/ctx/default", "http://example.com/ctx/inferred"));
repositoryRDF.initialize();
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/FacadingPredicateBuilderTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/FacadingPredicateBuilderTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/FacadingPredicateBuilderTest.java
index c9515cb..88e043b 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/FacadingPredicateBuilderTest.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/FacadingPredicateBuilderTest.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.builder;
import static org.hamcrest.CoreMatchers.allOf;
@@ -49,6 +50,7 @@ public class FacadingPredicateBuilderTest extends AbstractFacadingTest {
super.setup();
connection = repositoryRDF.getConnection();
+ connection.begin();
facading = FacadingFactory.createFacading(connection);
}
@@ -90,7 +92,7 @@ public class FacadingPredicateBuilderTest extends AbstractFacadingTest {
@After
public void tearDown() throws RepositoryException {
if (connection != null) {
- connection.rollback();
+ connection.commit();
connection.close();
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExampleFacade.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExampleFacade.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExampleFacade.java
index 186c9ba..632edce 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExampleFacade.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExampleFacade.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.builder.model;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExamplePropBuilder.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExamplePropBuilder.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExamplePropBuilder.java
index 0caf2c7..89baca4 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExamplePropBuilder.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/builder/model/ExamplePropBuilder.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.builder.model;
import org.apache.marmotta.commons.sesame.facading.model.AbstractNamespacePropBuilder;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/CollectionFacadingTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/CollectionFacadingTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/CollectionFacadingTest.java
index ef143dd..bebe041 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/CollectionFacadingTest.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/CollectionFacadingTest.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.collections;
import static org.hamcrest.CoreMatchers.hasItems;
@@ -39,20 +40,22 @@ public class CollectionFacadingTest extends AbstractFacadingTest {
@Test
public void testCollectionFacading() throws RepositoryException {
- final RepositoryConnection connection = repositoryRDF.getConnection();
final Random rnd = new Random();
final Date a, b, c, d, e, now;
- now = new Date();
+ now = new Date(60000*(System.currentTimeMillis()/60000L));
+
// Start 10Yrs back;
- final int tenYrsInSecs = 10 * 365 * 24 * 60 * 60;
- a = new Date(now.getTime() - tenYrsInSecs * 1000L);
- b = new Date(a.getTime() + rnd.nextInt(tenYrsInSecs) * 1000L);
- c = new Date(a.getTime() + rnd.nextInt(tenYrsInSecs) * 1000L);
- d = new Date(a.getTime() + rnd.nextInt(tenYrsInSecs) * 1000L);
- e = new Date(a.getTime() + rnd.nextInt(tenYrsInSecs) * 1000L);
+ final int tenYrsInMin = 10 * 365 * 24 * 60;
+ a = new Date(now.getTime() - tenYrsInMin * 60000L);
+ b = new Date(a.getTime() + rnd.nextInt(tenYrsInMin) * 60000L);
+ c = new Date(a.getTime() + rnd.nextInt(tenYrsInMin) * 60000L);
+ d = new Date(a.getTime() + rnd.nextInt(tenYrsInMin) * 60000L);
+ e = new Date(a.getTime() + rnd.nextInt(tenYrsInMin) * 60000L);
+ final RepositoryConnection connection = repositoryRDF.getConnection();
try {
+ connection.begin();
final Facading facading = FacadingFactory.createFacading(connection);
URI uri = connection.getValueFactory().createURI("http://www.example.com/rdf/test/collections");
@@ -70,6 +73,8 @@ public class CollectionFacadingTest extends AbstractFacadingTest {
facade.deleteDates();
Assert.assertEquals(facade.getDates().size(), 0);
+
+ connection.commit();
} finally {
connection.close();
}
@@ -83,6 +88,7 @@ public class CollectionFacadingTest extends AbstractFacadingTest {
try {
final Facading facading = FacadingFactory.createFacading(connection);
+ connection.begin();
URI uri = connection.getValueFactory().createURI("http://www.example.com/rdf/test/document");
CollectionFacade facade = facading.createFacade(uri, CollectionFacade.class);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/model/CollectionFacade.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/model/CollectionFacade.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/model/CollectionFacade.java
index 5980e17..72fdf8a 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/model/CollectionFacade.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/collections/model/CollectionFacade.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.collections.model;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/ConcurrentFacadingTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/ConcurrentFacadingTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/ConcurrentFacadingTest.java
new file mode 100644
index 0000000..241f5f3
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/ConcurrentFacadingTest.java
@@ -0,0 +1,198 @@
+/*
+ * 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.commons.sesame.facading.concurrent;
+
+import java.util.ConcurrentModificationException;
+import java.util.UUID;
+
+import org.apache.marmotta.commons.sesame.facading.AbstractFacadingTest;
+import org.apache.marmotta.commons.sesame.facading.FacadingFactory;
+import org.apache.marmotta.commons.sesame.facading.api.Facading;
+import org.apache.marmotta.commons.sesame.facading.concurrent.model.FooFacade;
+import org.apache.marmotta.commons.sesame.facading.concurrent.model.TypeFacade;
+import org.apache.marmotta.commons.sesame.repository.ResourceUtils;
+import org.apache.marmotta.commons.vocabulary.DCTERMS;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.model.vocabulary.RDF;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+
+public class ConcurrentFacadingTest extends AbstractFacadingTest {
+
+ private URI subject;
+
+ @Before
+ public void init() {
+ subject = repositoryRDF.getValueFactory().createURI("http://example.com/rdf/" + UUID.randomUUID().toString());
+ }
+
+ @Test
+ public void testParallelConnections() throws RepositoryException {
+ final URI type = repositoryRDF.getValueFactory().createURI(DCTERMS.Agent.stringValue()+"#", UUID.randomUUID().toString());
+ final RepositoryConnection cX = repositoryRDF.getConnection(),
+ cO = repositoryRDF.getConnection();
+ try {
+ cX.begin();
+ cO.begin();
+
+ cX.add(subject, RDF.TYPE, type);
+ Assert.assertTrue (cX.hasStatement(subject, RDF.TYPE, type, false));
+ Assert.assertFalse(cO.hasStatement(subject, RDF.TYPE, type, false));
+
+ cX.commit();
+ Assert.assertTrue(cO.hasStatement(subject, RDF.TYPE, type, false));
+
+ cO.commit();
+ } finally {
+ if (cX.isActive()) cX.rollback();
+ if (cO.isActive()) cO.rollback();
+ cX.close();
+ cO.close();
+ }
+ }
+
+ @Test
+ @Ignore("currently fails for H2 database because of transaction locking")
+ public void testParallelFacading() throws RepositoryException {
+ final RepositoryConnection fc = repositoryRDF.getConnection();
+ try {
+ fc.begin();
+ final Facading facading = FacadingFactory.createFacading(fc);
+
+ final FooFacade ff = facading.createFacade(subject, FooFacade.class);
+
+ Assert.assertNull(ff.getString());
+ final String v = UUID.randomUUID().toString();
+ ff.setString(v);
+ Assert.assertEquals(v, ff.getString());
+
+ final RepositoryConnection fc2 = repositoryRDF.getConnection();
+ try {
+ fc2.begin();
+
+ final Facading f2 = FacadingFactory.createFacading(fc2);
+ Assert.assertNull(f2.createFacade(subject, FooFacade.class).getString());
+
+ fc2.commit();
+ } finally {
+ if (fc2.isActive()) fc2.rollback();
+ fc2.close();
+ }
+
+ fc.commit();
+
+ final RepositoryConnection fc3 = repositoryRDF.getConnection();
+ try {
+ fc3.begin();
+
+ final Facading f3 = FacadingFactory.createFacading(fc3);
+ Assert.assertEquals(v, f3.createFacade(subject, FooFacade.class).getString());
+
+ fc3.commit();
+ } finally {
+ if (fc3.isActive()) fc3.rollback();
+ fc3.close();
+ }
+ } finally {
+ if (fc.isActive()) fc.rollback();
+ fc.close();
+ }
+ }
+
+ /**
+ * Test for MARMOTTA-236
+ * @throws RepositoryException
+ */
+ @Test
+ public void testParallelFacadingType() throws RepositoryException {
+ final RepositoryConnection mainCon = repositoryRDF.getConnection();
+ try {
+ mainCon.begin();
+ Assert.assertFalse(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
+
+ final Facading facading = FacadingFactory.createFacading(mainCon);
+ Assert.assertFalse(facading.isFacadeable(subject, TypeFacade.class));
+ Assert.assertFalse(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
+
+
+ final TypeFacade ff = facading.createFacade(subject, TypeFacade.class);
+ Assert.assertTrue(facading.isFacadeable(subject, TypeFacade.class));
+ Assert.assertTrue(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
+
+ Assert.assertNull(ff.getTitle());
+ final String v = UUID.randomUUID().toString();
+ ff.setTitle(v);
+ Assert.assertEquals(v, ff.getTitle());
+ Assert.assertTrue(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
+ Assert.assertTrue(facading.isFacadeable(subject, TypeFacade.class));
+
+ { // before-commit
+ final RepositoryConnection subCon_1 = repositoryRDF.getConnection();
+ try {
+ subCon_1.begin();
+ Assert.assertFalse(ResourceUtils.hasType(subCon_1, subject, TypeFacade.TYPE));
+
+ final Facading f_1 = FacadingFactory.createFacading(subCon_1);
+ Assert.assertFalse(f_1.isFacadeable(subject, TypeFacade.class));
+
+ final TypeFacade tf_1 = f_1.createFacade(subject, TypeFacade.class);
+ Assert.assertNull(tf_1.getTitle());
+ Assert.assertTrue(f_1.isFacadeable(subject, TypeFacade.class));
+ Assert.assertTrue(ResourceUtils.hasType(subCon_1, subject, TypeFacade.TYPE));
+
+ subCon_1.rollback();
+ } finally {
+ if (subCon_1.isActive()) subCon_1.rollback();
+ subCon_1.close();
+ }
+ }
+
+ mainCon.commit();
+
+ { // after-commit
+ final RepositoryConnection subCon_2 = repositoryRDF.getConnection();
+ try {
+ subCon_2.begin();
+ Assert.assertTrue(ResourceUtils.hasType(subCon_2, subject, TypeFacade.TYPE));
+
+ final Facading f_2 = FacadingFactory.createFacading(subCon_2);
+ Assert.assertTrue(f_2.isFacadeable(subject, TypeFacade.class));
+
+ Assert.assertEquals(v, f_2.createFacade(subject, TypeFacade.class).getTitle());
+ Assert.assertTrue(ResourceUtils.hasType(subCon_2, subject, TypeFacade.TYPE));
+ Assert.assertTrue(f_2.isFacadeable(subject, TypeFacade.class));
+
+ subCon_2.commit();
+ } finally {
+ if (subCon_2.isActive()) subCon_2.rollback();
+ subCon_2.close();
+ }
+ }
+ } catch (ConcurrentModificationException ex) {
+ // do nothing, H2 locking
+ } finally {
+ if (mainCon.isActive()) mainCon.rollback();
+ mainCon.close();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/FooFacade.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/FooFacade.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/FooFacade.java
new file mode 100644
index 0000000..095f6fe
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/FooFacade.java
@@ -0,0 +1,30 @@
+/*
+ * 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.commons.sesame.facading.concurrent.model;
+
+import org.apache.marmotta.commons.sesame.facading.annotations.RDF;
+import org.apache.marmotta.commons.sesame.facading.model.Facade;
+import org.openrdf.model.vocabulary.DCTERMS;
+
+public interface FooFacade extends Facade {
+
+ @RDF(DCTERMS.NAMESPACE + "string")
+ public void setString(String string);
+ public String getString();
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/TypeFacade.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/TypeFacade.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/TypeFacade.java
new file mode 100644
index 0000000..d08404a
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/concurrent/model/TypeFacade.java
@@ -0,0 +1,34 @@
+/*
+ * 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.commons.sesame.facading.concurrent.model;
+
+import org.apache.marmotta.commons.sesame.facading.annotations.RDF;
+import org.apache.marmotta.commons.sesame.facading.annotations.RDFType;
+import org.apache.marmotta.commons.sesame.facading.model.Facade;
+
+@RDFType(TypeFacade.TYPE)
+public interface TypeFacade extends Facade {
+
+ public static final String TITLE = "http://foo.bar/title";
+ public static final String TYPE = "http://foo.bar/Type";
+
+ @RDF(TITLE)
+ String getTitle();
+ void setTitle(String title);
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/FacadingFoafTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/FacadingFoafTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/FacadingFoafTest.java
index 646d3c1..9d1442e 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/FacadingFoafTest.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/FacadingFoafTest.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.foaf;
import static org.hamcrest.CoreMatchers.allOf;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/OnlineAccount.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/OnlineAccount.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/OnlineAccount.java
index d1d316a..12cd744 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/OnlineAccount.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/OnlineAccount.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.foaf.model;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/Person.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/Person.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/Person.java
index c6298c1..9328f75 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/Person.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/foaf/model/Person.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.foaf.model;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/LocaleFacadingTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/LocaleFacadingTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/LocaleFacadingTest.java
index 5932471..6dc860e 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/LocaleFacadingTest.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/LocaleFacadingTest.java
@@ -14,8 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.locale;
+import java.util.Locale;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.is;
@@ -23,7 +25,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-
import org.apache.marmotta.commons.sesame.facading.AbstractFacadingTest;
import org.apache.marmotta.commons.sesame.facading.FacadingFactory;
import org.apache.marmotta.commons.sesame.facading.api.Facading;
@@ -33,13 +34,11 @@ import org.openrdf.model.URI;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
-import java.util.Locale;
-
public class LocaleFacadingTest extends AbstractFacadingTest {
@Test
public void testWithLocale() throws RepositoryException {
- final Locale de = Locale.GERMAN, en = Locale.ENGLISH, fr = Locale.FRENCH, none = new Locale("none");
+ final Locale de = Locale.GERMAN, en = Locale.ENGLISH, fr = Locale.FRENCH, none = new Locale("xx", "none");
final String lbl = "Label",
lbl_de = lbl + ": " + de.toString(),
@@ -49,6 +48,7 @@ public class LocaleFacadingTest extends AbstractFacadingTest {
final RepositoryConnection connection = repositoryRDF.getConnection();
try {
+ connection.begin();
final Facading facading = FacadingFactory.createFacading(connection);
final URI uri = connection.getValueFactory().createURI("http://www.example.com/rdf/test/locale");
@@ -101,6 +101,7 @@ public class LocaleFacadingTest extends AbstractFacadingTest {
assertNull(f.getLabel(fr));
assertNull(f.getLabel(none));
+ connection.commit();
} finally {
connection.close();
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/model/LocaleFacade.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/model/LocaleFacade.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/model/LocaleFacade.java
index 1db7621..953fb02 100644
--- a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/model/LocaleFacade.java
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/locale/model/LocaleFacade.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.marmotta.commons.sesame.facading.locale.model;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/BoxedFacadingTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/BoxedFacadingTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/BoxedFacadingTest.java
new file mode 100644
index 0000000..5efc18a
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/BoxedFacadingTest.java
@@ -0,0 +1,157 @@
+/*
+ * 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.commons.sesame.facading.primitive;
+
+import java.util.Date;
+import java.util.Locale;
+import java.util.Random;
+import java.util.UUID;
+
+import org.apache.marmotta.commons.sesame.facading.AbstractFacadingTest;
+import org.apache.marmotta.commons.sesame.facading.FacadingFactory;
+import org.apache.marmotta.commons.sesame.facading.api.Facading;
+import org.apache.marmotta.commons.sesame.facading.primitive.model.Boxed;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+
+public class BoxedFacadingTest extends AbstractFacadingTest {
+
+ private URI subject;
+ private Random random;
+ private RepositoryConnection facadingConnection;
+ private Boxed boxed;
+
+ @Before
+ public void before() throws Exception {
+ subject = repositoryRDF.getValueFactory().createURI("urn:", UUID.randomUUID().toString());
+ random = new Random();
+
+ facadingConnection = repositoryRDF.getConnection();
+ facadingConnection.begin();
+ final Facading factory = FacadingFactory.createFacading(facadingConnection);
+ boxed = factory.createFacade(subject, Boxed.class);
+ }
+
+ @After
+ public void after() throws Exception {
+ if (facadingConnection != null) {
+ if (facadingConnection.isActive()) facadingConnection.rollback();
+ facadingConnection.close();
+ }
+ }
+
+ @Test
+ public void testString() throws RepositoryException {
+ final String string = UUID.randomUUID().toString();
+
+ Assert.assertNull(boxed.getString());
+ boxed.setString(string);
+ Assert.assertEquals(string, boxed.getString());
+ }
+
+ @Test
+ public void testInteger() {
+ final Integer i = new Integer(random.nextInt());
+
+ Assert.assertEquals(new Integer(0), boxed.getInteger());
+ boxed.setInteger(i);
+ Assert.assertEquals(i, boxed.getInteger());
+ }
+
+ @Test
+ public void testLong() {
+ final Long l = new Long(random.nextLong());
+
+ Assert.assertEquals(new Long(0), boxed.getLong());
+ boxed.setLong(l);
+ Assert.assertEquals(l, boxed.getLong());
+ }
+
+ @Test
+ public void testFloat() {
+ final Float f = new Float(random.nextFloat());
+
+ Assert.assertEquals(0f, boxed.getFloat().floatValue(), 10e-9);
+ boxed.setFloat(f);
+ Assert.assertEquals(f, boxed.getFloat().floatValue(), 10e-9);
+ }
+
+ @Test
+ public void testDouble() {
+ final Double d = new Double(random.nextDouble());
+
+ Assert.assertEquals(0d, boxed.getDouble().doubleValue(), 10e-12);
+ boxed.setDouble(d);
+ Assert.assertEquals(d, boxed.getDouble().doubleValue(), 10e-12);
+ }
+
+ @Test
+ public void testCharacter() {
+ final Character c = new Character((char) random.nextInt(255));
+
+ Assert.assertNull(boxed.getCharacter());
+ boxed.setCharacter(c);
+ Assert.assertEquals(c, boxed.getCharacter());
+ }
+
+ @Test
+ public void testByte() {
+ final Byte b = new Byte((byte) random.nextInt(Byte.MAX_VALUE));
+
+ Assert.assertEquals(new Byte((byte)0), boxed.getByte());
+ boxed.setByte(b);
+ Assert.assertEquals(b, boxed.getByte());
+ }
+
+ @Test
+ public void testBoolean() {
+ Assert.assertFalse(boxed.getBoolean());
+ boxed.setBoolean(Boolean.FALSE);
+ Assert.assertFalse(boxed.getBoolean());
+ boxed.setBoolean(Boolean.TRUE);
+ Assert.assertTrue(boxed.getBoolean());
+ }
+
+ @Test
+ public void testLocale() {
+ Assert.assertNull(boxed.getLocale());
+
+ for (Locale l: Locale.getAvailableLocales()) {
+ boxed.setLocale(l);
+ //Assert.assertEquals(l, boxed.getLocale());
+ Assert.assertEquals(l.getDisplayLanguage(), boxed.getLocale().getDisplayLanguage());
+ }
+ }
+
+ @Test
+ public void testGetDate() {
+ /* Dates are stored with seconds-precision */
+ final Date d = new Date(1000*((random.nextLong()%System.currentTimeMillis())/1000));
+
+ Assert.assertNull(boxed.getDate());
+ boxed.setDate(d);
+ Assert.assertEquals(d, boxed.getDate());
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/PrimitiveFacadingTest.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/PrimitiveFacadingTest.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/PrimitiveFacadingTest.java
new file mode 100644
index 0000000..1d1d060
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/PrimitiveFacadingTest.java
@@ -0,0 +1,130 @@
+/*
+ * 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.commons.sesame.facading.primitive;
+
+import java.util.Random;
+import java.util.UUID;
+
+import org.apache.marmotta.commons.sesame.facading.AbstractFacadingTest;
+import org.apache.marmotta.commons.sesame.facading.FacadingFactory;
+import org.apache.marmotta.commons.sesame.facading.api.Facading;
+import org.apache.marmotta.commons.sesame.facading.primitive.model.Primitive;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+
+public class PrimitiveFacadingTest extends AbstractFacadingTest {
+
+ private static final int ITERATIONS = 2500;
+
+ private URI subject;
+ private Random random;
+ private RepositoryConnection facadingConnection;
+ private Primitive primitive;
+
+ @Before
+ public void before() throws Exception {
+ subject = repositoryRDF.getValueFactory().createURI("urn:", UUID.randomUUID().toString());
+ random = new Random();
+
+ facadingConnection = repositoryRDF.getConnection();
+ facadingConnection.begin();
+ final Facading factory = FacadingFactory.createFacading(facadingConnection);
+ primitive = factory.createFacade(subject, Primitive.class);
+
+ }
+
+ @After
+ public void after() throws RepositoryException {
+ if (facadingConnection != null) {
+ if (facadingConnection.isActive()) facadingConnection.rollback();
+ facadingConnection.close();
+ }
+ }
+
+ @Test
+ public void testInt() {
+
+ for (int j =0; j < ITERATIONS; j++) {
+ Assert.assertEquals(0, primitive.getInt());
+ }
+ final int i = random.nextInt();
+ primitive.setInt(i);
+ Assert.assertEquals(i, primitive.getInt());
+ }
+
+ @Test
+ public void testByte() {
+ final byte b = (byte) random.nextInt(Byte.MAX_VALUE);
+
+ Assert.assertEquals(0, primitive.getByte());
+ primitive.setByte(b);
+ Assert.assertEquals(b, primitive.getByte());
+ }
+
+ @Test
+ public void testFloat() {
+ final float f = random.nextFloat();
+
+ Assert.assertEquals(0f, primitive.getFloat(), 10e-9);
+ primitive.setFloat(f);
+ Assert.assertEquals(f, primitive.getFloat(), 10e-9);
+ }
+
+ @Test
+ public void testDouble() {
+ final double d = random.nextDouble();
+
+ Assert.assertEquals(0d, primitive.getDouble(), 10e-12);
+ primitive.setDouble(d);
+ Assert.assertEquals(d, primitive.getDouble(), 10e-12);
+ }
+
+ @Test
+ public void testLong() {
+ final long l = random.nextLong();
+
+ Assert.assertEquals(0l, primitive.getLong());
+ primitive.setLong(l);
+ Assert.assertEquals(l, primitive.getLong());
+ }
+
+
+ @Test
+ public void testGetBoolean() {
+ Assert.assertFalse(primitive.getBoolean());
+ primitive.setBoolean(false);
+ Assert.assertFalse(primitive.getBoolean());
+ primitive.setBoolean(true);
+ Assert.assertTrue(primitive.getBoolean());
+ }
+
+ @Test
+ public void testGetChar() {
+ final char c = (char) random.nextInt(255);
+
+ Assert.assertEquals(0, primitive.getChar());
+ primitive.setChar(c);
+ Assert.assertEquals(c, primitive.getChar());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Boxed.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Boxed.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Boxed.java
new file mode 100644
index 0000000..f540689
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Boxed.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.sesame.facading.primitive.model;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.marmotta.commons.sesame.facading.annotations.RDFPropertyBuilder;
+import org.apache.marmotta.commons.sesame.facading.model.Facade;
+
+@RDFPropertyBuilder(PropBuilder.class)
+public interface Boxed extends Facade {
+
+ public Integer getInteger();
+ public void setInteger(Integer integer);
+ public Long getLong();
+ public void setLong(Long l);
+ public Float getFloat();
+ public void setFloat(Float f);
+ public Double getDouble();
+ public void setDouble(Double d);
+ public Character getCharacter();
+ public void setCharacter(Character character);
+ public Byte getByte();
+ public void setByte(Byte b);
+ public Boolean getBoolean();
+ public void setBoolean(Boolean b);
+ public Locale getLocale();
+ public void setLocale(Locale locale);
+ public String getString();
+ public void setString(String string);
+ public Date getDate();
+ public void setDate(Date date);
+
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Primitive.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Primitive.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Primitive.java
new file mode 100644
index 0000000..05647c9
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/Primitive.java
@@ -0,0 +1,47 @@
+/*
+ * 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.commons.sesame.facading.primitive.model;
+
+import org.apache.marmotta.commons.sesame.facading.annotations.RDFPropertyBuilder;
+import org.apache.marmotta.commons.sesame.facading.model.Facade;
+
+@RDFPropertyBuilder(PropBuilder.class)
+public interface Primitive extends Facade {
+
+ public int getInt();
+ public void setInt(int i);
+
+ public float getFloat();
+ public void setFloat(float f);
+
+ public double getDouble();
+ public void setDouble(double d);
+
+ public long getLong();
+ public void setLong(long l);
+
+ public boolean getBoolean();
+ public void setBoolean(boolean b);
+
+ public char getChar();
+ public void setChar(char c);
+
+ public byte getByte();
+ public void setByte(byte b);
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/PropBuilder.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/PropBuilder.java b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/PropBuilder.java
new file mode 100644
index 0000000..98bfc3e
--- /dev/null
+++ b/commons/sesame-tools-facading/src/test/java/org/apache/marmotta/commons/sesame/facading/primitive/model/PropBuilder.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.sesame.facading.primitive.model;
+
+import org.apache.marmotta.commons.sesame.facading.model.AbstractNamespacePropBuilder;
+
+public class PropBuilder extends AbstractNamespacePropBuilder {
+
+ @Override
+ protected String getNamespace() {
+ return "http://persistence.text/prop#";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-facading/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-facading/src/test/resources/logback.xml b/commons/sesame-tools-facading/src/test/resources/logback.xml
index 1bfecff..864df3a 100644
--- a/commons/sesame-tools-facading/src/test/resources/logback.xml
+++ b/commons/sesame-tools-facading/src/test/resources/logback.xml
@@ -21,6 +21,7 @@
<pattern>%d{HH:mm:ss.SSS} %highlight(%level) %cyan(%logger{15}) - %m%n</pattern>
</encoder>
</appender>
+ <logger name="org.apache.marmotta.commons.sesame.facading.concurrent.model" level="TRACE" />
<root level="${root-level:-INFO}">
<appender-ref ref="CONSOLE"/>
</root>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-rio-api/pom.xml
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-api/pom.xml b/commons/sesame-tools-rio-api/pom.xml
index 18c3eee..475ae41 100644
--- a/commons/sesame-tools-rio-api/pom.xml
+++ b/commons/sesame-tools-rio-api/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-rio-ical/pom.xml
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-ical/pom.xml b/commons/sesame-tools-rio-ical/pom.xml
index 3414eed..8ec3e73 100644
--- a/commons/sesame-tools-rio-ical/pom.xml
+++ b/commons/sesame-tools-rio-ical/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.marmotta</groupId>
<artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating</version>
<relativePath>../../parent</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-rio-jsonld/pom.xml
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-jsonld/pom.xml b/commons/sesame-tools-rio-jsonld/pom.xml
deleted file mode 100644
index 028556c..0000000
--- a/commons/sesame-tools-rio-jsonld/pom.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.marmotta</groupId>
- <artifactId>marmotta-parent</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <name>Sesame I/O: JSON/LD</name>
- <artifactId>sesame-tools-rio-jsonld</artifactId>
- <packaging>jar</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>add-ext</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/ext/java</source>
- </sources>
- </configuration>
- </execution>
- <execution>
- <id>add-ext-test</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <inherited>false</inherited>
- <configuration>
- <sources>
- <source>src/ext-test/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <directory>src/ext/resources</directory>
- </resource>
- </resources>
- </build>
-
-
- <dependencies>
- <dependency>
- <groupId>org.apache.marmotta</groupId>
- <artifactId>sesame-tools-rio-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-model</artifactId>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-rio-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-query</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-queryparser-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-queryparser-sparql</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-queryalgebra-model</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-queryalgebra-evaluation</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-sail-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openrdf.sesame</groupId>
- <artifactId>sesame-repository-sail</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/JSONUtils.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/JSONUtils.java b/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/JSONUtils.java
deleted file mode 100644
index 4be1f99..0000000
--- a/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/JSONUtils.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package de.dfki.km.json;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.List;
-import java.util.Map;
-
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonLocation;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.ObjectWriter;
-
-/**
- * A bunch of functions to make loading JSON easy
- *
- * @author tristan
- *
- */
-public class JSONUtils {
- public static Object fromString(String jsonString) throws JsonParseException, JsonMappingException {
- ObjectMapper objectMapper = new ObjectMapper();
- Object rval = null;
- if (jsonString.trim().startsWith("[")) {
- try {
- rval = objectMapper.readValue(jsonString, List.class);
- } catch (IOException e) {
- // TODO: what?
- if (e instanceof JsonParseException) {
- throw (JsonParseException) e;
- } else if (e instanceof JsonMappingException) {
- throw (JsonMappingException) e;
- } else {
- // TODO: Auto-generated catch block
- e.printStackTrace();
- }
- }
- } else if (jsonString.trim().startsWith("{")) {
- try {
- rval = objectMapper.readValue(jsonString, Map.class);
- } catch (IOException e) {
- if (e instanceof JsonParseException) {
- throw (JsonParseException) e;
- } else if (e instanceof JsonMappingException) {
- throw (JsonMappingException) e;
- } else {
- // TODO: Auto-generated catch block
- e.printStackTrace();
- }
- }
- } else if (jsonString.trim().startsWith("\"")) {
- try {
- rval = objectMapper.readValue(jsonString, String.class);
- } catch (IOException e) {
- if (e instanceof JsonParseException) {
- throw (JsonParseException) e;
- } else if (e instanceof JsonMappingException) {
- throw (JsonMappingException) e;
- } else {
- // TODO: Auto-generated catch block
- e.printStackTrace();
- }
- }
- } else if (jsonString.trim().equals("true") || (jsonString.trim().equals("false"))) {
- try {
- rval = objectMapper.readValue(jsonString, Boolean.class);
- } catch (IOException e) {
- if (e instanceof JsonParseException) {
- throw (JsonParseException) e;
- } else if (e instanceof JsonMappingException) {
- throw (JsonMappingException) e;
- } else {
- // TODO: Auto-generated catch block
- e.printStackTrace();
- }
- }
- } else if (jsonString.trim().matches("[0-9.e+-]+")) {
- try {
- rval = objectMapper.readValue(jsonString, Number.class);
- } catch (IOException e) {
- if (e instanceof JsonParseException) {
- throw (JsonParseException) e;
- } else if (e instanceof JsonMappingException) {
- throw (JsonMappingException) e;
- } else {
- // TODO: Auto-generated catch block
- e.printStackTrace();
- }
- }
- } else if (jsonString.trim().equals("null")) {
- rval = null;
- } else {
- throw new JsonParseException("document doesn't start with a valid json element", new JsonLocation("\""
- + jsonString.substring(0, Math.min(jsonString.length(), 100)) + "...\"", 0, 1, 0));
- }
- return rval;
- }
-
- public static Object fromReader(Reader r) throws IOException {
- StringBuffer sb = new StringBuffer();
- int b;
- while ((b = r.read()) != -1) {
- sb.append((char) b);
- }
- return fromString(sb.toString());
- }
-
- public static void write(Writer w, Object jsonObject) throws JsonGenerationException, JsonMappingException, IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.getJsonFactory().disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
- objectMapper.writeValue(w, jsonObject);
- }
-
- public static void writePrettyPrint(Writer w, Object jsonObject) throws JsonGenerationException, JsonMappingException, IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.getJsonFactory().disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
- ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter();
-
- objectWriter.writeValue(w, jsonObject);
- }
-
- public static Object fromInputStream(InputStream content) throws IOException {
- return fromInputStream(content, "UTF-8"); // no readers from
- // inputstreams w.o.
- // encoding!!
- }
-
- public static Object fromInputStream(InputStream content, String enc) throws IOException {
- return fromReader(new BufferedReader(new InputStreamReader(content, enc)));
- }
-
- public static String toPrettyString(Object obj) {
- StringWriter sw = new StringWriter();
- try {
- writePrettyPrint(sw, obj);
- } catch (Exception e) {
- // TODO Is this really possible with stringwriter?
- // I think it's only there because of the interface
- // however, if so... well, we have to do something!
- // it seems weird for toString to throw an IOException
- }
- return sw.toString();
- }
-
- public static String toString(Object obj) { // throws
- // JsonGenerationException,
- // JsonMappingException {
- StringWriter sw = new StringWriter();
- try {
- write(sw, obj);
- } catch (Exception e) {
- // TODO Is this really possible with stringwriter?
- // I think it's only there because of the interface
- // however, if so... well, we have to do something!
- // it seems weird for toString to throw an IOException
- }
- return sw.toString();
- }
-
- public static boolean equals(Object v1, Object v2) {
- boolean rval = true;
- // TODO Auto-generated method stub
- if (v1 instanceof List && v2 instanceof List) {
- if (((List) v1).size() != ((List) v2).size()) {
- rval = false;
- } else {
- // TODO: should the order of things in the list matter?
- for (int i = 0; i < ((List<Object>) v1).size() && rval == true; i++) {
- rval = equals(((List<Object>) v1).get(i), ((List<Object>) v2).get(i));
- }
- }
- } else if (v1 instanceof Number && v2 instanceof Number) {
- // TODO: this is VERY sketchy
- double n1 = ((Number) v1).doubleValue();
- double n2 = ((Number) v2).doubleValue();
-
- rval = n1 == n2;
- } else if (v1 instanceof String && v2 instanceof String) {
- rval = ((String) v1).equals((String) v2);
- } else if (v1 instanceof Map && v2 instanceof Map) {
- if (((Map) v1).size() != ((Map) v2).size()) {
- rval = false;
- } else {
- for (Object k1 : ((Map) v1).keySet()) {
- rval = ((Map) v2).containsKey(k1) ? equals(((Map) v1).get(k1), ((Map) v2).get(k1)) : false;
- if (rval != true) {
- break;
- }
- }
- }
- } else if (v1 instanceof Boolean && v2 instanceof Boolean) {
- rval = v1 == v2;
- } else if (v1 != null && v2 != null) {
- rval = v1.equals(v2);
- } else {
- rval = v1 == v2;
- }
-
- return rval;
- }
-}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/582abb5b/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/jsonld/JSONLDConsts.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/jsonld/JSONLDConsts.java b/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/jsonld/JSONLDConsts.java
deleted file mode 100644
index a280194..0000000
--- a/commons/sesame-tools-rio-jsonld/src/ext/java/de/dfki/km/json/jsonld/JSONLDConsts.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package de.dfki.km.json.jsonld;
-
-public class JSONLDConsts {
-
- public static final String RDF_SYNTAX_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
- public static final String RDF_SCHEMA_NS = "http://www.w3.org/2000/01/rdf-schema#";
- public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema#";
-
- public static final String XSD_ANYTYPE = XSD_NS + "anyType";
- public static final String XSD_BOOLEAN = XSD_NS + "boolean";
- public static final String XSD_DOUBLE = XSD_NS + "double";
- public static final String XSD_INTEGER = XSD_NS + "integer";
- public static final String XSD_ANYURI = XSD_NS + "anyURI";
- public static final String XSD_STRING = XSD_NS + "string";
-
- public static final String RDF_TYPE = RDF_SYNTAX_NS + "type";
-}