Improve JCR and Jackrabbit
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 9 Jan 2011 16:15:34 +0000 (16:15 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 9 Jan 2011 16:15:34 +0000 (16:15 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@3998 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

pom.xml
security/dep/pom.xml
server/dep/org.argeo.server.dep.jackrabbit.server/pom.xml
server/runtime/org.argeo.server.jackrabbit/pom.xml
server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/unit/AbstractJcrTestCase.java [deleted file]
server/runtime/org.argeo.server.jcr/build.properties
server/runtime/org.argeo.server.jcr/pom.xml
server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/unit/AbstractJcrTestCase.java [new file with mode: 0644]
server/runtime/org.argeo.server.jcr/src/test/java/org/argeo/jcr/MapperTest.java
server/runtime/org.argeo.server.jcr/src/test/java/org/argeo/server/jcr/JcrResourceAdapterTest.java

diff --git a/pom.xml b/pom.xml
index 8f6ae885ff735cffe82417f8e80f4150fa0bde86..de428292ffc11dd6e153a3383c4b45e114152d11 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -142,9 +142,10 @@ limitations under the License.
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>buildnumber-maven-plugin</artifactId>
+                               <version>1.0-beta-4</version>
                                <executions>
                                        <execution>
-                                               <phase>validate</phase>
+                                               <phase>generate-resources</phase>
                                                <goals>
                                                        <goal>create</goal>
                                                </goals>
@@ -153,7 +154,14 @@ limitations under the License.
                                <configuration>
                                        <doCheck>false</doCheck>
                                        <doUpdate>false</doUpdate>
-                                       <useLastCommittedRevision>true</useLastCommittedRevision>
+                                       <format>{0,date,yyyyMMdd_HHmmss}</format>
+                                       <items>
+                                               <item>timestamp</item>
+                                       </items>
+                                       <revisionOnScmFailure>git</revisionOnScmFailure>
+                                       <providerImplementations>
+                                               <git>svn</git>
+                                       </providerImplementations>
                                </configuration>
                        </plugin>
                        <plugin>
index dd5bbfee62f24c0ffcd6b63a270735c1f3d1a65e..fe6851e514d0c84556ad3813da07b5083c3ab0ef 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>org.argeo.commons</groupId>
                <version>0.2.2-SNAPSHOT</version>
-               <artifactId>server</artifactId>
+               <artifactId>security</artifactId>
                <relativePath>..</relativePath>
        </parent>
        <groupId>org.argeo.commons.security</groupId>
index 16b7df005681a802b4a3d041f85a362f27054fc2..11e658918d5638d1212bc573ebd21e78a61cc19b 100644 (file)
                        <groupId>edu.oswego.cs.concurrent</groupId>
                        <artifactId>com.springsource.edu.oswego.cs.dl.util.concurrent</artifactId>
                </dependency>
-               <dependency>
-                       <groupId>org.apache.derby</groupId>
-                       <artifactId>com.springsource.org.apache.derby</artifactId>
-               </dependency>
 
                <!-- For webdav -->
                <dependency>
index 79d9ee198d6bd95d072a08ed09838ff2ca4febcc..808bae686dfbddf2d1e80e3af4b337f21486d71e 100644 (file)
@@ -57,7 +57,7 @@
                        <version>0.2.2-SNAPSHOT</version>
                </dependency>
 
-               <!-- Jack Rabbit -->
+               <!-- Jackrabbit -->
                <dependency>
                        <groupId>org.argeo.commons.server</groupId>
                        <artifactId>org.argeo.server.dep.jackrabbit.server</artifactId>
                        <artifactId>com.springsource.org.apache.commons.fileupload</artifactId>
                </dependency>
 
-               <dependency>
-                       <groupId>org.junit</groupId>
-                       <artifactId>com.springsource.junit</artifactId>
-                       <optional>true</optional>
-               </dependency>
-
                <!-- TEST -->
                <dependency>
                        <groupId>org.argeo.commons.basic</groupId>
diff --git a/server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/unit/AbstractJcrTestCase.java b/server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/server/jackrabbit/unit/AbstractJcrTestCase.java
deleted file mode 100644 (file)
index db62036..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
- *
- * Licensed 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.argeo.server.jackrabbit.unit;
-
-import java.io.File;
-
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.TransientRepository;
-import org.argeo.ArgeoException;
-
-public abstract class AbstractJcrTestCase extends TestCase {
-       private final static Log log = LogFactory.getLog(AbstractJcrTestCase.class);
-
-       private TransientRepository repository;
-       private Session session = null;
-
-       protected abstract File getRepositoryFile() throws Exception;
-
-       @Override
-       protected void setUp() throws Exception {
-               File homeDir = new File(System.getProperty("java.io.tmpdir"),
-                               AbstractJcrTestCase.class.getSimpleName() + "-"
-                                               + System.getProperty("user.name"));
-               FileUtils.deleteDirectory(homeDir);
-               repository = new TransientRepository(getRepositoryFile(), homeDir);
-       }
-
-       @Override
-       protected void tearDown() throws Exception {
-               if (session != null) {
-                       session.logout();
-                       if (log.isDebugEnabled())
-                               log.debug("Logout session");
-               }
-       }
-
-       protected Session session() {
-               if (session == null) {
-                       try {
-                               if (log.isDebugEnabled())
-                                       log.debug("Login session");
-                               session = getRepository().login(
-                                               new SimpleCredentials("demo", "demo".toCharArray()));
-                       } catch (Exception e) {
-                               throw new ArgeoException("Cannot login to repository", e);
-                       }
-               }
-               return session;
-       }
-
-       protected Repository getRepository() {
-               return repository;
-       }
-}
index d657ce9d2fa8cb5eeadc20c12d4addb17794be8e..2f77ca90060eea0e4d5c75883d754f9ac1190721 100644 (file)
@@ -16,4 +16,5 @@ additional.bundles = org.argeo.server.jackrabbit,\
                      com.springsource.org.apache.xml.serializer,\
                      com.springsource.org.apache.commons.dbcp,\
                      com.springsource.org.apache.commons.pool,\
+                     org.argeo.dep.osgi.jackrabbit
 
index c9bd5d402b4a313f6a0b42fb0c1146176057e22e..823b050f205e125d7f86115d88e71e75668f4498 100644 (file)
                        <version>0.2.2-SNAPSHOT</version>
                        <scope>test</scope>
                </dependency>
+               <dependency>
+                       <groupId>org.apache.derby</groupId>
+                       <artifactId>com.springsource.org.apache.derby</artifactId>
+               </dependency>
                <dependency>
                        <groupId>org.argeo.commons.basic</groupId>
                        <artifactId>org.argeo.support.junit</artifactId>
diff --git a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/unit/AbstractJcrTestCase.java b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/unit/AbstractJcrTestCase.java
new file mode 100644 (file)
index 0000000..e143360
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
+ *
+ * Licensed 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.argeo.jcr.unit;
+
+import java.io.File;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.ArgeoException;
+
+public abstract class AbstractJcrTestCase extends TestCase {
+       private final static Log log = LogFactory.getLog(AbstractJcrTestCase.class);
+
+       private Repository repository;
+       private Session session = null;
+
+       protected abstract File getRepositoryFile() throws Exception;
+
+       protected abstract Repository createRepository() throws Exception;
+
+       @Override
+       protected void setUp() throws Exception {
+               File homeDir = getHomeDir();
+               FileUtils.deleteDirectory(homeDir);
+               repository = createRepository();
+       }
+
+       protected File getHomeDir() {
+               File homeDir = new File(System.getProperty("java.io.tmpdir"),
+                               AbstractJcrTestCase.class.getSimpleName() + "-"
+                                               + System.getProperty("user.name"));
+               return homeDir;
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               if (session != null) {
+                       session.logout();
+                       if (log.isDebugEnabled())
+                               log.debug("Logout session");
+               }
+       }
+
+       protected Session session() {
+               if (session == null) {
+                       try {
+                               if (log.isDebugEnabled())
+                                       log.debug("Login session");
+                               session = getRepository().login(
+                                               new SimpleCredentials("demo", "demo".toCharArray()));
+                       } catch (Exception e) {
+                               throw new ArgeoException("Cannot login to repository", e);
+                       }
+               }
+               return session;
+       }
+
+       protected Repository getRepository() {
+               return repository;
+       }
+}
index 87be7e2f26b6d0e08c3be11efd4ff89de1ec60e4..121d722986c712ebf4071b682d7432ed7a1b5a83 100644 (file)
@@ -19,8 +19,10 @@ package org.argeo.jcr;
 import java.io.File;
 
 import javax.jcr.Node;
+import javax.jcr.Repository;
 
-import org.argeo.server.jackrabbit.unit.AbstractJcrTestCase;
+import org.apache.jackrabbit.core.TransientRepository;
+import org.argeo.jcr.unit.AbstractJcrTestCase;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 
@@ -53,4 +55,10 @@ public class MapperTest extends AbstractJcrTestCase {
                return res.getFile();
        }
 
+       protected Repository createRepository() throws Exception{
+               Repository repository = new TransientRepository(getRepositoryFile(), getHomeDir());
+               return repository;
+       }
+
+       
 }
index 525208c4391edaa477c2ce04418b506e7ab7c202..51e3af2d815b5dcbbeca09cc5e197eb3448da267 100644 (file)
@@ -22,11 +22,14 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.List;
 
+import javax.jcr.Repository;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.core.TransientRepository;
 import org.argeo.jcr.JcrResourceAdapter;
-import org.argeo.server.jackrabbit.unit.AbstractJcrTestCase;
+import org.argeo.jcr.unit.AbstractJcrTestCase;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 
@@ -107,4 +110,10 @@ public class JcrResourceAdapterTest extends AbstractJcrTestCase {
                return res.getFile();
        }
 
+       protected Repository createRepository() throws Exception {
+               Repository repository = new TransientRepository(getRepositoryFile(),
+                               getHomeDir());
+               return repository;
+       }
+
 }