o Decoupled it0063 from production JDK

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@699321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-09-26 13:40:13 +00:00
parent 66f606b5a9
commit e762352634
6 changed files with 54 additions and 70 deletions

View File

@ -23,27 +23,30 @@ import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.List;
public class MavenIT0063Test
extends AbstractMavenIntegrationTestCase
{
/**
* Test the use of a system scoped dependency to tools.jar.
* Test the use of a system scoped dependency to a (fake) tools.jar.
*/
public void testit0063()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0063" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.executeGoal( "package" );
verifier.assertFilePresent( "target/classes/org/apache/maven/it0063/Person.class" );
verifier.assertFilePresent( "target/test-classes/org/apache/maven/it0063/PersonTest.class" );
verifier.assertFilePresent( "target/maven-it-it0063-1.0.jar" );
verifier.assertFilePresent( "target/maven-it-it0063-1.0.jar!/it0063.properties" );
verifier.getSystemProperties().setProperty( "jre.home", new File( testDir, "jdk/jre" ).getPath() );
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution::compile" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
List lines = verifier.loadLines( "target/compile.txt", "UTF-8" );
assertEquals( 2, lines.size() );
assertEquals( new File( testDir, "jdk/lib/tools.jar").getCanonicalFile(),
new File( (String) lines.get(1) ).getCanonicalFile() );
}
}
}

View File

@ -1,38 +1,54 @@
<?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 :: it0063</name>
<groupId>org.apache.maven.its.it0063</groupId>
<artifactId>maven-it-it0063</artifactId>
<description>Test the use of a system scoped dependency to tools.jar.</description>
<packaging>jar</packaging>
<version>1.0</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: it0063</name>
<description>Test the use of a system scoped dependency to a (fake) tools.jar.</description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>${jre.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- NOTE: This will not be activated on OS X, since classes.jar already has the tools in it. -->
<id>default-tools.jar</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
<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

@ -1,18 +0,0 @@
package org.apache.maven.it0063;
import com.sun.tools.javac.Main;
public class Person
{
private String name;
public void setName( String name )
{
this.name = name;
}
public String getName()
{
return name;
}
}

View File

@ -1,16 +0,0 @@
package org.apache.maven.it0063;
import junit.framework.TestCase;
public class PersonTest
extends TestCase
{
public void testPerson()
{
Person person = new Person();
person.setName( "foo" );
assertEquals( "foo", person.getName() );
}
}