[MRM-1327] implement alternative or improve repository metadata storage: jcr is now default storage mode.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1179142 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-10-05 10:23:09 +00:00
parent 8892375451
commit f260414f76
21 changed files with 441 additions and 55 deletions

View File

@ -196,10 +196,22 @@
<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>
@ -209,6 +221,7 @@
<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>

View File

@ -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>

View File

@ -56,4 +56,12 @@
</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>

View File

@ -104,10 +104,22 @@
<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>
@ -151,6 +163,7 @@
<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>

View File

@ -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>

View File

@ -58,5 +58,13 @@
</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>

View File

@ -226,10 +226,22 @@
<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>

View File

@ -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>

View File

@ -62,4 +62,13 @@
<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>

View File

@ -459,9 +459,20 @@
</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>
@ -554,6 +565,7 @@
<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>
@ -904,9 +916,20 @@
<!-- 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>
<profile>

View File

@ -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>

View File

@ -35,4 +35,12 @@
<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>

View 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( );
}
}

View 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()

View File

@ -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( );
}
}

View 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>

View 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>

View 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>

View File

@ -40,4 +40,10 @@
<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>

View File

@ -43,12 +43,24 @@
<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>

View 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>