ruper2/src/test/core/org/krysalis/ruper2/protocols VirtualResourceLocatorTests.java,NONE,1.1 ProtocolOperationsManagerTests.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/protocols
In directory sc8-pr-cvs1:/tmp/cvs-serv30481/src/test/core/org/krysalis/ruper2/protocols

Added Files:
	VirtualResourceLocatorTests.java 
	ProtocolOperationsManagerTests.java 
Log Message:
Avoid clash with existing Ruper...

--- 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.protocols;

import java.net.URL;

import junit.framework.TestCase;

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);
	}
}

--- NEW FILE: ProtocolOperationsManagerTests.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.protocols;

import junit.framework.TestCase;

import org.krysalis.ruper2.impl.ResourceUpdaterContext;
import org.krysalis.ruper2.util.RuperConstants;
import org.krysalis.ruper2.util.select.AllSelector;
import org.krysalis.version.util.SystemUtils;

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

	private ResourceUpdaterContext m_testContext =
		ResourceUpdaterContext.getTestContext();

	private ProtocolOperationsManager m_pom = null;
	private VirtualResourceLocator m_http = null;
	private VirtualResourceLocator m_file = null;
	

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

	public void setUp() throws Exception {
		m_pom = new DefaultProtocolOperationsManager(m_testContext);
		m_http = new VirtualResourceLocator(RuperConstants.MAVEN_URL);
		m_file = new VirtualResourceLocator(SystemUtils.getCWD());
	}

	public void testMinimalPOM() throws Exception {
		assertTrue("Has Providers", m_pom.hasProviders());
		assertNotNull("Has HTTP Provider", m_pom.determineProviderFor(m_http));
		assertNotNull("Has File Provider", m_pom.determineProviderFor(m_file));
		//DebugUtils.dump(m_pom);
	}

	public void testList1() throws Exception {
		m_pom.performList(m_http, AllSelector.getInstance());
	}

	public void testList2() throws Exception {
		assertNotNull("Perform List", m_pom.performList(m_file, AllSelector.getInstance()));
		//DebugUtils.dump();
	}

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




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.