krysalis-update/src/test/java/org/apache/depot/update/protocols ProtocolOperationsManagerTests.java,NONE,1.1

Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:07:21 +0000
Newsgroups gmane.comp.krysalis.cvs
Message-ID <[email protected]>
Update of /cvsroot/krysalis/krysalis-update/src/test/java/org/apache/depot/update/protocols
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24726/src/test/java/org/apache/depot/update/protocols

Added Files:
	ProtocolOperationsManagerTests.java 
Log Message:
Copied from the apache incubator.

--- NEW FILE: ProtocolOperationsManagerTests.java ---
/*
 * Copyright  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.depot.update.protocols;

import java.util.List;

import junit.framework.TestCase;

import org.apache.depot.update.impl.ArtifactUpdaterContext;
import org.apache.depot.update.util.UpdateConstants;
import org.apache.depot.update.util.io.ResolvedFile;
import org.apache.depot.update.util.net.VirtualResourceLocator;
import org.apache.depot.update.util.select.AllSelector;

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

	private ArtifactUpdaterContext m_testContext =
		ArtifactUpdaterContext.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(UpdateConstants.MAVEN_URL);
		m_file = new VirtualResourceLocator(ResolvedFile.resolve("."));
	}

	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 testListHttp() throws Exception {
		List files = m_pom.performList(m_http, AllSelector.getInstance());
		assertNotNull("Files List", files);
		assertFalse("Listed Some Files", files.isEmpty());
	}

	public void testListFile() throws Exception {
		List files = m_pom.performList(m_file, AllSelector.getInstance());
		assertNotNull("Files List", files);
		assertFalse("Listed Some Files", files.isEmpty());
		//DebugUtils.dump();
	}

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



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/