Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core-it-suite/src/test/java/org/apache/maven/it/HttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,23 @@ public void start()
// server.join();
}

public boolean isFailed()
{
return server.isFailed();
}

public void stop()
throws Exception
{
server.stop();
}

public void join()
throws Exception
{
server.join();
}

public int port()
{
return ( (NetworkConnector) server.getConnectors()[0] ).getLocalPort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public static Test suite()
// Tests that don't run stable and need to be fixed
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng7470ResolverTransportTest.class );
suite.addTestSuite( MavenITmng7464ReadOnlyMojoParametersWarningTest.class );
suite.addTestSuite( MavenITmng7404IgnorePrefixlessExpressionsTest.class );
suite.addTestSuite( MavenITmng5222MojoDeprecatedTest.class );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package org.apache.maven.it;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import org.apache.maven.it.util.ResourceExtractor;

/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-7470">MNG-7470</a>:
* check that Maven two bundled transports works as expected.
*/
public class MavenITmng7470ResolverTransportTest
extends AbstractMavenIntegrationTestCase
{
private File testDir;

private File projectDir;

private HttpServer server;

private int port;

public MavenITmng7470ResolverTransportTest()
{
super( "[3.9.0,)" );
}

@Override
protected void setUp()
throws Exception
{
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7470-resolver-transport" );
projectDir = new File( testDir, "project" );

server = HttpServer.builder()
.port( 0 )
.source( new File( testDir, "repo" ) )
.build();
server.start();
if ( server.isFailed() )
{
fail( "Couldn't bind the server socket to a free port!" );
}
port = server.port();
System.out.println( "Bound server socket to the port " + port );
}

@Override
protected void tearDown()
throws Exception
{
if ( server != null )
{
server.stop();
server.join();
}
}

private void performTest( final String transport, final String logSnippet ) throws Exception
{
Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
Map<String, String> properties = new HashMap<>();
properties.put( "@port@", Integer.toString( port ) );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties );
verifier.setLogFileName( transport + "-transport.log" );
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.resolver-transport" );
verifier.addCliOption( "-X" );
verifier.addCliOption( "-s" );
verifier.addCliOption( new File( projectDir, "settings.xml" ).getAbsolutePath() );
verifier.addCliOption( "-Pmaven-core-it-repo" );
verifier.addCliOption( "-Dmaven.resolver.transport=" + transport );
// Maven will fail if project dependencies cannot be resolved.
// As dependency exists ONLY in HTTP repo, it MUST be reached using selected transport and
// successfully resolved from it.
verifier.executeGoal( "verify" );
verifier.verifyErrorFreeLog();
// verify maven console output contains "[DEBUG] Using transporter XXXTransporter"
verifier.verifyTextInLog( logSnippet );
verifier.resetStreams();
}

public void testResolverTransportWagon()
throws Exception
{
performTest( "wagon", "[DEBUG] Using transporter WagonTransporter" );
}

public void testResolverTransportNative()
throws Exception
{
performTest( "native", "[DEBUG] Using transporter HttpTransporter" );
}
}
69 changes: 69 additions & 0 deletions core-it-suite/src/test/resources/bootstrap/group-15/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.maven.its.bootstrap</groupId>
<artifactId>maven-it-boostrap</artifactId>
<version>1.0</version>
</parent>

<groupId>org.apache.maven.its.bootstrap</groupId>
<artifactId>group-15</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>Maven Integration Test :: Boostrap :: Group-15 :: Resolver 1.7.3</name>

<properties>
<resolverVersion>1.7.3</resolverVersion>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>${resolverVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-spi</artifactId>
<version>${resolverVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-util</artifactId>
<version>${resolverVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-impl</artifactId>
<version>${resolverVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
<version>${resolverVersion}</version>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions core-it-suite/src/test/resources/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ under the License.
<module>group-12</module>
<module>group-13</module>
<module>group-14</module>
<module>group-15</module>
</modules>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.resolver-transport</groupId>
<artifactId>project</artifactId>
<version>0.1</version>
<packaging>jar</packaging>

<name>Maven Integration Test :: resolver-transport</name>
<description>
Verify that Maven transport works.
</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>resolver-demo-maven-plugin</artifactId>
<version>1.7.3</version>
<executions>
<execution>
<id>resolve</id>
<phase>validate</phase>
<goals>
<goal>resolve-artifact</goal>
</goals>
<configuration>
<artifactCoords>org.apache.maven.its.resolver-transport:dependency:1.0</artifactCoords>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?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.
-->

<settings>
<profiles>
<profile>
<id>maven-core-it-repo</id>
<repositories>
<repository>
<id>maven-core-it</id>
<url>http://localhost:@port@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-core-it</id>
<url>http://localhost:@port@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pom text eol=lf
maven-metadata.xml text eol=lf

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b530516717ab5b3052fd3cdca860fc28574bd718
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.resolver-transport</groupId>
<artifactId>dependency</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>Maven Integration Test :: resolver-transport :: dependency</name>
<description>
Dependency pulled with transport.
</description>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b58c041fe630e9248109e305c5d2d0c5fea978a3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ed81d315b44e79187fe8ad71b7b2665ac9b95f08
Loading