首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

OSGI学习札记(六)

2012-08-25 
OSGI学习笔记(六)??public class SimpleServiceBundleTest extends AbstractConfigurableBundleCreatorTes

OSGI学习笔记(六)

?


?

public class SimpleServiceBundleTest extends AbstractConfigurableBundleCreatorTests {protected String[] getTestBundlesNames() {return new String[] {"org.springframework.osgi.samples, simple-service-bundle,1.2.1"};} public Resource getTestingFrameworkBundlesConfiguration() {return new InputStreamResource(AbstractDependencyManagerTests.class.getResourceAsStream("/boot-bundles.properties"));}public void testOSGiStartedOk() {assertNotNull(bundleContext); } public void testSimpleServiceExported() { ServiceReference ref = bundleContext.getServiceReference(MyService.class.getName()); assertNotNull("Service Reference is null", ref); try { MyService simpleService = (MyService) bundleContext.getService(ref); assertNotNull("Cannot find the service", simpleService); assertEquals("simple service at your service", simpleService.stringValue()); } finally { bundleContext.ungetService(ref); }}}


?


?可以尝试输入stop 10和start10试试看效果。

?

热点排行