mirror of https://github.com/apache/maven.git
o Decoupled it0043 from production plugin
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@701506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
800c4e4c1f
commit
38e082770c
|
@ -23,6 +23,7 @@ import org.apache.maven.it.Verifier;
|
|||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenIT0043Test
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
|
@ -36,22 +37,50 @@ public class MavenIT0043Test
|
|||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0043" );
|
||||
|
||||
File child1 = new File( testDir, "child1" );
|
||||
// Phase 1: Ensure the test plugin is downloaded before the test cuts off access to central
|
||||
File child1 = new File( testDir, "setup" );
|
||||
Verifier verifier = new Verifier( child1.getAbsolutePath() );
|
||||
|
||||
verifier.deleteArtifact( "org.apache.maven.plugins", "maven-help-plugin", "2.0.2", "jar" );
|
||||
|
||||
verifier.executeGoal( "org.apache.maven.plugins:maven-help-plugin:2.0.2:effective-pom" );
|
||||
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression::eval" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
File child2 = new File( testDir, "child2" );
|
||||
// Phase 2: Now run the test
|
||||
File child2 = new File( testDir, "test" );
|
||||
verifier = new Verifier( child2.getAbsolutePath() );
|
||||
|
||||
verifier.executeGoal( "org.apache.maven.plugins:maven-help-plugin:2.0.2:effective-pom" );
|
||||
Properties systemProperties = new Properties();
|
||||
systemProperties.put( "expression.expressions", "project/repositories,project/pluginRepositories" );
|
||||
verifier.setSystemProperties( systemProperties );
|
||||
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression::eval" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
}
|
||||
}
|
||||
verifier.assertFilePresent( "target/expression.properties" );
|
||||
Properties props = verifier.loadProperties( "target/expression.properties" );
|
||||
|
||||
int count = Integer.parseInt( props.getProperty( "project.repositories", "0" ) );
|
||||
assertTrue( count > 0 );
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
String key = "project.repositories." + i;
|
||||
if ( "central".equals( props.getProperty( key + ".id" ) ) )
|
||||
{
|
||||
assertEquals( "it0043", props.getProperty( key + ".name" ) );
|
||||
assertTrue( props.getProperty( key + ".url" ).endsWith( "/tmp/maven-core-it0043-repo" ) );
|
||||
}
|
||||
}
|
||||
|
||||
count = Integer.parseInt( props.getProperty( "project.pluginRepositories", "0" ) );
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
String key = "project.pluginRepositories." + i;
|
||||
if ( "central".equals( props.getProperty( key + ".id" ) ) )
|
||||
{
|
||||
assertEquals( "it0043", props.getProperty( key + ".name" ) );
|
||||
assertTrue( props.getProperty( key + ".url" ).endsWith( "/tmp/maven-core-it0043-repo" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven.its.it0043</groupId>
|
||||
<artifactId>maven-it-it0043-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-it-it0043-child1</artifactId>
|
||||
<name>Maven Integration Test :: it0043 Child1</name>
|
||||
<description>Test for repository inheritence - ensure using the same id overrides the defaults</description>
|
||||
|
||||
</project>
|
|
@ -1,44 +0,0 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven.its.it0043</groupId>
|
||||
<artifactId>maven-it-it0043-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-it-it0043-child2</artifactId>
|
||||
<name>Maven Integration Test :: it0043 Child2</name>
|
||||
<description>Test for repository inheritence - ensure using the same id overrides the defaults</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<name>Empty Repository</name>
|
||||
<url>file:/tmp/emptyRepo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>central</id>
|
||||
<name>Empty Repository</name>
|
||||
<url>file:/tmp/emptyRepo</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- make sure child1 is built first so the help plugin is in
|
||||
the local repo -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.it0043</groupId>
|
||||
<artifactId>maven-it-it0043-child1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>junit</groupId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,26 +0,0 @@
|
|||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class RepositoryOverrideTest extends TestCase
|
||||
{
|
||||
public void testPOM() throws Exception
|
||||
{
|
||||
|
||||
BufferedInputStream in = new BufferedInputStream( new FileInputStream("target/effective-pom.xml") );
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
|
||||
int rd = 0;
|
||||
byte [] buffer = new byte[512];
|
||||
|
||||
while ( ( rd = in.read( buffer ) ) > 0 )
|
||||
{
|
||||
out.write( buffer, 0, rd );
|
||||
}
|
||||
|
||||
assertEquals( -1, out.toString().indexOf("repo1.maven.org") );
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>Maven Integration Test :: it0043 Parent</name>
|
||||
<groupId>org.apache.maven.its.it0043</groupId>
|
||||
<artifactId>maven-it-it0043-parent</artifactId>
|
||||
<description>Test for repository inheritence - ensure using the same id overrides the defaults</description>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- this 3 project structure is to make sure that the help:plugin,
|
||||
used in child2, where the real test is, is available in the
|
||||
local repo. Child2 depends on child1 which uses the help plugin
|
||||
in a dummy call to make sure it's available. Then child2 is
|
||||
built, overriding the central repo. -->
|
||||
|
||||
<modules>
|
||||
<module>child1</module>
|
||||
<module>child2</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,31 @@
|
|||
<?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.it0043</groupId>
|
||||
<artifactId>maven-it-it0043</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<name>Maven Integration Test :: it0043 setup</name>
|
||||
<description>Preparation project with non-overriden URL to central for plugin download.</description>
|
||||
</project>
|
|
@ -0,0 +1,47 @@
|
|||
<?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.it0043</groupId>
|
||||
<artifactId>maven-it-it0043</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<name>Maven Integration Test :: it0043</name>
|
||||
<description>Test for repository inheritence - ensure using the same id overrides the defaults</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<name>it0043</name>
|
||||
<url>file:/tmp/maven-core-it0043-repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>central</id>
|
||||
<name>it0043</name>
|
||||
<url>file:/tmp/maven-core-it0043-repo</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
Loading…
Reference in New Issue