mirror of https://github.com/apache/maven.git
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:
parent
66f606b5a9
commit
e762352634
|
@ -23,27 +23,30 @@ import org.apache.maven.it.Verifier;
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MavenIT0063Test
|
public class MavenIT0063Test
|
||||||
extends AbstractMavenIntegrationTestCase
|
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()
|
public void testit0063()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0063" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0063" );
|
||||||
|
|
||||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
verifier.executeGoal( "package" );
|
verifier.getSystemProperties().setProperty( "jre.home", new File( testDir, "jdk/jre" ).getPath() );
|
||||||
verifier.assertFilePresent( "target/classes/org/apache/maven/it0063/Person.class" );
|
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution::compile" );
|
||||||
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.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
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() );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
|
@ -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>
|
<project>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>Maven Integration Test :: it0063</name>
|
|
||||||
<groupId>org.apache.maven.its.it0063</groupId>
|
<groupId>org.apache.maven.its.it0063</groupId>
|
||||||
<artifactId>maven-it-it0063</artifactId>
|
<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>
|
<version>1.0</version>
|
||||||
<dependencies>
|
<packaging>jar</packaging>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
<name>Maven Integration Test :: it0063</name>
|
||||||
<artifactId>junit</artifactId>
|
<description>Test the use of a system scoped dependency to a (fake) tools.jar.</description>
|
||||||
<version>3.8.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</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>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun</groupId>
|
<groupId>com.sun</groupId>
|
||||||
<artifactId>tools</artifactId>
|
<artifactId>tools</artifactId>
|
||||||
<version>1.4.2</version>
|
<version>1.4.2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${java.home}/../lib/tools.jar</systemPath>
|
<systemPath>${jre.home}/../lib/tools.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</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>
|
</project>
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
name = jason
|
|
|
@ -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() );
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue