aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-configuration
diff options
context:
space:
mode:
authorEdwin L. Punzalan <epunzalan@apache.org>2006-10-26 09:15:23 +0000
committerEdwin L. Punzalan <epunzalan@apache.org>2006-10-26 09:15:23 +0000
commit2b1e907f1070d1ceef1f9e211363af3aacd2b95c (patch)
tree87e3dc71eb1d1c01c214771d04c1dc98359deb3a /archiva-configuration
parent15fe0128dd35bc08124b4ee76d59b360ad6541cb (diff)
downloadarchiva-2b1e907f1070d1ceef1f9e211363af3aacd2b95c.tar.gz
archiva-2b1e907f1070d1ceef1f9e211363af3aacd2b95c.zip
- verified copyright headers
- optimized imports - ran code formatting git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@467926 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-configuration')
-rw-r--r--archiva-configuration/pom.xml21
-rw-r--r--archiva-configuration/src/test/conf/corrupt.xml3
-rw-r--r--archiva-configuration/src/test/conf/repository-manager.xml5
-rw-r--r--archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java14
-rw-r--r--archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java206
-rw-r--r--archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml3
6 files changed, 135 insertions, 117 deletions
diff --git a/archiva-configuration/pom.xml b/archiva-configuration/pom.xml
index 6caa30b55..7725fa2ec 100644
--- a/archiva-configuration/pom.xml
+++ b/archiva-configuration/pom.xml
@@ -1,5 +1,22 @@
-<?xml version="1.0"?>
-<project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>archiva</artifactId>
<groupId>org.apache.maven.archiva</groupId>
diff --git a/archiva-configuration/src/test/conf/corrupt.xml b/archiva-configuration/src/test/conf/corrupt.xml
index 2476f91ff..ed0c05c89 100644
--- a/archiva-configuration/src/test/conf/corrupt.xml
+++ b/archiva-configuration/src/test/conf/corrupt.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
@@ -5,7 +6,7 @@
~ 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
+ ~ 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,
diff --git a/archiva-configuration/src/test/conf/repository-manager.xml b/archiva-configuration/src/test/conf/repository-manager.xml
index a3f1f2745..8dd9d4c97 100644
--- a/archiva-configuration/src/test/conf/repository-manager.xml
+++ b/archiva-configuration/src/test/conf/repository-manager.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
+<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
@@ -7,7 +6,7 @@
~ 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
+ ~ 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,
diff --git a/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java b/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java
index f4f90c0a3..cfe704267 100644
--- a/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java
+++ b/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ConfigurationStoreTest.java
@@ -1,11 +1,5 @@
package org.apache.maven.archiva.configuration;
-import org.codehaus.plexus.PlexusTestCase;
-import org.easymock.MockControl;
-
-import java.io.File;
-import java.util.Properties;
-
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
@@ -13,7 +7,7 @@ import java.util.Properties;
* 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
+ * 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,
@@ -22,6 +16,12 @@ import java.util.Properties;
* limitations under the License.
*/
+import org.codehaus.plexus.PlexusTestCase;
+import org.easymock.MockControl;
+
+import java.io.File;
+import java.util.Properties;
+
/**
* Test the configuration store.
*
diff --git a/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java b/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java
index 6cfbe4a90..ffa76304f 100644
--- a/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java
+++ b/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/MavenProxyPropertyLoaderTest.java
@@ -1,103 +1,103 @@
-package org.apache.maven.archiva.configuration;
-
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.codehaus.plexus.PlexusTestCase;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * @author Edwin Punzalan
- */
-public class MavenProxyPropertyLoaderTest
- extends PlexusTestCase
-{
- private static final int DEFAULT_CACHE_PERIOD = 3600;
-
- private MavenProxyPropertyLoader loader;
-
- public void testLoadValidMavenProxyConfiguration()
- throws IOException, InvalidConfigurationException
- {
- File confFile = getTestFile( "src/test/conf/maven-proxy-complete.conf" );
-
- Configuration configuration = new Configuration();
- Proxy proxy = new Proxy();
- proxy.setHost( "original-host" );
- configuration.setProxy( proxy ); // overwritten
- configuration.setIndexPath( "index-path" ); // existing value
-
- loader.load( new FileInputStream( confFile ), configuration );
-
- List list = configuration.getRepositories();
- assertEquals( "check single managed repository", 1, list.size() );
- RepositoryConfiguration managedRepository = (RepositoryConfiguration) list.iterator().next();
- assertEquals( "cache path changed", "target", managedRepository.getDirectory() );
-
- assertEquals( "Count repositories", 4, configuration.getProxiedRepositories().size() );
-
- list = configuration.getProxiedRepositories();
- ProxiedRepositoryConfiguration repo = (ProxiedRepositoryConfiguration) list.get( 0 );
- assertEquals( "Repository name not as expected", "local-repo", repo.getId() );
- assertEquals( "Repository url does not match its name", "file://target", repo.getUrl() );
- assertEquals( "Repository cache period check failed", 0, repo.getSnapshotsInterval() );
- assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
-
- repo = (ProxiedRepositoryConfiguration) list.get( 1 );
- assertEquals( "Repository name not as expected", "www-ibiblio-org", repo.getId() );
- assertEquals( "Repository url does not match its name", "http://www.ibiblio.org/maven2", repo.getUrl() );
- assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getSnapshotsInterval() );
- assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
-
- repo = (ProxiedRepositoryConfiguration) list.get( 2 );
- assertEquals( "Repository name not as expected", "dist-codehaus-org", repo.getId() );
- assertEquals( "Repository url does not match its name", "http://dist.codehaus.org", repo.getUrl() );
- assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getSnapshotsInterval() );
- assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
-
- repo = (ProxiedRepositoryConfiguration) list.get( 3 );
- assertEquals( "Repository name not as expected", "private-example-com", repo.getId() );
- assertEquals( "Repository url does not match its name", "http://private.example.com/internal", repo.getUrl() );
- assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getSnapshotsInterval() );
- assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
- }
-
- public void testInvalidConfiguration()
- {
- Configuration configuration = new Configuration();
- try
- {
- loader.load( new Properties(), configuration );
- fail( "Incomplete config should have failed" );
- }
- catch ( InvalidConfigurationException e )
- {
- assertTrue( true );
- }
- }
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
- loader = new MavenProxyPropertyLoader();
- }
-}
+package org.apache.maven.archiva.configuration;
+
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.codehaus.plexus.PlexusTestCase;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author Edwin Punzalan
+ */
+public class MavenProxyPropertyLoaderTest
+ extends PlexusTestCase
+{
+ private static final int DEFAULT_CACHE_PERIOD = 3600;
+
+ private MavenProxyPropertyLoader loader;
+
+ public void testLoadValidMavenProxyConfiguration()
+ throws IOException, InvalidConfigurationException
+ {
+ File confFile = getTestFile( "src/test/conf/maven-proxy-complete.conf" );
+
+ Configuration configuration = new Configuration();
+ Proxy proxy = new Proxy();
+ proxy.setHost( "original-host" );
+ configuration.setProxy( proxy ); // overwritten
+ configuration.setIndexPath( "index-path" ); // existing value
+
+ loader.load( new FileInputStream( confFile ), configuration );
+
+ List list = configuration.getRepositories();
+ assertEquals( "check single managed repository", 1, list.size() );
+ RepositoryConfiguration managedRepository = (RepositoryConfiguration) list.iterator().next();
+ assertEquals( "cache path changed", "target", managedRepository.getDirectory() );
+
+ assertEquals( "Count repositories", 4, configuration.getProxiedRepositories().size() );
+
+ list = configuration.getProxiedRepositories();
+ ProxiedRepositoryConfiguration repo = (ProxiedRepositoryConfiguration) list.get( 0 );
+ assertEquals( "Repository name not as expected", "local-repo", repo.getId() );
+ assertEquals( "Repository url does not match its name", "file://target", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", 0, repo.getSnapshotsInterval() );
+ assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
+
+ repo = (ProxiedRepositoryConfiguration) list.get( 1 );
+ assertEquals( "Repository name not as expected", "www-ibiblio-org", repo.getId() );
+ assertEquals( "Repository url does not match its name", "http://www.ibiblio.org/maven2", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getSnapshotsInterval() );
+ assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
+
+ repo = (ProxiedRepositoryConfiguration) list.get( 2 );
+ assertEquals( "Repository name not as expected", "dist-codehaus-org", repo.getId() );
+ assertEquals( "Repository url does not match its name", "http://dist.codehaus.org", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getSnapshotsInterval() );
+ assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
+
+ repo = (ProxiedRepositoryConfiguration) list.get( 3 );
+ assertEquals( "Repository name not as expected", "private-example-com", repo.getId() );
+ assertEquals( "Repository url does not match its name", "http://private.example.com/internal", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getSnapshotsInterval() );
+ assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
+ }
+
+ public void testInvalidConfiguration()
+ {
+ Configuration configuration = new Configuration();
+ try
+ {
+ loader.load( new Properties(), configuration );
+ fail( "Incomplete config should have failed" );
+ }
+ catch ( InvalidConfigurationException e )
+ {
+ assertTrue( true );
+ }
+ }
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+ loader = new MavenProxyPropertyLoader();
+ }
+}
diff --git a/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml b/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml
index 64a1849a3..80e47dc0c 100644
--- a/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml
+++ b/archiva-configuration/src/test/resources/org/apache/maven/archiva/configuration/ConfigurationStoreTest.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
@@ -5,7 +6,7 @@
~ 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
+ ~ 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,