org.melati.poem.test
Class PoemTestCase

Package class diagram package PoemTestCase
java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.melati.poem.test.PoemTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
CachedCountTest, CachedExistsTest, CachedSelectionTest, CachedTailoredQueryTest, CapabilityTableTest, CapabilityTest, ColumnInfoTest, ColumnTest, DbmsSpec, EverythingTestCase, FieldSetTest, FieldTest, GroupCapabilityTableTest, GroupCapabilityTest, GroupMembershipTest, GroupTest, PersistentFactoryTest, PoemDatabaseTest, PoemThreadTest, PoemTransactionTest, PoemTypeFactoryTest, PreparedStatementFactoryTest, ResultSetEnumerationTest, SessionTokenTest, SettingTableTest, SQLPoemTypeSpec, StandardIntegrityFixTest, TableCategoryTest, TableFactoryTest, TableInfoTest, TableMapTest, TableTest, UserTest

public class PoemTestCase
extends junit.framework.TestCase
implements junit.framework.Test

A TestCase that runs in a Database session.

Since:
19-May-2006
Author:
timp

Field Summary
protected static int maxTrans
           
protected static junit.framework.TestResult result
           
 
Constructor Summary
PoemTestCase()
          Constructor.
PoemTestCase(String name)
          Constructor.
 
Method Summary
static void assertEquals(File expected, File actual)
          Asserts that two files are equal.
static void assertEquals(String message, File expected, File actual)
          Taken from junit-addons.sourceforge.net.
static void assertEquals(String message, int expected, int actual)
           
protected  void checkColumns(int columnCount)
           
protected  void checkDbUnchanged()
           
protected  void checkTables(int tableCount)
           
protected  void checkTablesAndColumns(int tableCount, int columnCount)
           
protected  void databaseUnchanged()
           
protected  void dropTable(String tableName)
           
protected  void dumpTable(org.melati.poem.Table t)
           
 org.melati.poem.Database getDatabase(String name)
           
 String getDatabaseName()
           
 org.melati.poem.Database getDb()
           
 org.melati.poem.Database getDb(String dbNameP)
           
 String getName()
          Gets the name of a TestCase.
static String getOrDie(Properties properties, String propertyName)
          Return a property.
 Properties getProperties()
           
 String getPropertiesFileName()
           
 org.melati.poem.AccessToken getUserToRunAs()
           
 void run(junit.framework.TestResult resultIn)
          Runs the test case and collects the results in TestResult.
protected  void runTest()
          Run the test in a session.
 void setDatabaseName(String databaseName)
           
 void setName(String name)
          Sets the name of a TestCase.
 void setPropertiesFileName(String propertiesFileNameIn)
           
protected  void setUp()
           
 void setUserToRunAs(org.melati.poem.AccessToken userToRunAs)
           
protected  void tearDown()
           
 void testNothing()
          Some test runners seem to think there should be a test in this file.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, run, runBare, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases
 

Field Detail

maxTrans

protected static int maxTrans

result

protected static junit.framework.TestResult result
Constructor Detail

PoemTestCase

public PoemTestCase()
Constructor.


PoemTestCase

public PoemTestCase(String name)
Constructor.

Parameters:
name -
Method Detail

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception
See Also:
TestCase.setUp()

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception
See Also:
TestCase.tearDown()

run

public void run(junit.framework.TestResult resultIn)
Runs the test case and collects the results in TestResult.

Specified by:
run in interface junit.framework.Test
Overrides:
run in class junit.framework.TestCase

assertEquals

public static void assertEquals(String message,
                                int expected,
                                int actual)

runTest

protected void runTest()
                throws Throwable
Run the test in a session.

Overrides:
runTest in class junit.framework.TestCase
Throws:
Throwable
See Also:
TestCase.runTest()

checkDbUnchanged

protected void checkDbUnchanged()

databaseUnchanged

protected void databaseUnchanged()

dropTable

protected void dropTable(String tableName)

checkTablesAndColumns

protected void checkTablesAndColumns(int tableCount,
                                     int columnCount)

checkTables

protected void checkTables(int tableCount)

checkColumns

protected void checkColumns(int columnCount)

dumpTable

protected void dumpTable(org.melati.poem.Table t)

getName

public String getName()
Gets the name of a TestCase.

Overrides:
getName in class junit.framework.TestCase
Returns:
returns a String

setName

public void setName(String name)
Sets the name of a TestCase.

Overrides:
setName in class junit.framework.TestCase
Parameters:
name - The name to set

getDb

public org.melati.poem.Database getDb()
Returns:
Returns the db.

getDb

public org.melati.poem.Database getDb(String dbNameP)
Parameters:
dbNameP - the name of the logical db
Returns:
a Database

getDatabase

public org.melati.poem.Database getDatabase(String name)
Parameters:
name - the name of the logical db
Returns:
a Database

getUserToRunAs

public org.melati.poem.AccessToken getUserToRunAs()
Returns:
the user

setUserToRunAs

public void setUserToRunAs(org.melati.poem.AccessToken userToRunAs)
Parameters:
userToRunAs - the user

getProperties

public Properties getProperties()
Returns:
a Properties

getOrDie

public static String getOrDie(Properties properties,
                              String propertyName)
Return a property.

Parameters:
properties - the Properties object to look in
propertyName - the property to get
Returns:
the property value
Throws:
RuntimeException - if the property is not set

getPropertiesFileName

public String getPropertiesFileName()
Returns:
the properties name

setPropertiesFileName

public void setPropertiesFileName(String propertiesFileNameIn)
Parameters:
propertiesFileName - the name to set

getDatabaseName

public String getDatabaseName()
Returns:
the db name

setDatabaseName

public void setDatabaseName(String databaseName)
Parameters:
databaseName - the db name

assertEquals

public static void assertEquals(String message,
                                File expected,
                                File actual)
Taken from junit-addons.sourceforge.net. Asserts that two files are equal. Throws an AssertionFailedError if they are not.

Note: This assertion method rely on the standard junit.framework.Assert(String expected, String actual) method to compare the lines of the files. JUnit > 3.8 provides a nicer way to display differences between two strings but since only lines are compared (and not entire paragraphs) you can still use JUnit 3.7.


assertEquals

public static void assertEquals(File expected,
                                File actual)
Asserts that two files are equal. Throws an AssertionFailedError if they are not.


testNothing

public void testNothing()
Some test runners seem to think there should be a test in this file.



Copyright © 2000-2010 PanEris. All Rights Reserved.