public void LoadBundle() { IFrameworkFactory factory = new CFrameworkFactory(); IFramework fwk = factory.NewFramework(null); fwk.Init(); Expect.Once.On(bundle_listener) .Method("BundleChanged"); IBundleContext ctx = fwk.getBundleContext(); ctx.AddBundleListener(bundle_listener); IBundle test_bundle = ctx.InstallBundle(TEST_BUNDLE_LOCATION); Assert.IsNotNull(test_bundle); Assert.AreEqual(test_bundle.getState(), BundleState.INSTALLED); Assert.AreEqual(test_bundle, ctx.getBundle(test_bundle.getBundleId())); Assert.AreEqual(test_bundle, ctx.InstallBundle(TEST_BUNDLE_LOCATION)); mockery.VerifyAllExpectationsHaveBeenMet(); }
static void Main(string[] args) { try { IFrameworkFactory factory = new CFrameworkFactory(); IFramework fwk = factory.NewFramework(null); fwk.Init(); fwk.Start(); IBundleContext ctx = fwk.getBundleContext(); IBundle console = ctx.InstallBundle("framework_console"); console.Start(); fwk.Stop(); fwk.WaitForStop(0); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }