mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestMetatypeInformationListener.java
private Event xmlServiceEvent()
    {
        //mock service behavior
        Bundle bundle = mock(Bundle.class);
        List<URL> urlList = new ArrayList<URL>();
        urlList.add(m_TestURL);
        Enumeration<URL> urls = getfileEnum(urlList);
        
        //mock behavior
        when(m_Context.getBundle(1L)).thenReturn(bundle);
        when(bundle.findEntries("OSGI-INF/metatype", "*.xml", true)).thenReturn(urls);

        //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 contains XML data.
     */
Mock a bundle event where the bundle contains XML data.
Mock a bundle event where the bundle contains XML data .
private Event xmlServiceEvent()
    {
        Bundle bundle = mock(Bundle.class);
        List<URL> urlList = new ArrayList<URL>();
        urlList.add(m_TestURL);
        Enumeration<URL> urls = getfileEnum(urlList);
        when(m_Context.getBundle(1L)).thenReturn(bundle);
        when(bundle.findEntries("OSGI-INF/metatype", "*.xml", true)).thenReturn(urls);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(EventConstants.BUNDLE_ID, 1L);
        return new Event(OSGiEventConstants.TOPIC_BUNDLE_RESOLVED, props);
    }
private Event xmlServiceEvent ( ) { Bundle bundle = mock ( Bundle . class ) ; List < URL > urlList = new ArrayList < URL > ( ) ; urlList . add ( m_TestURL ) ; Enumeration < URL > urls = getfileEnum ( urlList ) ; when ( m_Context . getBundle ( 1L ) ) . thenReturn ( bundle ) ; when ( bundle . findEntries ( "OSGI-INF/metatype" , "*.xml" , true ) ) . thenReturn ( urls ) ; 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 contains XML data.
Mock a bundle event where the bundle contains XML data .
//mock service behavior //mock behavior //mimic event information used //return created event