diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-10-08 23:08:32 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-10-08 23:08:32 +0000 |
commit | 25bc854985e1cac10e356155886f3289df1afbe9 (patch) | |
tree | f622731c36b1326cc6325dff282123f9be986f15 /archiva-base/archiva-proxy | |
parent | 8af86cd884b34ecfa98c6a42d2975fdd45c48fff (diff) | |
download | archiva-25bc854985e1cac10e356155886f3289df1afbe9.tar.gz archiva-25bc854985e1cac10e356155886f3289df1afbe9.zip |
Reducing chattiness by adding ConfigurationListener to give option of event on configuration save as a whole, not each field.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@582993 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-proxy')
-rw-r--r-- | archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java index 69f3ce3f4..08e4d2740 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MockConfiguration.java @@ -21,13 +21,14 @@ package org.apache.maven.archiva.proxy; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.ConfigurationListener; import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.RegistryException; import org.codehaus.plexus.registry.RegistryListener; import org.easymock.MockControl; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; +import java.util.Set; /** * MockConfiguration @@ -43,7 +44,8 @@ public class MockConfiguration { private Configuration configuration = new Configuration(); - private List<RegistryListener> listeners = new ArrayList<RegistryListener>(); + private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>(); + private Set<ConfigurationListener> configListeners = new HashSet<ConfigurationListener>(); private MockControl registryControl; @@ -57,7 +59,7 @@ public class MockConfiguration public void addChangeListener( RegistryListener listener ) { - listeners.add( listener ); + registryListeners.add( listener ); } public Configuration getConfiguration() @@ -73,7 +75,7 @@ public class MockConfiguration public void triggerChange( String name, String value ) { - for( RegistryListener listener: listeners ) + for(RegistryListener listener: registryListeners) { try { @@ -85,4 +87,14 @@ public class MockConfiguration } } } + + public void addListener( ConfigurationListener listener ) + { + configListeners.add(listener); + } + + public void removeListener( ConfigurationListener listener ) + { + configListeners.remove( listener ); + } } |