You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/08/03 23:44:50 UTC
svn commit: r800584 - in /maven/core-integration-testing/trunk:
core-it-suite/src/test/java/org/apache/maven/it/
core-it-suite/src/test/resources/mng-4279/
core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/
Author: jdcasey
Date: Mon Aug 3 21:44:50 2009
New Revision: 800584
URL: http://svn.apache.org/viewvc?rev=800584&view=rev
Log:
[MNG-4279] Attempting to work around apparent issues with reusing the 'central' repository/server id for this IT.
Added:
maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java (with props)
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4279WagonProviderFailoverTest.java
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/pom.xml
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/settings.xml
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4279WagonProviderFailoverTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4279WagonProviderFailoverTest.java?rev=800584&r1=800583&r2=800584&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4279WagonProviderFailoverTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4279WagonProviderFailoverTest.java Mon Aug 3 21:44:50 2009
@@ -46,6 +46,7 @@
verifier.getCliOptions().add( "-s" );
verifier.getCliOptions().add( "settings.xml" );
+
verifier.executeGoal( "deploy" );
verifier.verifyErrorFreeLog();
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/pom.xml?rev=800584&r1=800583&r2=800584&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/pom.xml Mon Aug 3 21:44:50 2009
@@ -18,8 +18,18 @@
<distributionManagement>
<repository>
- <id>central</id>
- <url>file:///${java.io.tmpdir}/${project.artifactId}</url>
+ <id>test</id>
+ <url>coreit://foo.com/deploy</url>
</repository>
</distributionManagement>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>core-it-wagon</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ </extension>
+ </extensions>
+ </build>
</project>
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/settings.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/settings.xml?rev=800584&r1=800583&r2=800584&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/settings.xml (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4279/settings.xml Mon Aug 3 21:44:50 2009
@@ -1,9 +1,9 @@
<settings>
<servers>
<server>
- <id>central</id>
+ <id>test</id>
<configuration>
- <wagonProvider>lightweight</wagonProvider>
+ <wagonProvider>foo</wagonProvider>
</configuration>
</server>
</servers>
Added: maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java?rev=800584&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java Mon Aug 3 21:44:50 2009
@@ -0,0 +1,181 @@
+package org.apache.maven.wagon.providers.coreit;
+
+/*
+ * 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.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Properties;
+
+import org.apache.maven.wagon.AbstractWagon;
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.InputData;
+import org.apache.maven.wagon.OutputData;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.resource.Resource;
+
+/**
+ * Shamelessly copied from ScpExternalWagon in this same project...
+ *
+ * @plexus.component role="org.apache.maven.wagon.Wagon" role-hint="coreit"
+ */
+public class CoreItWagon
+ extends AbstractWagon
+{
+ public void get( String resourceName, File destination )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ InputData inputData = new InputData();
+
+ Resource resource = new Resource( resourceName );
+
+ fireGetInitiated( resource, destination );
+
+ inputData.setResource( resource );
+
+ fillInputData( inputData );
+
+ InputStream is = inputData.getInputStream();
+
+ if ( is == null )
+ {
+ throw new TransferFailedException( getRepository().getUrl()
+ + " - Could not open input stream for resource: '" + resource + "'" );
+ }
+
+ createParentDirectories( destination );
+
+ getTransfer( inputData.getResource(), destination, is );
+ }
+
+ public boolean getIfNewer( String resourceName, File destination, long timestamp )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ return false;
+ }
+
+ public void put( File source, String resourceName )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ OutputData outputData = new OutputData();
+
+ Resource resource = new Resource( resourceName );
+
+ firePutInitiated( resource, source );
+
+ outputData.setResource( resource );
+
+ fillOutputData( outputData );
+
+ OutputStream os = outputData.getOutputStream();
+
+ if ( os == null )
+ {
+ throw new TransferFailedException( getRepository().getUrl()
+ + " - Could not open output stream for resource: '" + resource + "'" );
+ }
+
+ putTransfer( outputData.getResource(), source, os, true );
+ }
+
+ public void closeConnection()
+ throws ConnectionException
+ {
+ File f = new File( "target/wagon-data" );
+ try
+ {
+ f.getParentFile().mkdirs();
+ f.createNewFile();
+ }
+ catch ( IOException e )
+ {
+ throw new ConnectionException( e.getMessage(), e );
+ }
+ }
+
+ public void fillInputData( InputData inputData )
+ throws TransferFailedException, ResourceDoesNotExistException
+ {
+ try
+ {
+ inputData.setInputStream( new ByteArrayInputStream( "<metadata />".getBytes( "UTF-8" ) ) );
+ }
+ catch ( IOException e )
+ {
+ throw new TransferFailedException( "Broken JVM", e );
+ }
+ }
+
+ public void fillOutputData( OutputData outputData )
+ throws TransferFailedException
+ {
+ Properties props = new Properties();
+ if ( getRepository().getPermissions() != null )
+ {
+ String dirPerms = getRepository().getPermissions().getDirectoryMode();
+
+ if ( dirPerms != null )
+ {
+ props.setProperty( "directory.mode", dirPerms );
+ }
+
+ String filePerms = getRepository().getPermissions().getFileMode();
+ if ( filePerms != null )
+ {
+ props.setProperty( "file.mode", filePerms );
+ }
+ }
+
+ try
+ {
+ new File( "target" ).mkdirs();
+
+ OutputStream os = new FileOutputStream( "target/wagon.properties" );
+ try
+ {
+ props.store( os, "MAVEN-CORE-IT-WAGON" );
+ }
+ finally
+ {
+ os.close();
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new TransferFailedException( e.getMessage(), e );
+ }
+
+ outputData.setOutputStream( new ByteArrayOutputStream() );
+ }
+
+ public void openConnection()
+ throws ConnectionException, AuthenticationException
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/coreit/CoreItWagon.java
------------------------------------------------------------------------------
svn:eol-style = native