mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestMetatypeInformationListener.java
private Event managedServiceEvent()
    {
      //mock service behavior
        @SuppressWarnings("rawtypes")
        ServiceReference reg = mock(ServiceReference.class);
        Bundle bundle = mock(Bundle.class);
        
        when(reg.getBundle()).thenReturn(bundle);
        when(bundle.getBundleId()).thenReturn(1L);

        //mimic event
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(EventConstants.SERVICE_OBJECTCLASS, 
            new String[]{ManagedService.class.getName(), MetaTypeProvider.class.getName()});
        props.put(EventConstants.SERVICE, reg);
        props.put(EventConstants.SERVICE_PID, "pid");

        //return created event
        return new Event(OSGiEventConstants.TOPIC_SERVICE_REGISTERED, props);
    }
/**
     * Mock event that contains a service class that is not one that the component cares about.
     */
Mock event that contains a service class that is not one that the component cares about.
Mock event that contains a service class that is not one that the component cares about .
private Event managedServiceEvent()
    {
        @SuppressWarnings("rawtypes")
        ServiceReference reg = mock(ServiceReference.class);
        Bundle bundle = mock(Bundle.class);
        when(reg.getBundle()).thenReturn(bundle);
        when(bundle.getBundleId()).thenReturn(1L);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(EventConstants.SERVICE_OBJECTCLASS, 
            new String[]{ManagedService.class.getName(), MetaTypeProvider.class.getName()});
        props.put(EventConstants.SERVICE, reg);
        props.put(EventConstants.SERVICE_PID, "pid");
        return new Event(OSGiEventConstants.TOPIC_SERVICE_REGISTERED, props);
    }
private Event managedServiceEvent ( ) { @ SuppressWarnings ( "rawtypes" ) ServiceReference reg = mock ( ServiceReference . class ) ; Bundle bundle = mock ( Bundle . class ) ; when ( reg . getBundle ( ) ) . thenReturn ( bundle ) ; when ( bundle . getBundleId ( ) ) . thenReturn ( 1L ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( EventConstants . SERVICE_OBJECTCLASS , new String [ ] { ManagedService . class . getName ( ) , MetaTypeProvider . class . getName ( ) } ) ; props . put ( EventConstants . SERVICE , reg ) ; props . put ( EventConstants . SERVICE_PID , "pid" ) ; return new Event ( OSGiEventConstants . TOPIC_SERVICE_REGISTERED , props ) ; }
Mock event that contains a service class that is not one that the component cares about.
Mock event that contains a service class that is not one that the component cares about .
//mock service behavior //mimic event //return created event