mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestMissionProgramming.java
@Test
    public void testTriggeredDataCapture_Any() throws Exception
    {
        //create assets
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        Asset triggerAsset = assetDirectoryService.createAsset(ExampleAsset.class.getName(), "triggerAsset");
        Asset captureAsset = assetDirectoryService.createAsset(ExampleAsset.class.getName(), "captureAsset");
         
        //schedule and params to use for execution of the template
        MissionProgramSchedule schedule = new MissionProgramSchedule()
            .withIndefiniteInterval(true)
            .withImmediately(true)
            .withActive(true);
        final MapEntry entrySubEvent = new MapEntry("subscribeEvent", "New");
        //assets created earlier
        final MapEntry entryTrigger = new MapEntry("triggerAsset", "triggerAsset");
        final MapEntry entryCapture = new MapEntry("captureAsset", "captureAsset"); 
        final MapEntry entryModType = new MapEntry("modalityType", "Any");
        final MapEntry entrySenId = new MapEntry("triggerSensorId", "n/a");
        
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context, Program.TOPIC_PROGRAM_EXECUTED, 
                        String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, "triggered-data-captured-any"));
        
        MissionProgramParameters params = new MissionProgramParameters()
            .withTemplateName("triggered-data-captured")
            .withSchedule(schedule)
            .withParameters(entrySubEvent, entryTrigger, entryCapture, entryModType, entrySenId)
            .withProgramName("triggered-data-captured-any");
        
        //load the parameters
        Program program = m_MissionProgramManager.loadParameters(params);
        
        syncer.waitForEvent(10);
                
        // the mission should have executed, registers an event handler and captures data for each observation 
        assertThat(program.getProgramStatus(), is(ProgramStatus.EXECUTED));
        
        // set up to wait for an observation persisted from the capture asset
        syncer = new EventHandlerSyncer(m_Context, ObservationStore.TOPIC_OBSERVATION_PERSISTED, 
                String.format("(%s=%s)", FactoryDescriptor.EVENT_PROP_OBJ_UUID, captureAsset.getUuid().toString()));
        
        // have trigger asset persist observation to trigger other asset to capture data
        triggerAsset.captureData();
        
        syncer.waitForEvent(5);
    }
/**
     * Test running of the triggered-data-capture template.  When the trigger asset produces a detection, the capture 
     * asset should capture data.
     */
Test running of the triggered-data-capture template.  When the trigger asset produces a detection, the capture
asset should capture data.
Test running of the triggered - data - capture template . When the trigger asset produces a detection the capture asset should capture data .
@Test
    public void testTriggeredDataCapture_Any() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        Asset triggerAsset = assetDirectoryService.createAsset(ExampleAsset.class.getName(), "triggerAsset");
        Asset captureAsset = assetDirectoryService.createAsset(ExampleAsset.class.getName(), "captureAsset");
        MissionProgramSchedule schedule = new MissionProgramSchedule()
            .withIndefiniteInterval(true)
            .withImmediately(true)
            .withActive(true);
        final MapEntry entrySubEvent = new MapEntry("subscribeEvent", "New");
        final MapEntry entryTrigger = new MapEntry("triggerAsset", "triggerAsset");
        final MapEntry entryCapture = new MapEntry("captureAsset", "captureAsset"); 
        final MapEntry entryModType = new MapEntry("modalityType", "Any");
        final MapEntry entrySenId = new MapEntry("triggerSensorId", "n/a");
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context, Program.TOPIC_PROGRAM_EXECUTED, 
                        String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, "triggered-data-captured-any"));
        MissionProgramParameters params = new MissionProgramParameters()
            .withTemplateName("triggered-data-captured")
            .withSchedule(schedule)
            .withParameters(entrySubEvent, entryTrigger, entryCapture, entryModType, entrySenId)
            .withProgramName("triggered-data-captured-any");
        Program program = m_MissionProgramManager.loadParameters(params);
        syncer.waitForEvent(10);
        assertThat(program.getProgramStatus(), is(ProgramStatus.EXECUTED));
        syncer = new EventHandlerSyncer(m_Context, ObservationStore.TOPIC_OBSERVATION_PERSISTED, 
                String.format("(%s=%s)", FactoryDescriptor.EVENT_PROP_OBJ_UUID, captureAsset.getUuid().toString()));
        triggerAsset.captureData();
        syncer.waitForEvent(5);
    }
@ Test public void testTriggeredDataCapture_Any ( ) throws Exception { AssetDirectoryService assetDirectoryService = ServiceUtils . getService ( m_Context , AssetDirectoryService . class ) ; Asset triggerAsset = assetDirectoryService . createAsset ( ExampleAsset . class . getName ( ) , "triggerAsset" ) ; Asset captureAsset = assetDirectoryService . createAsset ( ExampleAsset . class . getName ( ) , "captureAsset" ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( true ) . withImmediately ( true ) . withActive ( true ) ; final MapEntry entrySubEvent = new MapEntry ( "subscribeEvent" , "New" ) ; final MapEntry entryTrigger = new MapEntry ( "triggerAsset" , "triggerAsset" ) ; final MapEntry entryCapture = new MapEntry ( "captureAsset" , "captureAsset" ) ; final MapEntry entryModType = new MapEntry ( "modalityType" , "Any" ) ; final MapEntry entrySenId = new MapEntry ( "triggerSensorId" , "n/a" ) ; EventHandlerSyncer syncer = new EventHandlerSyncer ( m_Context , Program . TOPIC_PROGRAM_EXECUTED , String . format ( "(%s=%s)" , Program . EVENT_PROP_PROGRAM_NAME , "triggered-data-captured-any" ) ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withTemplateName ( "triggered-data-captured" ) . withSchedule ( schedule ) . withParameters ( entrySubEvent , entryTrigger , entryCapture , entryModType , entrySenId ) . withProgramName ( "triggered-data-captured-any" ) ; Program program = m_MissionProgramManager . loadParameters ( params ) ; syncer . waitForEvent ( 10 ) ; assertThat ( program . getProgramStatus ( ) , is ( ProgramStatus . EXECUTED ) ) ; syncer = new EventHandlerSyncer ( m_Context , ObservationStore . TOPIC_OBSERVATION_PERSISTED , String . format ( "(%s=%s)" , FactoryDescriptor . EVENT_PROP_OBJ_UUID , captureAsset . getUuid ( ) . toString ( ) ) ) ; triggerAsset . captureData ( ) ; syncer . waitForEvent ( 5 ) ; }
Test running of the triggered-data-capture template.
Test running of the triggered - data - capture template .
//create assets //schedule and params to use for execution of the template //assets created earlier //load the parameters // the mission should have executed, registers an event handler and captures data for each observation  // set up to wait for an observation persisted from the capture asset // have trigger asset persist observation to trigger other asset to capture data