/*
 * Copyright 2002-2007 Network Engine for Objects in Lund AB [neotechnology.com]
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package unit.neo;

import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.neo4j.api.core.EmbeddedNeo;
import org.neo4j.api.core.NeoService;

public class TestAll extends TestSuite
{
	// Returns the generates suite
	public static Test suite()
	{
		return new TestSetup( generateSuite() );
	}
	
	// Generates a test suite
	private static TestSuite generateSuite()
	{
		// ADD YOUR NEW TESTS HERE:
		TestSuite suite = new TestSuite();
		suite.addTest( unit.neo.cache.TestAll.suite() ); 
		suite.addTest( unit.neo.event.TestAll.suite() );
		suite.addTest( unit.neo.api.TestAll.suite() );
		suite.addTest( unit.neo.transaction.TestAll.suite() );
		suite.addTest( unit.neo.store.TestAll.suite() );
		suite.addTest( unit.neo.util.TestAll.suite() );
		return suite;
	}
	
	private static NeoService neo;
	
	private static void startupNeo()
	{
		neo = new EmbeddedNeo( MyRelTypes.class, "var/neo" );
	}
	
	private static void shutdownNeo()
	{
		neo.shutdown();
	}
	
	public static void main( String args[] )
	{
		startupNeo();
		junit.textui.TestRunner.run( suite() );
		shutdownNeo();
		org.neo4j.impl.core.LockReleaser.getManager().dumpLocks();		
		org.neo4j.impl.transaction.LockManager.getManager().dumpRagStack();
		org.neo4j.impl.transaction.LockManager.getManager().dumpAllLocks();
		org.neo4j.impl.transaction.TxManager.getManager().dumpTransactions();
	}
}
