1 15 package org.apache.hivemind.service; 16 17 import org.apache.hivemind.ApplicationRuntimeException; 18 import org.apache.hivemind.BeanA; 19 import org.apache.hivemind.Registry; 20 import org.apache.hivemind.Reverser; 21 import org.apache.hivemind.xml.XmlTestCase; 22 23 30 public class TestBuilderFactoryBeanService extends XmlTestCase 31 { 32 33 private void attempt(String name) throws Exception 34 { 35 Registry reg = buildFrameworkRegistry("BeanService.xml"); 36 37 Reverser r = (Reverser) reg.getService(name, Reverser.class); 38 39 assertEquals("DNIMEVIH", r.reverse("HIVEMIND")); 40 r.reverse("HIVEMIND"); 42 reg.shutdown(); 43 44 try 45 { 46 r.reverse("SHUTDOWN"); 47 unreachable(); 48 } 49 catch (ApplicationRuntimeException ex) 50 { 51 } 52 } 53 54 public void testFactory() throws Exception 55 { 56 attempt("bean.FactoryReverser"); 57 } 58 59 public void testAutowireBeanServiceProperty() throws Exception 60 { 61 Registry reg = buildFrameworkRegistry("BeanService.xml"); 62 BeanA beanA = ( BeanA )reg.getService( BeanA.class ); 63 beanA.methodA(); 64 } 65 } | Popular Tags |