1 15 package org.apache.hivemind.service; 16 17 import hivemind.test.services.StringHolder; 18 19 import org.apache.hivemind.HiveMind; 20 import org.apache.hivemind.Registry; 21 import org.apache.hivemind.service.impl.BuilderFactory; 22 import org.apache.hivemind.xml.XmlTestCase; 23 24 29 public class TestBuilderFactoryServiceModel extends XmlTestCase 30 { 31 32 35 public void testManaged() throws Exception 36 { 37 Registry r = buildFrameworkRegistry("Pooled.xml"); 38 39 StringHolder s = 40 (StringHolder) r.getService("hivemind.test.services.Managed", StringHolder.class); 41 42 interceptLogging("hivemind.test.services.Managed"); 43 44 assertNull(s.getValue()); 45 46 assertLoggedMessage("activateService()"); 47 48 s.setValue("funky monkey"); 49 assertEquals("funky monkey", s.getValue()); 50 51 ThreadEventNotifier n = 52 (ThreadEventNotifier) r.getService( 53 HiveMind.THREAD_EVENT_NOTIFIER_SERVICE, 54 ThreadEventNotifier.class); 55 56 n.fireThreadCleanup(); 57 58 assertLoggedMessage("passivateService()"); 59 60 assertNull(s.getValue()); 61 } 62 63 } 64 | Popular Tags |