This one is breaking in gump! On 16-04-2005 16:50, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Author: shash > Date: Sat Apr 16 07:50:44 2005 > New Revision: 161574 > > URL: http://svn.apache.org/viewcvs?view=rev&rev=161574 > Log: > New test case from http://issues.apache.org/jira/browse/EXLBR-19 > > Added: > > excalibur/trunk/components/sourceresolve/src/test/org/apache/excalibur/source/ > test/URLSourceTestCase.java > > Added: > excalibur/trunk/components/sourceresolve/src/test/org/apache/excalibur/source/ > test/URLSourceTestCase.java > URL: > http://svn.apache.org/viewcvs/excalibur/trunk/components/sourceresolve/src/tes > t/org/apache/excalibur/source/test/URLSourceTestCase.java?view=auto&rev=161574 > ============================================================================== > --- > excalibur/trunk/components/sourceresolve/src/test/org/apache/excalibur/source/ > test/URLSourceTestCase.java (added) > +++ > excalibur/trunk/components/sourceresolve/src/test/org/apache/excalibur/source/ > test/URLSourceTestCase.java Sat Apr 16 07:50:44 2005 > @@ -0,0 +1,78 @@ > +/* > + * Copyright 2002-2004 The Apache Software Foundation > + * 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 > + * > + * 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.excalibur.source.test; > + > +import junit.framework.TestCase; > + > +import java.io.File; > +import java.net.URL; > +import java.util.Collections; > +import org.apache.excalibur.source.impl.URLSource; > + > +/** > + * Test case for URLSource. > + * > + * @author <a href="mailto:[email protected]">Avalon Development Team</a> > + * @version $Id: URLSourceTestCase.java,v 1.0 2005/04/16 11:47:22 shash Exp $ > + */ > +public class URLSourceTestCase extends TestCase > +{ > + > + URLSource m_urlSource; > + > + protected void setUp() throws Exception > + { > + m_urlSource = new URLSource(); > + } > + > + public void testFileExists() throws Exception > + { > + File tempFile = File.createTempFile( "filesource", "test" ); > + try > + { > + m_urlSource.init( tempFile.toURL(), Collections.EMPTY_MAP ); > + assertTrue( m_urlSource.exists() ); > + } > + finally > + { > + tempFile.delete(); > + } > + } > + > + public void testFileDoesNotExist() throws Exception > + { > + File tempFile = File.createTempFile( "filesource", "test" ); > + tempFile.delete(); > + > + m_urlSource.init( tempFile.toURL(), Collections.EMPTY_MAP ); > + assertFalse( m_urlSource.exists() ); > + } > + > + public void testHttpDoesNotExist() throws Exception > + { > + m_urlSource.init( new URL( "http://localhost/no_such_file" ), > + Collections.EMPTY_MAP ); > + assertFalse( m_urlSource.exists() ); > + } > + > + public void testHttpDoesExist() throws Exception > + { > + m_urlSource.init( new URL( "http://www.example.com/" ), > + Collections.EMPTY_MAP ); > + assertTrue( m_urlSource.exists() ); > + } > +} > \ No newline at end of file > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
