Return-Path: X-Original-To: apmail-marmotta-commits-archive@minotaur.apache.org Delivered-To: apmail-marmotta-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9C5A810AE0 for ; Mon, 30 Sep 2013 16:45:50 +0000 (UTC) Received: (qmail 87402 invoked by uid 500); 30 Sep 2013 16:45:49 -0000 Delivered-To: apmail-marmotta-commits-archive@marmotta.apache.org Received: (qmail 87227 invoked by uid 500); 30 Sep 2013 16:45:48 -0000 Mailing-List: contact commits-help@marmotta.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@marmotta.incubator.apache.org Delivered-To: mailing list commits@marmotta.incubator.apache.org Received: (qmail 86766 invoked by uid 99); 30 Sep 2013 16:45:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Sep 2013 16:45:46 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 30 Sep 2013 16:45:38 +0000 Received: (qmail 84197 invoked by uid 99); 30 Sep 2013 16:45:14 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Sep 2013 16:45:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C9406833150; Mon, 30 Sep 2013 16:44:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sschaffert@apache.org To: commits@marmotta.incubator.apache.org Date: Mon, 30 Sep 2013 16:44:55 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/50] [abbrv] git commit: merge X-Virus-Checked: Checked by ClamAV on apache.org merge Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/49ddd164 Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/49ddd164 Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/49ddd164 Branch: refs/heads/master Commit: 49ddd1645d2e88a824812085c5cd339435fd7ab4 Parents: 5f777a1 0c21ac9 Author: Sebastian Schaffert Authored: Wed Sep 11 17:20:52 2013 +0200 Committer: Sebastian Schaffert Committed: Wed Sep 11 17:20:52 2013 +0200 ---------------------------------------------------------------------- .../marmotta/kiwi/model/rdf/KiWiLiteral.java | 15 +-- .../kiwi/persistence/KiWiConnection.java | 15 ++- .../marmotta/kiwi/sail/KiWiValueFactory.java | 14 ++- .../marmotta/kiwi/test/RepositoryTest.java | 80 +++++++++++++ .../kiwi/test/junit/DatabaseRunnerTest1.java | 50 ++++++++- .../kiwi/test/junit/DatabaseRunnerTest2.java | 49 +++++++- .../kiwi/test/junit/KiWiDatabaseRunner.java | 24 +++- .../kiwi/test/sesame/KiWiLocaleTest.java | 111 +++++++++++++++++++ .../ldpath/api/functions/NodeFunction.java | 2 +- .../marmotta/ldpath/api/tests/NodeTest.java | 1 + .../api/transformers/NodeTransformer.java | 5 +- .../ldpath/backend/file/ParserTest.java | 6 +- .../java/org/apache/marmotta/ldpath/LDPath.java | 12 +- .../ldpath/model/fields/FieldMapping.java | 23 +++- .../model/functions/ConcatenateFunction.java | 3 +- .../ldpath/model/functions/CountFunction.java | 3 +- .../ldpath/model/functions/FirstFunction.java | 5 +- .../ldpath/model/functions/LastFunction.java | 5 +- .../ldpath/model/functions/SortFunction.java | 3 +- .../marmotta/ldpath/model/programs/Program.java | 53 ++++++--- .../ldpath/model/tests/LiteralTypeTest.java | 15 ++- .../tests/functions/BinaryNumericTest.java | 1 + .../marmotta/ldpath/util/Collections.java | 3 + .../at/newmedialab/ldpath/parser/rdfpath.jj | 77 +++++++------ .../BinaryNumericTestFunctionsTest.java | 4 +- .../ldpath/model/functions/FunctionsTest.java | 16 +-- .../marmotta/ldpath/parser/ParserTest.java | 10 +- .../marmotta/ldpath/parser/ProgramTest.java | 61 ++++++++++ .../marmotta/ldpath/parser/SelectorsTest.java | 2 +- .../marmotta/ldpath/parser/TestsTest.java | 2 +- .../marmotta/ldpath/test/AbstractTestBase.java | 14 +-- .../ldpath-core/src/test/resources/logback.xml | 2 + .../src/test/resources/parse/program.ldpath | 20 ++-- .../model/functions/date/DateFunctionsTest.java | 6 +- .../model/functions/html/HtmlFunctionsTest.java | 8 +- .../model/functions/math/MathFunctionTest.java | 30 ++--- .../tests/functions/text/StringTestTest.java | 4 +- .../xml/RemoveXmlTagsFunctionTest.java | 4 +- .../model/functions/xml/XPathFunctionTest.java | 4 +- .../js/widgets/configurator/configurator.coffee | 15 ++- .../config/ConfigurationWebService.java | 2 +- .../src/main/resources/web/admin/about.html | 18 +-- .../src/main/resources/web/admin/about.html | 41 ++++++- 43 files changed, 654 insertions(+), 184 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/49ddd164/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiConnection.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/49ddd164/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java ---------------------------------------------------------------------- diff --cc libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/RepositoryTest.java index 8568b51,f18413f..f501985 --- 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 @@@ -674,44 -673,83 +674,124 @@@ public class RepositoryTest } /** + * This test is for a strange bug that happens when running SPARQL updates that delete and reinsert a triple in + * the same transaction. It is similar to #testMARMOTTA283, but simulates the issue in more detail. + * See https://issues.apache.org/jira/browse/MARMOTTA-283 + */ + @Test + public void testMARMOTTA283_2() throws RepositoryException, RDFParseException, IOException, MalformedQueryException, UpdateExecutionException { + + //insert quadruples + String insert = + "WITH " + + "INSERT {" + + " ." + + " ." + + " ." + + " ." + + "} WHERE {}"; + + RepositoryConnection connectionInsert = repository.getConnection(); + try { + Update u = connectionInsert.prepareUpdate(QueryLanguage.SPARQL, insert); + u.execute(); + connectionInsert.commit(); + } finally { + connectionInsert.close(); + } + + //update quadruples + String update = + "WITH " + + "DELETE { " + + " ?annotation ?p ?v." + + " ?fragment ?r ?s." + + " ?fragment." + + "} INSERT {" + + " ." + + " ." + + " ." + + " ." + + "} WHERE {" + + " ?annotation ?fragment." + + " ?annotation ?p ?v." + + " OPTIONAL {" + + " ?fragment ?r ?s" + + " }" + + " FILTER (?fragment = )" + + "} "; + + RepositoryConnection connectionUpdate = repository.getConnection(); + try { + Update u = connectionUpdate.prepareUpdate(QueryLanguage.SPARQL, update); + u.execute(); + connectionUpdate.commit(); + } finally { + connectionUpdate.close(); + } + + //check quadruples + RepositoryConnection connectionVerify = repository.getConnection(); + try { + URI video = repository.getValueFactory().createURI("http://resource.org/video"); + URI hasFragment = repository.getValueFactory().createURI("http://ontology.org#hasFragment"); + URI fragment = repository.getValueFactory().createURI("http://resource.org/fragment1"); + URI annotation = repository.getValueFactory().createURI("http://resource.org/annotation1"); + URI hasTarget = repository.getValueFactory().createURI("http://ontology.org#hasTarget"); + URI hasBody = repository.getValueFactory().createURI("http://ontology.org#hasBody"); + URI subject = repository.getValueFactory().createURI("http://resource.org/subject1"); + URI shows = repository.getValueFactory().createURI("http://ontology.org#shows"); + + Assert.assertTrue(connectionVerify.hasStatement(video,hasFragment,fragment,true,video)); + Assert.assertTrue(connectionVerify.hasStatement(annotation,hasTarget,fragment,true,video)); + Assert.assertTrue(connectionVerify.hasStatement(annotation,hasBody,subject,true,video)); + Assert.assertTrue(connectionVerify.hasStatement(fragment,shows,subject,true,video)); + + connectionVerify.commit(); + } finally { + connectionVerify.close(); + } + } + ++ /** + * Test the concurrent connection problem reported in MARMOTTA-236 for facading: + * - get two parallel connections + * - add triple in connection 1; should be available in connection 1 and not in connection 2 + * - add same triple in connection 2; should be available in both, connection 1 and connection 2 or + * fail-fast by throwing a ConcurrentModificationException + * @throws Exception + */ + @Test + public void testMARMOTTA236() throws Exception { + RepositoryConnection con1 = repository.getConnection(); + RepositoryConnection con2 = repository.getConnection(); + + try { + URI r1 = repository.getValueFactory().createURI("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8)); + URI r2 = repository.getValueFactory().createURI("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8)); + URI r3 = repository.getValueFactory().createURI("http://localhost/"+ RandomStringUtils.randomAlphanumeric(8)); + + con1.begin(); + con1.add(r1,r2,r3); + + Assert.assertTrue(con1.hasStatement(r1,r2,r3,true)); + + con2.begin(); + Assert.assertFalse(con2.hasStatement(r1,r2,r3,true)); + + con2.add(r1,r2,r3); + + Assert.assertTrue(con2.hasStatement(r1,r2,r3,true)); + + con2.rollback(); + con1.commit(); + } catch (ConcurrentModificationException ex) { + + } finally { + con1.close(); + con2.close(); + } + + + } }