Author: dfabulich
Date: Fri Jan 25 18:49:33 2008
New Revision: 615427
URL: http://svn.apache.org/viewvc?rev=615427&view=rev
Log:
[SUREFIRE-428] Test classpath ordering.
Submitted by: Benjamin Bentmann
Reviewed by: Dan Fabulich
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/pom.xml
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-report.properties
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/it/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/it/BasicTest.java
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/resources/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderTest.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderTest.java?rev=615427&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderTest.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderTest.java
Fri Jan 25 18:49:33 2008
@@ -0,0 +1,31 @@
+package org.apache.maven.surefire.its;
+
+
+import junit.framework.TestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * Test for checking the order of class path elements
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Dan Fabulich</a>
+ *
+ */
+public class ClassPathOrderTest
+ extends TestCase
+{
+ public void testClassPathOrder ()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(),
"/classpath-order" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ verifier.executeGoal( "test" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ HelperAssertions.assertTestSuiteResults( 2, 0, 0, 0, testDir );
+ }
+}
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/pom.xml
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/pom.xml?rev=615427&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/pom.xml
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/pom.xml
Fri Jan 25 18:49:33 2008
@@ -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 xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.surefire</groupId>
+ <artifactId>classpath-order</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test proper order of class path elements: test-classes, classes,
dependencies</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties?rev=615427&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties
Fri Jan 25 18:49:33 2008
@@ -0,0 +1,2 @@
+# This file collides with the equally named file from the project's test
resources
+Surefire: classes
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-report.properties
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-report.properties?rev=615427&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-report.properties
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/main/resources/surefire-report.properties
Fri Jan 25 18:49:33 2008
@@ -0,0 +1,2 @@
+# This file collides with the equally named i18n bundle in the Surefire Report
Plugin
+Surefire: classes
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/it/BasicTest.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/it/BasicTest.java?rev=615427&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/it/BasicTest.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/java/it/BasicTest.java
Fri Jan 25 18:49:33 2008
@@ -0,0 +1,42 @@
+package it;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+public class BasicTest
+ extends TestCase
+{
+
+ public void testTestClassesBeforeMainClasses()
+ {
+ Properties props = getProperties(
"/surefire-classpath-order.properties" );
+ assertEquals( "test-classes", props.getProperty( "Surefire" ) );
+ }
+
+ public void testMainClassesBeforeDependencies()
+ {
+ Properties props = getProperties( "/surefire-report.properties" );
+ assertEquals( "classes", props.getProperty( "Surefire" ) );
+ }
+
+ private Properties getProperties(String resource)
+ {
+ InputStream in = getClass().getResourceAsStream( resource );
+ assertNotNull( in );
+ try
+ {
+ Properties props = new Properties();
+ props.load( in );
+ return props;
+ }
+ catch (IOException e)
+ {
+ fail(e.toString());
+ return null;
+ }
+ }
+
+}
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties?rev=615427&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties
Fri Jan 25 18:49:33 2008
@@ -0,0 +1,2 @@
+# This file collides with the equally named file from the project's main
resources
+Surefire: test-classes