[MRM-1327] implement alternative or improve repository metadata storage: remove some repository.xml not needed for test

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1179244 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-10-05 14:48:15 +00:00
parent 7590f5c92b
commit e506bed25d
8 changed files with 498 additions and 151 deletions

View File

@ -194,24 +194,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<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>

View File

@ -0,0 +1,249 @@
package org.apache.archiva.admin.mock;
/*
* 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.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.MetadataFacet;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.ProjectVersionReference;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* @author Olivier Lamy
*/
@Service( "RepositorySessionFactory#mock" )
public class MockRepositorySessionFactory
implements RepositorySessionFactory
{
public RepositorySession createSession( )
{
return new RepositorySession( null, null )
{
@Override
public void close( )
{
return;
}
@Override
public void save( )
{
// no op
}
@Override
public MetadataRepository getRepository( )
{
return new MetadataRepository( )
{
public void updateProject( String repositoryId, ProjectMetadata project )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void updateArtifact( String repositoryId, String namespace, String projectId,
String projectVersion, ArtifactMetadata artifactMeta )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void updateProjectVersion( String repositoryId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void updateNamespace( String repositoryId, String namespace )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public List<String> getMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{
return Collections.emptyList( );
}
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void removeMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void removeMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
Date endTime )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getRepositories( )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public void removeArtifact( String repositoryId, String namespace, String project, String version,
String id )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void removeRepository( String repositoryId )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public List<ArtifactMetadata> getArtifacts( String repositoryId )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public ProjectMetadata getProject( String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getRootNamespaces( String repoId )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getNamespaces( String repoId, String namespace )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getProjects( String repoId, String namespace )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public void save( )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void close( )
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void revert( )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public boolean canObtainAccess( Class<?> aClass )
{
return false; //To change body of implemented methods use File | Settings | File Templates.
}
public Object obtainAccess( Class<?> aClass )
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
};
}
};
}
}

View File

@ -1,51 +0,0 @@
<!--
~ 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,12 +56,4 @@
</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

@ -102,24 +102,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<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>

View File

@ -0,0 +1,249 @@
package org.apache.archiva.scheduler.indexing.mock;
/*
* 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.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.MetadataFacet;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.ProjectVersionReference;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* @author Olivier Lamy
*/
@Service( "RepositorySessionFactory#mock" )
public class MockRepositorySessionFactory
implements RepositorySessionFactory
{
public RepositorySession createSession( )
{
return new RepositorySession( null, null )
{
@Override
public void close( )
{
return;
}
@Override
public void save( )
{
// no op
}
@Override
public MetadataRepository getRepository( )
{
return new MetadataRepository( )
{
public void updateProject( String repositoryId, ProjectMetadata project )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void updateArtifact( String repositoryId, String namespace, String projectId,
String projectVersion, ArtifactMetadata artifactMeta )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void updateProjectVersion( String repositoryId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void updateNamespace( String repositoryId, String namespace )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public List<String> getMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{
return Collections.emptyList( );
}
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void removeMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void removeMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
Date endTime )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getRepositories( )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public void removeArtifact( String repositoryId, String namespace, String project, String version,
String id )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void removeRepository( String repositoryId )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public List<ArtifactMetadata> getArtifacts( String repositoryId )
throws MetadataRepositoryException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public ProjectMetadata getProject( String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getRootNamespaces( String repoId )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getNamespaces( String repoId, String namespace )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getProjects( String repoId, String namespace )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public void save( )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void close( )
{
//To change body of implemented methods use File | Settings | File Templates.
}
public void revert( )
throws MetadataRepositoryException
{
//To change body of implemented methods use File | Settings | File Templates.
}
public boolean canObtainAccess( Class<?> aClass )
{
return false; //To change body of implemented methods use File | Settings | File Templates.
}
public Object obtainAccess( Class<?> aClass )
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
};
}
};
}
}

View File

@ -1,49 +0,0 @@
<!--
~ 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,13 +58,6 @@
</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>