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 2016/09/03 20:23:43 UTC
[20/51] [partial] maven-aether git commit: [MNG-6007] rename Aether
to Maven Artifact Resolver
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-classpath/src/test/java/org/eclipse/aether/transport/classpath/RecordingTransportListener.java
----------------------------------------------------------------------
diff --git a/aether-transport-classpath/src/test/java/org/eclipse/aether/transport/classpath/RecordingTransportListener.java b/aether-transport-classpath/src/test/java/org/eclipse/aether/transport/classpath/RecordingTransportListener.java
deleted file mode 100644
index 9447d39..0000000
--- a/aether-transport-classpath/src/test/java/org/eclipse/aether/transport/classpath/RecordingTransportListener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.aether.transport.classpath;
-
-/*
- * 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.ByteArrayOutputStream;
-import java.nio.ByteBuffer;
-
-import org.eclipse.aether.spi.connector.transport.TransportListener;
-import org.eclipse.aether.transfer.TransferCancelledException;
-
-class RecordingTransportListener
- extends TransportListener
-{
-
- public final ByteArrayOutputStream baos = new ByteArrayOutputStream( 1024 );
-
- public long dataOffset;
-
- public long dataLength;
-
- public int startedCount;
-
- public int progressedCount;
-
- public boolean cancelStart;
-
- public boolean cancelProgress;
-
- @Override
- public void transportStarted( long dataOffset, long dataLength )
- throws TransferCancelledException
- {
- startedCount++;
- progressedCount = 0;
- this.dataLength = dataLength;
- this.dataOffset = dataOffset;
- baos.reset();
- if ( cancelStart )
- {
- throw new TransferCancelledException();
- }
- }
-
- @Override
- public void transportProgressed( ByteBuffer data )
- throws TransferCancelledException
- {
- progressedCount++;
- baos.write( data.array(), data.arrayOffset() + data.position(), data.remaining() );
- if ( cancelProgress )
- {
- throw new TransferCancelledException();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-classpath/src/test/resources/file.txt
----------------------------------------------------------------------
diff --git a/aether-transport-classpath/src/test/resources/file.txt b/aether-transport-classpath/src/test/resources/file.txt
deleted file mode 100644
index 30d74d2..0000000
--- a/aether-transport-classpath/src/test/resources/file.txt
+++ /dev/null
@@ -1 +0,0 @@
-test
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-classpath/src/test/resources/repo space/file.txt
----------------------------------------------------------------------
diff --git a/aether-transport-classpath/src/test/resources/repo space/file.txt b/aether-transport-classpath/src/test/resources/repo space/file.txt
deleted file mode 100644
index 30d74d2..0000000
--- a/aether-transport-classpath/src/test/resources/repo space/file.txt
+++ /dev/null
@@ -1 +0,0 @@
-test
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-classpath/src/test/resources/repository/empty.txt
----------------------------------------------------------------------
diff --git a/aether-transport-classpath/src/test/resources/repository/empty.txt b/aether-transport-classpath/src/test/resources/repository/empty.txt
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-classpath/src/test/resources/repository/file.txt
----------------------------------------------------------------------
diff --git a/aether-transport-classpath/src/test/resources/repository/file.txt b/aether-transport-classpath/src/test/resources/repository/file.txt
deleted file mode 100644
index 30d74d2..0000000
--- a/aether-transport-classpath/src/test/resources/repository/file.txt
+++ /dev/null
@@ -1 +0,0 @@
-test
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-classpath/src/test/resources/repository/some space.txt
----------------------------------------------------------------------
diff --git a/aether-transport-classpath/src/test/resources/repository/some space.txt b/aether-transport-classpath/src/test/resources/repository/some space.txt
deleted file mode 100644
index 82cbe04..0000000
--- a/aether-transport-classpath/src/test/resources/repository/some space.txt
+++ /dev/null
@@ -1 +0,0 @@
-space
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/pom.xml
----------------------------------------------------------------------
diff --git a/aether-transport-file/pom.xml b/aether-transport-file/pom.xml
deleted file mode 100644
index a88dc49..0000000
--- a/aether-transport-file/pom.xml
+++ /dev/null
@@ -1,89 +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.2.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>aether-transport-file</artifactId>
-
- <name>Aether Transport File</name>
- <description>
- A transport implementation for repositories using file:// URLs.
- </description>
-
- <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>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <scope>provided</scope>
- <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-core</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.eclipse.sisu</groupId>
- <artifactId>sisu-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporter.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporter.java b/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporter.java
deleted file mode 100644
index 5c5cfa4..0000000
--- a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.aether.transport.file;
-
-/*
- * 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.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.transport.AbstractTransporter;
-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.log.Logger;
-import org.eclipse.aether.transfer.NoTransporterException;
-
-/**
- * A transporter using {@link java.io.File}.
- */
-final class FileTransporter
- extends AbstractTransporter
-{
-
- private final Logger logger;
-
- private final File basedir;
-
- public FileTransporter( RemoteRepository repository, Logger logger )
- throws NoTransporterException
- {
- if ( !"file".equalsIgnoreCase( repository.getProtocol() ) )
- {
- throw new NoTransporterException( repository );
- }
- this.logger = logger;
- basedir = new File( PathUtils.basedir( repository.getUrl() ) ).getAbsoluteFile();
- }
-
- File getBasedir()
- {
- return basedir;
- }
-
- public int classify( Throwable error )
- {
- if ( error instanceof ResourceNotFoundException )
- {
- return ERROR_NOT_FOUND;
- }
- return ERROR_OTHER;
- }
-
- @Override
- protected void implPeek( PeekTask task )
- throws Exception
- {
- getFile( task, true );
- }
-
- @Override
- protected void implGet( GetTask task )
- throws Exception
- {
- File file = getFile( task, true );
- utilGet( task, new FileInputStream( file ), true, file.length(), false );
- }
-
- @Override
- protected void implPut( PutTask task )
- throws Exception
- {
- File file = getFile( task, false );
- file.getParentFile().mkdirs();
- try
- {
- utilPut( task, new FileOutputStream( file ), true );
- }
- catch ( Exception e )
- {
- if ( !file.delete() && file.exists() )
- {
- logger.debug( "Could not delete partial file " + file );
- }
- throw e;
- }
- }
-
- private File getFile( TransportTask task, boolean required )
- throws Exception
- {
- String path = task.getLocation().getPath();
- if ( path.contains( "../" ) )
- {
- throw new IllegalArgumentException( "Illegal resource path: " + path );
- }
- File file = new File( basedir, path );
- if ( required && !file.exists() )
- {
- throw new ResourceNotFoundException( "Could not locate " + file );
- }
- return file;
- }
-
- @Override
- protected void implClose()
- {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporterFactory.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporterFactory.java b/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporterFactory.java
deleted file mode 100644
index 86ae6fc..0000000
--- a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/FileTransporterFactory.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.aether.transport.file;
-
-/*
- * 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 for repositories using the {@code file:} protocol.
- */
-@Named( "file" )
-public final class FileTransporterFactory
- implements TransporterFactory, Service
-{
-
- private Logger logger = NullLoggerFactory.LOGGER;
-
- private float priority;
-
- /**
- * 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 FileTransporterFactory()
- {
- // enables default constructor
- }
-
- @Inject
- FileTransporterFactory( LoggerFactory loggerFactory )
- {
- setLoggerFactory( loggerFactory );
- }
-
- public void initService( ServiceLocator locator )
- {
- setLoggerFactory( locator.getService( LoggerFactory.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 FileTransporterFactory setLoggerFactory( LoggerFactory loggerFactory )
- {
- this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, FileTransporter.class );
- 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 FileTransporterFactory setPriority( float priority )
- {
- this.priority = priority;
- return this;
- }
-
- public Transporter newInstance( RepositorySystemSession session, RemoteRepository repository )
- throws NoTransporterException
- {
- return new FileTransporter( repository, logger );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/PathUtils.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/PathUtils.java b/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/PathUtils.java
deleted file mode 100644
index ac3f8fd..0000000
--- a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/PathUtils.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.eclipse.aether.transport.file;
-
-/*
- * 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.
- */
-
-/**
- * URL handling for file URLs. Based on org.apache.maven.wagon.PathUtils.
- */
-final class PathUtils
-{
-
- private PathUtils()
- {
- }
-
- /**
- * Return the protocol name. <br/>
- * E.g: for input <code>http://www.codehause.org</code> this method will return <code>http</code>
- *
- * @param url the url
- * @return the host name
- */
- public static String protocol( final String url )
- {
- final int pos = url.indexOf( ":" );
-
- if ( pos == -1 )
- {
- return "";
- }
- return url.substring( 0, pos ).trim();
- }
-
- /**
- * Derive the path portion of the given URL.
- *
- * @param url the file-repository URL
- * @return the basedir of the repository
- */
- public static String basedir( String url )
- {
- String protocol = PathUtils.protocol( url );
-
- String retValue = null;
-
- if ( protocol.length() > 0 )
- {
- retValue = url.substring( protocol.length() + 1 );
- }
- else
- {
- retValue = url;
- }
- retValue = decode( retValue );
- // special case: if omitted // on protocol, keep path as is
- if ( retValue.startsWith( "//" ) )
- {
- retValue = retValue.substring( 2 );
-
- if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
- {
- // special case: if there is a windows drive letter, then keep the original return value
- retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
- }
- else
- {
- // Now we expect the host
- int index = retValue.indexOf( "/" );
- if ( index >= 0 )
- {
- retValue = retValue.substring( index + 1 );
- }
-
- // special case: if there is a windows drive letter, then keep the original return value
- if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
- {
- retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
- }
- else if ( index >= 0 )
- {
- // leading / was previously stripped
- retValue = "/" + retValue;
- }
- }
- }
-
- // special case: if there is a windows drive letter using |, switch to :
- if ( retValue.length() >= 2 && retValue.charAt( 1 ) == '|' )
- {
- retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
- }
-
- return retValue.trim();
- }
-
- /**
- * Decodes the specified (portion of a) URL. <strong>Note:</strong> This decoder assumes that ISO-8859-1 is used to
- * convert URL-encoded octets to characters.
- *
- * @param url The URL to decode, may be <code>null</code>.
- * @return The decoded URL or <code>null</code> if the input was <code>null</code>.
- */
- static String decode( String url )
- {
- String decoded = url;
- if ( url != null )
- {
- int pos = -1;
- while ( ( pos = decoded.indexOf( '%', pos + 1 ) ) >= 0 )
- {
- if ( pos + 2 < decoded.length() )
- {
- String hexStr = decoded.substring( pos + 1, pos + 3 );
- char ch = (char) Integer.parseInt( hexStr, 16 );
- decoded = decoded.substring( 0, pos ) + ch + decoded.substring( pos + 3 );
- }
- }
- }
- return decoded;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/ResourceNotFoundException.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/ResourceNotFoundException.java b/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/ResourceNotFoundException.java
deleted file mode 100644
index 462fa0a..0000000
--- a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/ResourceNotFoundException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.aether.transport.file;
-
-/*
- * 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.IOException;
-
-/**
- * Special exception type used instead of {@code FileNotFoundException} to avoid misinterpretation of errors unrelated
- * to the remote resource.
- */
-class ResourceNotFoundException
- extends IOException
-{
-
- public ResourceNotFoundException( String message )
- {
- super( message );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/package-info.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/package-info.java b/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/package-info.java
deleted file mode 100644
index 8220bf4..0000000
--- a/aether-transport-file/src/main/java/org/eclipse/aether/transport/file/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 the local filesystem as "remote" storage.
- */
-package org.eclipse.aether.transport.file;
-
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/site/site.xml
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/site/site.xml b/aether-transport-file/src/site/site.xml
deleted file mode 100644
index 3a16bf9..0000000
--- a/aether-transport-file/src/site/site.xml
+++ /dev/null
@@ -1,36 +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">
- <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-aether/blob/27f8bd73/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/FileTransporterTest.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/FileTransporterTest.java b/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/FileTransporterTest.java
deleted file mode 100644
index 6c4e361..0000000
--- a/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/FileTransporterTest.java
+++ /dev/null
@@ -1,554 +0,0 @@
-package org.eclipse.aether.transport.file;
-
-/*
- * 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.io.File;
-import java.io.FileNotFoundException;
-import java.net.URI;
-
-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.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.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- */
-public class FileTransporterTest
-{
-
- private DefaultRepositorySystemSession session;
-
- private TransporterFactory factory;
-
- private Transporter transporter;
-
- private File repoDir;
-
- private RemoteRepository newRepo( String url )
- {
- return new RemoteRepository.Builder( "test", "default", url ).build();
- }
-
- private void newTransporter( String url )
- throws Exception
- {
- if ( transporter != null )
- {
- transporter.close();
- transporter = null;
- }
- transporter = factory.newInstance( session, newRepo( url ) );
- }
-
- @Before
- public void setUp()
- throws Exception
- {
- session = TestUtils.newSession();
- factory = new FileTransporterFactory( new TestLoggerFactory() );
- repoDir = TestFileUtils.createTempDir();
- TestFileUtils.writeString( new File( repoDir, "file.txt" ), "test" );
- TestFileUtils.writeString( new File( repoDir, "empty.txt" ), "" );
- TestFileUtils.writeString( new File( repoDir, "some space.txt" ), "space" );
- newTransporter( repoDir.toURI().toString() );
- }
-
- @After
- public void tearDown()
- {
- if ( transporter != null )
- {
- transporter.close();
- transporter = null;
- }
- factory = null;
- session = null;
- }
-
- @Test
- public void testClassify()
- throws Exception
- {
- assertEquals( Transporter.ERROR_OTHER, transporter.classify( new FileNotFoundException() ) );
- assertEquals( Transporter.ERROR_NOT_FOUND, transporter.classify( new ResourceNotFoundException( "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 ( ResourceNotFoundException 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" );
- 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_Fragment()
- throws Exception
- {
- GetTask task = new GetTask( URI.create( "file.txt#ignored" ) );
- transporter.get( task );
- assertEquals( "test", task.getDataString() );
- }
-
- @Test
- public void testGet_Query()
- throws Exception
- {
- GetTask task = new GetTask( URI.create( "file.txt?ignored" ) );
- transporter.get( task );
- assertEquals( "test", 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 ( ResourceNotFoundException 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 );
- 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( 0, listener.progressedCount );
- }
-
- @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", TestFileUtils.readString( new File( repoDir, "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", TestFileUtils.readString( new File( repoDir, "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( "", TestFileUtils.readString( new File( repoDir, "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", TestFileUtils.readString( new File( repoDir, "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", TestFileUtils.readString( new File( repoDir, "some space.txt" ) ) );
- }
-
- @Test
- public void testPut_FileHandleLeak()
- throws Exception
- {
- for ( int i = 0; i < 100; i++ )
- {
- File src = TestFileUtils.createTempFile( "upload" );
- File dst = new File( repoDir, "file.txt" );
- transporter.put( new PutTask( URI.create( "file.txt" ) ).setDataFile( src ) );
- assertTrue( i + ", " + src.getAbsolutePath(), src.delete() );
- assertTrue( i + ", " + dst.getAbsolutePath(), dst.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" );
- 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( 0, listener.progressedCount );
- assertFalse( new File( repoDir, "file.txt" ).exists() );
- }
-
- @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 );
- assertFalse( new File( repoDir, "file.txt" ).exists() );
- }
-
- @Test( expected = NoTransporterException.class )
- public void testInit_BadProtocol()
- throws Exception
- {
- newTransporter( "bad:/void" );
- }
-
- @Test
- public void testInit_CaseInsensitiveProtocol()
- throws Exception
- {
- newTransporter( "file:/void" );
- newTransporter( "FILE:/void" );
- newTransporter( "File:/void" );
- }
-
- @Test
- public void testInit_OpaqueUrl()
- throws Exception
- {
- testInit( "file:repository", "repository" );
- }
-
- @Test
- public void testInit_OpaqueUrlTrailingSlash()
- throws Exception
- {
- testInit( "file:repository/", "repository" );
- }
-
- @Test
- public void testInit_OpaqueUrlSpaces()
- throws Exception
- {
- testInit( "file:repo%20space", "repo space" );
- }
-
- @Test
- public void testInit_OpaqueUrlSpacesDecoded()
- throws Exception
- {
- testInit( "file:repo space", "repo space" );
- }
-
- @Test
- public void testInit_HierarchicalUrl()
- throws Exception
- {
- testInit( "file:/repository", "/repository" );
- }
-
- @Test
- public void testInit_HierarchicalUrlTrailingSlash()
- throws Exception
- {
- testInit( "file:/repository/", "/repository" );
- }
-
- @Test
- public void testInit_HierarchicalUrlSpaces()
- throws Exception
- {
- testInit( "file:/repo%20space", "/repo space" );
- }
-
- @Test
- public void testInit_HierarchicalUrlSpacesDecoded()
- throws Exception
- {
- testInit( "file:/repo space", "/repo space" );
- }
-
- @Test
- public void testInit_HierarchicalUrlRoot()
- throws Exception
- {
- testInit( "file:/", "/" );
- }
-
- @Test
- public void testInit_HierarchicalUrlHostNoPath()
- throws Exception
- {
- testInit( "file://host/", "/" );
- }
-
- @Test
- public void testInit_HierarchicalUrlHostPath()
- throws Exception
- {
- testInit( "file://host/dir", "/dir" );
- }
-
- private void testInit( String base, String expected )
- throws Exception
- {
- newTransporter( base );
- File exp = new File( expected ).getAbsoluteFile();
- assertEquals( exp, ( (FileTransporter) transporter ).getBasedir() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/RecordingTransportListener.java
----------------------------------------------------------------------
diff --git a/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/RecordingTransportListener.java b/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/RecordingTransportListener.java
deleted file mode 100644
index c6331e0..0000000
--- a/aether-transport-file/src/test/java/org/eclipse/aether/transport/file/RecordingTransportListener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.aether.transport.file;
-
-/*
- * 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.ByteArrayOutputStream;
-import java.nio.ByteBuffer;
-
-import org.eclipse.aether.spi.connector.transport.TransportListener;
-import org.eclipse.aether.transfer.TransferCancelledException;
-
-class RecordingTransportListener
- extends TransportListener
-{
-
- public final ByteArrayOutputStream baos = new ByteArrayOutputStream( 1024 );
-
- public long dataOffset;
-
- public long dataLength;
-
- public int startedCount;
-
- public int progressedCount;
-
- public boolean cancelStart;
-
- public boolean cancelProgress;
-
- @Override
- public void transportStarted( long dataOffset, long dataLength )
- throws TransferCancelledException
- {
- startedCount++;
- progressedCount = 0;
- this.dataLength = dataLength;
- this.dataOffset = dataOffset;
- baos.reset();
- if ( cancelStart )
- {
- throw new TransferCancelledException();
- }
- }
-
- @Override
- public void transportProgressed( ByteBuffer data )
- throws TransferCancelledException
- {
- progressedCount++;
- baos.write( data.array(), data.arrayOffset() + data.position(), data.remaining() );
- if ( cancelProgress )
- {
- throw new TransferCancelledException();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-http/pom.xml
----------------------------------------------------------------------
diff --git a/aether-transport-http/pom.xml b/aether-transport-http/pom.xml
deleted file mode 100644
index 835bce2..0000000
--- a/aether-transport-http/pom.xml
+++ /dev/null
@@ -1,118 +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.2.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>aether-transport-http</artifactId>
-
- <name>Aether Transport HTTP</name>
- <description>
- A transport implementation for repositories using http:// and https:// URLs.
- </description>
-
- <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.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.3.6</version>
- <exclusions>
- <exclusion>
- <!-- using jcl-over-slf4j instead -->
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>1.7.16</version>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <scope>provided</scope>
- <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-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.aether</groupId>
- <artifactId>aether-test-util</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>7.6.19.v20160209</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.0.13</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>sisu-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/AuthSchemePool.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/AuthSchemePool.java b/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/AuthSchemePool.java
deleted file mode 100644
index 9b86252..0000000
--- a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/AuthSchemePool.java
+++ /dev/null
@@ -1,71 +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 java.util.LinkedList;
-
-import org.apache.http.auth.AuthScheme;
-import org.apache.http.client.params.AuthPolicy;
-import org.apache.http.impl.auth.BasicScheme;
-
-/**
- * Pool of (equivalent) auth schemes for a single host.
- */
-final class AuthSchemePool
-{
-
- private final LinkedList<AuthScheme> authSchemes;
-
- private String schemeName;
-
- public AuthSchemePool()
- {
- authSchemes = new LinkedList<AuthScheme>();
- }
-
- public synchronized AuthScheme get()
- {
- AuthScheme authScheme = null;
- if ( !authSchemes.isEmpty() )
- {
- authScheme = authSchemes.removeLast();
- }
- else if ( AuthPolicy.BASIC.equalsIgnoreCase( schemeName ) )
- {
- authScheme = new BasicScheme();
- }
- return authScheme;
- }
-
- public synchronized void put( AuthScheme authScheme )
- {
- if ( authScheme == null )
- {
- return;
- }
- if ( !authScheme.getSchemeName().equals( schemeName ) )
- {
- schemeName = authScheme.getSchemeName();
- authSchemes.clear();
- }
- authSchemes.add( authScheme );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DeferredCredentialsProvider.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DeferredCredentialsProvider.java b/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DeferredCredentialsProvider.java
deleted file mode 100644
index c0daeaf..0000000
--- a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DeferredCredentialsProvider.java
+++ /dev/null
@@ -1,194 +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 java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.Credentials;
-import org.apache.http.auth.NTCredentials;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.eclipse.aether.repository.AuthenticationContext;
-
-/**
- * Credentials provider that defers calls into the auth context until authentication is actually requested.
- */
-final class DeferredCredentialsProvider
- implements CredentialsProvider
-{
-
- private final CredentialsProvider delegate;
-
- private final Map<AuthScope, Factory> factories;
-
- public DeferredCredentialsProvider()
- {
- delegate = new BasicCredentialsProvider();
- factories = new HashMap<AuthScope, Factory>();
- }
-
- public void setCredentials( AuthScope authScope, Factory factory )
- {
- factories.put( authScope, factory );
- }
-
- public void setCredentials( AuthScope authScope, Credentials credentials )
- {
- delegate.setCredentials( authScope, credentials );
- }
-
- public Credentials getCredentials( AuthScope authScope )
- {
- synchronized ( factories )
- {
- for ( Iterator<Map.Entry<AuthScope, Factory>> it = factories.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry<AuthScope, Factory> entry = it.next();
- if ( authScope.match( entry.getKey() ) >= 0 )
- {
- it.remove();
- delegate.setCredentials( entry.getKey(), entry.getValue().newCredentials() );
- }
- }
- }
- return delegate.getCredentials( authScope );
- }
-
- public void clear()
- {
- delegate.clear();
- }
-
- interface Factory
- {
-
- Credentials newCredentials();
-
- }
-
- static class BasicFactory
- implements Factory
- {
-
- private final AuthenticationContext authContext;
-
- public BasicFactory( AuthenticationContext authContext )
- {
- this.authContext = authContext;
- }
-
- public Credentials newCredentials()
- {
- String username = authContext.get( AuthenticationContext.USERNAME );
- if ( username == null )
- {
- return null;
- }
- String password = authContext.get( AuthenticationContext.PASSWORD );
- return new UsernamePasswordCredentials( username, password );
- }
-
- }
-
- static class NtlmFactory
- implements Factory
- {
-
- private final AuthenticationContext authContext;
-
- public NtlmFactory( AuthenticationContext authContext )
- {
- this.authContext = authContext;
- }
-
- public Credentials newCredentials()
- {
- String username = authContext.get( AuthenticationContext.USERNAME );
- if ( username == null )
- {
- return null;
- }
- String password = authContext.get( AuthenticationContext.PASSWORD );
- String domain = authContext.get( AuthenticationContext.NTLM_DOMAIN );
- String workstation = authContext.get( AuthenticationContext.NTLM_WORKSTATION );
-
- if ( domain == null )
- {
- int backslash = username.indexOf( '\\' );
- if ( backslash < 0 )
- {
- domain = guessDomain();
- }
- else
- {
- domain = username.substring( 0, backslash );
- username = username.substring( backslash + 1 );
- }
- }
- if ( workstation == null )
- {
- workstation = guessWorkstation();
- }
-
- return new NTCredentials( username, password, workstation, domain );
- }
-
- private static String guessDomain()
- {
- return safeNtlmString( System.getProperty( "http.auth.ntlm.domain" ), System.getenv( "USERDOMAIN" ) );
- }
-
- private static String guessWorkstation()
- {
- String localHost = null;
- try
- {
- localHost = InetAddress.getLocalHost().getHostName();
- }
- catch ( UnknownHostException e )
- {
- // well, we have other options to try
- }
- return safeNtlmString( System.getProperty( "http.auth.ntlm.host" ), System.getenv( "COMPUTERNAME" ),
- localHost );
- }
-
- private static String safeNtlmString( String... strings )
- {
- for ( String string : strings )
- {
- if ( string != null )
- {
- return string;
- }
- }
- // avoid NPE from httpclient and trigger proper auth failure instead
- return "";
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DemuxCredentialsProvider.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DemuxCredentialsProvider.java b/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DemuxCredentialsProvider.java
deleted file mode 100644
index f16246e..0000000
--- a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/DemuxCredentialsProvider.java
+++ /dev/null
@@ -1,76 +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 org.apache.http.HttpHost;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.Credentials;
-import org.apache.http.client.CredentialsProvider;
-
-/**
- * Credentials provider that helps to isolate server from proxy credentials. Apache HttpClient uses a single provider
- * for both server and proxy auth, using the auth scope (host, port, etc.) to select the proper credentials. With regard
- * to redirects, we use an auth scope for server credentials that's not specific enough to not be mistaken for proxy
- * auth. This provider helps to maintain the proper isolation.
- */
-final class DemuxCredentialsProvider
- implements CredentialsProvider
-{
-
- private final CredentialsProvider serverCredentialsProvider;
-
- private final CredentialsProvider proxyCredentialsProvider;
-
- private final HttpHost proxy;
-
- public DemuxCredentialsProvider( CredentialsProvider serverCredentialsProvider,
- CredentialsProvider proxyCredentialsProvider, HttpHost proxy )
- {
- this.serverCredentialsProvider = serverCredentialsProvider;
- this.proxyCredentialsProvider = proxyCredentialsProvider;
- this.proxy = proxy;
- }
-
- private CredentialsProvider getDelegate( AuthScope authScope )
- {
- if ( proxy.getPort() == authScope.getPort() && proxy.getHostName().equalsIgnoreCase( authScope.getHost() ) )
- {
- return proxyCredentialsProvider;
- }
- return serverCredentialsProvider;
- }
-
- public Credentials getCredentials( AuthScope authScope )
- {
- return getDelegate( authScope ).getCredentials( authScope );
- }
-
- public void setCredentials( AuthScope authScope, Credentials credentials )
- {
- getDelegate( authScope ).setCredentials( authScope, credentials );
- }
-
- public void clear()
- {
- serverCredentialsProvider.clear();
- proxyCredentialsProvider.clear();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/GlobalState.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/GlobalState.java b/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/GlobalState.java
deleted file mode 100644
index b3a9d4b..0000000
--- a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/GlobalState.java
+++ /dev/null
@@ -1,215 +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 java.io.Closeable;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.http.HttpHost;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.impl.conn.PoolingClientConnectionManager;
-import org.eclipse.aether.RepositoryCache;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.util.ConfigUtils;
-
-/**
- * Container for HTTP-related state that can be shared across incarnations of the transporter to optimize the
- * communication with servers.
- */
-final class GlobalState
- implements Closeable
-{
-
- static class CompoundKey
- {
-
- private final Object[] keys;
-
- public CompoundKey( Object... keys )
- {
- this.keys = keys;
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null || !getClass().equals( obj.getClass() ) )
- {
- return false;
- }
- CompoundKey that = (CompoundKey) obj;
- return Arrays.equals( keys, that.keys );
- }
-
- @Override
- public int hashCode()
- {
- int hash = 17;
- hash = hash * 31 + Arrays.hashCode( keys );
- return hash;
- }
-
- @Override
- public String toString()
- {
- return Arrays.toString( keys );
- }
- }
-
- private static final String KEY = GlobalState.class.getName();
-
- private static final String CONFIG_PROP_CACHE_STATE = "aether.connector.http.cacheState";
-
- private final ConcurrentMap<SslConfig, ClientConnectionManager> connectionManagers;
-
- private final ConcurrentMap<CompoundKey, Object> userTokens;
-
- private final ConcurrentMap<HttpHost, AuthSchemePool> authSchemePools;
-
- private final ConcurrentMap<CompoundKey, Boolean> expectContinues;
-
- public static GlobalState get( RepositorySystemSession session )
- {
- GlobalState cache;
- RepositoryCache repoCache = session.getCache();
- if ( repoCache == null || !ConfigUtils.getBoolean( session, true, CONFIG_PROP_CACHE_STATE ) )
- {
- cache = null;
- }
- else
- {
- Object tmp = repoCache.get( session, KEY );
- if ( tmp instanceof GlobalState )
- {
- cache = (GlobalState) tmp;
- }
- else
- {
- synchronized ( GlobalState.class )
- {
- tmp = repoCache.get( session, KEY );
- if ( tmp instanceof GlobalState )
- {
- cache = (GlobalState) tmp;
- }
- else
- {
- cache = new GlobalState();
- repoCache.put( session, KEY, cache );
- }
- }
- }
- }
- return cache;
- }
-
- private GlobalState()
- {
- connectionManagers = new ConcurrentHashMap<SslConfig, ClientConnectionManager>();
- userTokens = new ConcurrentHashMap<CompoundKey, Object>();
- authSchemePools = new ConcurrentHashMap<HttpHost, AuthSchemePool>();
- expectContinues = new ConcurrentHashMap<CompoundKey, Boolean>();
- }
-
- public void close()
- {
- for ( Iterator<Map.Entry<SslConfig, ClientConnectionManager>> it = connectionManagers.entrySet().iterator(); it.hasNext(); )
- {
- ClientConnectionManager connMgr = it.next().getValue();
- it.remove();
- connMgr.shutdown();
- }
- }
-
- public ClientConnectionManager getConnectionManager( SslConfig config )
- {
- ClientConnectionManager manager = connectionManagers.get( config );
- if ( manager == null )
- {
- ClientConnectionManager connMgr = newConnectionManager( config );
- manager = connectionManagers.putIfAbsent( config, connMgr );
- if ( manager != null )
- {
- connMgr.shutdown();
- }
- else
- {
- manager = connMgr;
- }
- }
- return manager;
- }
-
- public static ClientConnectionManager newConnectionManager( SslConfig sslConfig )
- {
- SchemeRegistry schemeReg = new SchemeRegistry();
- schemeReg.register( new Scheme( "http", 80, new PlainSocketFactory() ) );
- schemeReg.register( new Scheme( "https", 443, new SslSocketFactory( sslConfig ) ) );
-
- PoolingClientConnectionManager connMgr = new PoolingClientConnectionManager( schemeReg );
- connMgr.setMaxTotal( 100 );
- connMgr.setDefaultMaxPerRoute( 50 );
- return connMgr;
- }
-
- public Object getUserToken( CompoundKey key )
- {
- return userTokens.get( key );
- }
-
- public void setUserToken( CompoundKey key, Object userToken )
- {
- if ( userToken != null )
- {
- userTokens.put( key, userToken );
- }
- else
- {
- userTokens.remove( key );
- }
- }
-
- public ConcurrentMap<HttpHost, AuthSchemePool> getAuthSchemePools()
- {
- return authSchemePools;
- }
-
- public Boolean getExpectContinue( CompoundKey key )
- {
- return expectContinues.get( key );
- }
-
- public void setExpectContinue( CompoundKey key, boolean enabled )
- {
- expectContinues.put( key, enabled );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpMkCol.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpMkCol.java b/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpMkCol.java
deleted file mode 100644
index 7a945ea..0000000
--- a/aether-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpMkCol.java
+++ /dev/null
@@ -1,44 +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 java.net.URI;
-
-import org.apache.http.client.methods.HttpRequestBase;
-
-/**
- * WebDAV MKCOL request to create parent directories.
- */
-final class HttpMkCol
- extends HttpRequestBase
-{
-
- public HttpMkCol( URI uri )
- {
- setURI( uri );
- }
-
- @Override
- public String getMethod()
- {
- return "MKCOL";
- }
-
-}