You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by jo...@apache.org on 2007/02/08 01:09:04 UTC
svn commit: r504749 [2/3] - in /maven/wagon/trunk: ./ wagon-manager/
wagon-manager/src/ wagon-manager/src/main/ wagon-manager/src/main/java/
wagon-manager/src/main/java/org/ wagon-manager/src/main/java/org/apache/
wagon-manager/src/main/java/org/apache...
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java Wed Feb 7 16:08:59 2007
@@ -29,6 +29,7 @@
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.resource.Resource;
import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.io.FileInputStream;
@@ -51,7 +52,7 @@
public abstract class AbstractWagon
implements Wagon
{
- protected static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+ protected static final int DEFAULT_BUFFER_SIZE = 1024 * 32;
protected Repository repository;
@@ -64,6 +65,8 @@
protected AuthenticationInfo authenticationInfo;
protected boolean interactive = true;
+
+ private boolean connected = false;
// ----------------------------------------------------------------------
// Accessors
@@ -74,75 +77,127 @@
return repository;
}
+ public void setRepository( Repository repository )
+ {
+ this.repository = repository;
+ }
+
public ProxyInfo getProxyInfo()
{
return proxyInfo;
}
- public AuthenticationInfo getAuthenticationInfo()
+ public void setProxyInfo( ProxyInfo proxyInfo )
{
- return authenticationInfo;
+ this.proxyInfo = proxyInfo;
}
- // ----------------------------------------------------------------------
- // Connection
- // ----------------------------------------------------------------------
-
- public void connect( Repository repository )
- throws ConnectionException, AuthenticationException
+ public AuthenticationInfo getAuthenticationInfo()
{
- connect( repository, null, null );
+ if ( authenticationInfo == null )
+ {
+ authenticationInfo = new AuthenticationInfo();
+ }
+ return authenticationInfo;
}
- public void connect( Repository repository, ProxyInfo proxyInfo )
- throws ConnectionException, AuthenticationException
+ public void setAuthenticationInfo( AuthenticationInfo authnInfo )
{
- connect( repository, null, proxyInfo );
+ this.authenticationInfo = authnInfo;
}
-
- public void connect( Repository repository, AuthenticationInfo authenticationInfo )
- throws ConnectionException, AuthenticationException
+
+ public boolean isConnected()
{
- connect( repository, authenticationInfo, null );
+ return this.connected;
}
- public void connect( Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
+ // ----------------------------------------------------------------------
+ // Connection
+ // ----------------------------------------------------------------------
+
+ /**
+ * Handle the protocol specific connection opening process.
+ *
+ * Note: Providers should look for the values in {@link #getRepository()}, {@link #getAuthenticationInfo()}, and
+ * {@link #getProxyInfo()} to properly establish their connection.
+ *
+ * @throws ConnectionException
+ * @throws AuthenticationException
+ */
+ protected abstract void openConnection()
+ throws ConnectionException, AuthenticationException;
+
+ public void connect()
throws ConnectionException, AuthenticationException
{
if ( repository == null )
{
- throw new IllegalStateException( "The repository specified cannot be null." );
+ throw new IllegalStateException( "Cannot open a connection to a null wagon repository." );
}
- this.repository = repository;
-
- if ( authenticationInfo == null )
+ /* Perform some AuthenticationInfo to Wagon URL mappings */
+ if ( getAuthenticationInfo() != null )
{
- authenticationInfo = new AuthenticationInfo();
- }
-
- if ( authenticationInfo.getUserName() == null )
- {
- // Get user/pass that were encoded in the URL.
- if ( repository.getUsername() != null )
+ if ( !StringUtils.isEmpty( getAuthenticationInfo().getUserName() ) )
{
- authenticationInfo.setUserName( repository.getUsername() );
- if ( repository.getPassword() != null && authenticationInfo.getPassword() == null )
+ // Get user/pass that were encoded in the URL.
+ if ( !StringUtils.isEmpty( repository.getUsername() ) )
{
- authenticationInfo.setPassword( repository.getPassword() );
+ authenticationInfo.setUserName( repository.getUsername() );
+ if ( repository.getPassword() != null && authenticationInfo.getPassword() == null )
+ {
+ authenticationInfo.setPassword( repository.getPassword() );
+ }
}
}
}
- // TODO: Do these needs to be fields, or are they only used in openConnection()?
- this.authenticationInfo = authenticationInfo;
- this.proxyInfo = proxyInfo;
-
fireSessionOpening();
openConnection();
-
+
fireSessionOpened();
+
+ connected = true;
+ }
+
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()}
+ */
+ public void connect( Repository repository )
+ throws ConnectionException, AuthenticationException
+ {
+ connect();
+ }
+
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()} and
+ * {@link #getProxyInfo()}
+ */
+ public void connect( Repository repository, ProxyInfo proxyInfo )
+ throws ConnectionException, AuthenticationException
+ {
+ connect();
+ }
+
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()} and
+ * {@link #getAuthenticationInfo()}
+ */
+ public void connect( Repository repository, AuthenticationInfo authenticationInfo )
+ throws ConnectionException, AuthenticationException
+ {
+ connect();
+ }
+
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()} and
+ * {@link #getAuthenticationInfo()} and {@link #getProxyInfo()}
+ */
+ public void connect( Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
+ throws ConnectionException, AuthenticationException
+ {
+ connect();
}
public void disconnect()
@@ -153,6 +208,8 @@
closeConnection();
fireSessionDisconnected();
+
+ connected = false;
}
protected abstract void closeConnection()
@@ -166,8 +223,8 @@
{
if ( !destinationDirectory.mkdirs() )
{
- throw new TransferFailedException(
- "Specified destination directory cannot be created: " + destinationDirectory );
+ throw new TransferFailedException( "Specified destination directory cannot be created: "
+ + destinationDirectory );
}
}
}
@@ -182,8 +239,7 @@
getTransfer( resource, destination, input, true, Integer.MAX_VALUE );
}
- protected void getTransfer( Resource resource, File destination, InputStream input, boolean closeInput,
- int maxSize )
+ protected void getTransfer( Resource resource, File destination, InputStream input, boolean closeInput, int maxSize )
throws TransferFailedException
{
// ensure that the destination is created only when we are ready to transfer
@@ -321,7 +377,7 @@
{
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_PROGRESS, requestType );
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_PROGRESS, requestType );
int remaining = maxSize;
while ( remaining > 0 )
@@ -354,7 +410,7 @@
{
long timestamp = System.currentTimeMillis();
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_COMPLETED,
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_GET );
transferEvent.setTimestamp( timestamp );
@@ -368,7 +424,7 @@
{
long timestamp = System.currentTimeMillis();
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_STARTED,
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_STARTED,
TransferEvent.REQUEST_GET );
transferEvent.setTimestamp( timestamp );
@@ -382,7 +438,7 @@
{
long timestamp = System.currentTimeMillis();
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_INITIATED,
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_INITIATED,
TransferEvent.REQUEST_GET );
transferEvent.setTimestamp( timestamp );
@@ -396,7 +452,7 @@
{
long timestamp = System.currentTimeMillis();
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_INITIATED,
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_INITIATED,
TransferEvent.REQUEST_PUT );
transferEvent.setTimestamp( timestamp );
@@ -410,7 +466,7 @@
{
long timestamp = System.currentTimeMillis();
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_COMPLETED,
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_PUT );
transferEvent.setTimestamp( timestamp );
@@ -424,7 +480,7 @@
{
long timestamp = System.currentTimeMillis();
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_STARTED,
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_STARTED,
TransferEvent.REQUEST_PUT );
transferEvent.setTimestamp( timestamp );
@@ -438,7 +494,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_DISCONNECTED );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_DISCONNECTED );
sessionEvent.setTimestamp( timestamp );
@@ -449,7 +505,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_DISCONNECTING );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_DISCONNECTING );
sessionEvent.setTimestamp( timestamp );
@@ -460,7 +516,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_LOGGED_IN );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_LOGGED_IN );
sessionEvent.setTimestamp( timestamp );
@@ -471,7 +527,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_LOGGED_OFF );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_LOGGED_OFF );
sessionEvent.setTimestamp( timestamp );
@@ -482,7 +538,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_OPENED );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_OPENED );
sessionEvent.setTimestamp( timestamp );
@@ -493,7 +549,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_OPENING );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_OPENING );
sessionEvent.setTimestamp( timestamp );
@@ -505,7 +561,7 @@
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, SessionEvent.SESSION_CONNECTION_REFUSED );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, SessionEvent.SESSION_CONNECTION_REFUSED );
sessionEvent.setTimestamp( timestamp );
@@ -516,7 +572,7 @@
{
long timestamp = System.currentTimeMillis();
- SessionEvent sessionEvent = new SessionEvent( this, exception );
+ SessionEvent sessionEvent = new SessionEvent( this, this.repository, exception );
sessionEvent.setTimestamp( timestamp );
@@ -566,12 +622,11 @@
protected void fireTransferError( Resource resource, Exception e, int requestType )
{
- TransferEvent transferEvent = new TransferEvent( this, resource, e, requestType );
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, e, requestType );
transferEventSupport.fireTransferError( transferEvent );
}
-
public SessionEventSupport getSessionEventSupport()
{
return sessionEventSupport;
@@ -601,7 +656,7 @@
{
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
- TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_PROGRESS, requestType );
+ TransferEvent transferEvent = new TransferEvent( this, repository, resource, TransferEvent.TRANSFER_PROGRESS, requestType );
try
{
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/Wagon.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
package org.apache.maven.wagon;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.authentication.AuthenticationException;
@@ -88,7 +91,7 @@
*/
void putDirectory( File sourceDirectory, String destinationDirectory )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
-
+
/**
* Check if a remote resource exists
*
@@ -99,7 +102,7 @@
*/
boolean resourceExists( String resourceName )
throws TransferFailedException, AuthorizationException;
-
+
/**
* <p>
* Returns a {@link List} of strings naming the files and directories in the directory denoted by
@@ -125,35 +128,97 @@
* @throws AuthorizationException if not authorized to list the contents of the directory
*/
List getFileList( String destinationDirectory )
- throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException;
+
+ // ----------------------------------------------------------------------
+ // Settings / Configuration
+ // ----------------------------------------------------------------------
+
+ /**
+ * Get the protocol for this wagon.
+ *
+ * NOTE: This requires that the wagon only support 1 protocol.
+ *
+ * @return the protocol supported by this wagon.
+ */
+ String getProtocol();
/**
+ * Flag indicating if this wagon supports directory copy operations.
*
* @return whether if this wagon supports directory operations
*/
boolean supportsDirectoryCopy();
+ boolean isInteractive();
+
+ void setInteractive( boolean interactive );
+
Repository getRepository();
+
+ void setRepository( Repository repository );
+
+ AuthenticationInfo getAuthenticationInfo();
+
+ void setAuthenticationInfo( AuthenticationInfo authnInfo );
+
+ ProxyInfo getProxyInfo();
+
+ void setProxyInfo( ProxyInfo proxyInfo );
// ----------------------------------------------------------------------
// Connection/Disconnection
// ----------------------------------------------------------------------
+ /**
+ * Initiate the connection to the Repository.
+ *
+ * @see #getAuthenticationInfo()
+ * @see #getProxyInfo()
+ * @see #getRepository()
+ */
+ void connect()
+ throws ConnectionException, AuthenticationException;
+
+ /**
+ * Flag indicating if the wagon is currently connected (or not)
+ *
+ * @return true if wagon is currently connected.
+ */
+ boolean isConnected();
+
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()}
+ */
void connect( Repository source )
throws ConnectionException, AuthenticationException;
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()} and
+ * {@link #getProxyInfo()}
+ */
void connect( Repository source, ProxyInfo proxyInfo )
throws ConnectionException, AuthenticationException;
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()} and
+ * {@link #getAuthenticationInfo()}
+ */
void connect( Repository source, AuthenticationInfo authenticationInfo )
throws ConnectionException, AuthenticationException;
+ /**
+ * @deprecated Replaced by calls to {@link #connect()}, uses {@link #getRepository()} and
+ * {@link #getAuthenticationInfo()} and {@link #getProxyInfo()}
+ */
void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
throws ConnectionException, AuthenticationException;
- void openConnection()
- throws ConnectionException, AuthenticationException;
-
+ /**
+ * Close the connection.
+ *
+ * @throws ConnectionException
+ */
void disconnect()
throws ConnectionException;
@@ -177,7 +242,4 @@
boolean hasTransferListener( TransferListener listener );
- boolean isInteractive();
-
- void setInteractive( boolean interactive );
}
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEvent.java Wed Feb 7 16:08:59 2007
@@ -17,6 +17,7 @@
*/
import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.repository.Repository;
/**
* SessionEvent is used for notifing SessionListeners about
@@ -95,25 +96,26 @@
/**
* Creates new instance of SessionEvent
*
- * @param wagon <code>Wagon<code> object which created this event
+ * @param wagon <code>Wagon</code> object which created this event
+ * @param repository <code>Repository</code> object that this event belongs to.
* @param eventType the type of the event
*/
- public SessionEvent( final Wagon wagon, final int eventType )
+ public SessionEvent( final Wagon wagon, final Repository repository, final int eventType )
{
- super( wagon );
+ super( wagon, repository );
this.eventType = eventType;
-
}
/**
* Creates new instance of SessionEvent. Sets event type to <code>SESSION_ERROR_OCCURRED</code>
*
- * @param wagon <code>Wagon<code> object which created this event
+ * @param wagon <code>Wagon</code> object which created this event
+ * @param repository <code>Repository</code> object that this event belongs to.
* @param exception the exception
*/
- public SessionEvent( final Wagon wagon, final Exception exception )
+ public SessionEvent( final Wagon wagon, final Repository repository, final Exception exception )
{
- super( wagon );
+ super( wagon, repository );
this.exception = exception;
this.eventType = SESSION_ERROR_OCCURRED;
@@ -161,7 +163,7 @@
break;
case SessionEvent.SESSION_CONNECTION_REFUSED:
break;
- default :
+ default:
throw new IllegalArgumentException( "Illegal event type: " + eventType );
}
this.eventType = eventType;
@@ -175,4 +177,58 @@
this.exception = exception;
}
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( "SessionEvent[" );
+
+ switch ( this.eventType )
+ {
+ case SessionEvent.SESSION_CLOSED:
+ sb.append( "CONNECTION_CLOSED" );
+ break;
+ case SessionEvent.SESSION_DISCONNECTED:
+ sb.append( "CONNECTION_DISCONNECTED" );
+ break;
+ case SessionEvent.SESSION_DISCONNECTING:
+ sb.append( "CONNECTION_DISCONNECTING" );
+ break;
+ case SessionEvent.SESSION_ERROR_OCCURRED:
+ sb.append( "CONNECTION_ERROR_OCCURRED" );
+ break;
+ case SessionEvent.SESSION_LOGGED_IN:
+ sb.append( "CONNECTION_LOGGED_IN" );
+ break;
+ case SessionEvent.SESSION_LOGGED_OFF:
+ sb.append( "CONNECTION_LOGGED_OFF" );
+ break;
+ case SessionEvent.SESSION_OPENED:
+ sb.append( "CONNECTION_OPENED" );
+ break;
+ case SessionEvent.SESSION_OPENING:
+ sb.append( "CONNECTION_OPENING" );
+ break;
+ case SessionEvent.SESSION_CONNECTION_REFUSED:
+ sb.append( "CONNECTION_CONNECTION_REFUSED" );
+ break;
+ default:
+ sb.append( eventType );
+ }
+ sb.append( "|" );
+
+ sb.append( this.repository ).append( "|" );
+ sb.append( this.source );
+
+ if ( exception != null )
+ {
+ sb.append( "|" );
+ sb.append( exception.getClass().getName() ).append( ":" );
+ sb.append( exception.getMessage() );
+ }
+
+ sb.append( "]" );
+
+ return sb.toString();
+ }
}
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/SessionEventSupport.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
package org.apache.maven.wagon.events;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 java.util.ArrayList;
@@ -46,7 +49,10 @@
*/
public void addSessionListener( final SessionListener listener )
{
- listeners.add( listener );
+ if ( listener != null )
+ {
+ listeners.add( listener );
+ }
}
/**
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java Wed Feb 7 16:08:59 2007
@@ -17,6 +17,7 @@
*/
import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.resource.Resource;
import java.io.File;
@@ -77,9 +78,16 @@
private File localFile;
- public TransferEvent( final Wagon wagon, final Resource resource, final int eventType, final int requestType )
+ public TransferEvent( final Wagon wagon, final Repository repository, final Resource resource, final Exception exception, final int requestType )
{
- super( wagon );
+ this( wagon, repository, resource, TRANSFER_ERROR, requestType );
+
+ this.exception = exception;
+ }
+
+ public TransferEvent( final Wagon wagon, final Repository repository, final Resource resource, final int eventType, final int requestType )
+ {
+ super( wagon, repository );
this.resource = resource;
@@ -89,13 +97,6 @@
}
- public TransferEvent( final Wagon wagon, final Resource resource, final Exception exception, final int requestType )
- {
- this( wagon, resource, TRANSFER_ERROR, requestType );
-
- this.exception = exception;
- }
-
/**
* @return Returns the resource.
*/
@@ -141,7 +142,7 @@
case REQUEST_GET:
break;
- default :
+ default:
throw new IllegalArgumentException( "Illegal request type: " + requestType );
}
@@ -174,7 +175,7 @@
break;
case TRANSFER_ERROR:
break;
- default :
+ default:
throw new IllegalArgumentException( "Illegal event type: " + eventType );
}
@@ -203,5 +204,57 @@
public void setLocalFile( File localFile )
{
this.localFile = localFile;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( "TransferEvent[" );
+
+ switch ( this.getRequestType() )
+ {
+ case REQUEST_GET:
+ sb.append( "GET" );
+ break;
+ case REQUEST_PUT:
+ sb.append( "PUT" );
+ break;
+ default:
+ sb.append( this.getRequestType() );
+ break;
+ }
+
+ sb.append( "|" );
+ switch ( this.getEventType() )
+ {
+ case TRANSFER_COMPLETED:
+ sb.append( "COMPLETED" );
+ break;
+ case TRANSFER_ERROR:
+ sb.append( "ERROR" );
+ break;
+ case TRANSFER_INITIATED:
+ sb.append( "INITIATED" );
+ break;
+ case TRANSFER_PROGRESS:
+ sb.append( "PROGRESS" );
+ break;
+ case TRANSFER_STARTED:
+ sb.append( "STARTED" );
+ break;
+ default:
+ sb.append( this.getEventType() );
+ break;
+ }
+
+ sb.append( "|" );
+
+ sb.append( this.repository ).append( "|" );
+ sb.append( this.getLocalFile() ).append( "|" );
+ sb.append( this.getResource() );
+ sb.append( "]" );
+
+ return sb.toString();
}
}
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEventSupport.java Wed Feb 7 16:08:59 2007
@@ -48,7 +48,10 @@
*/
public void addTransferListener( final TransferListener listener )
{
- listeners.add( listener );
+ if ( listener != null )
+ {
+ listeners.add( listener );
+ }
}
/**
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/WagonEvent.java Wed Feb 7 16:08:59 2007
@@ -44,9 +44,10 @@
/**
* @param source The Wagon object on which the WagonEvent initially occurred
*/
- public WagonEvent( final Wagon source )
+ public WagonEvent( final Wagon source, final Repository repository )
{
super( source );
+ this.repository = repository;
}
/**
@@ -79,4 +80,13 @@
this.timestamp = timestamp;
}
+ /**
+ * Returns the repository which this event is associated with.
+ *
+ * @return the repository that this event is associated with.
+ */
+ public Repository getRepository()
+ {
+ return repository;
+ }
}
Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java Wed Feb 7 16:08:59 2007
@@ -1,23 +1,27 @@
package org.apache.maven.wagon.repository;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.PathUtils;
import org.apache.maven.wagon.WagonConstants;
+import org.codehaus.plexus.util.StringUtils;
import java.io.Serializable;
import java.util.Properties;
@@ -194,12 +198,19 @@
public String toString()
{
- if ( getName() != null )
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( "Repository[" );
+
+ if ( StringUtils.isNotEmpty( getName() ) )
{
- return "[" + getName() + "] -> " + getUrl();
+ sb.append( getName() ).append( "|" );
}
- return getUrl();
+ sb.append( getUrl() );
+ sb.append( "]" );
+
+ return sb.toString();
}
public String getProtocol()
Modified: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/WagonMock.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/WagonMock.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/WagonMock.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/WagonMock.java Wed Feb 7 16:08:59 2007
@@ -34,6 +34,8 @@
extends StreamWagon
{
private boolean errorInputStream;
+
+ private String protocol;
public WagonMock()
{
@@ -120,4 +122,13 @@
return false;
}
+ public String getProtocol()
+ {
+ return protocol;
+ }
+
+ public void setProtocol( String protocol )
+ {
+ this.protocol = protocol;
+ }
}
Modified: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java Wed Feb 7 16:08:59 2007
@@ -1,24 +1,28 @@
package org.apache.maven.wagon.events;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 junit.framework.TestCase;
import org.apache.maven.wagon.WagonMock;
import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.repository.Repository;
/**
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
@@ -83,8 +87,9 @@
eventSupport.addSessionListener( mock2 );
final Wagon wagon = new WagonMock();
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionDisconnected( event );
@@ -110,7 +115,8 @@
final Wagon wagon = new WagonMock();
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionDisconnecting( event );
@@ -135,7 +141,8 @@
final Wagon wagon = new WagonMock();
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionLoggedIn( event );
@@ -161,7 +168,8 @@
final Wagon wagon = new WagonMock();
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionLoggedOff( event );
@@ -187,7 +195,8 @@
final Wagon wagon = new WagonMock();
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionOpened( event );
@@ -214,7 +223,8 @@
final Wagon wagon = new WagonMock();
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionOpening( event );
@@ -240,7 +250,8 @@
final Wagon wagon = new WagonMock();
- final SessionEvent event = new SessionEvent( wagon, 1 );
+ final Repository repository = new Repository( "test", "http://localhost:10007/" );
+ final SessionEvent event = new SessionEvent( wagon, repository, 1 );
eventSupport.fireSessionConnectionRefused( event );
Modified: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
package org.apache.maven.wagon.events;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 junit.framework.TestCase;
@@ -60,20 +63,21 @@
final Wagon wagon = new WagonMock();
final Repository repo = new Repository();
+ wagon.setRepository( repo );
- wagon.connect( repo );
+ wagon.connect();
final long timestamp = System.currentTimeMillis();
final Exception exception = new AuthenticationException( "dummy" );
- SessionEvent event = new SessionEvent( wagon, SessionEvent.SESSION_CLOSED );
+ SessionEvent event = new SessionEvent( wagon, repo, SessionEvent.SESSION_CLOSED );
assertEquals( wagon, event.getWagon() );
assertEquals( repo, event.getWagon().getRepository() );
assertEquals( SessionEvent.SESSION_CLOSED, event.getEventType() );
- event = new SessionEvent( wagon, exception );
+ event = new SessionEvent( wagon, repo, exception );
assertEquals( wagon, event.getWagon() );
assertEquals( repo, event.getWagon().getRepository() );
Modified: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java Wed Feb 7 16:08:59 2007
@@ -189,7 +189,7 @@
private TransferEvent getEvent( final Wagon wagon )
{
- final TransferEvent event = new TransferEvent( wagon, null, TransferEvent.TRANSFER_COMPLETED,
+ final TransferEvent event = new TransferEvent( wagon, null, null, TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_GET );
return event;
}
Modified: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java Wed Feb 7 16:08:59 2007
@@ -59,7 +59,8 @@
final Repository repo = new Repository();
- wagon.connect( repo );
+ wagon.setRepository( repo );
+ wagon.connect();
final long timestamp = System.currentTimeMillis();
@@ -69,7 +70,7 @@
resource.setName( "mm" );
- TransferEvent event = new TransferEvent( wagon, resource, TransferEvent.TRANSFER_COMPLETED,
+ TransferEvent event = new TransferEvent( wagon, repo, resource, TransferEvent.TRANSFER_COMPLETED,
TransferEvent.REQUEST_GET );
assertEquals( wagon, event.getWagon() );
@@ -86,7 +87,7 @@
res.setName( "mm" );
- event = new TransferEvent( wagon, res, exception, TransferEvent.REQUEST_GET );
+ event = new TransferEvent( wagon, repo, res, exception, TransferEvent.REQUEST_GET );
assertEquals( wagon, event.getWagon() );
Modified: maven/wagon/trunk/wagon-provider-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/pom.xml?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-test/pom.xml (original)
+++ maven/wagon/trunk/wagon-provider-test/pom.xml Wed Feb 7 16:08:59 2007
@@ -14,12 +14,18 @@
<artifactId>junit</artifactId>
</dependency>
<dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>4.2.12</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
+ <scope>compile</scope>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Modified: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java (original)
+++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
package org.apache.maven.wagon;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.authentication.AuthenticationInfo;
@@ -165,6 +168,9 @@
throws Exception
{
Wagon wagon = (Wagon) lookup( Wagon.ROLE, getProtocol() );
+
+ wagon.setRepository( testRepository );
+ wagon.setAuthenticationInfo( getAuthInfo() );
Debug debug = new Debug();
@@ -217,7 +223,7 @@
writeTestFile( "c/test-resource-4.txt" );
writeTestFile( "d/e/f/test-resource-5.txt" );
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
wagon.putDirectory( sourceFile, "directory-copy" );
@@ -265,7 +271,7 @@
writeTestFile( "c/test-resource-4.txt" );
writeTestFile( "d/e/f/test-resource-5.txt" );
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
wagon.putDirectory( sourceFile, "deep0/deep1/deep2" );
@@ -320,7 +326,7 @@
writeTestFile( resources[i] );
}
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
wagon.putDirectory( sourceFile, dirName );
@@ -353,7 +359,7 @@
{
writeTestFile( resourceToCreate );
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
wagon.putDirectory( sourceFile, dirName );
@@ -423,10 +429,10 @@
message( "Getting test artifact from test repository " + testRepository );
Wagon wagon = getWagon();
-
+
wagon.addTransferListener( checksumObserver );
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
destFile = FileTestUtils.createUniqueFile( getName(), getName() );
@@ -477,7 +483,7 @@
Wagon wagon = getWagon();
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
List list = wagon.getFileList( dirName );
assertNotNull( "file list should not be null.", list );
@@ -511,7 +517,7 @@
Wagon wagon = getWagon();
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
try
{
@@ -547,7 +553,7 @@
putFile();
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
assertTrue( sourceFile.getName() + " does not exist", wagon.resourceExists( sourceFile.getName() ) );
@@ -571,7 +577,7 @@
Wagon wagon = getWagon();
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
assertFalse( wagon.resourceExists( "a/bad/resource/name/that/should/not/exist.txt" ) );
@@ -596,7 +602,7 @@
wagon.addTransferListener( checksumObserver );
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
sourceFile = new File( FileTestUtils.getTestOutputDir(), testFileName );
sourceFile.getParentFile().mkdirs();
@@ -624,7 +630,7 @@
wagon.addTransferListener( checksumObserver );
- wagon.connect( testRepository, getAuthInfo() );
+ wagon.connect();
destFile = FileTestUtils.createUniqueFile( getName(), getName() );
Copied: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Context.java (from r503909, maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/Context.java)
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Context.java?view=diff&rev=504749&p1=maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/Context.java&r1=503909&p2=maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Context.java&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/Context.java (original)
+++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Context.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
-package org.apache.maven.wagon.providers.webdav;
+package org.apache.maven.wagon.servlet;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 java.util.List;
Copied: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Servlet.java (from r503909, maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/Servlet.java)
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Servlet.java?view=diff&rev=504749&p1=maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/Servlet.java&r1=503909&p2=maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Servlet.java&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/Servlet.java (original)
+++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/Servlet.java Wed Feb 7 16:08:59 2007
@@ -1,22 +1,25 @@
-package org.apache.maven.wagon.providers.webdav;
-
-import java.util.Properties;
+package org.apache.maven.wagon.servlet;
/*
- * Copyright 2001-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
+ * 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
+ * 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.
+ * 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 java.util.Properties;
/**
* Servlet
Copied: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/ServletServer.java (from r503909, maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/ServletServer.java)
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/ServletServer.java?view=diff&rev=504749&p1=maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/ServletServer.java&r1=503909&p2=maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/ServletServer.java&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-webdav/src/test/java/org/apache/maven/wagon/providers/webdav/ServletServer.java (original)
+++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/servlet/ServletServer.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
-package org.apache.maven.wagon.providers.webdav;
+package org.apache.maven.wagon.servlet;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 java.util.Iterator;
Modified: maven/wagon/trunk/wagon-providers/pom.xml
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/pom.xml?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/pom.xml Wed Feb 7 16:08:59 2007
@@ -40,12 +40,12 @@
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-provider-test</artifactId>
- <scope>test</scope>
+ <artifactId>wagon-provider-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-provider-api</artifactId>
+ <artifactId>wagon-provider-test</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
</project>
Modified: maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java Wed Feb 7 16:08:59 2007
@@ -53,6 +53,11 @@
public class FileWagon
extends StreamWagon
{
+ public String getProtocol()
+ {
+ return "file";
+ }
+
public void fillInputData( InputData inputData )
throws TransferFailedException, ResourceDoesNotExistException
{
Modified: maven/wagon/trunk/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java Wed Feb 7 16:08:59 2007
@@ -63,6 +63,7 @@
Resource resource = new Resource();
resource.setContentLength( 100000 );
Repository repository = new Repository();
- wagon.connect( repository );
+ wagon.setRepository( repository );
+ wagon.connect();
}
}
Propchange: maven/wagon/trunk/wagon-providers/wagon-ftp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Feb 7 16:08:59 2007
@@ -1,11 +1,14 @@
-*.log
target
-.classpath
-.project
-default.lst
-test.out
-default.ajsym
-*.iml
+*~
+.*.swp
+*.log
+*.patch
+*.diff
*.ipr
*.iws
+*.iml
+.classpath
+.project
+.settings
+.wtpmodules
cobertura.ser
Modified: maven/wagon/trunk/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java Wed Feb 7 16:08:59 2007
@@ -59,6 +59,11 @@
extends StreamWagon
{
private FTPClient ftp;
+
+ public String getProtocol()
+ {
+ return "ftp";
+ }
public void openConnection()
throws ConnectionException, AuthenticationException
Modified: maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java Wed Feb 7 16:08:59 2007
@@ -68,6 +68,11 @@
* @component.configuration default="false"
*/
private boolean useCache;
+
+ public String getProtocol()
+ {
+ return "http";
+ }
public void fillInputData( InputData inputData )
throws TransferFailedException, ResourceDoesNotExistException
Modified: maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagon.java Wed Feb 7 16:08:59 2007
@@ -1,9 +1,5 @@
package org.apache.maven.wagon.providers.http;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -23,6 +19,10 @@
* under the License.
*/
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.proxy.ProxyInfo;
+
/**
* LIghtweightHttpsWagon
*
@@ -39,10 +39,15 @@
private String previousHttpsProxyHost;
private String previousHttpsProxyPort;
-
+
public LightweightHttpsWagon()
{
super();
+ }
+
+ public String getProtocol()
+ {
+ return "https";
}
public void openConnection()
Modified: maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonGzipTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonGzipTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonGzipTest.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonGzipTest.java Wed Feb 7 16:08:59 2007
@@ -33,77 +33,80 @@
import junit.framework.TestCase;
-public class LightweightHttpWagonGzipTest extends TestCase
+public class LightweightHttpWagonGzipTest
+ extends TestCase
{
- public void testGzipGet() throws Exception
+ public void testGzipGet()
+ throws Exception
{
HttpServer server = new HttpServer();
SocketListener listener = new SocketListener();
- listener.setPort(10008);
- server.addListener(listener);
+ listener.setPort( 10008 );
+ server.addListener( listener );
String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
HttpContext context = new HttpContext();
- context.setContextPath("/");
- context.setResourceBase(localRepositoryPath);
+ context.setContextPath( "/" );
+ context.setResourceBase( localRepositoryPath );
ResourceHandler rh = new ResourceHandler();
- rh.setMinGzipLength(1);
- context.addHandler(rh);
- server.addContext(context);
+ rh.setMinGzipLength( 1 );
+ context.addHandler( rh );
+ server.addContext( context );
server.start();
- try
+ try
{
Wagon wagon = new LightweightHttpWagon();
- Repository testRepository = new Repository();
+ Repository testRepository = new Repository( "testrepo", "http://localhost:10008" );
- testRepository.setUrl("http://localhost:10008");
+ wagon.setRepository( testRepository );
- File sourceFile = new File(localRepositoryPath + "/gzip");
+ File sourceFile = new File( localRepositoryPath + "/gzip" );
sourceFile.deleteOnExit();
String resName = "gzip-res.txt";
- String sourceContent = writeTestFileGzip(sourceFile, resName);
+ String sourceContent = writeTestFileGzip( sourceFile, resName );
- wagon.connect(testRepository);
+ wagon.connect();
- File destFile = FileTestUtils.createUniqueFile(getName(), getName());
+ File destFile = FileTestUtils.createUniqueFile( getName(), getName() );
destFile.deleteOnExit();
- wagon.get("gzip/" + resName, destFile);
+ wagon.get( "gzip/" + resName, destFile );
wagon.disconnect();
- String destContent = FileUtils.fileRead(destFile);
+ String destContent = FileUtils.fileRead( destFile );
- assertEquals(sourceContent, destContent);
- }
- finally
+ assertEquals( sourceContent, destContent );
+ }
+ finally
{
server.stop();
}
}
- private String writeTestFileGzip(File parent, String child) throws IOException
+ private String writeTestFileGzip( File parent, String child )
+ throws IOException
{
- File file = new File(parent, child);
+ File file = new File( parent, child );
file.getParentFile().mkdirs();
file.deleteOnExit();
- OutputStream out = new FileOutputStream(file);
- out.write(child.getBytes());
+ OutputStream out = new FileOutputStream( file );
+ out.write( child.getBytes() );
out.close();
-
- file = new File(parent, child + ".gz");
+
+ file = new File( parent, child + ".gz" );
file.deleteOnExit();
- out = new FileOutputStream(file);
- out = new GZIPOutputStream(out);
+ out = new FileOutputStream( file );
+ out = new GZIPOutputStream( out );
//write out different data than non-gz file, so we can
//assert the gz version was returned
String content = file.getAbsolutePath();
- out.write(content.getBytes());
+ out.write( content.getBytes() );
out.close();
return content;
}
Modified: maven/wagon/trunk/wagon-providers/wagon-http/pom.xml
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/pom.xml?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http/pom.xml Wed Feb 7 16:08:59 2007
@@ -37,7 +37,7 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
+ <version>1.0.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
Modified: maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java Wed Feb 7 16:08:59 2007
@@ -74,6 +74,11 @@
private int numberOfAttempts = DEFAULT_NUMBER_OF_ATTEMPTS;
private static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone( "GMT" );
+
+ public String getProtocol()
+ {
+ return "http";
+ }
public void openConnection()
{
@@ -158,7 +163,7 @@
try
{
- InputStream is = new PutInputStream( source, resource, this, getTransferEventSupport() );
+ InputStream is = new PutInputStream( source, repository, resource, this, getTransferEventSupport() );
putMethod.setRequestBody( is );
}
Modified: maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java Wed Feb 7 16:08:59 2007
@@ -22,6 +22,7 @@
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.events.TransferEvent;
import org.apache.maven.wagon.events.TransferEventSupport;
+import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.resource.Resource;
import java.io.File;
@@ -29,7 +30,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
-
/**
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
@@ -37,22 +37,20 @@
public class PutInputStream
extends FileInputStream
{
-
private TransferEventSupport eventSupport;
private TransferEvent event;
- public PutInputStream( File file, Resource resource, Wagon wagon, TransferEventSupport eventSupport )
+ public PutInputStream( File file, Repository repo, Resource resource, Wagon wagon, TransferEventSupport eventSupport )
throws FileNotFoundException
{
super( file );
this.eventSupport = eventSupport;
- event = new TransferEvent( wagon, resource, TransferEvent.TRANSFER_PROGRESS, TransferEvent.REQUEST_PUT );
+ event = new TransferEvent( wagon, repo, resource, TransferEvent.TRANSFER_PROGRESS, TransferEvent.REQUEST_PUT );
event.setLocalFile( file );
-
}
@@ -60,7 +58,6 @@
throws IOException
{
return read( b, 0, b.length );
-
}
public int read()
@@ -69,7 +66,6 @@
byte b[] = new byte[1];
return read( b );
-
}
public int read( byte b[], int off, int len )
Modified: maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonGzipTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonGzipTest.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonGzipTest.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonGzipTest.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
package org.apache.maven.wagon.providers.http;
/*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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 java.io.File;
@@ -33,77 +36,85 @@
import junit.framework.TestCase;
-public class HttpWagonGzipTest extends TestCase
+/**
+ * HttpWagonGzipTest
+ *
+ * @version $Id$
+ */
+public class HttpWagonGzipTest
+ extends TestCase
{
- public void testGzipGet() throws Exception
+ public void testGzipGet()
+ throws Exception
{
HttpServer server = new HttpServer();
SocketListener listener = new SocketListener();
- listener.setPort(10008);
- server.addListener(listener);
+ listener.setPort( 10008 );
+ server.addListener( listener );
String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
HttpContext context = new HttpContext();
- context.setContextPath("/");
- context.setResourceBase(localRepositoryPath);
+ context.setContextPath( "/" );
+ context.setResourceBase( localRepositoryPath );
ResourceHandler rh = new ResourceHandler();
- rh.setMinGzipLength(1);
- context.addHandler(rh);
- server.addContext(context);
+ rh.setMinGzipLength( 1 );
+ context.addHandler( rh );
+ server.addContext( context );
server.start();
- try
+ try
{
Wagon wagon = new HttpWagon();
- Repository testRepository = new Repository();
+ Repository testRepository = new Repository( "testrepo", "http://localhost:10008" );
- testRepository.setUrl("http://localhost:10008");
+ wagon.setRepository( testRepository );
- File sourceFile = new File(localRepositoryPath + "/gzip");
+ File sourceFile = new File( localRepositoryPath + "/gzip" );
sourceFile.deleteOnExit();
String resName = "gzip-res.txt";
- String sourceContent = writeTestFileGzip(sourceFile, resName);
+ String sourceContent = writeTestFileGzip( sourceFile, resName );
- wagon.connect(testRepository);
+ wagon.connect();
- File destFile = FileTestUtils.createUniqueFile(getName(), getName());
+ File destFile = FileTestUtils.createUniqueFile( getName(), getName() );
destFile.deleteOnExit();
- wagon.get("gzip/" + resName, destFile);
+ wagon.get( "gzip/" + resName, destFile );
wagon.disconnect();
- String destContent = FileUtils.fileRead(destFile);
+ String destContent = FileUtils.fileRead( destFile );
- assertEquals(sourceContent, destContent);
- }
- finally
+ assertEquals( sourceContent, destContent );
+ }
+ finally
{
server.stop();
}
}
- private String writeTestFileGzip(File parent, String child) throws IOException
+ private String writeTestFileGzip( File parent, String child )
+ throws IOException
{
- File file = new File(parent, child);
+ File file = new File( parent, child );
file.getParentFile().mkdirs();
file.deleteOnExit();
- OutputStream out = new FileOutputStream(file);
- out.write(child.getBytes());
+ OutputStream out = new FileOutputStream( file );
+ out.write( child.getBytes() );
out.close();
-
- file = new File(parent, child + ".gz");
+
+ file = new File( parent, child + ".gz" );
file.deleteOnExit();
- out = new FileOutputStream(file);
- out = new GZIPOutputStream(out);
+ out = new FileOutputStream( file );
+ out = new GZIPOutputStream( out );
//write out different data than non-gz file, so we can
//assert the gz version was returned
String content = file.getAbsolutePath();
- out.write(content.getBytes());
+ out.write( content.getBytes() );
out.close();
return content;
}
Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/pom.xml?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/pom.xml Wed Feb 7 16:08:59 2007
@@ -17,6 +17,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -30,6 +31,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
+ <scope>compile</scope>
</dependency>
</dependencies>
</project>
Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java?view=diff&rev=504749&r1=504748&r2=504749
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java (original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-common-test/src/main/java/org/apache/maven/wagon/providers/ssh/knownhost/KnownHostsProviderTestCase.java Wed Feb 7 16:08:59 2007
@@ -1,19 +1,22 @@
package org.apache.maven.wagon.providers.ssh.knownhost;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * 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
*
- * 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
*
- * 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.
+ * 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.Wagon;
@@ -22,6 +25,11 @@
import org.apache.maven.wagon.repository.Repository;
import org.codehaus.plexus.PlexusTestCase;
+/**
+ * KnownHostsProviderTestCase
+ *
+ * @version $Id$
+ */
public class KnownHostsProviderTestCase
extends PlexusTestCase
{
@@ -53,7 +61,7 @@
try
{
- wagon.connect( source );
+ wagon.connect();
fail( "Should not have successfully connected - host is not known" );
}
@@ -75,7 +83,7 @@
try
{
- wagon.connect( source );
+ wagon.connect();
fail( "Should not have successfully connected - host is changed" );
}
@@ -95,7 +103,7 @@
{
wagon.setKnownHostsProvider( okHostsProvider );
- wagon.connect( source );
+ wagon.connect();
assertTrue( true );
}
@@ -109,6 +117,7 @@
wagon = (SshWagon) lookup( Wagon.ROLE, "scp" );
wagon.setInteractive( false );
+ wagon.setRepository( source );
this.okHostsProvider = new SingleKnownHostProvider( TestData.getHostname(), CORRECT_KEY );
this.failHostsProvider = new SingleKnownHostProvider( "beaver.codehaus.org", CORRECT_KEY );
---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org