]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1327] implement alternative or improve repository metadata storage: jcr is now...
authorOlivier Lamy <olamy@apache.org>
Wed, 5 Oct 2011 10:23:09 +0000 (10:23 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 5 Oct 2011 10:23:09 +0000 (10:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1179142 13f79535-47bb-0310-9956-ffa450edef68

21 files changed:
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/repository.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/repository.xml [new file with mode: 0644]
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repository.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/appserver-base/conf/repository.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/ShutdowJackrabbitServlet.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-DependencyTreeTest.xml
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-artifacts-download.xml
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml
archiva-modules/archiva-web/archiva-webapp/src/test/webapp/WEB-INF/feedServletTest-web.xml
archiva-modules/plugins/stage-repository-merge/pom.xml

index 2c114c1963f4ad7fe25c2e56327c4ea856d78c2a..a48d3fe6729ba38bf07996b653762b055e07c4dc 100644 (file)
 
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>metadata-store-file</artifactId>
+      <artifactId>metadata-store-jcr</artifactId>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
   </dependencies>
 
   <build>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <systemPropertyVariables>
+            <basedir>${basedir}</basedir>
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <plexus.home>${project.build.directory}/appserver-base</plexus.home>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/repository.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/repository.xml
new file mode 100644 (file)
index 0000000..625570e
--- /dev/null
@@ -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.
+  -->
+
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN"
+    "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
+
+<Repository>
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+  <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    <param name="path" value="${rep.home}/repository"/>
+</FileSystem>  -->
+  <Security appName="Jackrabbit">
+    <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security"/>
+    <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
+    <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
+  </Security>
+  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+  <Workspace name="${wsp.name}">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${wsp.home}"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+      <param name="path" value="${wsp.home}/index"/>
+    </SearchIndex>
+  </Workspace>
+  <Versioning rootPath="${rep.home}/version">
+    <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.mem.InMemPersistenceManager"/>
+    <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+           <param name="path" value="${rep.home}/version"/>
+       </FileSystem>
+   <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>-->
+  </Versioning>
+</Repository>
index 6eebfe03f26cc107ce008cb5912ab863b503d260..a7401b0460f5f494c6a1b761771ce1c88ff18a2a 100644 (file)
     </property>
   </bean>
 
+  <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
+    <constructor-arg ref="config"/>
+  </bean>
+  <bean id="config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/src/test/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
+
 </beans>
\ No newline at end of file
index 400bfdee493c53460e5ec0c1b1d26573c882ba3d..2ef9af76484bc32ff7ceb1ac27c482f2f2858845 100644 (file)
 
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>metadata-store-file</artifactId>
+      <artifactId>metadata-store-jcr</artifactId>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
     <dependency>
       <groupId>org.codehaus.redback</groupId>
       <artifactId>redback-rbac-cached</artifactId>
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <plexus.home>${project.build.directory}/appserver-base</plexus.home>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
+            <basedir>${basedir}</basedir>
           </systemPropertyVariables>
         </configuration>
       </plugin>
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/repository.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/repository.xml
new file mode 100644 (file)
index 0000000..0be86eb
--- /dev/null
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN"
+    "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
+
+<Repository>
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+  <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    <param name="path" value="${rep.home}/repository"/>
+</FileSystem>  -->
+  <Security appName="Jackrabbit">
+    <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security"/>
+    <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
+    <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
+  </Security>
+  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+  <Workspace name="${wsp.name}">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${wsp.home}"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+      <param name="path" value="${wsp.home}/index"/>
+    </SearchIndex>
+  </Workspace>
+  <Versioning rootPath="${rep.home}/version">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${rep.home}/version"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+  </Versioning>
+</Repository>
index 57165c11be7ba14ca74cc47500292f70614a09a7..7bb21cd65bc2566392808fe2805c3094ec93074e 100644 (file)
     </property>
   </bean>
 
+  <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
+    <constructor-arg ref="config"/>
+  </bean>
+  <bean id="config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/src/test/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
+
 
 </beans>
\ No newline at end of file
index 9bb9fcba5c85e712c5a7b9254a3a25c1a043d988..90f06a75bab29826c722673b6b421efbdd9b4297 100644 (file)
 
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>metadata-store-file</artifactId>
+      <artifactId>metadata-store-jcr</artifactId>
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-repository-admin-default</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repository.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repository.xml
new file mode 100644 (file)
index 0000000..0be86eb
--- /dev/null
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN"
+    "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
+
+<Repository>
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+  <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    <param name="path" value="${rep.home}/repository"/>
+</FileSystem>  -->
+  <Security appName="Jackrabbit">
+    <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security"/>
+    <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
+    <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
+  </Security>
+  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+  <Workspace name="${wsp.name}">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${wsp.home}"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+      <param name="path" value="${wsp.home}/index"/>
+    </SearchIndex>
+  </Workspace>
+  <Versioning rootPath="${rep.home}/version">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${rep.home}/version"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+  </Versioning>
+</Repository>
index fe0be3d31489e503f47757dabffe8d62b938fda6..c96d355c2bfce11f2173977baacc2feb8532e612 100644 (file)
     <property name="executor" ref="taskExecutor#repository-scanning"/>
     <property name="queue" ref="taskQueue#repository-scanning"/>
   </bean>
+
+  <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
+    <constructor-arg ref="config"/>
+  </bean>
+  <bean id="config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/src/test/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
+
 </beans>
\ No newline at end of file
index 1ff34b4f655ae44e481288831269f6630b9e7ddd..bb1650e85360cb1e7383f40c206c1fc6817b1bc0 100644 (file)
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>metadata-store-file</artifactId>
+      <artifactId>metadata-store-jcr</artifactId>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
     <dependency>
       <groupId>org.apache.velocity</groupId>
       <artifactId>velocity-tools</artifactId>
             <archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl>
             <rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
             <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
+            <basedir>${basedir}</basedir>
           </systemPropertyVariables>
         </configuration>
       </plugin>
         <!-- TODO: Bug in the Tomcat plugin - it doesn't seem to respect runtime dependencies, so we redeclare it as compile -->
         <dependency>
           <groupId>org.apache.archiva</groupId>
-          <artifactId>metadata-store-file</artifactId>
+          <artifactId>metadata-store-jcr</artifactId>
+          <scope>compile</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.jackrabbit</groupId>
+          <artifactId>jackrabbit-core</artifactId>
           <scope>compile</scope>
+          <exclusions>
+            <exclusion>
+              <groupId>commons-logging</groupId>
+              <artifactId>commons-logging</artifactId>
+            </exclusion>
+          </exclusions>
         </dependency>
       </dependencies>
     </profile>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/appserver-base/conf/repository.xml b/archiva-modules/archiva-web/archiva-webapp/src/appserver-base/conf/repository.xml
new file mode 100644 (file)
index 0000000..0be86eb
--- /dev/null
@@ -0,0 +1,49 @@
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN"
+    "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
+
+<Repository>
+  <FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem"/>
+  <!--<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    <param name="path" value="${rep.home}/repository"/>
+</FileSystem>  -->
+  <Security appName="Jackrabbit">
+    <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security"/>
+    <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"/>
+    <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule"/>
+  </Security>
+  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+  <Workspace name="${wsp.name}">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${wsp.home}"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+      <param name="path" value="${wsp.home}/index"/>
+    </SearchIndex>
+  </Workspace>
+  <Versioning rootPath="${rep.home}/version">
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+      <param name="path" value="${rep.home}/version"/>
+    </FileSystem>
+    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
+  </Versioning>
+</Repository>
index acce3d04eeed87c7a0d99f656ec68dfe08211f7c..034abf343d6f00c4b0aadcd1c78616bb07d8157c 100755 (executable)
 
   <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
 
+  <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true">
+    <constructor-arg ref="jcr-config"/>
+  </bean>
+  <bean id="jcr-config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${appserver.base}/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
+
 </beans>
\ No newline at end of file
index ce330cb266244f9533dc88caeb58347cb399168a..136be1905160095875fdab6de3c5c6a1c89f9b5a 100644 (file)
@@ -33,10 +33,11 @@ import org.apache.archiva.metadata.model.License;
 import org.apache.archiva.metadata.model.Organization;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.model.Scm;
-import org.apache.archiva.webtest.memory.TestMetadataResolver;
 import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
 import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent;
 import org.apache.archiva.security.UserRepositoriesStub;
+import org.apache.archiva.webtest.memory.TestMetadataResolver;
+import org.apache.jackrabbit.api.JackrabbitRepository;
 import org.apache.struts2.StrutsSpringTestCase;
 
 import java.util.HashMap;
@@ -99,7 +100,7 @@ public abstract class AbstractActionTestCase
     protected static final String TEST_GENERIC_METADATA_PROPERTY_VALUE = "5 stars";
 
     @Override
-    protected String[] getContextLocations()
+    protected String[] getContextLocations( )
     {
         return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
     }
@@ -117,34 +118,34 @@ public abstract class AbstractActionTestCase
 
     protected void assertDefaultModel( ProjectVersionMetadata model, String groupId, String artifactId, String version )
     {
-        assertEquals( version, model.getVersion() );
-        assertEquals( TEST_URL, model.getUrl() );
-        assertEquals( TEST_NAME, model.getName() );
-        assertEquals( TEST_DESCRIPTION, model.getDescription() );
-        assertEquals( TEST_ORGANIZATION_NAME, model.getOrganization().getName() );
-        assertEquals( TEST_ORGANIZATION_URL, model.getOrganization().getUrl() );
-        assertEquals( 2, model.getLicenses().size() );
-        License l = model.getLicenses().get( 0 );
-        assertEquals( TEST_LICENSE_NAME, l.getName() );
-        assertEquals( TEST_LICENSE_URL, l.getUrl() );
-        l = model.getLicenses().get( 1 );
-        assertEquals( TEST_LICENSE_NAME_2, l.getName() );
-        assertEquals( TEST_LICENSE_URL_2, l.getUrl() );
-        assertEquals( TEST_ISSUE_SYSTEM, model.getIssueManagement().getSystem() );
-        assertEquals( TEST_ISSUE_URL, model.getIssueManagement().getUrl() );
-        assertEquals( TEST_CI_SYSTEM, model.getCiManagement().getSystem() );
-        assertEquals( TEST_CI_URL, model.getCiManagement().getUrl() );
-        assertEquals( TEST_SCM_CONNECTION, model.getScm().getConnection() );
-        assertEquals( TEST_SCM_DEV_CONNECTION, model.getScm().getDeveloperConnection() );
-        assertEquals( TEST_SCM_URL, model.getScm().getUrl() );
+        assertEquals( version, model.getVersion( ) );
+        assertEquals( TEST_URL, model.getUrl( ) );
+        assertEquals( TEST_NAME, model.getName( ) );
+        assertEquals( TEST_DESCRIPTION, model.getDescription( ) );
+        assertEquals( TEST_ORGANIZATION_NAME, model.getOrganization( ).getName( ) );
+        assertEquals( TEST_ORGANIZATION_URL, model.getOrganization( ).getUrl( ) );
+        assertEquals( 2, model.getLicenses( ).size( ) );
+        License l = model.getLicenses( ).get( 0 );
+        assertEquals( TEST_LICENSE_NAME, l.getName( ) );
+        assertEquals( TEST_LICENSE_URL, l.getUrl( ) );
+        l = model.getLicenses( ).get( 1 );
+        assertEquals( TEST_LICENSE_NAME_2, l.getName( ) );
+        assertEquals( TEST_LICENSE_URL_2, l.getUrl( ) );
+        assertEquals( TEST_ISSUE_SYSTEM, model.getIssueManagement( ).getSystem( ) );
+        assertEquals( TEST_ISSUE_URL, model.getIssueManagement( ).getUrl( ) );
+        assertEquals( TEST_CI_SYSTEM, model.getCiManagement( ).getSystem( ) );
+        assertEquals( TEST_CI_URL, model.getCiManagement( ).getUrl( ) );
+        assertEquals( TEST_SCM_CONNECTION, model.getScm( ).getConnection( ) );
+        assertEquals( TEST_SCM_DEV_CONNECTION, model.getScm( ).getDeveloperConnection( ) );
+        assertEquals( TEST_SCM_URL, model.getScm( ).getUrl( ) );
 
         MavenProjectFacet mavenFacet = (MavenProjectFacet) model.getFacet( MavenProjectFacet.FACET_ID );
-        assertEquals( groupId, mavenFacet.getGroupId() );
-        assertEquals( artifactId, mavenFacet.getArtifactId() );
-        assertEquals( TEST_PACKAGING, mavenFacet.getPackaging() );
-        assertEquals( TEST_PARENT_GROUP_ID, mavenFacet.getParent().getGroupId() );
-        assertEquals( TEST_PARENT_ARTIFACT_ID, mavenFacet.getParent().getArtifactId() );
-        assertEquals( TEST_PARENT_VERSION, mavenFacet.getParent().getVersion() );
+        assertEquals( groupId, mavenFacet.getGroupId( ) );
+        assertEquals( artifactId, mavenFacet.getArtifactId( ) );
+        assertEquals( TEST_PACKAGING, mavenFacet.getPackaging( ) );
+        assertEquals( TEST_PARENT_GROUP_ID, mavenFacet.getParent( ).getGroupId( ) );
+        assertEquals( TEST_PARENT_ARTIFACT_ID, mavenFacet.getParent( ).getArtifactId( ) );
+        assertEquals( TEST_PARENT_VERSION, mavenFacet.getParent( ).getVersion( ) );
     }
 
     protected ProjectVersionMetadata createProjectModel( String version )
@@ -154,50 +155,50 @@ public abstract class AbstractActionTestCase
 
     protected ProjectVersionMetadata createProjectModel( String groupId, String artifactId, String version )
     {
-        ProjectVersionMetadata model = new ProjectVersionMetadata();
+        ProjectVersionMetadata model = new ProjectVersionMetadata( );
         model.setId( version );
         model.setUrl( TEST_URL );
         model.setName( TEST_NAME );
         model.setDescription( TEST_DESCRIPTION );
-        CiManagement ci = new CiManagement();
+        CiManagement ci = new CiManagement( );
         ci.setSystem( TEST_CI_SYSTEM );
         ci.setUrl( TEST_CI_URL );
         model.setCiManagement( ci );
-        IssueManagement issue = new IssueManagement();
+        IssueManagement issue = new IssueManagement( );
         issue.setSystem( TEST_ISSUE_SYSTEM );
         issue.setUrl( TEST_ISSUE_URL );
         model.setIssueManagement( issue );
-        Organization organization = new Organization();
+        Organization organization = new Organization( );
         organization.setName( TEST_ORGANIZATION_NAME );
         organization.setUrl( TEST_ORGANIZATION_URL );
         model.setOrganization( organization );
-        License l = new License();
+        License l = new License( );
         l.setName( TEST_LICENSE_NAME );
         l.setUrl( TEST_LICENSE_URL );
         model.addLicense( l );
-        l = new License();
+        l = new License( );
         l.setName( TEST_LICENSE_NAME_2 );
         l.setUrl( TEST_LICENSE_URL_2 );
         model.addLicense( l );
-        Scm scm = new Scm();
+        Scm scm = new Scm( );
         scm.setConnection( TEST_SCM_CONNECTION );
         scm.setDeveloperConnection( TEST_SCM_DEV_CONNECTION );
         scm.setUrl( TEST_SCM_URL );
         model.setScm( scm );
 
-        MavenProjectFacet mavenProjectFacet = new MavenProjectFacet();
+        MavenProjectFacet mavenProjectFacet = new MavenProjectFacet( );
         mavenProjectFacet.setGroupId( groupId );
         mavenProjectFacet.setArtifactId( artifactId );
         mavenProjectFacet.setPackaging( TEST_PACKAGING );
-        MavenProjectParent parent = new MavenProjectParent();
+        MavenProjectParent parent = new MavenProjectParent( );
         parent.setGroupId( TEST_PARENT_GROUP_ID );
         parent.setArtifactId( TEST_PARENT_ARTIFACT_ID );
         parent.setVersion( TEST_PARENT_VERSION );
         mavenProjectFacet.setParent( parent );
         model.addFacet( mavenProjectFacet );
 
-        GenericMetadataFacet genericMetadataFacet = new GenericMetadataFacet();
-        Map<String, String> props = new HashMap<String, String>();
+        GenericMetadataFacet genericMetadataFacet = new GenericMetadataFacet( );
+        Map<String, String> props = new HashMap<String, String>( );
         props.put( TEST_GENERIC_METADATA_PROPERTY_NAME, TEST_GENERIC_METADATA_PROPERTY_VALUE );
         genericMetadataFacet.setAdditionalProperties( props );
         model.addFacet( genericMetadataFacet );
@@ -206,18 +207,26 @@ public abstract class AbstractActionTestCase
     }
 
     @Override
-    protected void setUp()
+    protected void setUp( )
         throws Exception
     {
-        super.setUp();
+        super.setUp( );
 
-        ConfigurationManager configurationManager = new ConfigurationManager();
-        configurationManager.addContainerProvider( new XWorkConfigurationProvider() );
-        Configuration config = configurationManager.getConfiguration();
-        Container container = config.getContainer();
+        ConfigurationManager configurationManager = new ConfigurationManager( );
+        configurationManager.addContainerProvider( new XWorkConfigurationProvider( ) );
+        Configuration config = configurationManager.getConfiguration( );
+        Container container = config.getContainer( );
+
+        ValueStack stack = container.getInstance( ValueStackFactory.class ).createValueStack( );
+        stack.getContext( ).put( ActionContext.CONTAINER, container );
+        ActionContext.setContext( new ActionContext( stack.getContext( ) ) );
+    }
 
-        ValueStack stack = container.getInstance( ValueStackFactory.class ).createValueStack();
-        stack.getContext().put( ActionContext.CONTAINER, container );
-        ActionContext.setContext( new ActionContext( stack.getContext() ) );
+    @Override
+    protected void tearDown( )
+        throws Exception
+    {
+        super.tearDown( );
+        applicationContext.getBean( JackrabbitRepository.class ).shutdown( );
     }
 }
index d44687168bf8223b18ebe4cbab7091a9989dc75e..d4058f8f4aaa422da3d657f4f26aff7859f62b05 100644 (file)
@@ -28,6 +28,8 @@ import com.meterware.servletunit.ServletUnitClient;
 import junit.framework.TestCase;
 import org.apache.commons.codec.Encoder;
 import org.apache.commons.codec.binary.Base64;
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.util.RepositoryLock;
 
 
 import java.io.File;
@@ -67,9 +69,11 @@ public class RssFeedServletTest
     public void testRetrieveServlet()
         throws Exception
     {
+
         RssFeedServlet servlet = (RssFeedServlet) client.newInvocation(
             "http://localhost/feeds/test-repo" ).getServlet();
         assertNotNull( servlet );
+        //client.newInvocation( "http://localhost/shutdown/foo" );
     }
 
     public void testRequestNewArtifactsInRepo()
@@ -90,6 +94,8 @@ public class RssFeedServletTest
         assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
         assertNotNull( "Should have recieved a response", response );
         assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
+
+        //client.newInvocation( "http://localhost/shutdown/foo" );
     }
 
     public void testRequestNewVersionsOfArtifact()
@@ -110,6 +116,7 @@ public class RssFeedServletTest
         assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
         assertNotNull( "Should have recieved a response", response );
         assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
+        //client.newInvocation( "http://localhost/shutdown/foo" );
     }
 
     public void XXX_testInvalidRequest()
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/ShutdowJackrabbitServlet.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/ShutdowJackrabbitServlet.java
new file mode 100644 (file)
index 0000000..1e1051d
--- /dev/null
@@ -0,0 +1,46 @@
+package org.apache.archiva.web.rss;
+/*
+ * 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.
+ */
+
+import org.apache.jackrabbit.api.JackrabbitRepository;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author Olivier Lamy
+ */
+public class ShutdowJackrabbitServlet
+    extends HttpServlet
+{
+    @Override
+    protected void doGet( HttpServletRequest req, HttpServletResponse resp )
+        throws ServletException, IOException
+    {
+        WebApplicationContext applicationContext =
+            WebApplicationContextUtils.getWebApplicationContext( getServletContext( ) );
+        applicationContext.getBean( JackrabbitRepository.class ).shutdown( );
+    }
+}
+
index 9144b0745b98d8a2146061624ccdd063b048bcc5..73bd682be641375cf868c6a44f8771f73a74a793 100644 (file)
@@ -34,4 +34,9 @@
 
   <bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.TestConfiguration" />
   <alias name="archivaConfiguration#test" alias="archivaConfiguration#default" />
+
+  <bean id="jcr-config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/appserver-base/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
 </beans>
index 2f4c5d5cc27efe5cc61aa15fcd071b67bb45fe1b..fab8a29304ada5ec4349d60418b1e89a15acf428 100644 (file)
@@ -51,5 +51,9 @@
     </property>
   </bean>
 
+  <bean id="jcr-config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/appserver-base/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
 
 </beans>
index 7860e21a103cc84a2527b2fbe1cb6fd6afd56d1a..8a628b1b65f62879a463ab36f800bad5537505aa 100644 (file)
@@ -43,4 +43,9 @@
 
   <alias name="securitySystem#test" alias="securitySystem"/>
 
+  <bean id="jcr-config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/appserver-base/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
+
 </beans>
\ No newline at end of file
index fe6cbae7632ca02988a5c618ebbaebea53303864..f4de2d66f0bfc6a32cfa99a206b37d48b6f8d866 100644 (file)
 
   <bean name="metadataResolver#test" class="org.apache.archiva.webtest.memory.TestMetadataResolver"/>
   <alias name="metadataResolver#test" alias="metadataResolver#default"/>
+
+  <bean id="jcr-config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
+    <constructor-arg value="${basedir}/appserver-base/conf/repository.xml"/>
+    <constructor-arg value="${appserver.base}/jcr"/>
+  </bean>
+
 </beans>
index 8b8b624a9633c90d78154336f5d635fa3cc36c46..97c83eeccc5e003fb1adc29ec18d79ba58c11939 100644 (file)
     <url-pattern>/feeds/*</url-pattern>
   </servlet-mapping>
 
+  <servlet>
+    <servlet-name>ShutdownServlet</servlet-name>
+    <servlet-class>org.apache.archiva.web.rss.ShutdowJackrabbitServlet</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>ShutdownServlet</servlet-name>
+    <url-pattern>/shutdown/*</url-pattern>
+  </servlet-mapping>
+
+
+
 
   <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>
-      classpath*:/spring-context-rss-servlet.xml
       classpath*:/META-INF/spring-context.xml
+      classpath*:/spring-context-rss-servlet.xml
     </param-value>
   </context-param>
 
index 7fe0863556982d68ef82758a8441892341af764c..f374ca23542458158a3cade01564700b6259eb93 100644 (file)
@@ -54,7 +54,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>metadata-store-file</artifactId>
+      <artifactId>metadata-store-jcr</artifactId>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>