You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2014/10/09 00:46:25 UTC
git commit: Fixed build process
Repository: maven-surefire
Updated Branches:
refs/heads/master 3cecbd360 -> 072cb7a7e
Fixed build process
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/072cb7a7
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/072cb7a7
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/072cb7a7
Branch: refs/heads/master
Commit: 072cb7a7eb6750ee2a4bd6305c9e8f697b5e292f
Parents: 3cecbd3
Author: tibordigana <ti...@lycos.com>
Authored: Thu Oct 9 00:25:21 2014 +0200
Committer: tibordigana <ti...@lycos.com>
Committed: Thu Oct 9 00:25:21 2014 +0200
----------------------------------------------------------------------
...urefire1082ParallelJUnitParameterizedIT.java | 86 +++++++++++++++-----
1 file changed, 67 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/072cb7a7/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnitParameterizedIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnitParameterizedIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnitParameterizedIT.java
index 5beab2c..7699f4b 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnitParameterizedIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1082ParallelJUnitParameterizedIT.java
@@ -23,14 +23,17 @@ import org.apache.maven.it.VerificationException;
import org.apache.maven.surefire.its.fixture.OutputValidator;
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
import org.junit.Test;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
-import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.AnyOf.anyOf;
+import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
@@ -42,6 +45,26 @@ public class Surefire1082ParallelJUnitParameterizedIT
extends SurefireJUnit4IntegrationTestCase
{
+ private static Set<String> printOnlyTestLines( OutputValidator validator )
+ throws VerificationException
+ {
+ Set<String> log = new TreeSet<String>( validator.loadLogLines() );
+ for ( Iterator<String> it = log.iterator(); it.hasNext(); )
+ {
+ String line = it.next();
+ if ( !line.startsWith( "class jiras.surefire1082." ) )
+ {
+ it.remove();
+ }
+ }
+ return log;
+ }
+
+ private static Matcher<Set<String>> regex( Set<String> r )
+ {
+ return new IsRegex( r );
+ }
+
@Test
public void test()
throws VerificationException
@@ -53,18 +76,18 @@ public class Surefire1082ParallelJUnitParameterizedIT
assertThat( log.size(), is( 4 ) );
Set<String> expectedLogs1 = new TreeSet<String>();
- expectedLogs1.add( "class jiras.surefire1082.Jira1082Test a 0 pool-1-thread-1" );
- expectedLogs1.add( "class jiras.surefire1082.Jira1082Test b 0 pool-1-thread-1" );
- expectedLogs1.add( "class jiras.surefire1082.Jira1082Test a 1 pool-1-thread-2" );
- expectedLogs1.add( "class jiras.surefire1082.Jira1082Test b 1 pool-1-thread-2" );
+ expectedLogs1.add( "class jiras.surefire1082.Jira1082Test a 0 pool-[\\d]+-thread-1" );
+ expectedLogs1.add( "class jiras.surefire1082.Jira1082Test b 0 pool-[\\d]+-thread-1" );
+ expectedLogs1.add( "class jiras.surefire1082.Jira1082Test a 1 pool-[\\d]+-thread-2" );
+ expectedLogs1.add( "class jiras.surefire1082.Jira1082Test b 1 pool-[\\d]+-thread-2" );
Set<String> expectedLogs2 = new TreeSet<String>();
- expectedLogs2.add( "class jiras.surefire1082.Jira1082Test a 1 pool-1-thread-1" );
- expectedLogs2.add( "class jiras.surefire1082.Jira1082Test b 1 pool-1-thread-1" );
- expectedLogs2.add( "class jiras.surefire1082.Jira1082Test a 0 pool-1-thread-2" );
- expectedLogs2.add( "class jiras.surefire1082.Jira1082Test b 0 pool-1-thread-2" );
+ expectedLogs2.add( "class jiras.surefire1082.Jira1082Test a 1 pool-[\\d]+-thread-1" );
+ expectedLogs2.add( "class jiras.surefire1082.Jira1082Test b 1 pool-[\\d]+-thread-1" );
+ expectedLogs2.add( "class jiras.surefire1082.Jira1082Test a 0 pool-[\\d]+-thread-2" );
+ expectedLogs2.add( "class jiras.surefire1082.Jira1082Test b 0 pool-[\\d]+-thread-2" );
- assertThat( log, anyOf( is( expectedLogs1 ), is( expectedLogs2 ) ) );
+ assertThat( log, anyOf( regex( expectedLogs1 ), regex( expectedLogs2 ) ) );
}
private SurefireLauncher unpack()
@@ -72,16 +95,41 @@ public class Surefire1082ParallelJUnitParameterizedIT
return unpack( "surefire-1082-parallel-junit-parameterized" );
}
- private static Set<String> printOnlyTestLines( OutputValidator validator )
- throws VerificationException
+ private static class IsRegex
+ extends BaseMatcher<Set<String>>
{
- Set<String> log = new TreeSet<String>( validator.loadLogLines() );
- for ( Iterator<String> it = log.iterator(); it.hasNext(); ) {
- String line = it.next();
- if ( !line.startsWith( "class jiras.surefire1082." ) ) {
- it.remove();
+ private final Set<String> expectedRegex;
+
+ IsRegex( Set<String> expectedRegex )
+ {
+ this.expectedRegex = expectedRegex;
+ }
+
+ public boolean matches( Object o )
+ {
+ if ( o != null && o instanceof Set )
+ {
+ Set<String> actual = (Set<String>) o;
+ boolean matches = actual.size() == expectedRegex.size();
+ Iterator<String> regex = expectedRegex.iterator();
+ for ( String s : actual )
+ {
+ if ( s == null || !regex.hasNext() || !s.matches( regex.next() ) )
+ {
+ matches = false;
+ }
+ }
+ return matches;
+ }
+ else
+ {
+ return false;
}
}
- return log;
+
+ public void describeTo( Description description )
+ {
+ description.appendValue( expectedRegex );
+ }
}
-}
\ No newline at end of file
+}