1 64 package com.jcorporate.expresso.kernel.digester.test; 65 66 import com.jcorporate.expresso.kernel.digester.ComponentConfig; 67 import com.jcorporate.expresso.kernel.digester.ExpressoServicesConfig; 68 import junit.framework.TestCase; 69 70 73 public class TestExpressoServicesConfig extends TestCase { 74 75 public TestExpressoServicesConfig(String _name) { 76 super(_name); 77 } 78 79 82 protected void setUp() { 83 } 84 85 88 protected void tearDown() { 89 } 90 91 94 public void testLoadExpressoServices() { 95 try { 96 ExpressoServicesConfig esc = new ExpressoServicesConfig(); 97 esc.setExpressoServicesFile(com.jcorporate.expresso.kernel.test 98 .TestComponentSystem.class.getResource("Test1ExpressoServices.xml")); 99 esc.loadExpressoServices(); 100 } catch (Exception ex) { 101 fail("Error attempting to digest services file"); 102 } 103 } 104 105 108 public void testExpressoServicesFileContents() { 109 try { 110 ExpressoServicesConfig esc = new ExpressoServicesConfig(); 111 esc.setExpressoServicesFile( 112 com.jcorporate.expresso.kernel.test.TestComponentSystem.class.getResource( 113 "Test1ExpressoServices.xml")); 114 esc.loadExpressoServices(); 115 ComponentConfig root = esc.getRootConfig(); 116 assertTrue(root != null); 117 assertTrue("Must have some child components got null instead", root.getChildComponents() != null); 118 assertTrue("Should have one child component. Got " + root.getChildComponents().size() + " instead.", 119 root.getChildComponents().size() == 1); 120 assertTrue( 121 "Should have four properties. Got " + ((ComponentConfig) root.getChildComponents().get(0)).getProperties().size() + " instead" 122 , ((ComponentConfig) root.getChildComponents().get(0)).getProperties().size() == 4); 123 } catch (Exception ex) { 124 fail("Error attempting to digest services file"); 125 } 126 } 127 128 133 public static void main(String [] argv) { 134 String [] testCaseList = {TestExpressoServicesConfig.class.getName()}; 135 junit.textui.TestRunner.main(testCaseList); 136 } 137 } 138 | Popular Tags |