Author: stephenc Date: Mon Jun 13 14:35:51 2011 New Revision: 1135114 URL: http://svn.apache.org/viewvc?rev=1135114&view=rev Log: update license headers and add the ability to have per-class throwing of the @ReproducesPlexusBug switch
Added: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/test/resources/ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/test/resources/org/ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/test/resources/org/codehaus/ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/test/resources/org/codehaus/plexus/ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-commons-bridge/src/test/resources/org/codehaus/plexus/util/ Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/FixPlexusBugs.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/ReproducesPlexusBug.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/Task.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/Base64Test.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/CollectionUtilsTest.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/IOUtilTest.java maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/FixPlexusBugs.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/FixPlexusBugs.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/FixPlexusBugs.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/FixPlexusBugs.java Mon Jun 13 14:35:51 2011 @@ -1,5 +1,24 @@ package org.apache.maven.tck; +/* + * 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. + */ + import org.junit.rules.MethodRule; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.Statement; @@ -8,6 +27,12 @@ import org.junit.runners.model.Statement * A rule that checks for a resource called {@code /FixPlexusBugs.enforce} and if it exists, will invert the test * result of any tests annotated with {@link ReproducesPlexusBug}. Obviously this invertion only occurs in test classes * with this rule, e.g. have a public field like {@code @Rule public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs();} + * <p/> + * To turn on the switch globally create a resource in the root of the test classpath called + * {@code /FixPlexusBugs.enforce}. + * <p/> + * To turn on the switch for a specific test class, create a resource with the same name as the test class only + * substituting {@code .enforce} for {@code .class}. */ public class FixPlexusBugs implements MethodRule @@ -21,7 +46,13 @@ public class FixPlexusBugs if ( getClass().getResource( "/" + getClass().getSimpleName() + ".enforce" ) == null ) { - return base; + String name = "/" + method.getMethod().getDeclaringClass().getName().replace( '.', '/' ) + ".enforce"; + if ( getClass().getResource( name ) == null ) + { + System.out.println( "Not found " + name ); + return base; + } + System.out.println( "Found " + name ); } return new Statement() { Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/ReproducesPlexusBug.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/ReproducesPlexusBug.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/ReproducesPlexusBug.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/ReproducesPlexusBug.java Mon Jun 13 14:35:51 2011 @@ -1,5 +1,24 @@ package org.apache.maven.tck; +/* + * 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. + */ + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/Task.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/Task.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/Task.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/apache/maven/tck/Task.java Mon Jun 13 14:35:51 2011 @@ -1,5 +1,24 @@ package org.apache.maven.tck; +/* + * 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. + */ + public interface Task { void task() throws Exception; Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/Base64Test.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/Base64Test.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/Base64Test.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/Base64Test.java Mon Jun 13 14:35:51 2011 @@ -19,6 +19,8 @@ package org.codehaus.plexus.util; * under the License. */ +import org.apache.maven.tck.FixPlexusBugs; +import org.junit.Rule; import org.junit.Test; import static org.apache.maven.tck.TckMatchers.hasDefaultConstructor; @@ -28,7 +30,8 @@ import static org.junit.Assert.assertTha public class Base64Test { - + @Rule + public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs(); @Test public void isNotUtilityClass() Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/CollectionUtilsTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/CollectionUtilsTest.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/CollectionUtilsTest.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/CollectionUtilsTest.java Mon Jun 13 14:35:51 2011 @@ -6,7 +6,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.maven.tck.FixPlexusBugs; import org.junit.Assert; +import org.junit.Rule; import org.junit.Test; import com.google.common.collect.HashMultiset; @@ -16,6 +18,9 @@ import com.google.common.collect.Multise public class CollectionUtilsTest extends Assert { + @Rule + public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs(); + @SuppressWarnings( "rawtypes" ) @Test public void testMergeMaps() Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java Mon Jun 13 14:35:51 2011 @@ -18,6 +18,7 @@ package org.codehaus.plexus.util; */ import junit.framework.AssertionFailedError; +import org.apache.maven.tck.FixPlexusBugs; import org.hamcrest.CoreMatchers; import org.junit.Before; import org.junit.Ignore; @@ -61,6 +62,8 @@ import static org.junit.matchers.JUnitMa */ public class FileUtilsTest { + @Rule + public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs(); // Test data Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/IOUtilTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/IOUtilTest.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/IOUtilTest.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/IOUtilTest.java Mon Jun 13 14:35:51 2011 @@ -19,8 +19,10 @@ package org.codehaus.plexus.util; * under the License. */ +import org.apache.maven.tck.FixPlexusBugs; import org.apache.maven.tck.ReproducesPlexusBug; import org.apache.maven.tck.Task; +import org.junit.Rule; import org.junit.Test; import java.io.BufferedInputStream; @@ -46,6 +48,8 @@ import static org.junit.Assert.assertTha public class IOUtilTest { + @Rule + public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs(); private static final long INFINITE_LOOP_TIMEOUT = 500; Modified: maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java?rev=1135114&r1=1135113&r2=1135114&view=diff ============================================================================== --- maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java (original) +++ maven/sandbox/trunk/plexus-utils-commons-bridge/plexus-utils-tck/src/test/java/org/codehaus/plexus/util/PropertyUtilsTest.java Mon Jun 13 14:35:51 2011 @@ -19,6 +19,7 @@ package org.codehaus.plexus.util; * under the License. */ +import org.apache.maven.tck.FixPlexusBugs; import org.junit.Rule; import org.junit.Test; import org.junit.rules.MethodRule; @@ -44,6 +45,9 @@ import static org.junit.Assert.assertTha public class PropertyUtilsTest { + @Rule + public FixPlexusBugs fixPlexusBugs = new FixPlexusBugs(); + @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.METHOD ) @interface NeedsTemporaryFolder