You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2004/10/19 10:59:53 UTC

svn commit: rev 55056 - in incubator/jackrabbit/trunk: applications/test src/conf src/java/org/apache/jackrabbit/core src/test/org/apache/jackrabbit/test

Author: stefan
Date: Tue Oct 19 01:59:51 2004
New Revision: 55056

Added:
   incubator/jackrabbit/trunk/applications/test/repository.xml   (contents, props changed)
Removed:
   incubator/jackrabbit/trunk/applications/test/config.xml
   incubator/jackrabbit/trunk/src/conf/config.xml
Modified:
   incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
   incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JackrabbitRepositoryStub.java
Log:
fixing junit tests (were broken because of changed config layout)

Added: incubator/jackrabbit/trunk/applications/test/repository.xml
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/applications/test/repository.xml	Tue Oct 19 01:59:51 2004
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- <!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "file://config.dtd"> -->
+<Repository>
+    <!--
+        virtual file system where the repository stores global state
+        (e.g. registered namespaces, custom node types, etc.)
+    -->
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    	<param name="path" value="${rep.home}/repository"/>
+    </FileSystem>
+    <!--
+        location of workspaces root directory and name of default workspace
+    -->
+    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
+    <!--
+        workspace configuration template:
+        used to create the initial workspace if there's no workspace yet
+    -->
+    <Workspace name="${wsp.name}">
+        <!--
+            virtual file system of the workspace:
+            class: FQN of class implementing FileSystem interface
+        -->
+        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${wsp.home}"/>
+        </FileSystem>
+        <!--
+            persistence of the workspace:
+            class: FQN of class implementing PersistenceManager interface
+        -->
+        <PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager">
+            <!-- <param name="someParam" value="someValue"/> -->
+        </PersistenceManager>
+        <SearchIndex path="/index"/>
+    </Workspace>
+</Repository>
\ No newline at end of file

Modified: incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties
==============================================================================
--- incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties	(original)
+++ incubator/jackrabbit/trunk/applications/test/repositoryStubImpl.properties	Tue Oct 19 01:59:51 2004
@@ -26,5 +26,6 @@
 javax.jcr.tck.AddNodeTest.testName.nodename1=myname
 
 # repository name
-org.apache.jackrabbit.repository.name=localfs
+org.apache.jackrabbit.repository.config=applications/test/repository.xml
+org.apache.jackrabbit.repository.name=repo
 org.apache.jackrabbit.repository.home=applications/test

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	Tue Oct 19 01:59:51 2004
@@ -1202,7 +1202,11 @@
             // Path.getAncestor requires relative degree, i.e. we need
             // to convert absolute to relative ancestor degree
             Path path = getPrimaryPath();
-            Path ancestorPath = path.getAncestor(path.getAncestorCount() - degree);
+            int relDegree = path.getAncestorCount() - degree;
+            if (relDegree < 0) {
+                throw new ItemNotFoundException();
+            }
+            Path ancestorPath = path.getAncestor(relDegree);
             return itemMgr.getItem(ancestorPath);
         } catch (PathNotFoundException pnfe) {
             throw new ItemNotFoundException();

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JackrabbitRepositoryStub.java
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JackrabbitRepositoryStub.java	(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/JackrabbitRepositoryStub.java	Tue Oct 19 01:59:51 2004
@@ -73,13 +73,14 @@
                 String repName = environment.getProperty(PROP_REPOSITORY_NAME, "repo");
                 String repConfig = environment.getProperty(PROP_REPOSITORY_CONFIG);
                 String repHome = environment.getProperty(PROP_REPOSITORY_HOME);
-/*
+
                 RepositoryConfig repConf = RepositoryConfig.create(repConfig, repHome);
                 repository = RepositoryImpl.create(repConf);
-*/
+/*
                 InitialContext ctx = new InitialContext();
-                RegistryHelper.registerRepository(ctx, "repo", repConfig, repHome, true);
-                repository = (Repository) ctx.lookup("repo");
+                RegistryHelper.registerRepository(ctx, repName, repConfig, repHome, true);
+                repository = (Repository) ctx.lookup(repName);
+*/
 /*
                 Runtime.getRuntime().addShutdownHook(new Thread() {
                     public void run() {
@@ -87,9 +88,7 @@
                     }
                 });
 */
-            } catch (NamingException e) {
-                throw new RepositoryStubException(e.toString());
-            } catch (RepositoryException e) {
+            } catch (Exception e) {
                 throw new RepositoryStubException(e.toString());
             }
         }