Author: jvanzyl
Date: Sat Mar 10 07:37:15 2007
New Revision: 516732

URL: http://svn.apache.org/viewvc?view=rev&rev=516732
Log:
missing files

Added:
    
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java
   (with props)
    
maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
   (with props)

Added: 
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java?view=auto&rev=516732
==============================================================================
--- 
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java
 (added)
+++ 
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java
 Sat Mar 10 07:37:15 2007
@@ -0,0 +1,60 @@
+package org.apache.maven.artifact.manager;
+
+/*
+ * 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.maven.wagon.TransferFailedException;
+
+
+public class WagonConfigurationException
+    extends TransferFailedException
+{
+    
+    static final long serialVersionUID = 1;
+
+    private final String originalMessage;
+    private final String repositoryId;
+
+    public WagonConfigurationException( String repositoryId, String message, 
Throwable cause )
+    {
+        super( "While configuring wagon for \'" + repositoryId + "\': " + 
message, cause );
+        
+        this.repositoryId = repositoryId;
+        this.originalMessage = message;
+    }
+
+    public WagonConfigurationException( String repositoryId, String message )
+    {
+        super( "While configuring wagon for \'" + repositoryId + "\': " + 
message );
+        
+        this.repositoryId = repositoryId;
+        this.originalMessage = message;
+    }
+    
+    public final String getRepositoryId()
+    {
+        return repositoryId;
+    }
+    
+    public final String getOriginalMessage()
+    {
+        return originalMessage;
+    }
+
+}

Propchange: 
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: 
maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java?view=auto&rev=516732
==============================================================================
--- 
maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
 (added)
+++ 
maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
 Sat Mar 10 07:37:15 2007
@@ -0,0 +1,150 @@
+package org.apache.maven.artifact.manager;
+
+/*
+ * 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.maven.wagon.UnsupportedProtocolException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.repository.Repository;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * @author <a href="[EMAIL PROTECTED]">Michal Maczka</a>
+ * @version $Id$
+ */
+public class DefaultWagonManagerTest
+    extends PlexusTestCase
+{
+
+    private WagonManager wagonManager;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        wagonManager = (WagonManager) lookup( WagonManager.ROLE );
+    }
+
+    public void testDefaultWagonManager()
+        throws Exception
+    {
+        assertWagon( "a" );
+
+        assertWagon( "b1" );
+
+        assertWagon( "b2" );
+
+        assertWagon( "c" );
+
+        try
+        {
+            assertWagon( "d" );
+
+            fail( "Expected :" + UnsupportedProtocolException.class.getName() 
);
+        }
+        catch ( UnsupportedProtocolException e )
+        {
+            //ok
+            assertTrue( true );
+        }
+    }
+
+    public void testGetWagonRepository()
+        throws Exception
+    {
+        assertWagonRepository( "a" );
+
+        assertWagonRepository( "b1" );
+
+        assertWagonRepository( "b2" );
+
+        assertWagonRepository( "c" );
+
+        try
+        {
+            assertWagonRepository( "d" );
+
+            fail( "Expected :" + UnsupportedProtocolException.class.getName() 
);
+        }
+        catch ( UnsupportedProtocolException e )
+        {
+            //ok
+            assertTrue( true );
+        }
+    }
+
+    public void testGetWagonRepositoryNullProtocol()
+        throws Exception
+    {
+        try
+        {
+            Repository repository = new Repository();
+
+            repository.setProtocol( null );
+
+            Wagon wagon = (Wagon) wagonManager.getWagon( repository );
+
+            fail( "Expected :" + UnsupportedProtocolException.class.getName() 
);
+        }
+        catch ( UnsupportedProtocolException e )
+        {
+            //ok
+            assertTrue( true );
+        }
+    }
+
+    private void assertWagon( String protocol )
+        throws Exception
+    {
+        Wagon wagon = wagonManager.getWagon( protocol );
+
+        assertNotNull( "Check wagon, protocol=" + protocol, wagon );
+    }
+
+    private void assertWagonRepository( String protocol )
+        throws Exception
+    {
+        Repository repository = new Repository();
+
+        String s = "value=" + protocol;
+
+        repository.setId( "id=" + protocol );
+
+        repository.setProtocol( protocol );
+
+        Xpp3Dom conf = new Xpp3Dom( "configuration" );
+
+        Xpp3Dom configurableField = new Xpp3Dom( "configurableField" );
+
+        configurableField.setValue( s );
+
+        conf.addChild( configurableField );
+
+        wagonManager.addConfiguration( repository.getId(), conf );
+
+        WagonMock wagon = (WagonMock) wagonManager.getWagon( repository );
+
+        assertNotNull( "Check wagon, protocol=" + protocol, wagon );
+
+        assertEquals( "Check configuration for wagon, protocol=" + protocol, 
s, wagon.getConfigurableField() );
+    }
+
+}

Propchange: 
maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/trunk/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"


Reply via email to