Package org.osgi.framework

Examples of org.osgi.framework.BundleEvent


        @Override
        public void moduleChanged(ModuleEvent event) {
            int type = event.getType();
            Module module = event.getModule();
            BundleEvent bundleEvent = new BundleEvent(type, new BundleAdaptor(module));
            delegate.bundleChanged(bundleEvent);
        }
View Full Code Here


        cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getSymbolicName"), "test.composite");
        cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getVersion"), new Version("1.0.0"));
       
        assertTrue(BundleTrackerFactory.getAllBundleTracker().isEmpty());
       
        sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb));
        assertEquals(1, BundleTrackerFactory.getAllBundleTracker().size());
        assertEquals(1, BundleTrackerFactory.getBundleTrackerList("test.composite_1.0.0").size());
       
        sut.removedBundle(cb, new BundleEvent(BundleEvent.STOPPED, cb), cb);
        assertTrue(BundleTrackerFactory.getAllBundleTracker().isEmpty());       
    }
View Full Code Here

  
    @Test
    public void testToCompositeData() throws Exception {

        BundleEvent event = mock(BundleEvent.class);
        Bundle bundle = mock(Bundle.class);
        when(event.getBundle()).thenReturn(bundle);
        when(bundle.getSymbolicName()).thenReturn("test");
        when(bundle.getBundleId()).thenReturn(new Long(4));
        when(bundle.getLocation()).thenReturn("location");
        when(event.getType()).thenReturn(BundleEvent.INSTALLED);
       
        BundleEventData eventData = new BundleEventData(event);
        CompositeData eventCompositeData = eventData.toCompositeData();
       
        assertEquals(new Long(4), (Long) eventCompositeData.get(IDENTIFIER));
View Full Code Here

  
    @Test
    public void testToCompositeData() throws Exception {

        BundleEvent event = mock(BundleEvent.class);
        Bundle bundle = mock(Bundle.class);
        when(event.getBundle()).thenReturn(bundle);
        when(bundle.getSymbolicName()).thenReturn("test");
        when(bundle.getBundleId()).thenReturn(new Long(4));
        when(bundle.getLocation()).thenReturn("location");
        when(event.getType()).thenReturn(BundleEvent.INSTALLED);
       
        BundleEventData eventData = new BundleEventData(event);
        CompositeData eventCompositeData = eventData.toCompositeData();
       
        assertEquals(new Long(4), (Long) eventCompositeData.get(IDENTIFIER));
View Full Code Here

        Bundle b1 = mock(Bundle.class);
        when(b1.getBundleId()).thenReturn(new Long(9));
        when(b1.getSymbolicName()).thenReturn("bundle");
        when(b1.getLocation()).thenReturn("file:/location");
       
        BundleEvent installedEvent = mock(BundleEvent.class);
        when(installedEvent.getBundle()).thenReturn(b1);
        when(installedEvent.getType()).thenReturn(BundleEvent.INSTALLED);
      
        BundleEvent resolvedEvent = mock(BundleEvent.class);
        when(resolvedEvent.getBundle()).thenReturn(b1);
        when(resolvedEvent.getType()).thenReturn(BundleEvent.RESOLVED);
       
        MBeanServer server = mock(MBeanServer.class);
       
        //setup for notification
        ObjectName objectName = new ObjectName(OBJECTNAME);
View Full Code Here

        registry.setEkbClassLoader(new EKBTestClassLoader());
        registry.setGraphDb(graph);
    }

    private BundleEvent getMockedBundleEvent(boolean full) throws Exception {
        BundleEvent event = mock(BundleEvent.class);
        Bundle bundle = new MockedBundle(full);
        when(event.getBundle()).thenReturn(bundle);
        return event;
    }
View Full Code Here

        return new ModelDescription(ModelA.class, new Version(1, 0, 0).toString());
    }

    @Test
    public void testIfModelRegistryOnlyAddsModels_shouldWork() throws Exception {
        BundleEvent event = getMockedBundleEvent(true);
        registry.addingBundle(event.getBundle(), event);
        verify(graph).addModel(getCorrectModel());
        verify(graph, never()).addModel(getIncorrectModel());
    }
View Full Code Here

        verify(graph, never()).addModel(getIncorrectModel());
    }
   
    @Test
    public void testIfModelRegistryCanWorkWithEmptyBundles_shouldWork() throws Exception {
        BundleEvent event = getMockedBundleEvent(false);
        registry.addingBundle(event.getBundle(), event);
    }
View Full Code Here

      expectLastCall().times(1);
      providerListener.added(anyObject(JcloudsTestYetAnotherComputeProviderMetadata.class));
      expectLastCall().times(1);
      replay(bundle, providerListener);

      BundleEvent event = new BundleEvent(BundleEvent.STARTED, bundle);
      listener.bundleChanged(event);
      verify(bundle, providerListener);
   }
View Full Code Here

      expectLastCall().times(1);
      apiListener.added(anyObject(JcloudsTestComputeApiMetadata.class));
      expectLastCall().times(1);
      replay(bundle, apiListener);

      BundleEvent event = new BundleEvent(BundleEvent.STARTED, bundle);
      listener.bundleChanged(event);
      verify(bundle, apiListener);
   }
View Full Code Here

TOP

Related Classes of org.osgi.framework.BundleEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.