mirror of https://github.com/apache/archiva.git
fixing some test spring configuration : still some tests fail and puzzle me ! :-)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1129792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3289f9b03b
commit
206b66a2be
|
@ -103,6 +103,7 @@ public class DefaultRepositoryProxyConnectors
|
|||
* plexus.requirement
|
||||
*/
|
||||
@Inject
|
||||
@Named(value = "repositoryContentFactory#default")
|
||||
private RepositoryContentFactory repositoryFactory;
|
||||
|
||||
/**
|
||||
|
@ -115,17 +116,17 @@ public class DefaultRepositoryProxyConnectors
|
|||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
|
||||
* plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
|
||||
*/
|
||||
private Map<String, PreDownloadPolicy> preDownloadPolicies;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
|
||||
* plexus.requirement role="org.apache.maven.archiva.policies.PostDownloadPolicy"
|
||||
*/
|
||||
private Map<String, PostDownloadPolicy> postDownloadPolicies;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
|
||||
* plexus.requirement role="org.apache.maven.archiva.policies.DownloadErrorPolicy"
|
||||
*/
|
||||
private Map<String, DownloadErrorPolicy> downloadErrorPolicies;
|
||||
|
||||
|
|
|
@ -39,67 +39,67 @@ public class TestMetadataRepository
|
|||
{
|
||||
public ProjectMetadata getProject( String repoId, String namespace, String projectId )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<String> getRootNamespaces( String repoId )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<String> getNamespaces( String repoId, String namespace )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<String> getProjects( String repoId, String namespace )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void updateProject( String repoId, ProjectMetadata project )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
|
||||
ArtifactMetadata artifactMeta )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void updateProjectVersion( String repoId, String namespace, String projectId,
|
||||
ProjectVersionMetadata versionMetadata )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void updateNamespace( String repoId, String namespace )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public List<String> getMetadataFacets( String repodId, String facetId )
|
||||
|
@ -109,73 +109,73 @@ public class TestMetadataRepository
|
|||
|
||||
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void removeMetadataFacets( String repositoryId, String facetId )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void removeMetadataFacet( String repoId, String facetId, String name )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<String> getRepositories()
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void removeRepository( String repoId )
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
|
||||
String projectVersion )
|
||||
{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public void revert()
|
||||
{
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
// no op
|
||||
}
|
||||
|
||||
public boolean canObtainAccess( Class<?> aClass )
|
||||
{
|
||||
return false; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object obtainAccess( Class<?> aClass )
|
||||
|
@ -185,6 +185,6 @@ public class TestMetadataRepository
|
|||
|
||||
public List<ArtifactMetadata> getArtifacts( String repositoryId )
|
||||
{
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,13 +47,13 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
@ -135,11 +135,13 @@ public abstract class AbstractProxyTestCase
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
proxyHandler = applicationContext.getBean("repositoryProxyConnectors#default", RepositoryProxyConnectors.class );
|
||||
|
||||
config =
|
||||
(MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
|
||||
|
||||
config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
|
||||
config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
|
||||
config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
|
||||
|
||||
// Setup source repository (using default layout)
|
||||
String repoPath = "target/test-repository/managed/" + getName();
|
||||
File repoLocation = new File( repoPath );
|
||||
|
@ -162,6 +164,8 @@ public abstract class AbstractProxyTestCase
|
|||
createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
|
||||
"legacy" );
|
||||
|
||||
|
||||
|
||||
managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
|
||||
|
||||
repoConfig = managedLegacyRepository.getRepository();
|
||||
|
@ -183,6 +187,9 @@ public abstract class AbstractProxyTestCase
|
|||
// Setup the proxy handler.
|
||||
//proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
|
||||
|
||||
proxyHandler =
|
||||
applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class );
|
||||
|
||||
// Setup the wagon mock.
|
||||
wagonMockControl = MockControl.createNiceControl( Wagon.class );
|
||||
wagonMock = (Wagon) wagonMockControl.getMock();
|
||||
|
|
|
@ -50,7 +50,7 @@ import java.util.Set;
|
|||
* role-hint="mock"
|
||||
*/
|
||||
@Service( "archivaConfiguration#mock" )
|
||||
@Scope( "prototype" )
|
||||
//Scope( "prototype" )
|
||||
public class MockConfiguration
|
||||
implements ArchivaConfiguration
|
||||
{
|
||||
|
|
|
@ -27,5 +27,4 @@
|
|||
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<bean id="repositorySessionFactory" class="org.apache.archiva.metadata.repository.TestRepositorySessionFactory"/>
|
||||
</beans>
|
|
@ -45,10 +45,16 @@
|
|||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="repositoryProxyConnectors#default" class="org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors">
|
||||
<bean name="repositoryContentFactory#mocked" class="org.apache.maven.archiva.repository.RepositoryContentFactory">
|
||||
<property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean name="repositoryProxyConnectors#test" class="org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors">
|
||||
<property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
|
||||
<property name="repositoryFactory" ref="repositoryContentFactory#mocked"/>
|
||||
</bean>
|
||||
|
||||
<bean name="metadataTools#default" class="org.apache.maven.archiva.repository.metadata.MetadataTools">
|
||||
<property name="configuration" ref="archivaConfiguration#mock"/>
|
||||
</bean>
|
||||
|
|
Loading…
Reference in New Issue