mirror of https://github.com/apache/archiva.git
Correcting unit test failures.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@511956 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eec1a48273
commit
7b52510e87
|
@ -51,5 +51,34 @@
|
|||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-repository-metadata</artifactId>
|
||||
</dependency>
|
||||
<!-- TEST DEPS -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus.cache</groupId>
|
||||
<artifactId>plexus-cache-hashmap</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>merge</id>
|
||||
<goals>
|
||||
<goal>merge-descriptors</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${basedir}/src/main/resources/META-INF/plexus/components.xml</descriptor>
|
||||
<descriptor>${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -35,7 +35,7 @@ public class CachedRepositoryQueryLayer
|
|||
implements RepositoryQueryLayer
|
||||
{
|
||||
/**
|
||||
* @plexus.requirement
|
||||
* @plexus.requirement role-hint="repository-query"
|
||||
*/
|
||||
private Cache cache;
|
||||
|
||||
|
@ -43,16 +43,10 @@ public class CachedRepositoryQueryLayer
|
|||
* @plexus.requirement
|
||||
*/
|
||||
private RepositoryQueryLayer layer;
|
||||
|
||||
public CachedRepositoryQueryLayer( RepositoryQueryLayer layer )
|
||||
|
||||
public CachedRepositoryQueryLayer()
|
||||
{
|
||||
this.layer = layer;
|
||||
}
|
||||
|
||||
public CachedRepositoryQueryLayer( RepositoryQueryLayer layer, Cache cache )
|
||||
{
|
||||
this.cache = cache;
|
||||
this.layer = layer;
|
||||
|
||||
}
|
||||
|
||||
public boolean containsArtifact( Artifact artifact )
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.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.
|
||||
-->
|
||||
|
||||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.codehaus.plexus.cache.Cache</role>
|
||||
<role-hint>repository-query</role-hint>
|
||||
<implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
|
||||
<description>EhcacheCache</description>
|
||||
<configuration>
|
||||
<disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
|
||||
<disk-persistent>true</disk-persistent>
|
||||
<disk-store-path>${java.io.tmpdir}/ehcache/repo-query</disk-store-path>
|
||||
<eternal>false</eternal>
|
||||
<max-elements-in-memory>1000</max-elements-in-memory>
|
||||
<memory-eviction-policy>LRU</memory-eviction-policy>
|
||||
<name>repository-query</name>
|
||||
<overflow-to-disk>false</overflow-to-disk>
|
||||
<time-to-idle-seconds>600</time-to-idle-seconds>
|
||||
<time-to-live-seconds>300</time-to-live-seconds>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
|
@ -0,0 +1,44 @@
|
|||
package org.apache.maven.archiva;
|
||||
|
||||
/*
|
||||
* 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 junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* AllTests - conveinence test suite for IDE users.
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AllTests
|
||||
{
|
||||
|
||||
public static Test suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva" );
|
||||
//$JUnit-BEGIN$
|
||||
suite.addTest( org.apache.maven.archiva.repository.AllTests.suite() );
|
||||
suite.addTest( org.apache.maven.archiva.layer.AllTests.suite() );
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.apache.maven.archiva.layer;
|
||||
|
||||
/*
|
||||
* 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 junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* AllTests
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AllTests
|
||||
{
|
||||
|
||||
public static Test suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.layer" );
|
||||
//$JUnit-BEGIN$
|
||||
suite.addTestSuite( CachedRepositoryQueryLayerTest.class );
|
||||
suite.addTestSuite( DefaultRepositoryQueryLayerTest.class );
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package org.apache.maven.archiva.layer;
|
||||
|
||||
import org.codehaus.plexus.cache.Cache;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -21,22 +19,22 @@ import org.codehaus.plexus.cache.Cache;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* CachedRepositoryQueryLayerTest
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CachedRepositoryQueryLayerTest
|
||||
extends AbstractRepositoryQueryLayerTestCase
|
||||
{
|
||||
private Cache cache;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
cache = (Cache) lookup( Cache.ROLE, "test" );
|
||||
|
||||
queryLayer = new CachedRepositoryQueryLayer( new DefaultRepositoryQueryLayer( repository ), cache );
|
||||
queryLayer = (RepositoryQueryLayer) lookup( RepositoryQueryLayer.ROLE, "test-cached" );
|
||||
}
|
||||
|
||||
public void testUseFileCache()
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.apache.maven.archiva.repository;
|
||||
|
||||
/*
|
||||
* 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 junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* AllTests
|
||||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AllTests
|
||||
{
|
||||
|
||||
public static Test suite()
|
||||
{
|
||||
TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.repository" );
|
||||
//$JUnit-BEGIN$
|
||||
suite.addTestSuite( RepositoryURLTest.class );
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.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.
|
||||
-->
|
||||
|
||||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.layer.RepositoryQueryLayer</role>
|
||||
<role-hint>test-cached</role-hint>
|
||||
<implementation>org.apache.maven.archiva.layer.CachedRepositoryQueryLayer</implementation>
|
||||
<description>CachedRepositoryQueryLayer - simple wrapper around another non-cached Repository Query Layer.</description>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.codehaus.plexus.cache.Cache</role>
|
||||
<role-hint>test-repository-query</role-hint>
|
||||
<field-name>cache</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.archiva.layer.RepositoryQueryLayer</role>
|
||||
<field-name>layer</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.codehaus.plexus.cache.Cache</role>
|
||||
<role-hint>test-repository-query</role-hint>
|
||||
<implementation>org.codehaus.plexus.cache.hashmap.HashMapCache</implementation>
|
||||
<configuration>
|
||||
<cache-hit-ratio>1.0</cache-hit-ratio>
|
||||
<cache-max-size>0</cache-max-size>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
Loading…
Reference in New Issue