added another test for the garbage collector

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

Branch: refs/heads/develop
Commit: 4cad2d407cc4deadc0c4179fcb2b342fa1cb125a
Parents: f9ce1c9
Author: Sebastian Schaffert <[email protected]>
Authored: Fri Mar 29 12:49:16 2013 +0100
Committer: Sebastian Schaffert <[email protected]>
Committed: Fri Mar 29 12:49:16 2013 +0100

----------------------------------------------------------------------
 .../versioning/test/VersioningPersistenceTest.java |   29 ++++++++++++---
 pom.xml                                            |   25 +++++++++++--
 2 files changed, 46 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4cad2d40/libraries/kiwi/kiwi-versioning/src/test/java/org/apache/marmotta/kiwi/versioning/test/VersioningPersistenceTest.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-versioning/src/test/java/org/apache/marmotta/kiwi/versioning/test/VersioningPersistenceTest.java
 
b/libraries/kiwi/kiwi-versioning/src/test/java/org/apache/marmotta/kiwi/versioning/test/VersioningPersistenceTest.java
index 10ad516..960bbc7 100644
--- 
a/libraries/kiwi/kiwi-versioning/src/test/java/org/apache/marmotta/kiwi/versioning/test/VersioningPersistenceTest.java
+++ 
b/libraries/kiwi/kiwi-versioning/src/test/java/org/apache/marmotta/kiwi/versioning/test/VersioningPersistenceTest.java
@@ -17,6 +17,7 @@
  */
 package org.apache.marmotta.kiwi.versioning.test;
 
+import info.aduna.iteration.Iterations;
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.marmotta.kiwi.model.rdf.KiWiStringLiteral;
 import org.apache.marmotta.kiwi.model.rdf.KiWiTriple;
@@ -38,6 +39,8 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Date;
@@ -292,6 +295,7 @@ public class VersioningPersistenceTest {
             version2.setCommitTime(new Date());
             version2.addTriple(triple2);
             version2.removeTriple(triple1);
+            connection.deleteTriple(triple1);
             connection.storeVersion(version2);
             connection.commit();
 
@@ -302,7 +306,7 @@ public class VersioningPersistenceTest {
 
 
             // now we test different ways of listing versions between dates
-            List<Version> list1 = 
connection.listVersions(date1,date2).asList();
+            List<Version> list1 = 
Iterations.asList(connection.listVersions(date1, date2));
             Assert.assertEquals("there should be exactly one version from 
"+date1+" to "+date2,1,list1.size());
             Assert.assertEquals("contents of version differ", version1, 
list1.get(0));
             Assert.assertEquals("version id is not 1", 1L, 
(long)list1.get(0).getId());
@@ -313,27 +317,42 @@ public class VersioningPersistenceTest {
             Assert.assertEquals("latest version is not the expected version", 
version1,latest2);
 
             // check if listVersions with subject1 now gives exactly one 
version
-            List<Version> listr1 = 
connection.listVersions(subject,date1,date2).asList();
+            List<Version> listr1 = 
Iterations.asList(connection.listVersions(subject, date1, date2));
             Assert.assertEquals("there should be exactly one version", 1, 
listr1.size());
             Assert.assertEquals("contents of version differ", version1, 
listr1.get(0));
             Assert.assertEquals("version id is not 1", 1L, 
(long)listr1.get(0).getId());
 
 
-            List<Version> list2 = 
connection.listVersions(date2,date3).asList();
+            List<Version> list2 = 
Iterations.asList(connection.listVersions(date2, date3));
             Assert.assertEquals("there should be exactly one version from 
"+date2+" to "+date3,1,list2.size());
             Assert.assertEquals("contents of version differ", version2, 
list2.get(0));
             Assert.assertEquals("version id is not 2", 2L, 
(long)list2.get(0).getId());
 
-            List<Version> list3 = connection.listVersions(date3,new 
Date()).asList();
+            List<Version> list3 = 
Iterations.asList(connection.listVersions(date3, new Date()));
             Assert.assertEquals("there should be no version from "+date3+" to 
now",0,list3.size());
 
-            List<Version> list4 = 
connection.listVersions(date1,date3).asList();
+            List<Version> list4 = 
Iterations.asList(connection.listVersions(date1, date3));
             Assert.assertEquals("there should be exactly two versions from 
"+date1+" to "+date3,2,list4.size());
             Assert.assertEquals("contents of version1 differ", version1, 
list4.get(0));
             Assert.assertEquals("contents of version2 differ", version2, 
list4.get(1));
 
 
             connection.commit();
+
+            // test garbage collector (should not throw an error and should 
not remove any triples, since they are
+            // referenced by the versioning table)
+            // test database contents
+            PreparedStatement stmt = 
connection.getJDBCConnection().prepareStatement("SELECT * FROM triples WHERE 
deleted = true");
+            ResultSet dbResult1 = stmt.executeQuery();
+            Assert.assertTrue(dbResult1.next());
+
+            persistence.forceGarbageCollector();
+
+            // triple should not be garbage collected
+            ResultSet dbResult2 = stmt.executeQuery();
+            Assert.assertTrue(dbResult2.next());
+
+
         } finally {
             connection.close();
         }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4cad2d40/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0970fdf..3f3b938 100644
--- a/pom.xml
+++ b/pom.xml
@@ -329,7 +329,14 @@
                                                 <include name="*.tar.gz" />
                                             </fileset>
                                         </checksum>
-                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-src.zip"
 algorithm="SHA1" property="checksum" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-installer.zip"
 algorithm="SHA1" property="checksum.installer.zip" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-installer.tar.gz"
 algorithm="SHA1" property="checksum.installer.tgz" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-ldpath.zip"
 algorithm="SHA1" property="checksum.ldpath.zip" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-ldpath.tar.gz"
 algorithm="SHA1" property="checksum.ldpath.tgz" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-src.zip"
 algorithm="SHA1" property="checksum.src.zip" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-src.tar.gz"
 algorithm="SHA1" property="checksum.src.tgz" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-webapp.zip"
 algorithm="SHA1" property="checksum.webapp.zip" />
+                                        <checksum 
file="${basedir}/target/${project.version}/apache-marmotta-${project.version}-webapp.tar.gz"
 algorithm="SHA1" property="checksum.webapp.tgz" />
                                         <echo 
file="${basedir}/target/vote.txt">
 From: ${username}@apache.org
 To: [email protected]
@@ -339,11 +346,23 @@ A candidate for the Marmotta ${project.version} release 
is available at:
 
 https://dist.apache.org/repos/dist/dev/incubator/marmotta/${project.version}/
 
-The release candidate is a zip archive of the sources in:
+The release candidate is based on the sources tagged with ${project.version} 
in:
 
 https://git-wip-us.apache.org/repos/asf/incubator-marmotta.git
 
-The SHA1 checksum of the archive is ${checksum}.
+The release candidate consists of the following distribution archives:
+- apache-marmotta-${project.version}-installer.[zip|tar.gz]
+  SHA1 of ZIP: ${checksum.installer.zip}
+  SHA1 of TGZ: ${checksum.installer.tgz}
+- apache-marmotta-${project.version}-ldpath.[zip|tar.gz]
+  SHA1 of ZIP: ${checksum.ldpath.zip}
+  SHA1 of TGZ: ${checksum.ldpath.tgz}
+- apache-marmotta-${project.version}-src.[zip|tar.gz]
+  SHA1 of ZIP: ${checksum.src.zip}
+  SHA1 of TGZ: ${checksum.src.tgz}
+- apache-marmotta-${project.version}-webapp.[zip|tar.gz]
+  SHA1 of ZIP: ${checksum.webapp.zip}
+  SHA1 of TGZ: ${checksum.webapp.tgz}
 
 A staged Maven repository is available for review at:
 

Reply via email to