mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestLinkLayerNamespace.java
@Test
    public void testPerformBIT() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        // construct new link layer message type
        PerformBITRequestData getStatusRequest = PerformBITRequestData.newBuilder().
                setLinkUuid(linkUuid).
                build();
        
        LinkLayerNamespace.Builder linkLayerMessage = LinkLayerNamespace.newBuilder().
                setType(LinkLayerMessageType.PerformBITRequest).
                setData(getStatusRequest.toByteString());
        
        TerraHarvestMessage message = TerraHarvestMessageHelper.createTerraHarvestMsg(Namespace.LinkLayer, 
                linkLayerMessage);
        
        message.writeDelimitedTo(socket.getOutputStream());
        
        // listen for messages for a specific time interval
        LinkLayerNamespace response = (LinkLayerNamespace)listener.waitForMessage(Namespace.LinkLayer,
                LinkLayerMessageType.PerformBITResponse, listenerTimeout);
       
        PerformBITResponseData dataResponse = PerformBITResponseData.parseFrom(response.getData());
        
        //example link layer will always return ok for the perform bit status
        assertThat(dataResponse.getPerformBitStatus(), is(CustomCommsTypes.LinkStatus.OK));
        assertThat(dataResponse.getLinkUuid(), is(linkUuid));   
    }
/**
     * Assuming link layer was created in setup. Make sure its status returned from performing BIT is ok.
     */
Assuming link layer was created in setup. Make sure its status returned from performing BIT is ok.
Assuming link layer was created in setup . Make sure its status returned from performing BIT is ok .
@Test
    public void testPerformBIT() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        PerformBITRequestData getStatusRequest = PerformBITRequestData.newBuilder().
                setLinkUuid(linkUuid).
                build();
        LinkLayerNamespace.Builder linkLayerMessage = LinkLayerNamespace.newBuilder().
                setType(LinkLayerMessageType.PerformBITRequest).
                setData(getStatusRequest.toByteString());
        TerraHarvestMessage message = TerraHarvestMessageHelper.createTerraHarvestMsg(Namespace.LinkLayer, 
                linkLayerMessage);
        message.writeDelimitedTo(socket.getOutputStream());
        LinkLayerNamespace response = (LinkLayerNamespace)listener.waitForMessage(Namespace.LinkLayer,
                LinkLayerMessageType.PerformBITResponse, listenerTimeout);
        PerformBITResponseData dataResponse = PerformBITResponseData.parseFrom(response.getData());
        assertThat(dataResponse.getPerformBitStatus(), is(CustomCommsTypes.LinkStatus.OK));
        assertThat(dataResponse.getLinkUuid(), is(linkUuid));   
    }
@ Test public void testPerformBIT ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; PerformBITRequestData getStatusRequest = PerformBITRequestData . newBuilder ( ) . setLinkUuid ( linkUuid ) . build ( ) ; LinkLayerNamespace . Builder linkLayerMessage = LinkLayerNamespace . newBuilder ( ) . setType ( LinkLayerMessageType . PerformBITRequest ) . setData ( getStatusRequest . toByteString ( ) ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createTerraHarvestMsg ( Namespace . LinkLayer , linkLayerMessage ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; LinkLayerNamespace response = ( LinkLayerNamespace ) listener . waitForMessage ( Namespace . LinkLayer , LinkLayerMessageType . PerformBITResponse , listenerTimeout ) ; PerformBITResponseData dataResponse = PerformBITResponseData . parseFrom ( response . getData ( ) ) ; assertThat ( dataResponse . getPerformBitStatus ( ) , is ( CustomCommsTypes . LinkStatus . OK ) ) ; assertThat ( dataResponse . getLinkUuid ( ) , is ( linkUuid ) ) ; }
Assuming link layer was created in setup.
Assuming link layer was created in setup .
// construct new link layer message type // listen for messages for a specific time interval //example link layer will always return ok for the perform bit status