mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestMetatypeInformationListener.java
private Event xmlServiceEventNoXMLData()
    {
        //mock service behavior
        Bundle bundle = mock(Bundle.class);
        @SuppressWarnings("unchecked")
        Enumeration<URL> urls = mock(Enumeration.class);
        
        //mock behavior
        when(m_Context.getBundle(1L)).thenReturn(bundle);
        when(bundle.findEntries("OSGI-INF/metatype", "*.xml", true)).thenReturn(null);
        when(urls.hasMoreElements()).thenReturn(false);

        //mimic event information used
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(EventConstants.BUNDLE_ID, 1L);

        //return created event
        return new Event(OSGiEventConstants.TOPIC_BUNDLE_RESOLVED, props);
    }
/**
     * Mock a bundle event where the bundle does not contain XML data.
     */
Mock a bundle event where the bundle does not contain XML data.
Mock a bundle event where the bundle does not contain XML data .
private Event xmlServiceEventNoXMLData()
    {
        Bundle bundle = mock(Bundle.class);
        @SuppressWarnings("unchecked")
        Enumeration<URL> urls = mock(Enumeration.class);
        when(m_Context.getBundle(1L)).thenReturn(bundle);
        when(bundle.findEntries("OSGI-INF/metatype", "*.xml", true)).thenReturn(null);
        when(urls.hasMoreElements()).thenReturn(false);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(EventConstants.BUNDLE_ID, 1L);
        return new Event(OSGiEventConstants.TOPIC_BUNDLE_RESOLVED, props);
    }
private Event xmlServiceEventNoXMLData ( ) { Bundle bundle = mock ( Bundle . class ) ; @ SuppressWarnings ( "unchecked" ) Enumeration < URL > urls = mock ( Enumeration . class ) ; when ( m_Context . getBundle ( 1L ) ) . thenReturn ( bundle ) ; when ( bundle . findEntries ( "OSGI-INF/metatype" , "*.xml" , true ) ) . thenReturn ( null ) ; when ( urls . hasMoreElements ( ) ) . thenReturn ( false ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( EventConstants . BUNDLE_ID , 1L ) ; return new Event ( OSGiEventConstants . TOPIC_BUNDLE_RESOLVED , props ) ; }
Mock a bundle event where the bundle does not contain XML data.
Mock a bundle event where the bundle does not contain XML data .
//mock service behavior //mock behavior //mimic event information used //return created event