mil.dod.th.ose.controller/test/mil/dod/th/ose/controller/impl/TestTerraHarvestControllerImpl.java
@SuppressWarnings("unchecked")
    @Test
    public void testGetProxyCapabilities() throws UnmarshalException, MalformedURLException
    {  
        ServiceReference<TerraHarvestControllerProxy> serviceRef = mock(ServiceReference.class);
        Bundle proxyBundle = mock(Bundle.class);
        TerraHarvestControllerProxy proxy = mock(TerraHarvestControllerProxy.class);
        URL proxyCapUrl = new URL("file:\\proxy-cap.xml");
        ControllerCapabilities proxyCaps = new ControllerCapabilities().withManufacturer("custom");
        
        when(m_Context.getServiceReference(TerraHarvestControllerProxy.class)).thenReturn(serviceRef);
        when(serviceRef.getBundle()).thenReturn(proxyBundle);
        when(m_UnmarshalService.getXmlResource(proxyBundle, FactoryDescriptor.CAPABILITIES_XML_FOLDER_NAME, 
                proxy.getClass().getName()))
            .thenReturn(proxyCapUrl);
        when(m_UnmarshalService.getXmlObject(Mockito.any(), eq(proxyCapUrl))).thenReturn(proxyCaps);
        m_SUT.setProxy(proxy);
        m_SUT.activate(m_Context);
        
        // verify proxy bundle cap URL is used instead
        verify(m_UnmarshalService).getXmlObject(ControllerCapabilities.class, proxyCapUrl);

        ControllerCapabilities caps = m_SUT.getCapabilities();
        assertThat(caps, is(proxyCaps));
    }
/**
     * Test to verify that getCapabilities returns unmarshalled capabilities XML for the extended capabilities if the 
     * proxy service is available.
     */
Test to verify that getCapabilities returns unmarshalled capabilities XML for the extended capabilities if the
proxy service is available.
Test to verify that getCapabilities returns unmarshalled capabilities XML for the extended capabilities if the proxy service is available .
@SuppressWarnings("unchecked")
    @Test
    public void testGetProxyCapabilities() throws UnmarshalException, MalformedURLException
    {  
        ServiceReference<TerraHarvestControllerProxy> serviceRef = mock(ServiceReference.class);
        Bundle proxyBundle = mock(Bundle.class);
        TerraHarvestControllerProxy proxy = mock(TerraHarvestControllerProxy.class);
        URL proxyCapUrl = new URL("file:\\proxy-cap.xml");
        ControllerCapabilities proxyCaps = new ControllerCapabilities().withManufacturer("custom");
        when(m_Context.getServiceReference(TerraHarvestControllerProxy.class)).thenReturn(serviceRef);
        when(serviceRef.getBundle()).thenReturn(proxyBundle);
        when(m_UnmarshalService.getXmlResource(proxyBundle, FactoryDescriptor.CAPABILITIES_XML_FOLDER_NAME, 
                proxy.getClass().getName()))
            .thenReturn(proxyCapUrl);
        when(m_UnmarshalService.getXmlObject(Mockito.any(), eq(proxyCapUrl))).thenReturn(proxyCaps);
        m_SUT.setProxy(proxy);
        m_SUT.activate(m_Context);
        verify(m_UnmarshalService).getXmlObject(ControllerCapabilities.class, proxyCapUrl);
        ControllerCapabilities caps = m_SUT.getCapabilities();
        assertThat(caps, is(proxyCaps));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testGetProxyCapabilities ( ) throws UnmarshalException , MalformedURLException { ServiceReference < TerraHarvestControllerProxy > serviceRef = mock ( ServiceReference . class ) ; Bundle proxyBundle = mock ( Bundle . class ) ; TerraHarvestControllerProxy proxy = mock ( TerraHarvestControllerProxy . class ) ; URL proxyCapUrl = new URL ( "file:\\proxy-cap.xml" ) ; ControllerCapabilities proxyCaps = new ControllerCapabilities ( ) . withManufacturer ( "custom" ) ; when ( m_Context . getServiceReference ( TerraHarvestControllerProxy . class ) ) . thenReturn ( serviceRef ) ; when ( serviceRef . getBundle ( ) ) . thenReturn ( proxyBundle ) ; when ( m_UnmarshalService . getXmlResource ( proxyBundle , FactoryDescriptor . CAPABILITIES_XML_FOLDER_NAME , proxy . getClass ( ) . getName ( ) ) ) . thenReturn ( proxyCapUrl ) ; when ( m_UnmarshalService . getXmlObject ( Mockito . any ( ) , eq ( proxyCapUrl ) ) ) . thenReturn ( proxyCaps ) ; m_SUT . setProxy ( proxy ) ; m_SUT . activate ( m_Context ) ; verify ( m_UnmarshalService ) . getXmlObject ( ControllerCapabilities . class , proxyCapUrl ) ; ControllerCapabilities caps = m_SUT . getCapabilities ( ) ; assertThat ( caps , is ( proxyCaps ) ) ; }
Test to verify that getCapabilities returns unmarshalled capabilities XML for the extended capabilities if the
 proxy service is available.
Test to verify that getCapabilities returns unmarshalled capabilities XML for the extended capabilities if the proxy service is available .
// verify proxy bundle cap URL is used instead