FileDocCategorySizeDatePackage
LegacyTestCase.javaAPI DocHibernate 3.2.51762Thu Mar 29 07:35:52 BST 2007org.hibernate.test.legacy

LegacyTestCase

public abstract class LegacyTestCase extends org.hibernate.junit.functional.FunctionalTestCase
author
Steve Ebersole

Fields Summary
public static final String
USE_ANTLR_PARSER_PROP
private final boolean
useAntlrParser
Constructors Summary
public LegacyTestCase(String x)


	   
		super( x );
		useAntlrParser = Boolean.valueOf( extractFromSystem( USE_ANTLR_PARSER_PROP ) ).booleanValue();
	
Methods Summary
public voidconfigure(org.hibernate.cfg.Configuration cfg)

		super.configure( cfg );
		if ( !useAntlrParser ) {
			cfg.setProperty( Environment.QUERY_TRANSLATOR, ClassicQueryTranslatorFactory.class.getName() );
			try {
				String dialectTrueRepresentation = Dialect.getDialect().toBooleanValueString( true );
				// if this call succeeds, then the dialect is saying to represent true/false as int values...
				Integer.parseInt( dialectTrueRepresentation );
				String subs = cfg.getProperties().getProperty( Environment.QUERY_SUBSTITUTIONS );
				if ( subs == null ) {
					subs = "";
				}
				if ( StringHelper.isEmpty( subs ) ) {
					subs = "true=1, false=0";
				}
				else {
					subs += ", true=1, false=0";
				}
				cfg.getProperties().setProperty( Environment.QUERY_SUBSTITUTIONS, subs );
			}
			catch( NumberFormatException nfe ) {
				// the Integer#parseInt call failed...
			}
		}
	
protected static java.lang.StringextractFromSystem(java.lang.String systemPropertyName)

		try {
			return System.getProperty( systemPropertyName );
		}
		catch( Throwable t ) {
			return null;
		}