ozone core API

org.ozoneDB.test
Class OzoneTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.ozoneDB.test.OzoneTestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class OzoneTestCase
extends junit.framework.TestCase

Base class for the Ozone based TestCase. The following is an example of writting OzoneTestCase.

  packge com.foo;

  import junit.framework.*;
  import org.ozoneDB.test.OzoneTestCase;
  import org.ozoneDB.test.simple.*;
 
  package FooTestCase extends OzoneTestCase {
    public static Test suite() {
      TestSuite suite = new TestSuite();
      suite.addTestSuite(FooTestCase.class);
      return suite;
    }
 
    public void testCreate() {
      // db() provide the access to database setup by TestRunner
      Auto auto = (Auto)db().createObject(AutoImpl.class.getName()); 
      assertNotNull(auto);
      // Test away!!!
    }
  }

Version:
$Revision: 1.1 $Date: 2001/12/18 10:31:31 $
Author:
SMB
, David Li

Field Summary
private  org.ozoneDB.ExternalDatabase db
          the database to be used for testing
private static org.apache.log4j.Category fLog
          log4j logger
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
protected OzoneTestCase(java.lang.String name)
          Constructor.
 
Method Summary
 org.ozoneDB.ExternalDatabase db()
          Return the database set up by OzoneTestRunner
 void setDB(org.ozoneDB.ExternalDatabase db)
          Set the database for this TestCase.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, 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
 

Field Detail

fLog

private static org.apache.log4j.Category fLog
log4j logger


db

private org.ozoneDB.ExternalDatabase db
the database to be used for testing

Constructor Detail

OzoneTestCase

protected OzoneTestCase(java.lang.String name)
Constructor.

Method Detail

db

public org.ozoneDB.ExternalDatabase db()
Return the database set up by OzoneTestRunner

Returns:
a instance of ExternalDatabase

setDB

public void setDB(org.ozoneDB.ExternalDatabase db)
Set the database for this TestCase. This is typically used by the OzoneTestRunner. However, you can also use it in the setUp() method to connect to different database than the one specified by the OzoneTestRunner.

Parameters:
db - the database to be used for the TestCase

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.