Просмотр исходного кода

[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
tags/archiva-1.4-M1
Olivier Lamy 12 лет назад
Родитель
Сommit
f260414f76
21 измененных файлов: 441 добавлений и 55 удалений
  1. 14
    1
      archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
  2. 51
    0
      archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/repository.xml
  3. 8
    0
      archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml
  4. 14
    1
      archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
  5. 49
    0
      archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/repository.xml
  6. 8
    0
      archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml
  7. 13
    1
      archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
  8. 49
    0
      archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repository.xml
  9. 9
    0
      archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
  10. 25
    2
      archiva-modules/archiva-web/archiva-webapp/pom.xml
  11. 49
    0
      archiva-modules/archiva-web/archiva-webapp/src/appserver-base/conf/repository.xml
  12. 8
    0
      archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml
  13. 57
    48
      archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java
  14. 7
    0
      archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
  15. 46
    0
      archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/ShutdowJackrabbitServlet.java
  16. 5
    0
      archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-DependencyTreeTest.xml
  17. 4
    0
      archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-artifacts-download.xml
  18. 5
    0
      archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml
  19. 6
    0
      archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml
  20. 13
    1
      archiva-modules/archiva-web/archiva-webapp/src/test/webapp/WEB-INF/feedServletTest-web.xml
  21. 1
    1
      archiva-modules/plugins/stage-repository-merge/pom.xml

+ 14
- 1
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml Просмотреть файл

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

+ 51
- 0
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/repository.xml Просмотреть файл

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

+ 8
- 0
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml Просмотреть файл

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

+ 14
- 1
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml Просмотреть файл

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

+ 49
- 0
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/repository.xml Просмотреть файл

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

+ 8
- 0
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/spring-context.xml Просмотреть файл

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

+ 13
- 1
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml Просмотреть файл

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

+ 49
- 0
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repository.xml Просмотреть файл

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

+ 9
- 0
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml Просмотреть файл

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

+ 25
- 2
archiva-modules/archiva-web/archiva-webapp/pom.xml Просмотреть файл

@@ -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,8 +916,19 @@
<!-- 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>

+ 49
- 0
archiva-modules/archiva-web/archiva-webapp/src/appserver-base/conf/repository.xml Просмотреть файл

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

+ 8
- 0
archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml Просмотреть файл

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

+ 57
- 48
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java Просмотреть файл

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

+ 7
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java Просмотреть файл

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

+ 46
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/ShutdowJackrabbitServlet.java Просмотреть файл

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


+ 5
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-DependencyTreeTest.xml Просмотреть файл

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

+ 4
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-artifacts-download.xml Просмотреть файл

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

+ 5
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml Просмотреть файл

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

+ 6
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml Просмотреть файл

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

+ 13
- 1
archiva-modules/archiva-web/archiva-webapp/src/test/webapp/WEB-INF/feedServletTest-web.xml Просмотреть файл

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


+ 1
- 1
archiva-modules/plugins/stage-repository-merge/pom.xml Просмотреть файл

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

Загрузка…
Отмена
Сохранить