You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2010/04/06 22:31:02 UTC

svn commit: r931309 - /ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java

Author: maartenc
Date: Tue Apr  6 20:31:02 2010
New Revision: 931309

URL: http://svn.apache.org/viewvc?rev=931309&view=rev
Log:
Added junit tests for IVY-923

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java   (with props)

Added: 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=931309&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java Tue Apr  6 20:31:02 2010
@@ -0,0 +1,72 @@
+/*
+ *  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.
+ *
+ */
+package org.apache.ivy.util.url;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.ivy.util.CopyProgressListener;
+
+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"));
+        assertEquals("http://ant.apache.org/ivy/url%20with%20space/ivy-1.0.xml", normalizedUrl);
+    }
+
+    /**
+     * JUnit test for IVY-923.
+     */
+    public void testNormalizeToStringWithPlusCharacter() throws Exception {
+        AbstractURLHandler handler = new TestURLHandler();
+        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);
+    }
+
+    private static class TestURLHandler extends AbstractURLHandler {
+
+        public void download(URL src, File dest, CopyProgressListener l) throws IOException {
+            throw new UnsupportedOperationException();
+        }
+
+        public URLInfo getURLInfo(URL url) {
+            throw new UnsupportedOperationException();
+        }
+
+        public URLInfo getURLInfo(URL url, int timeout) {
+            throw new UnsupportedOperationException();
+        }
+
+        public InputStream openStream(URL url) throws IOException {
+            throw new UnsupportedOperationException();
+        }
+
+        public void upload(File src, URL dest, CopyProgressListener l) throws IOException {
+            throw new UnsupportedOperationException();
+        }
+        
+    }
+}

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain