krysalis-update/src/test/java/org/apache/depot/update/repository RepositoryTests.java,NONE,1.1

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

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

--- NEW FILE: RepositoryTests.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.repository;

import java.util.List;

import junit.framework.TestCase;

import org.apache.depot.common.log.Logger;
import org.apache.depot.update.artifact.ArtifactGroup;
import org.apache.depot.update.impl.ArtifactUpdaterContext;
import org.apache.depot.update.impl.RepositoryWrapper;
import org.apache.depot.update.util.select.AllSelector;

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

	private RepositoryWrapper m_repo1 = null;
	private RepositoryWrapper m_repo2 = null;
//	private MockRepository mock_repo = null;

	//	static {
	//		Logger.testInit();
	//	}

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

	public void setUp() throws Exception {

		Logger.testInit();

		m_repo1 = new RepositoryWrapper(
				DefaultRepository.getLocalTestRepository(),
				ArtifactUpdaterContext.getTestContext());

		m_repo2 = new RepositoryWrapper(MockRepository.getMockRepository(),
				ArtifactUpdaterContext.getTestContext());
		
//		mock_repo = new MockRepository("Test");
	}

	public void testListGroups1() throws Exception {
		List list1 = m_repo1.listGroups(AllSelector.getInstance());
		assertNotNull("List Groups", list1);
		assertFalse("List Groups Not Empty", list1.isEmpty());

		List list2 = m_repo2.listGroups(AllSelector.getInstance());
		assertNotNull("List Groups", list2);
		assertFalse("List Groups Not Empty", list2.isEmpty());

		//DebugUtils.dump("Test Groups", list1);
		//DebugUtils.dump("Mock Groups", list2);
	}

	public void testListArtifacts1() throws Exception {
		ArtifactGroup testGroup = new ArtifactGroup("junit");

		List list1 = m_repo1.listArtifacts(testGroup, AllSelector.getInstance());
		assertNotNull("List Artifacts", list1);
		assertFalse("List Artifacts not Empty", list1.isEmpty());

		List list2 = m_repo2.listArtifacts(testGroup, AllSelector.getInstance());
		assertNotNull("List Artifacts", list2);
		assertFalse("List Artifacts not Empty", list2.isEmpty());

//		List list3 = mock_repo.listArtifacts(ArtifactUpdaterContext.getTestContext(), testGroup, AllSelector.getInstance());
//		assertNotNull("List Artifacts", list2);
//		assertFalse("List Artifacts not Empty", list2.isEmpty());		
		
		//		DebugUtils.dump("Test Artifacts", list1);
		//		DebugUtils.dump("Mock Artifacts", list2);
	}

	public void testListArtifactInstances1() throws Exception {
		ArtifactGroup testGroup = new ArtifactGroup("junit");

		List artifacts1 = m_repo1.listInstances(testGroup,
				AllSelector.getInstance());

		assertNotNull("List Artifacts", artifacts1);
		assertFalse("List Artifacts Not Empty", artifacts1.isEmpty());

		List artifacts2 = m_repo2.listInstances(testGroup,
				AllSelector.getInstance());
		assertNotNull("List Artifacts", artifacts2);
		assertFalse("List Artifacts Not Empty", artifacts2.isEmpty());
	}

	public static void main(String[] args) {
		junit.textui.TestRunner.run(RepositoryTests.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/