Browse Source

[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 years ago
parent
commit
f260414f76
21 changed files with 441 additions and 55 deletions
  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 View File



<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>metadata-store-file</artifactId>
<artifactId>metadata-store-jcr</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </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> </dependencies>


<build> <build>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<basedir>${basedir}</basedir>
<appserver.base>${project.build.directory}/appserver-base</appserver.base> <appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home> <plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.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 View File

<!--
~ 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 View File

</property> </property>
</bean> </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> </beans>

+ 14
- 1
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml View File



<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>metadata-store-file</artifactId>
<artifactId>metadata-store-jcr</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </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> <dependency>
<groupId>org.codehaus.redback</groupId> <groupId>org.codehaus.redback</groupId>
<artifactId>redback-rbac-cached</artifactId> <artifactId>redback-rbac-cached</artifactId>
<appserver.base>${project.build.directory}/appserver-base</appserver.base> <appserver.base>${project.build.directory}/appserver-base</appserver.base>
<plexus.home>${project.build.directory}/appserver-base</plexus.home> <plexus.home>${project.build.directory}/appserver-base</plexus.home>
<derby.system.home>${project.build.directory}/appserver-base</derby.system.home> <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
<basedir>${basedir}</basedir>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>

+ 49
- 0
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/repository.xml View File

<!--
~ 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 View File

</property> </property>
</bean> </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> </beans>

+ 13
- 1
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml View File



<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>metadata-store-file</artifactId>
<artifactId>metadata-store-jcr</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </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> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin-default</artifactId> <artifactId>archiva-repository-admin-default</artifactId>

+ 49
- 0
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repository.xml View File

<!--
~ 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 View File

<property name="executor" ref="taskExecutor#repository-scanning"/> <property name="executor" ref="taskExecutor#repository-scanning"/>
<property name="queue" ref="taskQueue#repository-scanning"/> <property name="queue" ref="taskQueue#repository-scanning"/>
</bean> </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> </beans>

+ 25
- 2
archiva-modules/archiva-web/archiva-webapp/pom.xml View File

</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>metadata-store-file</artifactId>
<artifactId>metadata-store-jcr</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </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> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId> <artifactId>velocity-tools</artifactId>
<archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl> <archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl>
<rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd> <rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
<archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName> <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
<basedir>${basedir}</basedir>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
<!-- TODO: Bug in the Tomcat plugin - it doesn't seem to respect runtime dependencies, so we redeclare it as compile --> <!-- TODO: Bug in the Tomcat plugin - it doesn't seem to respect runtime dependencies, so we redeclare it as compile -->
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <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> <scope>compile</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>

+ 49
- 0
archiva-modules/archiva-web/archiva-webapp/src/appserver-base/conf/repository.xml View File

<!--
~ 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 View File



<util:properties id="archivaRuntimeProperties" location="classpath:application.properties" /> <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> </beans>

+ 57
- 48
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java View File

import org.apache.archiva.metadata.model.Organization; import org.apache.archiva.metadata.model.Organization;
import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.Scm; 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.MavenProjectFacet;
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent; import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent;
import org.apache.archiva.security.UserRepositoriesStub; 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 org.apache.struts2.StrutsSpringTestCase;


import java.util.HashMap; import java.util.HashMap;
protected static final String TEST_GENERIC_METADATA_PROPERTY_VALUE = "5 stars"; protected static final String TEST_GENERIC_METADATA_PROPERTY_VALUE = "5 stars";


@Override @Override
protected String[] getContextLocations()
protected String[] getContextLocations( )
{ {
return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" }; return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
} }


protected void assertDefaultModel( ProjectVersionMetadata model, String groupId, String artifactId, String version ) 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 ); 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 ) protected ProjectVersionMetadata createProjectModel( String version )


protected ProjectVersionMetadata createProjectModel( String groupId, String artifactId, String version ) protected ProjectVersionMetadata createProjectModel( String groupId, String artifactId, String version )
{ {
ProjectVersionMetadata model = new ProjectVersionMetadata();
ProjectVersionMetadata model = new ProjectVersionMetadata( );
model.setId( version ); model.setId( version );
model.setUrl( TEST_URL ); model.setUrl( TEST_URL );
model.setName( TEST_NAME ); model.setName( TEST_NAME );
model.setDescription( TEST_DESCRIPTION ); model.setDescription( TEST_DESCRIPTION );
CiManagement ci = new CiManagement();
CiManagement ci = new CiManagement( );
ci.setSystem( TEST_CI_SYSTEM ); ci.setSystem( TEST_CI_SYSTEM );
ci.setUrl( TEST_CI_URL ); ci.setUrl( TEST_CI_URL );
model.setCiManagement( ci ); model.setCiManagement( ci );
IssueManagement issue = new IssueManagement();
IssueManagement issue = new IssueManagement( );
issue.setSystem( TEST_ISSUE_SYSTEM ); issue.setSystem( TEST_ISSUE_SYSTEM );
issue.setUrl( TEST_ISSUE_URL ); issue.setUrl( TEST_ISSUE_URL );
model.setIssueManagement( issue ); model.setIssueManagement( issue );
Organization organization = new Organization();
Organization organization = new Organization( );
organization.setName( TEST_ORGANIZATION_NAME ); organization.setName( TEST_ORGANIZATION_NAME );
organization.setUrl( TEST_ORGANIZATION_URL ); organization.setUrl( TEST_ORGANIZATION_URL );
model.setOrganization( organization ); model.setOrganization( organization );
License l = new License();
License l = new License( );
l.setName( TEST_LICENSE_NAME ); l.setName( TEST_LICENSE_NAME );
l.setUrl( TEST_LICENSE_URL ); l.setUrl( TEST_LICENSE_URL );
model.addLicense( l ); model.addLicense( l );
l = new License();
l = new License( );
l.setName( TEST_LICENSE_NAME_2 ); l.setName( TEST_LICENSE_NAME_2 );
l.setUrl( TEST_LICENSE_URL_2 ); l.setUrl( TEST_LICENSE_URL_2 );
model.addLicense( l ); model.addLicense( l );
Scm scm = new Scm();
Scm scm = new Scm( );
scm.setConnection( TEST_SCM_CONNECTION ); scm.setConnection( TEST_SCM_CONNECTION );
scm.setDeveloperConnection( TEST_SCM_DEV_CONNECTION ); scm.setDeveloperConnection( TEST_SCM_DEV_CONNECTION );
scm.setUrl( TEST_SCM_URL ); scm.setUrl( TEST_SCM_URL );
model.setScm( scm ); model.setScm( scm );


MavenProjectFacet mavenProjectFacet = new MavenProjectFacet();
MavenProjectFacet mavenProjectFacet = new MavenProjectFacet( );
mavenProjectFacet.setGroupId( groupId ); mavenProjectFacet.setGroupId( groupId );
mavenProjectFacet.setArtifactId( artifactId ); mavenProjectFacet.setArtifactId( artifactId );
mavenProjectFacet.setPackaging( TEST_PACKAGING ); mavenProjectFacet.setPackaging( TEST_PACKAGING );
MavenProjectParent parent = new MavenProjectParent();
MavenProjectParent parent = new MavenProjectParent( );
parent.setGroupId( TEST_PARENT_GROUP_ID ); parent.setGroupId( TEST_PARENT_GROUP_ID );
parent.setArtifactId( TEST_PARENT_ARTIFACT_ID ); parent.setArtifactId( TEST_PARENT_ARTIFACT_ID );
parent.setVersion( TEST_PARENT_VERSION ); parent.setVersion( TEST_PARENT_VERSION );
mavenProjectFacet.setParent( parent ); mavenProjectFacet.setParent( parent );
model.addFacet( mavenProjectFacet ); 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 ); props.put( TEST_GENERIC_METADATA_PROPERTY_NAME, TEST_GENERIC_METADATA_PROPERTY_VALUE );
genericMetadataFacet.setAdditionalProperties( props ); genericMetadataFacet.setAdditionalProperties( props );
model.addFacet( genericMetadataFacet ); model.addFacet( genericMetadataFacet );
} }


@Override @Override
protected void setUp()
protected void setUp( )
throws Exception 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 View File

import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.commons.codec.Encoder; import org.apache.commons.codec.Encoder;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.jackrabbit.core.RepositoryImpl;
import org.apache.jackrabbit.core.util.RepositoryLock;




import java.io.File; import java.io.File;
public void testRetrieveServlet() public void testRetrieveServlet()
throws Exception throws Exception
{ {

RssFeedServlet servlet = (RssFeedServlet) client.newInvocation( RssFeedServlet servlet = (RssFeedServlet) client.newInvocation(
"http://localhost/feeds/test-repo" ).getServlet(); "http://localhost/feeds/test-repo" ).getServlet();
assertNotNull( servlet ); assertNotNull( servlet );
//client.newInvocation( "http://localhost/shutdown/foo" );
} }


public void testRequestNewArtifactsInRepo() public void testRequestNewArtifactsInRepo()
assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) ); assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
assertNotNull( "Should have recieved a response", response ); assertNotNull( "Should have recieved a response", response );
assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() ); assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );

//client.newInvocation( "http://localhost/shutdown/foo" );
} }


public void testRequestNewVersionsOfArtifact() public void testRequestNewVersionsOfArtifact()
assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) ); assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
assertNotNull( "Should have recieved a response", response ); assertNotNull( "Should have recieved a response", response );
assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() ); assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
//client.newInvocation( "http://localhost/shutdown/foo" );
} }


public void XXX_testInvalidRequest() public void XXX_testInvalidRequest()

+ 46
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/ShutdowJackrabbitServlet.java View File

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



<bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.TestConfiguration" /> <bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.TestConfiguration" />
<alias name="archivaConfiguration#test" alias="archivaConfiguration#default" /> <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> </beans>

+ 4
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-artifacts-download.xml View File

</property> </property>
</bean> </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> </beans>

+ 5
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml View File



<alias name="securitySystem#test" alias="securitySystem"/> <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> </beans>

+ 6
- 0
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context.xml View File



<bean name="metadataResolver#test" class="org.apache.archiva.webtest.memory.TestMetadataResolver"/> <bean name="metadataResolver#test" class="org.apache.archiva.webtest.memory.TestMetadataResolver"/>
<alias name="metadataResolver#test" alias="metadataResolver#default"/> <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> </beans>

+ 13
- 1
archiva-modules/archiva-web/archiva-webapp/src/test/webapp/WEB-INF/feedServletTest-web.xml View File

<url-pattern>/feeds/*</url-pattern> <url-pattern>/feeds/*</url-pattern>
</servlet-mapping> </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> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value> <param-value>
classpath*:/spring-context-rss-servlet.xml
classpath*:/META-INF/spring-context.xml classpath*:/META-INF/spring-context.xml
classpath*:/spring-context-rss-servlet.xml
</param-value> </param-value>
</context-param> </context-param>



+ 1
- 1
archiva-modules/plugins/stage-repository-merge/pom.xml View File

</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>metadata-store-file</artifactId>
<artifactId>metadata-store-jcr</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>

Loading…
Cancel
Save