mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestLinkLayerNamespace.java
@Test
    public void testDeactivate() throws IOException, InterruptedException
    {
        // activate the layer
        RemoteLinkLayerUtils.activateLink(linkUuid, socket);
        
        //---Deactivate the link layer---
        RemoteLinkLayerUtils.deactivateLink(linkUuid, socket);
        
        MessageListener listener = new MessageListener(socket);

        //---Verify the link layer was deactivated---
        // construct new link layer message type
        IsActivatedRequestData isActivatedRequest = IsActivatedRequestData.newBuilder().
                setUuid(linkUuid).
                build();
        
        LinkLayerNamespace.Builder linkLayerMessage = LinkLayerNamespace.newBuilder().
                setType(LinkLayerMessageType.IsActivatedRequest).
                setData(isActivatedRequest.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.IsActivatedResponse, listenerTimeout);
        
        IsActivatedResponseData dataResponse = IsActivatedResponseData.parseFrom(response.getData());
        
        assertThat(dataResponse.getIsActivated(), is(false));
    }
/**
     * Assuming a link layer was created in setup.
     * Deactivate the link layer and verify we receive that it is deactivated.
     */
Assuming a link layer was created in setup.
Deactivate the link layer and verify we receive that it is deactivated.
Assuming a link layer was created in setup . Deactivate the link layer and verify we receive that it is deactivated .
@Test
    public void testDeactivate() throws IOException, InterruptedException
    {
        RemoteLinkLayerUtils.activateLink(linkUuid, socket);
        RemoteLinkLayerUtils.deactivateLink(linkUuid, socket);
        MessageListener listener = new MessageListener(socket);
        IsActivatedRequestData isActivatedRequest = IsActivatedRequestData.newBuilder().
                setUuid(linkUuid).
                build();
        LinkLayerNamespace.Builder linkLayerMessage = LinkLayerNamespace.newBuilder().
                setType(LinkLayerMessageType.IsActivatedRequest).
                setData(isActivatedRequest.toByteString());
        TerraHarvestMessage message = TerraHarvestMessageHelper.createTerraHarvestMsg(Namespace.LinkLayer, 
                linkLayerMessage);
        message.writeDelimitedTo(socket.getOutputStream());
        LinkLayerNamespace response = (LinkLayerNamespace)listener.waitForMessage(Namespace.LinkLayer,
                LinkLayerMessageType.IsActivatedResponse, listenerTimeout);
        IsActivatedResponseData dataResponse = IsActivatedResponseData.parseFrom(response.getData());
        assertThat(dataResponse.getIsActivated(), is(false));
    }
@ Test public void testDeactivate ( ) throws IOException , InterruptedException { RemoteLinkLayerUtils . activateLink ( linkUuid , socket ) ; RemoteLinkLayerUtils . deactivateLink ( linkUuid , socket ) ; MessageListener listener = new MessageListener ( socket ) ; IsActivatedRequestData isActivatedRequest = IsActivatedRequestData . newBuilder ( ) . setUuid ( linkUuid ) . build ( ) ; LinkLayerNamespace . Builder linkLayerMessage = LinkLayerNamespace . newBuilder ( ) . setType ( LinkLayerMessageType . IsActivatedRequest ) . setData ( isActivatedRequest . toByteString ( ) ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createTerraHarvestMsg ( Namespace . LinkLayer , linkLayerMessage ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; LinkLayerNamespace response = ( LinkLayerNamespace ) listener . waitForMessage ( Namespace . LinkLayer , LinkLayerMessageType . IsActivatedResponse , listenerTimeout ) ; IsActivatedResponseData dataResponse = IsActivatedResponseData . parseFrom ( response . getData ( ) ) ; assertThat ( dataResponse . getIsActivated ( ) , is ( false ) ) ; }
Assuming a link layer was created in setup.
Assuming a link layer was created in setup .
// activate the layer //---Deactivate the link layer--- //---Verify the link layer was deactivated--- // construct new link layer message type // listen for messages for a specific time interval