mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestLinkLayerNamespace.java
@Test
    public void testPerformBITEvent() 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);
        RemoteEventRegistration.regRemoteEventMessages(socket, LinkLayer.TOPIC_PREFIX + "*");
        message.writeDelimitedTo(socket.getOutputStream());
        
        
        // listen for messages for a specific time interval
        EventAdminNamespace response = (EventAdminNamespace)listener.
                waitForRemoteEvent(LinkLayer.TOPIC_STATUS_CHANGED, listenerTimeout);
        
        SendEventData event = SendEventData.parseFrom(response.getData());

        //check event properties
        Map<String, Object> propertyMap = new HashMap<String, Object>();
        for (ComplexTypesMapEntry entry : event.getPropertyList())
        {
            if (entry.getKey().equals(LinkLayer.EVENT_PROP_LINK_STATUS))
            {
                propertyMap.put(entry.getKey(), entry.getLinkLayerStatus());
            }
        }
        assertThat((CustomCommsTypes.LinkStatus)propertyMap.get(LinkLayer.EVENT_PROP_LINK_STATUS), 
                is(CustomCommsTypes.LinkStatus.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.
Assuming link layer was created in setup . Make sure its status returned from performing BIT is ok .
@Test
    public void testPerformBITEvent() 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);
        RemoteEventRegistration.regRemoteEventMessages(socket, LinkLayer.TOPIC_PREFIX + "*");
        message.writeDelimitedTo(socket.getOutputStream());
        EventAdminNamespace response = (EventAdminNamespace)listener.
                waitForRemoteEvent(LinkLayer.TOPIC_STATUS_CHANGED, listenerTimeout);
        SendEventData event = SendEventData.parseFrom(response.getData());
        Map<String, Object> propertyMap = new HashMap<String, Object>();
        for (ComplexTypesMapEntry entry : event.getPropertyList())
        {
            if (entry.getKey().equals(LinkLayer.EVENT_PROP_LINK_STATUS))
            {
                propertyMap.put(entry.getKey(), entry.getLinkLayerStatus());
            }
        }
        assertThat((CustomCommsTypes.LinkStatus)propertyMap.get(LinkLayer.EVENT_PROP_LINK_STATUS), 
                is(CustomCommsTypes.LinkStatus.OK));
    }
@ Test public void testPerformBITEvent ( ) 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 ) ; RemoteEventRegistration . regRemoteEventMessages ( socket , LinkLayer . TOPIC_PREFIX + "*" ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; EventAdminNamespace response = ( EventAdminNamespace ) listener . waitForRemoteEvent ( LinkLayer . TOPIC_STATUS_CHANGED , listenerTimeout ) ; SendEventData event = SendEventData . parseFrom ( response . getData ( ) ) ; Map < String , Object > propertyMap = new HashMap < String , Object > ( ) ; for ( ComplexTypesMapEntry entry : event . getPropertyList ( ) ) { if ( entry . getKey ( ) . equals ( LinkLayer . EVENT_PROP_LINK_STATUS ) ) { propertyMap . put ( entry . getKey ( ) , entry . getLinkLayerStatus ( ) ) ; } } assertThat ( ( CustomCommsTypes . LinkStatus ) propertyMap . get ( LinkLayer . EVENT_PROP_LINK_STATUS ) , is ( CustomCommsTypes . LinkStatus . OK ) ) ; }
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 //check event properties