mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/secondrun/TestPersistedRemoteEventRegistrations.java
@Test
    public void testPersistedRegistration() throws UnknownHostException, IOException, InterruptedException
    {
        //used to register for events
        MessageListener listener = new MessageListener(m_Socket);

        CreateAssetRequestData request = CreateAssetRequestData.newBuilder().
                setProductType(ExampleAsset.class.getName()).build();
        AssetDirectoryServiceNamespace.Builder assetDirMessage = AssetDirectoryServiceNamespace.newBuilder().
                setType(AssetDirectoryServiceMessageType.CreateAssetRequest).
                setData(request.toByteString());
        TerraHarvestMessage message = TerraHarvestMessageHelper.
                createAdditionalSystemTerraHarvestMsg(Namespace.AssetDirectoryService, assetDirMessage);
        message.writeDelimitedTo(m_Socket.getOutputStream());
        
        AssetDirectoryServiceNamespace response = (AssetDirectoryServiceNamespace)listener.waitForMessage(
                Namespace.AssetDirectoryService, AssetDirectoryServiceMessageType.CreateAssetResponse, 2000);
        //create the asset
        CreateAssetResponseData assetCreation = 
                CreateAssetResponseData.parseFrom(response.getData());
        
        //will hold the create assets UUID
        final SharedMessages.UUID assetUuid = assetCreation.getInfo().getUuid();
        
        // build request
        CaptureDataRequestData requestCapture = CaptureDataRequestData.newBuilder()
                .setUuid(assetUuid)
                .setObservationFormat(RemoteTypesGen.LexiconFormat.Enum.UUID_ONLY).build();
        AssetNamespace.Builder assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.CaptureDataRequest).
                setData(requestCapture.toByteString());
        message = TerraHarvestMessageHelper.
                createAdditionalSystemTerraHarvestMsg(Namespace.Asset, assetMessage);
        
        message.writeDelimitedTo(m_Socket.getOutputStream());
        
        listener.waitForRemoteEvent(Asset.TOPIC_DATA_CAPTURED, 1000);
    }
/**
     * Test that an event registration for data capture was persisted through shutdown.
     */
Test that an event registration for data capture was persisted through shutdown.
Test that an event registration for data capture was persisted through shutdown .
@Test
    public void testPersistedRegistration() throws UnknownHostException, IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(m_Socket);
        CreateAssetRequestData request = CreateAssetRequestData.newBuilder().
                setProductType(ExampleAsset.class.getName()).build();
        AssetDirectoryServiceNamespace.Builder assetDirMessage = AssetDirectoryServiceNamespace.newBuilder().
                setType(AssetDirectoryServiceMessageType.CreateAssetRequest).
                setData(request.toByteString());
        TerraHarvestMessage message = TerraHarvestMessageHelper.
                createAdditionalSystemTerraHarvestMsg(Namespace.AssetDirectoryService, assetDirMessage);
        message.writeDelimitedTo(m_Socket.getOutputStream());
        AssetDirectoryServiceNamespace response = (AssetDirectoryServiceNamespace)listener.waitForMessage(
                Namespace.AssetDirectoryService, AssetDirectoryServiceMessageType.CreateAssetResponse, 2000);
        CreateAssetResponseData assetCreation = 
                CreateAssetResponseData.parseFrom(response.getData());
        final SharedMessages.UUID assetUuid = assetCreation.getInfo().getUuid();
        CaptureDataRequestData requestCapture = CaptureDataRequestData.newBuilder()
                .setUuid(assetUuid)
                .setObservationFormat(RemoteTypesGen.LexiconFormat.Enum.UUID_ONLY).build();
        AssetNamespace.Builder assetMessage = AssetNamespace.newBuilder().
                setType(AssetMessageType.CaptureDataRequest).
                setData(requestCapture.toByteString());
        message = TerraHarvestMessageHelper.
                createAdditionalSystemTerraHarvestMsg(Namespace.Asset, assetMessage);
        message.writeDelimitedTo(m_Socket.getOutputStream());
        listener.waitForRemoteEvent(Asset.TOPIC_DATA_CAPTURED, 1000);
    }
@ Test public void testPersistedRegistration ( ) throws UnknownHostException , IOException , InterruptedException { MessageListener listener = new MessageListener ( m_Socket ) ; CreateAssetRequestData request = CreateAssetRequestData . newBuilder ( ) . setProductType ( ExampleAsset . class . getName ( ) ) . build ( ) ; AssetDirectoryServiceNamespace . Builder assetDirMessage = AssetDirectoryServiceNamespace . newBuilder ( ) . setType ( AssetDirectoryServiceMessageType . CreateAssetRequest ) . setData ( request . toByteString ( ) ) ; TerraHarvestMessage message = TerraHarvestMessageHelper . createAdditionalSystemTerraHarvestMsg ( Namespace . AssetDirectoryService , assetDirMessage ) ; message . writeDelimitedTo ( m_Socket . getOutputStream ( ) ) ; AssetDirectoryServiceNamespace response = ( AssetDirectoryServiceNamespace ) listener . waitForMessage ( Namespace . AssetDirectoryService , AssetDirectoryServiceMessageType . CreateAssetResponse , 2000 ) ; CreateAssetResponseData assetCreation = CreateAssetResponseData . parseFrom ( response . getData ( ) ) ; final SharedMessages . UUID assetUuid = assetCreation . getInfo ( ) . getUuid ( ) ; CaptureDataRequestData requestCapture = CaptureDataRequestData . newBuilder ( ) . setUuid ( assetUuid ) . setObservationFormat ( RemoteTypesGen . LexiconFormat . Enum . UUID_ONLY ) . build ( ) ; AssetNamespace . Builder assetMessage = AssetNamespace . newBuilder ( ) . setType ( AssetMessageType . CaptureDataRequest ) . setData ( requestCapture . toByteString ( ) ) ; message = TerraHarvestMessageHelper . createAdditionalSystemTerraHarvestMsg ( Namespace . Asset , assetMessage ) ; message . writeDelimitedTo ( m_Socket . getOutputStream ( ) ) ; listener . waitForRemoteEvent ( Asset . TOPIC_DATA_CAPTURED , 1000 ) ; }
Test that an event registration for data capture was persisted through shutdown.
Test that an event registration for data capture was persisted through shutdown .
//used to register for events //create the asset //will hold the create assets UUID // build request