mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestBaseNamespace.java
@Test
    public final void testGetControllerCapabilities() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        // send out message
        BaseNamespace.Builder baseNamespaceMsg = 
                BaseNamespace.newBuilder().setType(BaseMessageType.GetControllerCapabilitiesRequest);
        TerraHarvestMessage thRequest = TerraHarvestMessageHelper.
                createTerraHarvestMsg(Namespace.Base, baseNamespaceMsg);
        thRequest.writeDelimitedTo(socket.getOutputStream());

        // read in response
        Message response = listener.waitForMessage(Namespace.Base, 
                BaseMessageType.GetControllerCapabilitiesResponse, 300);
        BaseNamespace namespaceResponse = (BaseNamespace)response;
        assertThat(namespaceResponse, is(notNullValue()));

        assertThat(namespaceResponse.getType(), is(BaseMessageType.GetControllerCapabilitiesResponse));
        GetControllerCapabilitiesResponseData dataResponse = 
                GetControllerCapabilitiesResponseData.parseFrom(namespaceResponse.getData());
        //test various capabilities
        ControllerCapabilities caps = dataResponse.getControllerCapabilitiesNative();
        assertThat(caps, is(notNullValue()));
        assertThat(caps.getBase().getDescription(), is("Example Controller"));
        assertThat(caps.getLowPowerModeSupported(), is(false));
        assertThat(caps.getVoltageReported(), is(false));
        assertThat(caps.getLowPowerModeSupported(), is(false));
        assertThat(caps.getBatteryAmpHourReported(), is(false));
        assertThat(caps.getIdOverridden(), is(false));
        assertThat(caps.getNameOverridden(), is(false));
        assertThat(caps.getVersionOverridden(), is(false));
        assertThat(caps.getBuildInfoOverridden(), is(false));
        assertThat(caps.getBase().getPrimaryImage().getEncoding(), is("image/png"));
        
        BufferedImage img= ImageIO.read(
                new ByteArrayInputStream(caps.getBase().getPrimaryImage().getValue().toByteArray()));
        int imHeight = img.getHeight();
        int imWidth = img.getWidth();
        assertThat(imHeight, is(128));
        assertThat(imWidth, is(128));
    }
/**
     *  
     * Verify sending a get controller capabilities request message returns with
     * generic controller capabilities response.
     *  
     */
Verify sending a get controller capabilities request message returns with
generic controller capabilities response.
Verify sending a get controller capabilities request message returns with generic controller capabilities response .
@Test
    public final void testGetControllerCapabilities() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        BaseNamespace.Builder baseNamespaceMsg = 
                BaseNamespace.newBuilder().setType(BaseMessageType.GetControllerCapabilitiesRequest);
        TerraHarvestMessage thRequest = TerraHarvestMessageHelper.
                createTerraHarvestMsg(Namespace.Base, baseNamespaceMsg);
        thRequest.writeDelimitedTo(socket.getOutputStream());
        Message response = listener.waitForMessage(Namespace.Base, 
                BaseMessageType.GetControllerCapabilitiesResponse, 300);
        BaseNamespace namespaceResponse = (BaseNamespace)response;
        assertThat(namespaceResponse, is(notNullValue()));
        assertThat(namespaceResponse.getType(), is(BaseMessageType.GetControllerCapabilitiesResponse));
        GetControllerCapabilitiesResponseData dataResponse = 
                GetControllerCapabilitiesResponseData.parseFrom(namespaceResponse.getData());
        ControllerCapabilities caps = dataResponse.getControllerCapabilitiesNative();
        assertThat(caps, is(notNullValue()));
        assertThat(caps.getBase().getDescription(), is("Example Controller"));
        assertThat(caps.getLowPowerModeSupported(), is(false));
        assertThat(caps.getVoltageReported(), is(false));
        assertThat(caps.getLowPowerModeSupported(), is(false));
        assertThat(caps.getBatteryAmpHourReported(), is(false));
        assertThat(caps.getIdOverridden(), is(false));
        assertThat(caps.getNameOverridden(), is(false));
        assertThat(caps.getVersionOverridden(), is(false));
        assertThat(caps.getBuildInfoOverridden(), is(false));
        assertThat(caps.getBase().getPrimaryImage().getEncoding(), is("image/png"));
        BufferedImage img= ImageIO.read(
                new ByteArrayInputStream(caps.getBase().getPrimaryImage().getValue().toByteArray()));
        int imHeight = img.getHeight();
        int imWidth = img.getWidth();
        assertThat(imHeight, is(128));
        assertThat(imWidth, is(128));
    }
@ Test public final void testGetControllerCapabilities ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; BaseNamespace . Builder baseNamespaceMsg = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . GetControllerCapabilitiesRequest ) ; TerraHarvestMessage thRequest = TerraHarvestMessageHelper . createTerraHarvestMsg ( Namespace . Base , baseNamespaceMsg ) ; thRequest . writeDelimitedTo ( socket . getOutputStream ( ) ) ; Message response = listener . waitForMessage ( Namespace . Base , BaseMessageType . GetControllerCapabilitiesResponse , 300 ) ; BaseNamespace namespaceResponse = ( BaseNamespace ) response ; assertThat ( namespaceResponse , is ( notNullValue ( ) ) ) ; assertThat ( namespaceResponse . getType ( ) , is ( BaseMessageType . GetControllerCapabilitiesResponse ) ) ; GetControllerCapabilitiesResponseData dataResponse = GetControllerCapabilitiesResponseData . parseFrom ( namespaceResponse . getData ( ) ) ; ControllerCapabilities caps = dataResponse . getControllerCapabilitiesNative ( ) ; assertThat ( caps , is ( notNullValue ( ) ) ) ; assertThat ( caps . getBase ( ) . getDescription ( ) , is ( "Example Controller" ) ) ; assertThat ( caps . getLowPowerModeSupported ( ) , is ( false ) ) ; assertThat ( caps . getVoltageReported ( ) , is ( false ) ) ; assertThat ( caps . getLowPowerModeSupported ( ) , is ( false ) ) ; assertThat ( caps . getBatteryAmpHourReported ( ) , is ( false ) ) ; assertThat ( caps . getIdOverridden ( ) , is ( false ) ) ; assertThat ( caps . getNameOverridden ( ) , is ( false ) ) ; assertThat ( caps . getVersionOverridden ( ) , is ( false ) ) ; assertThat ( caps . getBuildInfoOverridden ( ) , is ( false ) ) ; assertThat ( caps . getBase ( ) . getPrimaryImage ( ) . getEncoding ( ) , is ( "image/png" ) ) ; BufferedImage img = ImageIO . read ( new ByteArrayInputStream ( caps . getBase ( ) . getPrimaryImage ( ) . getValue ( ) . toByteArray ( ) ) ) ; int imHeight = img . getHeight ( ) ; int imWidth = img . getWidth ( ) ; assertThat ( imHeight , is ( 128 ) ) ; assertThat ( imWidth , is ( 128 ) ) ; }
Verify sending a get controller capabilities request message returns with
 generic controller capabilities response.
Verify sending a get controller capabilities request message returns with generic controller capabilities response .
// send out message // read in response //test various capabilities