mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/ShutdownController.java
@Test
    public void testShutdown() throws UnknownHostException, IOException
    {
        try (Socket socket = SocketHostHelper.connectToController())
        {
            // send out message
            TerraHarvestMessage request = TerraHarvestMessageHelper.createTerraHarvestMsg(Namespace.Base,
                    BaseNamespace.newBuilder().setType(BaseMessageType.ShutdownSystem));
            request.writeDelimitedTo(socket.getOutputStream());
            
            // read in response
            TerraHarvestMessage response = TerraHarvestMessage.parseDelimitedFrom(socket.getInputStream());
            TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
            assertThat(response, is(notNullValue()));
            assertThat(payLoadTest.getNamespace(), is(Namespace.Base));
    
            BaseNamespace namespaceResponse = BaseNamespace.parseFrom(payLoadTest.getNamespaceMessage());
            assertThat(namespaceResponse.getType(), is(BaseMessageType.ReceivedShutdownRequest));        
        }
    }
/**
     * Verify the shutdown message will shutdown the controller.
     */
Verify the shutdown message will shutdown the controller.
Verify the shutdown message will shutdown the controller .
@Test
    public void testShutdown() throws UnknownHostException, IOException
    {
        try (Socket socket = SocketHostHelper.connectToController())
        {
            TerraHarvestMessage request = TerraHarvestMessageHelper.createTerraHarvestMsg(Namespace.Base,
                    BaseNamespace.newBuilder().setType(BaseMessageType.ShutdownSystem));
            request.writeDelimitedTo(socket.getOutputStream());
            TerraHarvestMessage response = TerraHarvestMessage.parseDelimitedFrom(socket.getInputStream());
            TerraHarvestPayload payLoadTest = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
            assertThat(response, is(notNullValue()));
            assertThat(payLoadTest.getNamespace(), is(Namespace.Base));
            BaseNamespace namespaceResponse = BaseNamespace.parseFrom(payLoadTest.getNamespaceMessage());
            assertThat(namespaceResponse.getType(), is(BaseMessageType.ReceivedShutdownRequest));        
        }
    }
@ Test public void testShutdown ( ) throws UnknownHostException , IOException { try ( Socket socket = SocketHostHelper . connectToController ( ) ) { TerraHarvestMessage request = TerraHarvestMessageHelper . createTerraHarvestMsg ( Namespace . Base , BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . ShutdownSystem ) ) ; request . writeDelimitedTo ( socket . getOutputStream ( ) ) ; TerraHarvestMessage response = TerraHarvestMessage . parseDelimitedFrom ( socket . getInputStream ( ) ) ; TerraHarvestPayload payLoadTest = TerraHarvestPayload . parseFrom ( response . getTerraHarvestPayload ( ) ) ; assertThat ( response , is ( notNullValue ( ) ) ) ; assertThat ( payLoadTest . getNamespace ( ) , is ( Namespace . Base ) ) ; BaseNamespace namespaceResponse = BaseNamespace . parseFrom ( payLoadTest . getNamespaceMessage ( ) ) ; assertThat ( namespaceResponse . getType ( ) , is ( BaseMessageType . ReceivedShutdownRequest ) ) ; } }
Verify the shutdown message will shutdown the controller.
Verify the shutdown message will shutdown the controller .
// send out message // read in response