1 package org.jadetower.dao.test; 2 3 import junit.framework.TestCase; 4 import org.jadetower.dao.*; 5 import org.jadetower.dao.test.daos.ContextDao; 6 import java.util.HashMap; 7 import java.io.File; 8 9 10 public class DaoContextConfigTestCase extends TestCase { 11 12 DaoContainer container = null; 13 String expectedName = "org.jadetower.dao.test.daos.ContextDao"; 14 String expectedFile = "context-example.xconf"; 15 16 protected void setUp() throws Exception { 17 super.setUp(); 18 String[] configuration = new String[]{"src/conf/context-example.xconf"}; 19 container = new DaoContainer(configuration, null, null); 20 } 21 22 public void testBeanConfiguration() throws Exception { 23 DaoManager manager = (DaoManager) container.getManager("bean"); 24 ContextDao dao = (ContextDao) manager.getDao("context"); 25 String name = dao.getName(); 26 String file = dao.getFile().getName(); 27 boolean pass = name.equalsIgnoreCase(expectedName) && 28 file.equalsIgnoreCase(expectedFile); 29 assertTrue(pass); 30 } 31 32 public void testMapConfiguration() throws Exception { 33 DaoManager manager = (DaoManager) container.getManager("map"); 34 ContextDao dao = (ContextDao) manager.getDao("context"); 35 String name = dao.getName(); 36 String file = dao.getFile().getName(); 37 boolean pass = name.equalsIgnoreCase(expectedName) && 38 file.equalsIgnoreCase(expectedFile); 39 assertTrue(pass); 40 } 41 42 public void testAvalonConfiguration() throws Exception { 43 DaoManager manager = (DaoManager) container.getManager("avalon"); 44 ContextDao dao = (ContextDao) manager.getDao("context"); 45 String name = dao.getName(); 46 String file = dao.getFile().getName(); 47 boolean pass = name.equalsIgnoreCase(expectedName) && 48 file.equalsIgnoreCase(expectedFile); 49 assertTrue(pass); 50 } 51 52 public void testScriptedConfiguration() throws Exception { 53 DaoManager manager = (DaoManager) container.getManager("scripted"); 54 ContextDao dao = (ContextDao) manager.getDao("context"); 55 String name = dao.getName(); 56 String file = dao.getFile().getName(); 57 boolean pass = name.equalsIgnoreCase(expectedName) && 58 file.equalsIgnoreCase(expectedFile); 59 assertTrue(pass); 60 } 61 62 public void testEmbeddedConfiguration() throws Exception { 63 DaoManager manager = (DaoManager) container.getManager("embedded"); 64 ContextDao dao = (ContextDao) manager.getDao("context"); 65 String name = dao.getName(); 66 String file = dao.getFile().getName(); 67 boolean pass = name.equalsIgnoreCase(expectedName) && 68 file.equalsIgnoreCase(expectedFile); 69 assertTrue(pass); 70 } 71 72 }

This page was automatically generated by Maven