You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/01/22 14:02:13 UTC
[18/54] [abbrv] [partial] maven-resolver git commit: [MNG-6007]
renamed Aether to Maven Artifact Resolver
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/UriUtilsTest.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/UriUtilsTest.java b/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/UriUtilsTest.java
deleted file mode 100644
index e3ea9fa..0000000
--- a/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/UriUtilsTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.eclipse.aether.transport.http;
-
-/*
- * 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 static org.junit.Assert.*;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Test;
-
-public class UriUtilsTest
-{
-
- private String resolve( URI base, String ref )
- {
- return UriUtils.resolve( base, URI.create( ref ) ).toString();
- }
-
- @Test
- public void testResolve_BaseEmptyPath()
- {
- URI base = URI.create( "http://host" );
- assertEquals( "http://host/file.jar", resolve( base, "file.jar" ) );
- assertEquals( "http://host/dir/file.jar", resolve( base, "dir/file.jar" ) );
- assertEquals( "http://host?arg=val", resolve( base, "?arg=val" ) );
- assertEquals( "http://host/file?arg=val", resolve( base, "file?arg=val" ) );
- assertEquals( "http://host/dir/file?arg=val", resolve( base, "dir/file?arg=val" ) );
- }
-
- @Test
- public void testResolve_BaseRootPath()
- {
- URI base = URI.create( "http://host/" );
- assertEquals( "http://host/file.jar", resolve( base, "file.jar" ) );
- assertEquals( "http://host/dir/file.jar", resolve( base, "dir/file.jar" ) );
- assertEquals( "http://host/?arg=val", resolve( base, "?arg=val" ) );
- assertEquals( "http://host/file?arg=val", resolve( base, "file?arg=val" ) );
- assertEquals( "http://host/dir/file?arg=val", resolve( base, "dir/file?arg=val" ) );
- }
-
- @Test
- public void testResolve_BasePathTrailingSlash()
- {
- URI base = URI.create( "http://host/sub/dir/" );
- assertEquals( "http://host/sub/dir/file.jar", resolve( base, "file.jar" ) );
- assertEquals( "http://host/sub/dir/dir/file.jar", resolve( base, "dir/file.jar" ) );
- assertEquals( "http://host/sub/dir/?arg=val", resolve( base, "?arg=val" ) );
- assertEquals( "http://host/sub/dir/file?arg=val", resolve( base, "file?arg=val" ) );
- assertEquals( "http://host/sub/dir/dir/file?arg=val", resolve( base, "dir/file?arg=val" ) );
- }
-
- @Test
- public void testResolve_BasePathNoTrailingSlash()
- {
- URI base = URI.create( "http://host/sub/d%20r" );
- assertEquals( "http://host/sub/d%20r/file.jar", resolve( base, "file.jar" ) );
- assertEquals( "http://host/sub/d%20r/dir/file.jar", resolve( base, "dir/file.jar" ) );
- assertEquals( "http://host/sub/d%20r?arg=val", resolve( base, "?arg=val" ) );
- assertEquals( "http://host/sub/d%20r/file?arg=val", resolve( base, "file?arg=val" ) );
- assertEquals( "http://host/sub/d%20r/dir/file?arg=val", resolve( base, "dir/file?arg=val" ) );
- }
-
- private List<URI> getDirs( String base, String uri )
- {
- return UriUtils.getDirectories( ( base != null ) ? URI.create( base ) : null, URI.create( uri ) );
- }
-
- private void assertUris( List<URI> actual, String... expected )
- {
- List<String> uris = new ArrayList<String>( actual.size() );
- for ( URI uri : actual )
- {
- uris.add( uri.toString() );
- }
- assertEquals( Arrays.asList( expected ), uris );
- }
-
- @Test
- public void testGetDirectories_NoBase()
- {
- List<URI> parents = getDirs( null, "http://host/repo/sub/dir/file.jar" );
- assertUris( parents, "http://host/repo/sub/dir/", "http://host/repo/sub/", "http://host/repo/" );
-
- parents = getDirs( null, "http://host/repo/sub/dir/?file.jar" );
- assertUris( parents, "http://host/repo/sub/dir/", "http://host/repo/sub/", "http://host/repo/" );
-
- parents = getDirs( null, "http://host/" );
- assertUris( parents );
- }
-
- @Test
- public void testGetDirectories_ExplicitBaseTrailingSlash()
- {
- List<URI> parents = getDirs( "http://host/repo/", "http://host/repo/sub/dir/file.jar" );
- assertUris( parents, "http://host/repo/sub/dir/", "http://host/repo/sub/" );
-
- parents = getDirs( "http://host/repo/", "http://host/repo/sub/dir/?file.jar" );
- assertUris( parents, "http://host/repo/sub/dir/", "http://host/repo/sub/" );
-
- parents = getDirs( "http://host/repo/", "http://host/" );
- assertUris( parents );
- }
-
- @Test
- public void testGetDirectories_ExplicitBaseNoTrailingSlash()
- {
- List<URI> parents = getDirs( "http://host/repo", "http://host/repo/sub/dir/file.jar" );
- assertUris( parents, "http://host/repo/sub/dir/", "http://host/repo/sub/" );
-
- parents = getDirs( "http://host/repo", "http://host/repo/sub/dir/?file.jar" );
- assertUris( parents, "http://host/repo/sub/dir/", "http://host/repo/sub/" );
-
- parents = getDirs( "http://host/repo", "http://host/" );
- assertUris( parents );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-http/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/test/resources/logback.xml b/aether-transport-http/src/test/resources/logback.xml
deleted file mode 100644
index 9addbd5..0000000
--- a/aether-transport-http/src/test/resources/logback.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ! 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.
- !-->
-
-<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
-
- <root level="DEBUG">
- <appender-ref ref="STDOUT" />
- </root>
-
- <logger name="org.apache.http.wire" level="DEBUG" />
- <logger name="org.eclipse.jetty" level="INFO" />
-</configuration>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-http/src/test/resources/ssl/README.txt
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/test/resources/ssl/README.txt b/aether-transport-http/src/test/resources/ssl/README.txt
deleted file mode 100644
index b1be71c..0000000
--- a/aether-transport-http/src/test/resources/ssl/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-client-store generated via
-> keytool -genkey -alias localhost -keypass client-pwd -keystore client-store -storepass client-pwd -validity 4096 -dname "cn=localhost, ou=None, L=Seattle, ST=Washington, o=ExampleOrg, c=US" -keyalg RSA
-
-server-store generated via
-> keytool -genkey -alias localhost -keypass server-pwd -keystore server-store -storepass server-pwd -validity 4096 -dname "cn=localhost, ou=None, L=Seattle, ST=Washington, o=ExampleOrg, c=US" -keyalg RSA
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-http/src/test/resources/ssl/client-store
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/test/resources/ssl/client-store b/aether-transport-http/src/test/resources/ssl/client-store
deleted file mode 100644
index fbfb39d..0000000
Binary files a/aether-transport-http/src/test/resources/ssl/client-store and /dev/null differ
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-http/src/test/resources/ssl/server-store
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/test/resources/ssl/server-store b/aether-transport-http/src/test/resources/ssl/server-store
deleted file mode 100644
index 6137fee..0000000
Binary files a/aether-transport-http/src/test/resources/ssl/server-store and /dev/null differ
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/pom.xml
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/pom.xml b/aether-transport-wagon/pom.xml
deleted file mode 100644
index e2409f3..0000000
--- a/aether-transport-wagon/pom.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>aether-transport-wagon</artifactId>
-
- <name>Aether Transport Wagon</name>
- <description>
- A transport implementation based on Maven Wagon.
- </description>
-
- <properties>
- <wagonVersion>1.0</wagonVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-provider-api</artifactId>
- <version>${wagonVersion}</version>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-annotations</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-classworlds</artifactId>
- <version>2.4</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>2.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>org.eclipse.sisu.plexus</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.sonatype.sisu</groupId>
- <artifactId>sisu-guice</artifactId>
- <classifier>no_aop</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-test-util</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-metadata</artifactId>
- </plugin>
- <plugin>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>sisu-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonConfigurator.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonConfigurator.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonConfigurator.java
deleted file mode 100644
index 808d2b7..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonConfigurator.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.aether.internal.transport.wagon;
-
-/*
- * 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.Wagon;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.classworlds.realm.ClassRealm;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.component.configurator.AbstractComponentConfigurator;
-import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
-import org.codehaus.plexus.component.configurator.ConfigurationListener;
-import org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.eclipse.aether.transport.wagon.WagonConfigurator;
-
-/**
- * A wagon configurator based on the Plexus component configuration framework.
- */
-@Component( role = WagonConfigurator.class, hint = "plexus" )
-public class PlexusWagonConfigurator
- implements WagonConfigurator
-{
-
- @Requirement
- private PlexusContainer container;
-
- /**
- * Creates an uninitialized wagon configurator.
- *
- * @noreference This constructor only supports the Plexus IoC container and should not be called directly by
- * clients.
- */
- public PlexusWagonConfigurator()
- {
- // enables no-arg constructor
- }
-
- /**
- * Creates a wagon configurator using the specified Plexus container.
- *
- * @param container The Plexus container instance to use, must not be {@code null}.
- */
- public PlexusWagonConfigurator( PlexusContainer container )
- {
- if ( container == null )
- {
- throw new IllegalArgumentException( "plexus container has not been specified" );
- }
- this.container = container;
- }
-
- public void configure( Wagon wagon, Object configuration )
- throws Exception
- {
- PlexusConfiguration config = null;
- if ( configuration instanceof PlexusConfiguration )
- {
- config = (PlexusConfiguration) configuration;
- }
- else if ( configuration instanceof Xpp3Dom )
- {
- config = new XmlPlexusConfiguration( (Xpp3Dom) configuration );
- }
- else if ( configuration == null )
- {
- return;
- }
- else
- {
- throw new IllegalArgumentException( "Unexpected configuration type: " + configuration.getClass().getName() );
- }
-
- WagonComponentConfigurator configurator = new WagonComponentConfigurator();
-
- configurator.configureComponent( wagon, config, container.getContainerRealm() );
- }
-
- static class WagonComponentConfigurator
- extends AbstractComponentConfigurator
- {
-
- @Override
- public void configureComponent( Object component, PlexusConfiguration configuration,
- ExpressionEvaluator expressionEvaluator, ClassRealm containerRealm,
- ConfigurationListener listener )
- throws ComponentConfigurationException
- {
- ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter();
-
- converter.processConfiguration( converterLookup, component, containerRealm, configuration,
- expressionEvaluator, listener );
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonProvider.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonProvider.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonProvider.java
deleted file mode 100644
index 6f40f0d..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/PlexusWagonProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.aether.internal.transport.wagon;
-
-/*
- * 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.Wagon;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.eclipse.aether.transport.wagon.WagonProvider;
-
-/**
- * A wagon provider backed by a Plexus container and the wagons registered with this container.
- */
-@Component( role = WagonProvider.class, hint = "plexus" )
-public class PlexusWagonProvider
- implements WagonProvider
-{
-
- @Requirement
- private PlexusContainer container;
-
- /**
- * Creates an uninitialized wagon provider.
- *
- * @noreference This constructor only supports the Plexus IoC container and should not be called directly by
- * clients.
- */
- public PlexusWagonProvider()
- {
- // enables no-arg constructor
- }
-
- /**
- * Creates a wagon provider using the specified Plexus container.
- *
- * @param container The Plexus container instance to use, must not be {@code null}.
- */
- public PlexusWagonProvider( PlexusContainer container )
- {
- if ( container == null )
- {
- throw new IllegalArgumentException( "plexus container has not been specified" );
- }
- this.container = container;
- }
-
- public Wagon lookup( String roleHint )
- throws Exception
- {
- return container.lookup( Wagon.class, roleHint );
- }
-
- public void release( Wagon wagon )
- {
- try
- {
- if ( wagon != null )
- {
- container.release( wagon );
- }
- }
- catch ( Exception e )
- {
- // too bad
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/package-info.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/package-info.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/package-info.java
deleted file mode 100644
index df14e9c..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/internal/transport/wagon/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// CHECKSTYLE_OFF: RegexpHeader
-/*
- * 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.
- */
-/**
- * Integration with the Plexus IoC container which is the native runtime environment expected by many wagon
- * implementations.
- */
-package org.eclipse.aether.internal.transport.wagon;
-
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonCancelledException.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonCancelledException.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonCancelledException.java
deleted file mode 100644
index 105917f..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonCancelledException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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.eclipse.aether.transfer.TransferCancelledException;
-
-/**
- * Unchecked exception to allow the checked {@link TransferCancelledException} to bubble up from a wagon.
- */
-class WagonCancelledException
- extends RuntimeException
-{
-
- public WagonCancelledException( TransferCancelledException cause )
- {
- super( cause );
- }
-
- public static Exception unwrap( Exception e )
- {
- if ( e instanceof WagonCancelledException )
- {
- e = (Exception) e.getCause();
- }
- return e;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonConfigurator.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonConfigurator.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonConfigurator.java
deleted file mode 100644
index 42399cb..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonConfigurator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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.Wagon;
-
-/**
- * A component to configure wagon instances with provider-specific parameters.
- */
-public interface WagonConfigurator
-{
-
- /**
- * Configures the specified wagon instance with the given configuration.
- *
- * @param wagon The wagon instance to configure, must not be {@code null}.
- * @param configuration The configuration to apply to the wagon instance, must not be {@code null}.
- * @throws Exception If the configuration could not be applied to the wagon.
- */
- void configure( Wagon wagon, Object configuration )
- throws Exception;
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonProvider.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonProvider.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonProvider.java
deleted file mode 100644
index 77bf9d6..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonProvider.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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.Wagon;
-
-/**
- * A component to acquire and release wagon instances for uploads/downloads.
- */
-public interface WagonProvider
-{
-
- /**
- * Acquires a wagon instance that matches the specified role hint. The role hint is derived from the URI scheme,
- * e.g. "http" or "file".
- *
- * @param roleHint The role hint to get a wagon for, must not be {@code null}.
- * @return The requested wagon instance, never {@code null}.
- * @throws Exception If no wagon could be retrieved for the specified role hint.
- */
- Wagon lookup( String roleHint )
- throws Exception;
-
- /**
- * Releases the specified wagon. A wagon provider may either free any resources allocated for the wagon instance or
- * return the instance back to a pool for future use.
- *
- * @param wagon The wagon to release, may be {@code null}.
- */
- void release( Wagon wagon );
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransferListener.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransferListener.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransferListener.java
deleted file mode 100644
index 3c3120e..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransferListener.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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 java.nio.ByteBuffer;
-
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.observers.AbstractTransferListener;
-import org.eclipse.aether.spi.connector.transport.TransportListener;
-import org.eclipse.aether.transfer.TransferCancelledException;
-
-/**
- * A wagon transfer listener that forwards events to a transport listener.
- */
-final class WagonTransferListener
- extends AbstractTransferListener
-{
-
- private final TransportListener listener;
-
- public WagonTransferListener( TransportListener listener )
- {
- this.listener = listener;
- }
-
- @Override
- public void transferStarted( TransferEvent event )
- {
- try
- {
- listener.transportStarted( 0, event.getResource().getContentLength() );
- }
- catch ( TransferCancelledException e )
- {
- /*
- * NOTE: Wagon transfers are not freely abortable. In particular, aborting from
- * AbstractWagon.fire(Get|Put)Started() would result in unclosed streams so we avoid this case.
- */
- }
- }
-
- @Override
- public void transferProgress( TransferEvent event, byte[] buffer, int length )
- {
- try
- {
- listener.transportProgressed( ByteBuffer.wrap( buffer, 0, length ) );
- }
- catch ( TransferCancelledException e )
- {
- throw new WagonCancelledException( e );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporter.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporter.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporter.java
deleted file mode 100644
index e9f89c2..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporter.java
+++ /dev/null
@@ -1,700 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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 java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Method;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Queue;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.StreamingWagon;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.proxy.ProxyInfoProvider;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.eclipse.aether.ConfigurationProperties;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.AuthenticationContext;
-import org.eclipse.aether.repository.Proxy;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.transport.GetTask;
-import org.eclipse.aether.spi.connector.transport.PeekTask;
-import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.aether.spi.connector.transport.TransportTask;
-import org.eclipse.aether.spi.connector.transport.Transporter;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.transfer.NoTransporterException;
-import org.eclipse.aether.util.ConfigUtils;
-
-/**
- * A transporter using Maven Wagon.
- */
-final class WagonTransporter
- implements Transporter
-{
-
- private static final String CONFIG_PROP_CONFIG = "aether.connector.wagon.config";
-
- private static final String CONFIG_PROP_FILE_MODE = "aether.connector.perms.fileMode";
-
- private static final String CONFIG_PROP_DIR_MODE = "aether.connector.perms.dirMode";
-
- private static final String CONFIG_PROP_GROUP = "aether.connector.perms.group";
-
- private final Logger logger;
-
- private final RemoteRepository repository;
-
- private final RepositorySystemSession session;
-
- private final AuthenticationContext repoAuthContext;
-
- private final AuthenticationContext proxyAuthContext;
-
- private final WagonProvider wagonProvider;
-
- private final WagonConfigurator wagonConfigurator;
-
- private final String wagonHint;
-
- private final Repository wagonRepo;
-
- private final AuthenticationInfo wagonAuth;
-
- private final ProxyInfoProvider wagonProxy;
-
- private final Properties headers;
-
- private final Queue<Wagon> wagons = new ConcurrentLinkedQueue<Wagon>();
-
- private final AtomicBoolean closed = new AtomicBoolean();
-
- public WagonTransporter( WagonProvider wagonProvider, WagonConfigurator wagonConfigurator,
- RemoteRepository repository, RepositorySystemSession session, Logger logger )
- throws NoTransporterException
- {
- this.logger = logger;
- this.wagonProvider = wagonProvider;
- this.wagonConfigurator = wagonConfigurator;
- this.repository = repository;
- this.session = session;
-
- wagonRepo = new Repository( repository.getId(), repository.getUrl() );
- wagonRepo.setPermissions( getPermissions( repository.getId(), session ) );
-
- wagonHint = wagonRepo.getProtocol().toLowerCase( Locale.ENGLISH );
- if ( wagonHint == null || wagonHint.length() <= 0 )
- {
- throw new NoTransporterException( repository );
- }
-
- try
- {
- wagons.add( lookupWagon() );
- }
- catch ( Exception e )
- {
- logger.debug( e.getMessage(), e );
- throw new NoTransporterException( repository, e.getMessage(), e );
- }
-
- repoAuthContext = AuthenticationContext.forRepository( session, repository );
- proxyAuthContext = AuthenticationContext.forProxy( session, repository );
-
- wagonAuth = getAuthenticationInfo( repository, repoAuthContext );
- wagonProxy = getProxy( repository, proxyAuthContext );
-
- headers = new Properties();
- headers.put( "User-Agent", ConfigUtils.getString( session, ConfigurationProperties.DEFAULT_USER_AGENT,
- ConfigurationProperties.USER_AGENT ) );
- Map<?, ?> headers =
- ConfigUtils.getMap( session, null, ConfigurationProperties.HTTP_HEADERS + "." + repository.getId(),
- ConfigurationProperties.HTTP_HEADERS );
- if ( headers != null )
- {
- this.headers.putAll( headers );
- }
- }
-
- private static RepositoryPermissions getPermissions( String repoId, RepositorySystemSession session )
- {
- RepositoryPermissions result = null;
-
- RepositoryPermissions perms = new RepositoryPermissions();
-
- String suffix = '.' + repoId;
-
- String fileMode = ConfigUtils.getString( session, (String) null, CONFIG_PROP_FILE_MODE + suffix );
- if ( fileMode != null )
- {
- perms.setFileMode( fileMode );
- result = perms;
- }
-
- String dirMode = ConfigUtils.getString( session, (String) null, CONFIG_PROP_DIR_MODE + suffix );
- if ( dirMode != null )
- {
- perms.setDirectoryMode( dirMode );
- result = perms;
- }
-
- String group = ConfigUtils.getString( session, (String) null, CONFIG_PROP_GROUP + suffix );
- if ( group != null )
- {
- perms.setGroup( group );
- result = perms;
- }
-
- return result;
- }
-
- private AuthenticationInfo getAuthenticationInfo( RemoteRepository repository,
- final AuthenticationContext authContext )
- {
- AuthenticationInfo auth = null;
-
- if ( authContext != null )
- {
- auth = new AuthenticationInfo()
- {
- @Override
- public String getUserName()
- {
- return authContext.get( AuthenticationContext.USERNAME );
- }
-
- @Override
- public String getPassword()
- {
- return authContext.get( AuthenticationContext.PASSWORD );
- }
-
- @Override
- public String getPrivateKey()
- {
- return authContext.get( AuthenticationContext.PRIVATE_KEY_PATH );
- }
-
- @Override
- public String getPassphrase()
- {
- return authContext.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE );
- }
- };
- }
-
- return auth;
- }
-
- private ProxyInfoProvider getProxy( RemoteRepository repository, final AuthenticationContext authContext )
- {
- ProxyInfoProvider proxy = null;
-
- Proxy p = repository.getProxy();
- if ( p != null )
- {
- final ProxyInfo prox;
- if ( authContext != null )
- {
- prox = new ProxyInfo()
- {
- @Override
- public String getUserName()
- {
- return authContext.get( AuthenticationContext.USERNAME );
- }
-
- @Override
- public String getPassword()
- {
- return authContext.get( AuthenticationContext.PASSWORD );
- }
-
- @Override
- public String getNtlmDomain()
- {
- return authContext.get( AuthenticationContext.NTLM_DOMAIN );
- }
-
- @Override
- public String getNtlmHost()
- {
- return authContext.get( AuthenticationContext.NTLM_WORKSTATION );
- }
- };
- }
- else
- {
- prox = new ProxyInfo();
- }
- prox.setType( p.getType() );
- prox.setHost( p.getHost() );
- prox.setPort( p.getPort() );
-
- proxy = new ProxyInfoProvider()
- {
- public ProxyInfo getProxyInfo( String protocol )
- {
- return prox;
- }
- };
- }
-
- return proxy;
- }
-
- private Wagon lookupWagon()
- throws Exception
- {
- return wagonProvider.lookup( wagonHint );
- }
-
- private void releaseWagon( Wagon wagon )
- {
- wagonProvider.release( wagon );
- }
-
- private void connectWagon( Wagon wagon )
- throws Exception
- {
- if ( !headers.isEmpty() )
- {
- try
- {
- Method setHttpHeaders = wagon.getClass().getMethod( "setHttpHeaders", Properties.class );
- setHttpHeaders.invoke( wagon, headers );
- }
- catch ( NoSuchMethodException e )
- {
- // normal for non-http wagons
- }
- catch ( Exception e )
- {
- logger.debug( "Could not set user agent for wagon " + wagon.getClass().getName() + ": " + e );
- }
- }
-
- int connectTimeout =
- ConfigUtils.getInteger( session, ConfigurationProperties.DEFAULT_CONNECT_TIMEOUT,
- ConfigurationProperties.CONNECT_TIMEOUT );
- int requestTimeout =
- ConfigUtils.getInteger( session, ConfigurationProperties.DEFAULT_REQUEST_TIMEOUT,
- ConfigurationProperties.REQUEST_TIMEOUT );
-
- wagon.setTimeout( Math.max( Math.max( connectTimeout, requestTimeout ), 0 ) );
-
- wagon.setInteractive( ConfigUtils.getBoolean( session, ConfigurationProperties.DEFAULT_INTERACTIVE,
- ConfigurationProperties.INTERACTIVE ) );
-
- Object configuration = ConfigUtils.getObject( session, null, CONFIG_PROP_CONFIG + "." + repository.getId() );
- if ( configuration != null && wagonConfigurator != null )
- {
- try
- {
- wagonConfigurator.configure( wagon, configuration );
- }
- catch ( Exception e )
- {
- String msg =
- "Could not apply configuration for " + repository.getId() + " to wagon "
- + wagon.getClass().getName() + ":" + e.getMessage();
- if ( logger.isDebugEnabled() )
- {
- logger.warn( msg, e );
- }
- else
- {
- logger.warn( msg );
- }
- }
- }
-
- wagon.connect( wagonRepo, wagonAuth, wagonProxy );
- }
-
- private void disconnectWagon( Wagon wagon )
- {
- try
- {
- if ( wagon != null )
- {
- wagon.disconnect();
- }
- }
- catch ( Exception e )
- {
- logger.debug( "Could not disconnect wagon " + wagon, e );
- }
- }
-
- private Wagon pollWagon()
- throws Exception
- {
- Wagon wagon = wagons.poll();
-
- if ( wagon == null )
- {
- try
- {
- wagon = lookupWagon();
- connectWagon( wagon );
- }
- catch ( Exception e )
- {
- releaseWagon( wagon );
- throw e;
- }
- }
- else if ( wagon.getRepository() == null )
- {
- try
- {
- connectWagon( wagon );
- }
- catch ( Exception e )
- {
- wagons.add( wagon );
- throw e;
- }
- }
-
- return wagon;
- }
-
- public int classify( Throwable error )
- {
- if ( error instanceof ResourceDoesNotExistException )
- {
- return ERROR_NOT_FOUND;
- }
- return ERROR_OTHER;
- }
-
- public void peek( PeekTask task )
- throws Exception
- {
- execute( task, new PeekTaskRunner( task ) );
- }
-
- public void get( GetTask task )
- throws Exception
- {
- execute( task, new GetTaskRunner( task ) );
- }
-
- public void put( PutTask task )
- throws Exception
- {
- execute( task, new PutTaskRunner( task ) );
- }
-
- private void execute( TransportTask task, TaskRunner runner )
- throws Exception
- {
- if ( closed.get() )
- {
- throw new IllegalStateException( "transporter closed, cannot execute task " + task );
- }
- try
- {
- WagonTransferListener listener = new WagonTransferListener( task.getListener() );
- Wagon wagon = pollWagon();
- try
- {
- wagon.addTransferListener( listener );
- runner.run( wagon );
- }
- finally
- {
- wagon.removeTransferListener( listener );
- wagons.add( wagon );
- }
- }
- catch ( Exception e )
- {
- throw WagonCancelledException.unwrap( e );
- }
- }
-
- private static File newTempFile()
- throws IOException
- {
- return File.createTempFile( "wagon-" + UUID.randomUUID().toString().replace( "-", "" ), ".tmp" );
- }
-
- private void delTempFile( File path )
- {
- if ( path != null && !path.delete() && path.exists() )
- {
- logger.debug( "Could not delete temorary file " + path );
- }
- }
-
- private static void copy( OutputStream os, InputStream is )
- throws IOException
- {
- byte[] buffer = new byte[1024 * 32];
- for ( int read = is.read( buffer ); read >= 0; read = is.read( buffer ) )
- {
- os.write( buffer, 0, read );
- }
- }
-
- private static void close( Closeable file )
- {
- if ( file != null )
- {
- try
- {
- file.close();
- }
- catch ( IOException e )
- {
- // too bad
- }
- }
- }
-
- public void close()
- {
- if ( closed.compareAndSet( false, true ) )
- {
- AuthenticationContext.close( repoAuthContext );
- AuthenticationContext.close( proxyAuthContext );
-
- for ( Wagon wagon = wagons.poll(); wagon != null; wagon = wagons.poll() )
- {
- disconnectWagon( wagon );
- releaseWagon( wagon );
- }
- }
- }
-
- private interface TaskRunner
- {
-
- void run( Wagon wagon )
- throws Exception;
-
- }
-
- private static class PeekTaskRunner
- implements TaskRunner
- {
-
- private final PeekTask task;
-
- public PeekTaskRunner( PeekTask task )
- {
- this.task = task;
- }
-
- public void run( Wagon wagon )
- throws Exception
- {
- String src = task.getLocation().toString();
- if ( !wagon.resourceExists( src ) )
- {
- throw new ResourceDoesNotExistException( "Could not find " + src + " in "
- + wagon.getRepository().getUrl() );
- }
- }
-
- }
-
- private class GetTaskRunner
- implements TaskRunner
- {
-
- private final GetTask task;
-
- public GetTaskRunner( GetTask task )
- {
- this.task = task;
- }
-
- public void run( Wagon wagon )
- throws Exception
- {
- String src = task.getLocation().toString();
- File file = task.getDataFile();
- if ( file == null && wagon instanceof StreamingWagon )
- {
- OutputStream dst = task.newOutputStream();
- try
- {
- ( (StreamingWagon) wagon ).getToStream( src, dst );
- }
- finally
- {
- dst.close();
- }
- }
- else
- {
- File dst = ( file != null ) ? file : newTempFile();
- try
- {
- wagon.get( src, dst );
- if ( !dst.exists() )
- {
- /*
- * NOTE: Wagon (1.0-beta-6) doesn't create the destination file when transferring a 0-byte
- * resource. So if the resource we asked for didn't cause any exception but doesn't show up in
- * the dst file either, Wagon tells us in its weird way the file is empty.
- */
- new FileOutputStream( dst ).close();
- }
- if ( file == null )
- {
- readTempFile( dst );
- }
- }
- finally
- {
- if ( file == null )
- {
- delTempFile( dst );
- }
- }
- }
- }
-
- private void readTempFile( File dst )
- throws IOException
- {
- FileInputStream fis = new FileInputStream( dst );
- try
- {
- OutputStream os = task.newOutputStream();
- try
- {
- copy( os, fis );
- os.close();
- }
- finally
- {
- close( os );
- }
- }
- finally
- {
- close( fis );
- }
- }
-
- }
-
- private class PutTaskRunner
- implements TaskRunner
- {
-
- private final PutTask task;
-
- public PutTaskRunner( PutTask task )
- {
- this.task = task;
- }
-
- public void run( Wagon wagon )
- throws Exception
- {
- String dst = task.getLocation().toString();
- File file = task.getDataFile();
- if ( file == null && wagon instanceof StreamingWagon )
- {
- InputStream src = task.newInputStream();
- try
- {
- // StreamingWagon uses an internal buffer on src input stream.
- ( (StreamingWagon) wagon ).putFromStream( src, dst, task.getDataLength(), -1 );
- }
- finally
- {
- close( src );
- }
- }
- else
- {
- File src = ( file != null ) ? file : createTempFile();
- try
- {
- wagon.put( src, dst );
- }
- finally
- {
- if ( file == null )
- {
- delTempFile( src );
- }
- }
- }
- }
-
- private File createTempFile()
- throws IOException
- {
- File tmp = newTempFile();
- try
- {
- FileOutputStream fos = new FileOutputStream( tmp );
- try
- {
- InputStream is = task.newInputStream();
- try
- {
- copy( fos, is );
- fos.close();
- }
- finally
- {
- close( is );
- }
- }
- finally
- {
- close( fos );
- }
- }
- catch ( IOException e )
- {
- delTempFile( tmp );
- throw e;
- }
- return tmp;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporterFactory.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporterFactory.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporterFactory.java
deleted file mode 100644
index 490acac..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/WagonTransporterFactory.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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 javax.inject.Inject;
-import javax.inject.Named;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.transport.Transporter;
-import org.eclipse.aether.spi.connector.transport.TransporterFactory;
-import org.eclipse.aether.spi.locator.Service;
-import org.eclipse.aether.spi.locator.ServiceLocator;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.spi.log.LoggerFactory;
-import org.eclipse.aether.spi.log.NullLoggerFactory;
-import org.eclipse.aether.transfer.NoTransporterException;
-
-/**
- * A transporter factory using <a href="http://maven.apache.org/wagon/" target="_blank">Apache Maven Wagon</a>. Note
- * that this factory merely serves as an adapter to the Wagon API and by itself does not provide any transport services
- * unless one or more wagon implementations are registered with the {@link WagonProvider}.
- */
-@Named( "wagon" )
-public final class WagonTransporterFactory
- implements TransporterFactory, Service
-{
-
- private Logger logger = NullLoggerFactory.LOGGER;
-
- private WagonProvider wagonProvider;
-
- private WagonConfigurator wagonConfigurator;
-
- private float priority = -1;
-
- /**
- * Creates an (uninitialized) instance of this transporter factory. <em>Note:</em> In case of manual instantiation
- * by clients, the new factory needs to be configured via its various mutators before first use or runtime errors
- * will occur.
- */
- public WagonTransporterFactory()
- {
- // enables default constructor
- }
-
- @Inject
- WagonTransporterFactory( WagonProvider wagonProvider, WagonConfigurator wagonConfigurator,
- LoggerFactory loggerFactory )
- {
- setWagonProvider( wagonProvider );
- setWagonConfigurator( wagonConfigurator );
- setLoggerFactory( loggerFactory );
- }
-
- public void initService( ServiceLocator locator )
- {
- setLoggerFactory( locator.getService( LoggerFactory.class ) );
- setWagonProvider( locator.getService( WagonProvider.class ) );
- setWagonConfigurator( locator.getService( WagonConfigurator.class ) );
- }
-
- /**
- * Sets the logger factory to use for this component.
- *
- * @param loggerFactory The logger factory to use, may be {@code null} to disable logging.
- * @return This component for chaining, never {@code null}.
- */
- public WagonTransporterFactory setLoggerFactory( LoggerFactory loggerFactory )
- {
- this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, WagonTransporter.class );
- return this;
- }
-
- /**
- * Sets the wagon provider to use to acquire and release wagon instances.
- *
- * @param wagonProvider The wagon provider to use, may be {@code null}.
- * @return This factory for chaining, never {@code null}.
- */
- public WagonTransporterFactory setWagonProvider( WagonProvider wagonProvider )
- {
- this.wagonProvider = wagonProvider;
- return this;
- }
-
- /**
- * Sets the wagon configurator to use to apply provider-specific configuration to wagon instances.
- *
- * @param wagonConfigurator The wagon configurator to use, may be {@code null}.
- * @return This factory for chaining, never {@code null}.
- */
- public WagonTransporterFactory setWagonConfigurator( WagonConfigurator wagonConfigurator )
- {
- this.wagonConfigurator = wagonConfigurator;
- return this;
- }
-
- public float getPriority()
- {
- return priority;
- }
-
- /**
- * Sets the priority of this component.
- *
- * @param priority The priority.
- * @return This component for chaining, never {@code null}.
- */
- public WagonTransporterFactory setPriority( float priority )
- {
- this.priority = priority;
- return this;
- }
-
- public Transporter newInstance( RepositorySystemSession session, RemoteRepository repository )
- throws NoTransporterException
- {
- return new WagonTransporter( wagonProvider, wagonConfigurator, repository, session, logger );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/package-info.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/package-info.java b/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/package-info.java
deleted file mode 100644
index 82df9ac..0000000
--- a/aether-transport-wagon/src/main/java/org/eclipse/aether/transport/wagon/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// CHECKSTYLE_OFF: RegexpHeader
-/*
- * 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.
- */
-/**
- * Support for downloads/uploads using <a href="http://maven.apache.org/wagon/" target="_blank">Apache Maven Wagon</a>.
- */
-package org.eclipse.aether.transport.wagon;
-
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/site/site.xml
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/site/site.xml b/aether-transport-wagon/src/site/site.xml
deleted file mode 100644
index ffa91f4..0000000
--- a/aether-transport-wagon/src/site/site.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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.
--->
-
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"
- name="Transport Wagon">
- <body>
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java b/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java
deleted file mode 100644
index 61f8a8e..0000000
--- a/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/AbstractWagonTransporterTest.java
+++ /dev/null
@@ -1,534 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.net.URI;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.Wagon;
-import org.eclipse.aether.ConfigurationProperties;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.test.util.TestFileUtils;
-import org.eclipse.aether.internal.test.util.TestLoggerFactory;
-import org.eclipse.aether.internal.test.util.TestUtils;
-import org.eclipse.aether.repository.Authentication;
-import org.eclipse.aether.repository.Proxy;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.transport.GetTask;
-import org.eclipse.aether.spi.connector.transport.PeekTask;
-import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.aether.spi.connector.transport.Transporter;
-import org.eclipse.aether.spi.connector.transport.TransporterFactory;
-import org.eclipse.aether.transfer.NoTransporterException;
-import org.eclipse.aether.transfer.TransferCancelledException;
-import org.eclipse.aether.util.repository.AuthenticationBuilder;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- */
-public abstract class AbstractWagonTransporterTest
-{
-
- private DefaultRepositorySystemSession session;
-
- private TransporterFactory factory;
-
- private Transporter transporter;
-
- private String id;
-
- private Map<String, String> fs;
-
- protected abstract Wagon newWagon();
-
- private RemoteRepository newRepo( String url )
- {
- return new RemoteRepository.Builder( "test", "default", url ).build();
- }
-
- private void newTransporter( String url )
- throws Exception
- {
- newTransporter( newRepo( url ) );
- }
-
- private void newTransporter( RemoteRepository repo )
- throws Exception
- {
- if ( transporter != null )
- {
- transporter.close();
- transporter = null;
- }
- transporter = factory.newInstance( session, repo );
- }
-
- @Before
- public void setUp()
- throws Exception
- {
- session = TestUtils.newSession();
- factory = new WagonTransporterFactory( new WagonProvider()
- {
- public Wagon lookup( String roleHint )
- throws Exception
- {
- if ( "mem".equalsIgnoreCase( roleHint ) )
- {
- return newWagon();
- }
- throw new IllegalArgumentException( "Unknown wagon role: " + roleHint );
- }
-
- public void release( Wagon wagon )
- {
- }
- }, new WagonConfigurator()
- {
- public void configure( Wagon wagon, Object configuration )
- throws Exception
- {
- ( (Configurable) wagon ).setConfiguration( configuration );
- }
- }, new TestLoggerFactory() );
- id = UUID.randomUUID().toString().replace( "-", "" );
- fs = MemWagonUtils.getFilesystem( id );
- fs.put( "file.txt", "test" );
- fs.put( "empty.txt", "" );
- fs.put( "some space.txt", "space" );
- newTransporter( "mem://" + id );
- }
-
- @After
- public void tearDown()
- {
- if ( transporter != null )
- {
- transporter.close();
- transporter = null;
- }
- factory = null;
- session = null;
- }
-
- @Test
- public void testClassify()
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( new TransferFailedException( "test" ) ) );
- assertEquals( Transporter.ERROR_NOT_FOUND, transporter.classify( new ResourceDoesNotExistException( "test" ) ) );
- }
-
- @Test
- public void testPeek()
- throws Exception
- {
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
- @Test
- public void testPeek_NotFound()
- throws Exception
- {
- try
- {
- transporter.peek( new PeekTask( URI.create( "missing.txt" ) ) );
- fail( "Expected error" );
- }
- catch ( ResourceDoesNotExistException e )
- {
- assertEquals( Transporter.ERROR_NOT_FOUND, transporter.classify( e ) );
- }
- }
-
- @Test
- public void testPeek_Closed()
- throws Exception
- {
- transporter.close();
- try
- {
- transporter.peek( new PeekTask( URI.create( "missing.txt" ) ) );
- fail( "Expected error" );
- }
- catch ( IllegalStateException e )
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( e ) );
- }
- }
-
- @Test
- public void testGet_ToMemory()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- GetTask task = new GetTask( URI.create( "file.txt" ) ).setListener( listener );
- transporter.get( task );
- assertEquals( "test", task.getDataString() );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 4, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertTrue( "Count: " + listener.progressedCount, listener.progressedCount > 0 );
- assertEquals( task.getDataString(), listener.baos.toString( "UTF-8" ) );
- }
-
- @Test
- public void testGet_ToFile()
- throws Exception
- {
- File file = TestFileUtils.createTempFile( "failure" );
- RecordingTransportListener listener = new RecordingTransportListener();
- GetTask task = new GetTask( URI.create( "file.txt" ) ).setDataFile( file ).setListener( listener );
- transporter.get( task );
- assertEquals( "test", TestFileUtils.readString( file ) );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 4, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertTrue( "Count: " + listener.progressedCount, listener.progressedCount > 0 );
- assertEquals( "test", listener.baos.toString( "UTF-8" ) );
- }
-
- @Test
- public void testGet_EmptyResource()
- throws Exception
- {
- File file = TestFileUtils.createTempFile( "failure" );
- assertTrue( file.delete() && !file.exists() );
- RecordingTransportListener listener = new RecordingTransportListener();
- GetTask task = new GetTask( URI.create( "empty.txt" ) ).setDataFile( file ).setListener( listener );
- transporter.get( task );
- assertEquals( "", TestFileUtils.readString( file ) );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 0, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertEquals( 0, listener.progressedCount );
- assertEquals( "", listener.baos.toString( "UTF-8" ) );
- }
-
- @Test
- public void testGet_EncodedResourcePath()
- throws Exception
- {
- GetTask task = new GetTask( URI.create( "some%20space.txt" ) );
- transporter.get( task );
- assertEquals( "space", task.getDataString() );
- }
-
- @Test
- public void testGet_FileHandleLeak()
- throws Exception
- {
- for ( int i = 0; i < 100; i++ )
- {
- File file = TestFileUtils.createTempFile( "failure" );
- transporter.get( new GetTask( URI.create( "file.txt" ) ).setDataFile( file ) );
- assertTrue( i + ", " + file.getAbsolutePath(), file.delete() );
- }
- }
-
- @Test
- public void testGet_NotFound()
- throws Exception
- {
- try
- {
- transporter.get( new GetTask( URI.create( "missing.txt" ) ) );
- fail( "Expected error" );
- }
- catch ( ResourceDoesNotExistException e )
- {
- assertEquals( Transporter.ERROR_NOT_FOUND, transporter.classify( e ) );
- }
- }
-
- @Test
- public void testGet_Closed()
- throws Exception
- {
- transporter.close();
- try
- {
- transporter.get( new GetTask( URI.create( "file.txt" ) ) );
- fail( "Expected error" );
- }
- catch ( IllegalStateException e )
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( e ) );
- }
- }
-
- @Test
- public void testGet_StartCancelled()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- listener.cancelStart = true;
- GetTask task = new GetTask( URI.create( "file.txt" ) ).setListener( listener );
- transporter.get( task );
- assertEquals( 1, listener.startedCount );
- }
-
- @Test
- public void testGet_ProgressCancelled()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- listener.cancelProgress = true;
- GetTask task = new GetTask( URI.create( "file.txt" ) ).setListener( listener );
- try
- {
- transporter.get( task );
- fail( "Expected error" );
- }
- catch ( TransferCancelledException e )
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( e ) );
- }
- assertEquals( 0, listener.dataOffset );
- assertEquals( 4, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertEquals( 1, listener.progressedCount );
- }
-
- @Test
- public void testPut_FromMemory()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- PutTask task = new PutTask( URI.create( "file.txt" ) ).setListener( listener ).setDataString( "upload" );
- transporter.put( task );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 6, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertTrue( "Count: " + listener.progressedCount, listener.progressedCount > 0 );
- assertEquals( "upload", fs.get( "file.txt" ) );
- }
-
- @Test
- public void testPut_FromFile()
- throws Exception
- {
- File file = TestFileUtils.createTempFile( "upload" );
- RecordingTransportListener listener = new RecordingTransportListener();
- PutTask task = new PutTask( URI.create( "file.txt" ) ).setListener( listener ).setDataFile( file );
- transporter.put( task );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 6, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertTrue( "Count: " + listener.progressedCount, listener.progressedCount > 0 );
- assertEquals( "upload", fs.get( "file.txt" ) );
- }
-
- @Test
- public void testPut_EmptyResource()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- PutTask task = new PutTask( URI.create( "file.txt" ) ).setListener( listener );
- transporter.put( task );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 0, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertEquals( 0, listener.progressedCount );
- assertEquals( "", fs.get( "file.txt" ) );
- }
-
- @Test
- public void testPut_NonExistentParentDir()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- PutTask task =
- new PutTask( URI.create( "dir/sub/dir/file.txt" ) ).setListener( listener ).setDataString( "upload" );
- transporter.put( task );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 6, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertTrue( "Count: " + listener.progressedCount, listener.progressedCount > 0 );
- assertEquals( "upload", fs.get( "dir/sub/dir/file.txt" ) );
- }
-
- @Test
- public void testPut_EncodedResourcePath()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- PutTask task = new PutTask( URI.create( "some%20space.txt" ) ).setListener( listener ).setDataString( "OK" );
- transporter.put( task );
- assertEquals( 0, listener.dataOffset );
- assertEquals( 2, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertTrue( "Count: " + listener.progressedCount, listener.progressedCount > 0 );
- assertEquals( "OK", fs.get( "some space.txt" ) );
- }
-
- @Test
- public void testPut_FileHandleLeak()
- throws Exception
- {
- for ( int i = 0; i < 100; i++ )
- {
- File src = TestFileUtils.createTempFile( "upload" );
- transporter.put( new PutTask( URI.create( "file.txt" ) ).setDataFile( src ) );
- assertTrue( i + ", " + src.getAbsolutePath(), src.delete() );
- }
- }
-
- @Test
- public void testPut_Closed()
- throws Exception
- {
- transporter.close();
- try
- {
- transporter.put( new PutTask( URI.create( "missing.txt" ) ) );
- fail( "Expected error" );
- }
- catch ( IllegalStateException e )
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( e ) );
- }
- }
-
- @Test
- public void testPut_StartCancelled()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- listener.cancelStart = true;
- PutTask task = new PutTask( URI.create( "file.txt" ) ).setListener( listener ).setDataString( "upload" );
- transporter.put( task );
- assertEquals( 1, listener.startedCount );
- }
-
- @Test
- public void testPut_ProgressCancelled()
- throws Exception
- {
- RecordingTransportListener listener = new RecordingTransportListener();
- listener.cancelProgress = true;
- PutTask task = new PutTask( URI.create( "file.txt" ) ).setListener( listener ).setDataString( "upload" );
- try
- {
- transporter.put( task );
- fail( "Expected error" );
- }
- catch ( TransferCancelledException e )
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( e ) );
- }
- assertEquals( 0, listener.dataOffset );
- assertEquals( 6, listener.dataLength );
- assertEquals( 1, listener.startedCount );
- assertEquals( 1, listener.progressedCount );
- }
-
- @Test( expected = NoTransporterException.class )
- public void testInit_BadProtocol()
- throws Exception
- {
- newTransporter( "bad:/void" );
- }
-
- @Test
- public void testInit_CaseInsensitiveProtocol()
- throws Exception
- {
- newTransporter( "mem:/void" );
- newTransporter( "MEM:/void" );
- newTransporter( "mEm:/void" );
- }
-
- @Test
- public void testInit_Configuration()
- throws Exception
- {
- session.setConfigProperty( "aether.connector.wagon.config.test", "passed" );
- newTransporter( "mem://" + id + "?config=passed" );
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
- @Test
- public void testInit_UserAgent()
- throws Exception
- {
- session.setConfigProperty( ConfigurationProperties.USER_AGENT, "Test/1.0" );
- newTransporter( "mem://" + id + "?userAgent=Test/1.0" );
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
- @Test
- public void testInit_Timeout()
- throws Exception
- {
- session.setConfigProperty( ConfigurationProperties.REQUEST_TIMEOUT, "12345678" );
- newTransporter( "mem://" + id + "?requestTimeout=12345678" );
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
- @Test
- public void testInit_ServerAuth()
- throws Exception
- {
- String url =
- "mem://" + id + "?serverUsername=testuser&serverPassword=testpass"
- + "&serverPrivateKey=testkey&serverPassphrase=testphrase";
- Authentication auth =
- new AuthenticationBuilder().addUsername( "testuser" ).addPassword( "testpass" ).addPrivateKey( "testkey",
- "testphrase" ).build();
- RemoteRepository repo =
- new RemoteRepository.Builder( "test", "default", url ).setAuthentication( auth ).build();
- newTransporter( repo );
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
- @Test
- public void testInit_Proxy()
- throws Exception
- {
- String url = "mem://" + id + "?proxyHost=testhost&proxyPort=8888";
- RemoteRepository repo =
- new RemoteRepository.Builder( "test", "default", url ).setProxy( new Proxy( "http", "testhost", 8888 ) ).build();
- newTransporter( repo );
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
- @Test
- public void testInit_ProxyAuth()
- throws Exception
- {
- String url = "mem://" + id + "?proxyUsername=testuser&proxyPassword=testpass";
- Authentication auth = new AuthenticationBuilder().addUsername( "testuser" ).addPassword( "testpass" ).build();
- RemoteRepository repo =
- new RemoteRepository.Builder( "test", "default", url ).setProxy( new Proxy( "http", "testhost", 8888, auth ) ).build();
- newTransporter( repo );
- transporter.peek( new PeekTask( URI.create( "file.txt" ) ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/Configurable.java
----------------------------------------------------------------------
diff --git a/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/Configurable.java b/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/Configurable.java
deleted file mode 100644
index 9a90f6f..0000000
--- a/aether-transport-wagon/src/test/java/org/eclipse/aether/transport/wagon/Configurable.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.aether.transport.wagon;
-
-/*
- * 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.
- */
-
-/**
- */
-public interface Configurable
-{
-
- Object getConfiguration();
-
- void setConfiguration( Object config );
-
-}