]> source.dussan.org Git - archiva.git/commitdiff
Correcting unit test failures.
authorJoakim Erdfelt <joakime@apache.org>
Mon, 26 Feb 2007 19:20:59 +0000 (19:20 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Mon, 26 Feb 2007 19:20:59 +0000 (19:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@511956 13f79535-47bb-0310-9956-ffa450edef68

archiva-repository-layer/pom.xml
archiva-repository-layer/src/main/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayer.java
archiva-repository-layer/src/main/resources/META-INF/plexus/components.xml [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/AllTests.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/AllTests.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.java
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java [new file with mode: 0644]
archiva-repository-layer/src/test/resources/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.xml [new file with mode: 0644]

index a0135a5c6faea46c4ea60c249fdbb1209b624785..fa9a51ab86d71d42f5fa84055f47a879ea8d0e73 100644 (file)
       <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>
index 953827b18e9c3ef735890b5e77c8334de006c9ac..65f03c6a6122ea9f538b7518752a5be423e3cb5f 100644 (file)
@@ -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 )
-    {
-        this.layer = layer;
-    }
-
-    public CachedRepositoryQueryLayer( RepositoryQueryLayer layer, Cache cache )
+    
+    public CachedRepositoryQueryLayer()
     {
-        this.cache = cache;
-        this.layer = layer;
+        
     }
 
     public boolean containsArtifact( Artifact artifact )
diff --git a/archiva-repository-layer/src/main/resources/META-INF/plexus/components.xml b/archiva-repository-layer/src/main/resources/META-INF/plexus/components.xml
new file mode 100644 (file)
index 0000000..c2ee003
--- /dev/null
@@ -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>
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/AllTests.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/AllTests.java
new file mode 100644 (file)
index 0000000..e23eb09
--- /dev/null
@@ -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;
+    }
+
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/AllTests.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/layer/AllTests.java
new file mode 100644 (file)
index 0000000..c87f271
--- /dev/null
@@ -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;
+    }
+
+}
index b5435fc62119707f70a201447bd18dcd2c300d1f..f7da091cc64c67e4676cc502515c40241318d061 100644 (file)
@@ -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()
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java
new file mode 100644 (file)
index 0000000..e25a55e
--- /dev/null
@@ -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;
+    }
+
+}
diff --git a/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.xml b/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/layer/CachedRepositoryQueryLayerTest.xml
new file mode 100644 (file)
index 0000000..8ff658a
--- /dev/null
@@ -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>
\ No newline at end of file