Modified: maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/LocatorTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/LocatorTest.java?rev=595935&r1=595934&r2=595935&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/LocatorTest.java (original) +++ maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/LocatorTest.java Sat Nov 17 03:39:34 2007 @@ -1,5 +1,24 @@ package org.apache.maven.shared.io.location; +/* + * 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.util.ArrayList; import java.util.Collections; import java.util.List; @@ -98,31 +117,31 @@ mgr.verifyAll(); } - + public void testResolutionFallsThroughStrategyStackAndReturnsNullIfNotResolved() { List strategies = new ArrayList(); - + strategies.add( new LoggingLocatorStrategy() ); strategies.add( new LoggingLocatorStrategy() ); strategies.add( new LoggingLocatorStrategy() ); - + MessageHolder mh = new DefaultMessageHolder(); - + Locator locator = new Locator( strategies, mh ); Location location = locator.resolve( "some-specification" ); - + assertNull( location ); - + assertEquals( 3, mh.size() ); } - + public static final class LoggingLocatorStrategy implements LocatorStrategy { - + static int instanceCounter = 0; - + int counter = instanceCounter++; public Location resolve( String locationSpecification, MessageHolder messageHolder ) @@ -130,7 +149,7 @@ messageHolder.addMessage( "resolve hit on strategy-" + (counter) ); return null; } - + } }
Modified: maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocationTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocationTest.java?rev=595935&r1=595934&r2=595935&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocationTest.java (original) +++ maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocationTest.java Sat Nov 17 03:39:34 2007 @@ -1,5 +1,24 @@ package org.apache.maven.shared.io.location; +/* + * 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.io.File; import java.io.IOException; import java.net.URL; @@ -11,26 +30,26 @@ public class URLLocationTest extends TestCase { - + public void testShouldConstructFromUrlAndTempFileSpecifications() throws IOException { File f = File.createTempFile( "url-location.", ".test" ); f.deleteOnExit(); - + URL url = f.toURL(); - + new URLLocation( url, f.getAbsolutePath(), "prefix.", ".suffix", true ); } - + public void testShouldTransferFromTempFile() throws IOException { File f = File.createTempFile( "url-location.", ".test" ); f.deleteOnExit(); - + URL url = f.toURL(); - + URLLocation location = new URLLocation( url, f.getAbsolutePath(), "prefix.", ".suffix", true ); - + assertNotNull( location.getFile() ); assertFalse( f.equals( location.getFile() ) ); } @@ -39,23 +58,23 @@ { File f = File.createTempFile( "url-location.", ".test" ); f.deleteOnExit(); - + String testStr = "This is a test"; - + TestUtils.writeToFile( f, testStr ); - + URL url = f.toURL(); - + URLLocation location = new URLLocation( url, f.getAbsolutePath(), "prefix.", ".suffix", true ); - + location.open(); - + byte[] buffer = new byte[ testStr.length() ]; - + int read = location.read( buffer ); - + assertEquals( testStr.length(), read ); - + assertEquals( testStr, new String( buffer ) ); } Modified: maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocatorStrategyTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocatorStrategyTest.java?rev=595935&r1=595934&r2=595935&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocatorStrategyTest.java (original) +++ maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/location/URLLocatorStrategyTest.java Sat Nov 17 03:39:34 2007 @@ -1,5 +1,24 @@ package org.apache.maven.shared.io.location; +/* + * 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.io.File; import java.io.IOException; @@ -37,9 +56,9 @@ { File tempFile = File.createTempFile( "prefix.", ".suffix" ); tempFile.deleteOnExit(); - + String testStr = "This is a test."; - + TestUtils.writeToFile( tempFile, testStr ); MessageHolder mh = new DefaultMessageHolder(); @@ -48,12 +67,12 @@ assertNotNull( location ); assertEquals( 0, mh.size() ); - + location.open(); - + byte[] buffer = new byte[testStr.length()]; location.read( buffer ); - + assertEquals( testStr, new String( buffer ) ); } Modified: maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/logging/DefaultMessageHolderTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/logging/DefaultMessageHolderTest.java?rev=595935&r1=595934&r2=595935&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/logging/DefaultMessageHolderTest.java (original) +++ maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/logging/DefaultMessageHolderTest.java Sat Nov 17 03:39:34 2007 @@ -1,5 +1,24 @@ package org.apache.maven.shared.io.logging; +/* + * 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.io.PrintWriter; import java.io.StringWriter; @@ -19,7 +38,7 @@ assertEquals( 0, mh.size() ); MessageHolder test = mh.newMessage(); - + assertSame( mh, test ); assertEquals( 1, mh.size() ); @@ -37,7 +56,7 @@ assertEquals( 0, mh.size() ); MessageHolder test = mh.append( "test" ); - + assertSame( mh, test ); assertEquals( 1, mh.size() ); @@ -55,16 +74,16 @@ assertEquals( 0, mh.size() ); NullPointerException npe = new NullPointerException(); - + MessageHolder test = mh.append( npe ); - + assertSame( mh, test ); - + assertEquals( 1, mh.size() ); - + StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter( sw ); - + npe.printStackTrace( pw ); assertEquals( "[1] [INFO] Error:\n" + sw.toString(), mh.render() ); @@ -81,11 +100,11 @@ assertEquals( 0, mh.size() ); MessageHolder test = mh.newMessage(); - + assertSame( mh, test ); - + test = mh.append( "test" ); - + assertSame( mh, test ); assertEquals( 1, mh.size() ); @@ -105,15 +124,15 @@ assertEquals( 0, mh.size() ); MessageHolder test = mh.newMessage(); - + assertSame( mh, test ); - + test = mh.append( "test" ); - + assertSame( mh, test ); - + test = mh.append( " again" ); - + assertSame( mh, test ); assertEquals( 1, mh.size() ); @@ -133,29 +152,29 @@ assertEquals( 0, mh.size() ); MessageHolder test = mh.newMessage(); - + assertSame( mh, test ); - + test = mh.append( "test" ); - + assertSame( mh, test ); - + NullPointerException npe = new NullPointerException(); - + test = mh.append( npe ); - + assertSame( mh, test ); assertEquals( 1, mh.size() ); - + StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter( sw ); - + npe.printStackTrace( pw ); assertEquals( "[1] [INFO] test\nError:\n" + sw.toString(), mh.render() ); } - + // MessageHolder addMessage( CharSequence messagePart ); // int size(); // String render(); @@ -163,13 +182,13 @@ { MessageHolder mh = new DefaultMessageHolder(); MessageHolder check = mh.addMessage( "test" ); - + assertSame( mh, check ); - + assertEquals( 1, mh.size() ); assertEquals( "[1] [INFO] test", mh.render() ); } - + // MessageHolder addMessage( CharSequence messagePart ); // int size(); // String render(); @@ -177,40 +196,40 @@ { MessageHolder mh = new DefaultMessageHolder(); MessageHolder check = mh.addMessage( "test" ); - + assertSame( mh, check ); - + check = mh.addMessage( "test2" ); - + assertSame( mh, check ); - + assertEquals( 2, mh.size() ); assertEquals( "[1] [INFO] test\n\n[2] [INFO] test2", mh.render() ); } - + // MessageHolder addMessage( CharSequence messagePart, Throwable error ); // int size(); // String render(); public void testAddMessageWithErrorIncrementsSizeByOne() { MessageHolder mh = new DefaultMessageHolder(); - + NullPointerException npe = new NullPointerException(); - + MessageHolder check = mh.addMessage( "test", npe ); - + assertSame( mh, check ); - + assertEquals( 1, mh.size() ); - + StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter( sw ); - + npe.printStackTrace( pw ); assertEquals( "[1] [INFO] test\nError:\n" + sw.toString(), mh.render() ); } - + // MessageHolder addMessage( CharSequence messagePart, Throwable error ); // MessageHolder addMessage( CharSequence messagePart ); // int size(); @@ -218,50 +237,50 @@ public void testAddMessageWithErrorThenWithJustMessageIncrementsSizeByTwo() { MessageHolder mh = new DefaultMessageHolder(); - + NullPointerException npe = new NullPointerException(); - + MessageHolder check = mh.addMessage( "test", npe ); - + assertSame( mh, check ); - + check = mh.addMessage( "test2" ); - + assertSame( mh, check ); - + assertEquals( 2, mh.size() ); - + StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter( sw ); - + npe.printStackTrace( pw ); assertEquals( "[1] [INFO] test\nError:\n" + sw.toString() + "\n\n[2] [INFO] test2", mh.render() ); } - + // MessageHolder addMessage( Throwable error ); // int size(); // String render(); public void testAddMessageWithJustErrorIncrementsSizeByOne() { MessageHolder mh = new DefaultMessageHolder(); - + NullPointerException npe = new NullPointerException(); - + MessageHolder check = mh.addMessage( npe ); - + assertSame( mh, check ); - + assertEquals( 1, mh.size() ); - + StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter( sw ); - + npe.printStackTrace( pw ); assertEquals( "[1] [INFO] Error:\n" + sw.toString(), mh.render() ); } - + // boolean isEmpty(); public void testIsEmptyAfterConstruction() { @@ -273,13 +292,13 @@ { assertFalse( new DefaultMessageHolder().newMessage().isEmpty() ); } - + public void testAppendCharSequence() { MessageHolder mh = new DefaultMessageHolder(); mh.newMessage().append( new StringBuffer( "This is a test" ) ); - + assertTrue( mh.render().indexOf( "This is a test" ) > -1 ); } - + } Modified: maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/scan/mapping/SuffixMappingTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/scan/mapping/SuffixMappingTest.java?rev=595935&r1=595934&r2=595935&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/scan/mapping/SuffixMappingTest.java (original) +++ maven/shared/trunk/maven-shared-io/src/test/java/org/apache/maven/shared/io/scan/mapping/SuffixMappingTest.java Sat Nov 17 03:39:34 2007 @@ -1,20 +1,24 @@ package org.apache.maven.shared.io.scan.mapping; /* - * Copyright 2001-2005 The Apache Software Foundation. + * 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 * - * Licensed 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 * - * 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. + * 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 junit.framework.TestCase; import org.apache.maven.shared.io.scan.InclusionScanException; Modified: maven/shared/trunk/maven-shared-io/src/test/resources/META-INF/maven/test.properties URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-io/src/test/resources/META-INF/maven/test.properties?rev=595935&r1=595934&r2=595935&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-io/src/test/resources/META-INF/maven/test.properties (original) +++ maven/shared/trunk/maven-shared-io/src/test/resources/META-INF/maven/test.properties Sat Nov 17 03:39:34 2007 @@ -1 +1,17 @@ +# 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. test=successful
