Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/MockMessageLogger.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/MockMessageLogger.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/MockMessageLogger.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/MockMessageLogger.java Tue Jan 14 08:27:37 2014 @@ -88,7 +88,7 @@ public class MockMessageLogger extends A String log = (String) iter.next(); if (log.indexOf(message) != -1) { throw new AssertionFailedError("logs contain unexpected message: '" + message - + "' logs='\n" + join(_logs) + "'"); + + "' logs='\n" + join(_logs) + "'"); } } } @@ -96,6 +96,7 @@ public class MockMessageLogger extends A public void assertLogVerboseContains(String message) { assertLogContains(Message.MSG_VERBOSE + " " + message); } + public void assertLogInfoContains(String message) { assertLogContains(Message.MSG_INFO + " " + message); }
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/StringUtilsTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/StringUtilsTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/StringUtilsTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/StringUtilsTest.java Tue Jan 14 08:27:37 2014 @@ -20,15 +20,14 @@ package org.apache.ivy.util; import junit.framework.TestCase; public class StringUtilsTest extends TestCase { - + public void testGetStackTrace() throws Exception { String trace = StringUtils.getStackTrace(new Exception()); - assertTrue(trace.indexOf( - "java.lang.Exception") != -1); - assertTrue(trace.indexOf( - "at org.apache.ivy.util.StringUtilsTest.testGetStackTrace(StringUtilsTest.java") != -1); + assertTrue(trace.indexOf("java.lang.Exception") != -1); + assertTrue(trace + .indexOf("at org.apache.ivy.util.StringUtilsTest.testGetStackTrace(StringUtilsTest.java") != -1); } - + public void testEncryption() { assertEquals("apache", StringUtils.decrypt(StringUtils.encrypt("apache"))); assertEquals("yet another string with 126 digits and others :;%_-$& characters", Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java Tue Jan 14 08:27:37 2014 @@ -27,13 +27,14 @@ import org.apache.ivy.util.CopyProgressL import junit.framework.TestCase; public class AbstractURLHandlerTest extends TestCase { - + /** * JUnit test for IVY-923. */ public void testNormalizeToStringWithSpaceURL() throws Exception { AbstractURLHandler handler = new TestURLHandler(); - String normalizedUrl = handler.normalizeToString(new URL("http://ant.apache.org/ivy/url with space/ivy-1.0.xml")); + String normalizedUrl = handler.normalizeToString(new URL( + "http://ant.apache.org/ivy/url with space/ivy-1.0.xml")); assertEquals("http://ant.apache.org/ivy/url%20with%20space/ivy-1.0.xml", normalizedUrl); } @@ -42,22 +43,25 @@ public class AbstractURLHandlerTest exte */ public void testNormalizeToStringWithPlusCharacter() throws Exception { AbstractURLHandler handler = new TestURLHandler(); - String normalizedUrl = handler.normalizeToString(new URL("http://ant.apache.org/ivy/ivy-1.+.xml")); + String normalizedUrl = handler.normalizeToString(new URL( + "http://ant.apache.org/ivy/ivy-1.+.xml")); assertEquals("http://ant.apache.org/ivy/ivy-1.%2B.xml", normalizedUrl); } - public void testNormalizeToStringWithUnderscoreInHostname() throws Exception { + public void testNormalizeToStringWithUnderscoreInHostname() throws Exception { AbstractURLHandler handler = new TestURLHandler(); - String normalizedUrl = handler.normalizeToString(new URL("http://peat_hal.users.sourceforge.net/m2repository")); + String normalizedUrl = handler.normalizeToString(new URL( + "http://peat_hal.users.sourceforge.net/m2repository")); assertEquals("http://peat_hal.users.sourceforge.net/m2repository", normalizedUrl); } - - public void testNormalizeToStringWithUnderscoreInHostnameAndSpaceInPath() throws Exception { + + public void testNormalizeToStringWithUnderscoreInHostnameAndSpaceInPath() throws Exception { AbstractURLHandler handler = new TestURLHandler(); - String normalizedUrl = handler.normalizeToString(new URL("http://peat_hal.users.sourceforge.net/m2 repository")); + String normalizedUrl = handler.normalizeToString(new URL( + "http://peat_hal.users.sourceforge.net/m2 repository")); assertEquals("http://peat_hal.users.sourceforge.net/m2%20repository", normalizedUrl); } - + private static class TestURLHandler extends AbstractURLHandler { public void download(URL src, File dest, CopyProgressListener l) throws IOException { @@ -79,6 +83,6 @@ public class AbstractURLHandlerTest exte public void upload(File src, URL dest, CopyProgressListener l) throws IOException { throw new UnsupportedOperationException(); } - + } } Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java Tue Jan 14 08:27:37 2014 @@ -36,24 +36,24 @@ public class ApacheURLListerTest extends public void testRetrieveListing() throws Exception { ApacheURLLister lister = new ApacheURLLister(); - List files = lister.retrieveListing(ApacheURLListerTest.class - .getResource("apache-file-listing.html"), true, false); + List files = lister.retrieveListing( + ApacheURLListerTest.class.getResource("apache-file-listing.html"), true, false); assertNotNull(files); assertTrue(files.size() > 0); for (Iterator iter = files.iterator(); iter.hasNext();) { URL file = (URL) iter.next(); - assertTrue("found a non matching file: " + file, file.getPath().matches( - ".*/[^/]+\\.(jar|md5|sha1)")); + assertTrue("found a non matching file: " + file, + file.getPath().matches(".*/[^/]+\\.(jar|md5|sha1)")); } // try a directory listing - List dirs = lister.retrieveListing(ApacheURLListerTest.class - .getResource("apache-dir-listing.html"), false, true); + List dirs = lister.retrieveListing( + ApacheURLListerTest.class.getResource("apache-dir-listing.html"), false, true); assertNotNull(dirs); assertEquals(4, dirs.size()); - List empty = lister.retrieveListing(ApacheURLListerTest.class - .getResource("apache-dir-listing.html"), true, false); + List empty = lister.retrieveListing( + ApacheURLListerTest.class.getResource("apache-dir-listing.html"), true, false); assertTrue(empty.isEmpty()); } @@ -65,30 +65,30 @@ public class ApacheURLListerTest extends public void testRetrieveListingWithSpaces() throws Exception { ApacheURLLister lister = new ApacheURLLister(); - List files = lister.retrieveListing(ApacheURLListerTest.class - .getResource("listing-with-spaces.html"), true, false); + List files = lister.retrieveListing( + ApacheURLListerTest.class.getResource("listing-with-spaces.html"), true, false); assertNotNull(files); assertTrue(files.size() > 0); } - + public void testRetrieveArtifactoryListing() throws Exception { ApacheURLLister lister = new ApacheURLLister(); - List files = lister.retrieveListing(ApacheURLListerTest.class - .getResource("artifactory-dir-listing.html"), true, true); + List files = lister.retrieveListing( + ApacheURLListerTest.class.getResource("artifactory-dir-listing.html"), true, true); assertNotNull(files); assertEquals(1, files.size()); } - + public void testRetrieveArchivaListing() throws Exception { ApacheURLLister lister = new ApacheURLLister(); List d = lister.listDirectories(ApacheURLListerTest.class .getResource("archiva-listing.html")); assertNotNull(d); - // archiva listing is not valid html at all currently (1.0, unclosed a tags), + // archiva listing is not valid html at all currently (1.0, unclosed a tags), // and we don't want to adapt to this -// assertEquals(3, d.size()); + // assertEquals(3, d.size()); } public void testRetrieveFixedArchivaListing() throws Exception { Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java Tue Jan 14 08:27:37 2014 @@ -24,11 +24,12 @@ import junit.framework.TestCase; public class ArtifactoryListingTest extends TestCase { // remote.test - + public void testWicketListing() throws Exception { ApacheURLLister lister = new ApacheURLLister(); - - List content = lister.listAll(new URL("http://repo.jfrog.org/artifactory/libs-releases-local/org/apache/wicket/wicket/")); + + List content = lister.listAll(new URL( + "http://repo.jfrog.org/artifactory/libs-releases-local/org/apache/wicket/wicket/")); assertNotNull(content); assertEquals(5, content.size()); } Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java Tue Jan 14 08:27:37 2014 @@ -30,19 +30,20 @@ import junit.framework.TestCase; public class BasicURLHandlerTest extends TestCase { // remote.test private File testDir; + private BasicURLHandler handler; - + protected void setUp() throws Exception { testDir = new File("build/BasicURLHandlerTest"); testDir.mkdirs(); - + handler = new BasicURLHandler(); } - + protected void tearDown() throws Exception { FileUtil.forceDelete(testDir); } - + public void testIsReachable() throws Exception { assertTrue(handler.isReachable(new URL("http://www.google.fr/"))); assertFalse(handler.isReachable(new URL("http://www.google.fr/unknownpage.html"))); @@ -54,19 +55,27 @@ public class BasicURLHandlerTest extends // assertTrue(handler.isReachable(new URL("ftp://ftp.mozilla.org/pub/dir.sizes"))); assertFalse(handler.isReachable(new URL("ftp://ftp.mozilla.org/unknown.file"))); } - + public void testContentEncoding() throws Exception { - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html"), new File(testDir, "gzip.txt")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on"), new File(testDir, "deflate-zlib.txt")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on"), new File(testDir, "deflate.txt")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps"), new File(testDir, "a5-gzip.ps")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps?deflate=on"), new File(testDir, "a5-deflate.ps")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf"), new File(testDir, "nh80-gzip.pdf")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf?deflate=on"), new File(testDir, "nh80-deflate.pdf")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html"), new File( + testDir, "gzip.txt")); + assertDownloadOK(new URL( + "http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on"), new File( + testDir, "deflate-zlib.txt")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on"), + new File(testDir, "deflate.txt")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps"), new File(testDir, + "a5-gzip.ps")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps?deflate=on"), new File( + testDir, "a5-deflate.ps")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf"), new File(testDir, + "nh80-gzip.pdf")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf?deflate=on"), + new File(testDir, "nh80-deflate.pdf")); } - + private void assertDownloadOK(URL url, File file) throws Exception { handler.download(url, file, null); - assertTrue(file.exists()); + assertTrue(file.exists()); } } Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java Tue Jan 14 08:27:37 2014 @@ -31,19 +31,20 @@ import junit.framework.TestCase; public class HttpclientURLHandlerTest extends TestCase { // remote.test private File testDir; + private HttpClientHandler handler; - + protected void setUp() throws Exception { testDir = new File("build/HttpclientURLHandlerTest"); testDir.mkdirs(); - + handler = new HttpClientHandler(); } - + protected void tearDown() throws Exception { FileUtil.forceDelete(testDir); } - + public void testIsReachable() throws Exception { assertTrue(handler.isReachable(new URL("http://www.google.fr/"))); assertFalse(handler.isReachable(new URL("http://www.google.fr/unknownpage.html"))); @@ -55,22 +56,30 @@ public class HttpclientURLHandlerTest ex URLInfo info = handler .getURLInfo(new URL( "http://repo1.maven.org/maven2/commons-lang/commons-lang/[1.0,3.0[/commons-lang-[1.0,3.0[.pom")); - + assertEquals(URLHandler.UNAVAILABLE, info); } - + public void testContentEncoding() throws Exception { - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html"), new File(testDir, "gzip.txt")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on"), new File(testDir, "deflate-zlib.txt")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on"), new File(testDir, "deflate.txt")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps"), new File(testDir, "a5-gzip.ps")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps?deflate=on"), new File(testDir, "a5-deflate.ps")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf"), new File(testDir, "nh80-gzip.pdf")); - assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf?deflate=on"), new File(testDir, "nh80-deflate.pdf")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html"), new File( + testDir, "gzip.txt")); + assertDownloadOK(new URL( + "http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on"), new File( + testDir, "deflate-zlib.txt")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on"), + new File(testDir, "deflate.txt")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps"), new File(testDir, + "a5-gzip.ps")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/a5.ps?deflate=on"), new File( + testDir, "a5-deflate.ps")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf"), new File(testDir, + "nh80-gzip.pdf")); + assertDownloadOK(new URL("http://carsten.codimi.de/gzip.yaws/nh80.pdf?deflate=on"), + new File(testDir, "nh80-deflate.pdf")); } - + private void assertDownloadOK(URL url, File file) throws Exception { handler.download(url, file, null); - assertTrue(file.exists()); + assertTrue(file.exists()); } }
