o Decoupled it0069 from production dependency

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@700584 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-09-30 21:23:53 +00:00
parent ef1a75dc63
commit 6cbaa7ba27
6 changed files with 138 additions and 21 deletions

View File

@ -37,15 +37,50 @@ public class MavenIT0069Test
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0069" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
List cliOptions = new ArrayList();
cliOptions.add( "-o" );
verifier.setCliOptions( cliOptions );
verifier.executeGoal( "compile" );
verifier.assertFilePresent( "target/classes/org/apache/maven/it0069/ClassworldBasedThing.class" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
{
// phase 1: run build in online mode to fill local repo
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution::compile" );
verifier.assertFilePresent( "target/compile.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log1.txt" ) );
}
{
// phase 2: run build in offline mode to check it still passes (after deleting test repo, to be sure)
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.deleteDirectory( "repo" );
List cliOptions = new ArrayList();
cliOptions.add( "-o" );
verifier.setCliOptions( cliOptions );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution::compile" );
verifier.assertFilePresent( "target/compile.txt" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log2.txt" ) );
}
{
// phase 3: delete test artifact and run build in offline mode to check it fails now
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.deleteArtifact( "org.apache.maven.its.it0069", "it", "1.0.3", "jar" );
List cliOptions = new ArrayList();
cliOptions.add( "-o" );
verifier.setCliOptions( cliOptions );
try
{
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution::compile" );
fail( "Build did not fail!" );
}
catch( VerificationException e )
{
// expected, should fail
}
verifier.resetStreams();
new File( testDir, "log.txt").renameTo( new File( testDir, "log3.txt" ) );
}
}
}
}

View File

@ -1,16 +1,58 @@
<?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>
<name>Maven Integration Test :: it0069</name>
<groupId>org.apache.maven.its.it0069</groupId>
<artifactId>maven-it-it0069</artifactId>
<description>Test offline mode.</description>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: it0069</name>
<description>Test offline mode.</description>
<dependencies>
<dependency>
<groupId>classworlds</groupId>
<artifactId>classworlds</artifactId>
<version>1.1-alpha-2</version>
<groupId>org.apache.maven.its.it0069</groupId>
<artifactId>it</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>it0018</id>
<url>file:///${basedir}/repo</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<configuration>
<compileClassPath>target/compile.txt</compileClassPath>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
<?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.it0069</groupId>
<artifactId>it</artifactId>
<version>1.0.3</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>it0069</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<groupId>org.apache.maven.its.it0069</groupId>
<artifactId>it</artifactId>
<version>1.0.3</version>
<versioning>
<versions>
<version>1.0.3</version>
</versions>
<lastUpdated>20080930194953</lastUpdated>
</versioning>
</metadata>

View File

@ -1,7 +0,0 @@
package org.apache.maven.it0069;
public class ClassworldBasedThing
{
private org.codehaus.classworlds.ClassRealm realm;
}