You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2013/01/04 12:47:58 UTC
svn commit: r1428810 - in /maven/indexer/trunk: ./ indexer-cli/
indexer-core/ indexer-core/src/test/java/org/apache/maven/index/updater/
indexer-core/src/test/java/org/apache/maven/index/updater/fixtures/
Author: olamy
Date: Fri Jan 4 11:47:58 2013
New Revision: 1428810
URL: http://svn.apache.org/viewvc?rev=1428810&view=rev
Log:
no need of port allocation
use port 0 then get the real local port used.
Modified:
maven/indexer/trunk/indexer-cli/pom.xml
maven/indexer/trunk/indexer-core/pom.xml
maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java
maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/fixtures/ServerTestFixture.java
maven/indexer/trunk/pom.xml
Modified: maven/indexer/trunk/indexer-cli/pom.xml
URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-cli/pom.xml?rev=1428810&r1=1428809&r2=1428810&view=diff
==============================================================================
--- maven/indexer/trunk/indexer-cli/pom.xml (original)
+++ maven/indexer/trunk/indexer-cli/pom.xml Fri Jan 4 11:47:58 2013
@@ -104,7 +104,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
+ <artifactId>wagon-http</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -159,30 +159,11 @@ under the License.
<systemPropertyVariables>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
<indexerJar>${project.build.directory}/${project.artifactId}-${project.version}.jar</indexerJar>
- <index-server>${index-server}</index-server>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>reserve-network-port</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <portNames>
- <portName>index-server</portName>
- </portNames>
- </configuration>
- </plugin>
</plugins>
<pluginManagement>
<plugins>
Modified: maven/indexer/trunk/indexer-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/pom.xml?rev=1428810&r1=1428809&r2=1428810&view=diff
==============================================================================
--- maven/indexer/trunk/indexer-core/pom.xml (original)
+++ maven/indexer/trunk/indexer-core/pom.xml Fri Jan 4 11:47:58 2013
@@ -186,7 +186,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
+ <artifactId>wagon-http</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -213,24 +213,6 @@ under the License.
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>reserve-network-port</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <portNames>
- <portName>index-server</portName>
- </portNames>
- </configuration>
- </plugin>
</plugins>
<pluginManagement>
<plugins>
Modified: maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java
URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java?rev=1428810&r1=1428809&r2=1428810&view=diff
==============================================================================
--- maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java (original)
+++ maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java Fri Jan 4 11:47:58 2013
@@ -430,25 +430,12 @@ public class DefaultIndexUpdaterEmbeddin
public void setUp()
throws Exception
{
- // FIXME: Try to detect the port from the system environment.
- int port = -1;
- String portStr = System.getProperty( "index-server" );
- if ( portStr != null )
- {
- port = Integer.parseInt( portStr );
- }
- if ( port < 1024 )
- {
- System.out.println( "Using default port: 8080" );
- port = 8080;
- }
-
- baseUrl = "http://127.0.0.1:" + port + "/";
-
- server = new ServerTestFixture( port );
+ server = new ServerTestFixture( 0 );
container = new DefaultPlexusContainer();
+ baseUrl = "http://127.0.0.1:" + server.getPort() + "/";
+
updater = container.lookup( IndexUpdater.class, "default" );
wagonHelper = new WagonHelper( container );
Modified: maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/fixtures/ServerTestFixture.java
URL: http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/fixtures/ServerTestFixture.java?rev=1428810&r1=1428809&r2=1428810&view=diff
==============================================================================
--- maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/fixtures/ServerTestFixture.java (original)
+++ maven/indexer/trunk/indexer-core/src/test/java/org/apache/maven/index/updater/fixtures/ServerTestFixture.java Fri Jan 4 11:47:58 2013
@@ -65,12 +65,12 @@ public class ServerTestFixture
Connector connector = new SelectChannelConnector();
connector.setPort( port );
- server.setConnectors( new Connector[] { connector } );
+ server.setConnectors( new Connector[]{ connector } );
Constraint constraint = new Constraint();
constraint.setName( Constraint.__BASIC_AUTH );
- constraint.setRoles( new String[] { "allowed" } );
+ constraint.setRoles( new String[]{ "allowed" } );
constraint.setAuthenticate( true );
ConstraintMapping cm = new ConstraintMapping();
@@ -86,7 +86,7 @@ public class ServerTestFixture
realm.addUserToRole( "longuser", "allowed" );
sh.setUserRealm( realm );
- sh.setConstraintMappings( new ConstraintMapping[] { cm } );
+ sh.setConstraintMappings( new ConstraintMapping[]{ cm } );
WebAppContext ctx = new WebAppContext();
ctx.setContextPath( "/" );
@@ -102,7 +102,7 @@ public class ServerTestFixture
( (AbstractSessionManager) sessionHandler.getSessionManager() ).setUsingCookies( false );
HandlerCollection handlers = new HandlerCollection();
- handlers.setHandlers( new Handler[] { ctx, new DefaultHandler() } );
+ handlers.setHandlers( new Handler[]{ ctx, new DefaultHandler() } );
server.setHandler( handlers );
server.start();
@@ -147,7 +147,7 @@ public class ServerTestFixture
catch ( URISyntaxException e )
{
resp.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Cannot find server document root in classpath: " + SERVER_ROOT_RESOURCE_PATH );
+ "Cannot find server document root in classpath: " + SERVER_ROOT_RESOURCE_PATH );
return;
}
@@ -192,6 +192,11 @@ public class ServerTestFixture
}
}
+ public int getPort()
+ {
+ return server.getConnectors()[0].getLocalPort();
+ }
+
public static final class InfiniteRedirectionServlet
extends HttpServlet
{
Modified: maven/indexer/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/indexer/trunk/pom.xml?rev=1428810&r1=1428809&r2=1428810&view=diff
==============================================================================
--- maven/indexer/trunk/pom.xml (original)
+++ maven/indexer/trunk/pom.xml Fri Jan 4 11:47:58 2013
@@ -77,7 +77,7 @@ under the License.
<maven.version>3.0.4</maven.version>
<aether.version>1.13.1</aether.version>
<archetype.version>2.2</archetype.version>
- <wagon.version>2.2</wagon.version>
+ <wagon.version>2.3</wagon.version>
<truezip.version>7.6.6</truezip.version>
<maven.site.cache>${user.home}/maven-sites</maven.site.cache>
@@ -156,7 +156,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
+ <artifactId>wagon-http</artifactId>
<version>${wagon.version}</version>
<scope>test</scope>
</dependency>
@@ -300,25 +300,6 @@ under the License.
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <versionRange>[1.7,)</versionRange>
- <goals>
- <goal>allocate-ports</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
</plugin>
</plugins>
</pluginManagement>