1 package com.sri.emo.test; 2 3 import java.util.List; 4 import com.jcorporate.expresso.services.test.TestSystemInitializer; 5 import com.sri.emo.dbobj.NodeType; 6 import com.sri.emo.dbobj.Part; 7 import com.sri.emo.dbobj.WizDefinition; 8 import junit.framework.TestCase; 9 import com.sri.emo.wizard.completion.model.CompletionWizardTestBean; 10 11 /*** 12 * This is kind of a test the test suite, but I feel it's important 13 * to make sure that DBUnit is working properly and loading things like 14 * it should. 15 * 16 * @author Michael Rimov 17 */ 18 public class TestDatabaseTestFixture extends TestCase { 19 private DatabaseTestFixture databaseTestFixture = null; 20 21 /*** 22 * Constructs the database test fixture instance. 23 * 24 * @throws Exception 25 */ 26 protected void setUp() throws Exception { 27 super.setUp(); 28 databaseTestFixture = new DatabaseTestFixture(TestSystemInitializer 29 .getTestContext(), EmoTestSuite.class 30 .getResourceAsStream("WizardTestData.xml")); 31 32 } 33 34 protected void tearDown() throws Exception { 35 databaseTestFixture.tearDown(); 36 databaseTestFixture = null; 37 super.tearDown(); 38 } 39 40 /*** 41 * Runs the test fixture. 42 * 43 * @throws Exception 44 */ 45 public void testSetUp() throws Exception { 46 databaseTestFixture.setUp(); 47 WizDefinition wizdef = new WizDefinition(); 48 int value = wizdef.count(); 49 assertTrue(value > 0); 50 51 wizdef.setField(WizDefinition.FLD_ID, DatabaseTestFixture.DEFAULT_WIZ_ID); 52 List pages = wizdef.getPageDefinitions(); 53 assertEquals(DatabaseTestFixture.DEFAULT_WIZ_STEPS, pages.size()); 54 55 NodeType nt = new NodeType(); 56 nt.setField(NodeType.NODE_TYPE_NAME, "MOVIEDEMO"); 57 assertTrue("Need to find Movie Demo Node Type", nt.find()); 58 59 Part parts = new Part(); 60 parts.setField(Part.PARENT_TYPE, nt.getEntityName()); 61 List allParts = parts.searchAndRetrieveList(); 62 assertTrue(allParts.size() == CompletionWizardTestBean.NUMBER_OF_PARTS); 63 } 64 65 }