View Javadoc
1 /* 2 * Created on Feb 21, 2003 3 * 4 * To change this generated comment go to 5 * Window>Preferences>Java>Code Generation>Code Template 6 */ 7 package test.net.sf.fastxmldb; 8 9 import junit.framework.TestCase; 10 import net.sf.fastxmldb.impl.CollectionBroker; 11 import net.sf.fastxmldb.utils.FastXMLDBConstants; 12 13 import org.xmldb.api.DatabaseManager; 14 import org.xmldb.api.base.Collection; 15 import org.xmldb.api.base.Database; 16 import org.xmldb.api.base.XMLDBException; 17 18 /*** 19 * @author jbirchfield 20 */ 21 public class DatabaseImplTest extends TestCase { 22 23 24 /*** 25 * Constructor for DatabaseImplTest. 26 * @param arg0 27 */ 28 public DatabaseImplTest(String arg0) { 29 super(arg0); 30 } 31 32 /*** 33 * @see TestCase#setUp() 34 */ 35 protected void setUp() throws Exception { 36 super.setUp(); 37 Database database = 38 (Database) Class 39 .forName(FastXMLDBConstants.FAST_XMLDB_DATABASE_CLASSNAME) 40 .newInstance(); 41 DatabaseManager.registerDatabase(database); 42 //since this is a singleton, clear it out first 43 CollectionBroker.getInstance().clearCollections(); 44 } 45 46 /*** 47 * @see TestCase#tearDown() 48 */ 49 protected void tearDown() throws Exception { 50 super.tearDown(); 51 } 52 53 public void testGetCollection() { 54 try { 55 String collectionName = FastXMLDBConstants.DEFAULT_COLLECTION_URI + "test"; 56 Collection collection = 57 DatabaseManager.getCollection(collectionName); 58 assertNull(collection); 59 } catch (XMLDBException e) { 60 fail(e.getMessage()); 61 } 62 } 63 64 public void testGetConformanceLevel() { 65 String desiredLevel = "0"; 66 try { 67 String conformanceLevel = 68 DatabaseManager.getConformanceLevel(FastXMLDBConstants.DEFAULT_COLLECTION_URI); 69 assertEquals(conformanceLevel, desiredLevel); 70 } catch (XMLDBException e) { 71 e.printStackTrace(); 72 fail(e.getMessage()); 73 } 74 } 75 76 }

This page was automatically generated by Maven