diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-05-24 18:47:50 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-05-24 18:47:50 +0000 |
commit | c8610ec35db01abd58b2b1e77898a9d4cd292636 (patch) | |
tree | b768ff3466338cbc186fb21a7e353a17bc667265 /archiva-base/archiva-proxy | |
parent | d32992e00d2431de9fbcd7f5a0d1f16727982434 (diff) | |
download | archiva-c8610ec35db01abd58b2b1e77898a9d4cd292636.tar.gz archiva-c8610ec35db01abd58b2b1e77898a9d4cd292636.zip |
* Fixing test of propertyName values in ConfigurationNames class.
* Updating ProxyTestCase to use trigger with appropriate values.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@541383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-proxy')
3 files changed, 42 insertions, 9 deletions
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index dae8e55da..c23f80233 100644 --- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -744,7 +744,7 @@ public class DefaultRepositoryProxyConnectors public void initialize() throws InitializationException { - archivaConfiguration.addChangeListener( this ); initConnectorsAndNetworkProxies(); + archivaConfiguration.addChangeListener( this ); } } diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java index 088610424..fba5b8c27 100644 --- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java @@ -59,11 +59,11 @@ public class AbstractProxyTestCase protected static final String ID_LEGACY_PROXIED = "legacy-proxied"; protected static final String ID_PROXIED1 = "proxied1"; - + protected static final String ID_PROXIED1_TARGET = "proxied1-target"; protected static final String ID_PROXIED2 = "proxied2"; - + protected static final String ID_PROXIED2_TARGET = "proxied2-target"; protected static final String ID_DEFAULT_MANAGED = "default-managed-repository"; @@ -73,11 +73,11 @@ public class AbstractProxyTestCase protected static final String REPOPATH_PROXIED_LEGACY = "src/test/repositories/legacy-proxied"; protected static final String REPOPATH_PROXIED1 = "src/test/repositories/proxied1"; - + protected static final String REPOPATH_PROXIED1_TARGET = "target/test-repository/proxied1"; protected static final String REPOPATH_PROXIED2 = "src/test/repositories/proxied2"; - + protected static final String REPOPATH_PROXIED2_TARGET = "target/test-repository/proxied2"; protected static final String REPOPATH_DEFAULT_MANAGED = "src/test/repositories/managed"; @@ -134,7 +134,7 @@ public class AbstractProxyTestCase assertEquals( "MD5 File contents: " + md5File.getPath(), expectedMd5Contents, actualMd5Contents ); } } - + protected void assertFileEquals( File expectedFile, File actualFile, File sourceFile ) throws Exception { @@ -343,8 +343,18 @@ public class AbstractProxyTestCase connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, snapshotPolicy ); connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, cacheFailuresPolicy ); + int count = config.getConfiguration().getProxyConnectors().size(); config.getConfiguration().addProxyConnector( connectorConfig ); - config.triggerChange( "proxyConnector", "" ); + + // Proper Triggering ... + String prefix = "proxyConnectors.proxyConnector(" + count + ")"; + config.triggerChange( prefix + ".sourceRepoId", connectorConfig.getSourceRepoId() ); + config.triggerChange( prefix + ".targetRepoId", connectorConfig.getTargetRepoId() ); + config.triggerChange( prefix + ".proxyId", connectorConfig.getProxyId() ); + config.triggerChange( prefix + ".policies.releases", connectorConfig.getPolicy( "releases", "" ) ); + config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) ); + config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) ); + config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) ); } protected void saveRepositoryConfig( String id, String name, String path, String layout ) @@ -368,14 +378,15 @@ public class AbstractProxyTestCase config.triggerChange( "repository", "" ); } - protected File saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout ) throws IOException + protected File saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout ) + throws IOException { File repoLocation = getTestFile( targetPath ); FileUtils.deleteDirectory( repoLocation ); copyDirectoryStructure( getTestFile( originalPath ), repoLocation ); saveRepositoryConfig( id, "Target Repo-" + id, targetPath, layout ); - + return repoLocation; } diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml index 6daa370b8..61b78d1ed 100644 --- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml +++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml @@ -63,6 +63,28 @@ </requirement> </requirements> </component> + + <component> + <role>org.codehaus.plexus.cache.Cache</role> + <role-hint>url-failures-cache</role-hint> + <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation> + <description>URL Failure Cache</description> + <configuration> + <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds> + <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. --> + <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path> + <eternal>false</eternal> + <max-elements-in-memory>1000</max-elements-in-memory> + <memory-eviction-policy>LRU</memory-eviction-policy> + <name>cache</name> + <overflow-to-disk>false</overflow-to-disk> + <!-- 45 minutes = 2700 seconds --> + <time-to-idle-seconds>2700</time-to-idle-seconds> + <!-- 30 minutes = 1800 seconds --> + <time-to-live-seconds>1800</time-to-live-seconds> + </configuration> + </component> + <component> <role>org.codehaus.plexus.logging.LoggerManager</role> <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation> |