]> source.dussan.org Git - archiva.git/commitdiff
more unit tests fixes
authorOlivier Lamy <olamy@apache.org>
Mon, 29 Oct 2012 21:03:40 +0000 (21:03 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 29 Oct 2012 21:03:40 +0000 (21:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403514 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractDefaultRepositoryContentTestCase.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java [new file with mode: 0755]
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/MockConfiguration.java [deleted file]
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java
archiva-modules/plugins/maven2-repository/src/test/resources/spring-context-metadata-tools-test.xml
archiva-modules/plugins/maven2-repository/src/test/resources/spring-context-no-mock-conf.xml

index cf998b63e355a2bfdba332085bb90a52ab47f627..fb425badcc7ffe7e81888fad0211a04a7798b3ac 100644 (file)
@@ -33,8 +33,6 @@ import static org.junit.Assert.*;
 /**
  * AbstractDefaultRepositoryContentTestCase
  */
-@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public abstract class AbstractDefaultRepositoryContentTestCase
     extends AbstractRepositoryLayerTestCase
 {
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/conf/MockConfiguration.java
new file mode 100755 (executable)
index 0000000..db62852
--- /dev/null
@@ -0,0 +1,109 @@
+package org.apache.archiva.metadata.repository.storage.maven2.conf;
+
+/*
+ * 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.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.ConfigurationListener;
+import org.apache.archiva.redback.components.registry.Registry;
+import org.apache.archiva.redback.components.registry.RegistryException;
+import org.apache.archiva.redback.components.registry.RegistryListener;
+import org.easymock.MockControl;
+import org.springframework.stereotype.Service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * MockConfiguration 
+ *
+ *
+ */
+@Service("archivaConfiguration#mock")
+public class MockConfiguration
+    implements ArchivaConfiguration
+{
+
+    private Configuration configuration = new Configuration();
+
+    private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>();
+    private Set<ConfigurationListener> configListeners = new HashSet<ConfigurationListener>();
+
+    private MockControl registryControl;
+
+    private Registry registryMock;
+
+    public MockConfiguration()
+    {
+        registryControl = MockControl.createNiceControl( Registry.class );
+        registryMock = (Registry) registryControl.getMock();
+    }
+
+    public void addChangeListener( RegistryListener listener )
+    {
+        registryListeners.add( listener );
+    }
+
+    public Configuration getConfiguration()
+    {
+        return configuration;
+    }
+
+    public void save( Configuration configuration )
+        throws RegistryException
+    {
+        /* do nothing */
+    }
+
+    public void triggerChange( String name, String value )
+    {
+        for(RegistryListener listener: registryListeners)
+        {
+            try
+            {
+                listener.afterConfigurationChange( registryMock, name, value );
+            }
+            catch ( Exception e )
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public void addListener( ConfigurationListener listener )
+    {
+        configListeners.add(listener);
+    }
+
+    public void removeListener( ConfigurationListener listener )
+    {
+        configListeners.remove( listener );
+    }
+    
+    public boolean isDefaulted()
+    {
+        return false;
+    }
+
+    public void reload()
+    {
+        // no op
+    }
+}
index ee0606c886276a9213a651bcac609dd79b10466b..ec52fb4be5b11a83624e3895ce8548136af1e9fb 100644 (file)
@@ -37,7 +37,7 @@ import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
  *
  */
 @RunWith( ArchivaSpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context-no-mock-conf.xml" } )
 public abstract class AbstractRepositoryLayerTestCase
 {
     @Rule
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/MockConfiguration.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/MockConfiguration.java
deleted file mode 100755 (executable)
index 5137f2e..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.apache.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 org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ConfigurationListener;
-import org.apache.archiva.redback.components.registry.Registry;
-import org.apache.archiva.redback.components.registry.RegistryException;
-import org.apache.archiva.redback.components.registry.RegistryListener;
-import org.easymock.MockControl;
-import org.springframework.stereotype.Service;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * MockConfiguration 
- *
- *
- */
-@Service("archivaConfiguration#mock")
-public class MockConfiguration
-    implements ArchivaConfiguration
-{
-    private Configuration configuration = new Configuration();
-
-    private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>();
-    private Set<ConfigurationListener> configListeners = new HashSet<ConfigurationListener>();
-
-    private MockControl registryControl;
-
-    private Registry registryMock;
-
-    public MockConfiguration()
-    {
-        registryControl = MockControl.createNiceControl( Registry.class );
-        registryMock = (Registry) registryControl.getMock();
-    }
-
-    public void addChangeListener( RegistryListener listener )
-    {
-        registryListeners.add( listener );
-    }
-
-    public Configuration getConfiguration()
-    {
-        return configuration;
-    }
-
-    public void save( Configuration configuration )
-        throws RegistryException
-    {
-        /* do nothing */
-    }
-
-    public void triggerChange( String name, String value )
-    {
-        for(RegistryListener listener: registryListeners)
-        {
-            try
-            {
-                listener.afterConfigurationChange( registryMock, name, value );
-            }
-            catch ( Exception e )
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public void addListener( ConfigurationListener listener )
-    {
-        configListeners.add(listener);
-    }
-
-    public void removeListener( ConfigurationListener listener )
-    {
-        configListeners.remove( listener );
-    }
-    
-    public boolean isDefaulted()
-    {
-        return false;
-    }
-
-    public void reload()
-    {
-        // no op
-    }
-}
index e33f2daaca3d9946085c593d8041f1ad663fa159..baa103946b5ea56e79288ad137a13e2841cc3ee1 100644 (file)
@@ -30,7 +30,7 @@ import org.apache.archiva.policies.ReleasesPolicy;
 import org.apache.archiva.policies.SnapshotsPolicy;
 import org.apache.archiva.repository.AbstractRepositoryLayerTestCase;
 import org.apache.archiva.repository.ManagedRepositoryContent;
-import org.apache.archiva.repository.MockConfiguration;
+import org.apache.archiva.metadata.repository.storage.maven2.conf.MockConfiguration;
 import org.apache.archiva.repository.RemoteRepositoryContent;
 import org.apache.archiva.repository.layout.LayoutException;
 import org.apache.commons.io.FileUtils;
index 90b8da13e725916d3f0e8ddc20db12c4521ee26c..60989a3d7dc58e8f1858f702d075334d9b34b7cb 100644 (file)
@@ -27,7 +27,7 @@
            http://www.springframework.org/schema/context/spring-context-3.0.xsd"
        default-lazy-init="true">
 
-  <bean name="archivaConfiguration#mock" class="org.apache.archiva.repository.MockConfiguration"/>
+  <bean name="archivaConfiguration#mock" class="org.apache.archiva.metadata.repository.storage.maven2.conf.MockConfiguration"/>
   <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/>
   <bean name="metadataTools#test" class="org.apache.archiva.repository.metadata.MetadataTools">
     <property name="configuration" ref="archivaConfiguration#mock"/>
index 98df636175f781f841a883325a3bb78f810126a4..f4d78908dcb1418f5caf46189a305ff7bb927b88 100644 (file)
@@ -25,6 +25,8 @@
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-  <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/>
-  <alias name="archivaConfiguration#mock" alias="archivaConfiguration#test"/>
+
+  <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.metadata.repository.storage.maven2.conf"/>
+
 </beans>
\ No newline at end of file