ruper2/src/test/core/org/krysalis/ruper2/util/net VirtualResourceLocatorTests.java,NONE,1.1

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/src/test/core/org/krysalis/ruper2/util/net
In directory sc8-pr-cvs1:/tmp/cvs-serv17634/src/test/core/org/krysalis/ruper2/util/net

Added Files:
	VirtualResourceLocatorTests.java 
Log Message:
1) Moved VirtualResourceLocator ot a .util.net package
2) Fixed it up a litte, still pretty crude (but working).

--- NEW FILE: VirtualResourceLocatorTests.java ---
/*
 * Created on Aug 27, 2003
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package org.krysalis.ruper2.util.net;

import java.net.URL;

import junit.framework.TestCase;

import org.krysalis.ruper2.protocols.Protocol;
import org.krysalis.version.util.SystemUtils;

/**
 * @author arb_jack
 */
public class VirtualResourceLocatorTests extends TestCase {

	private URL m_mavenUrl = null;

	public VirtualResourceLocatorTests(String name) {
		super(name);
	}

	public void setUp() throws Exception {
		m_mavenUrl = new URL("http://www.ibiblio.org/maven/");
	}

	public void testVRLToFromURL() throws Exception {
		VirtualResourceLocator vrl = new VirtualResourceLocator(m_mavenUrl);

		assertEquals(
			"HTTP Protocol",
			Protocol.HTTP_PROTOCOL,
			vrl.getProtocol());
	}

	public void testVRLToFromFile() throws Exception {
		VirtualResourceLocator vrl =
			new VirtualResourceLocator(SystemUtils.getCWD());

		assertEquals(
			"File Protocol",
			Protocol.FILE_PROTOCOL,
			vrl.getProtocol());
	}

    public void testEquals() {
        VirtualResourceLocator vrlFileA =
            new VirtualResourceLocator(SystemUtils.getCWD());
        VirtualResourceLocator vrlFileB =
            new VirtualResourceLocator(SystemUtils.getCWD());

        assertEquals("Virtual resource locators constructed from same file should be equal",
                                vrlFileA, vrlFileB);

        VirtualResourceLocator vrlUrlA =
            new VirtualResourceLocator(m_mavenUrl);
        VirtualResourceLocator vrlUrlB =
            new VirtualResourceLocator(m_mavenUrl);

        assertEquals("Virtual resource locators constructed from same url should be equal",
                                vrlUrlA, vrlUrlB);
    }

	public static void main(String[] args) {
		junit.textui.TestRunner.run(VirtualResourceLocatorTests.class);
	}
}




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.