mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestMissionProgramming.java
public void testCoreService() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        Asset asset = assetDirectoryService.createAsset(ExampleAsset.class.getName()); 
        asset.setName("coreServicesAsset");
   
        //variable data
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
            withImmediately(true).withActive(true);
        Map<String, Object> parameters = new HashMap<>();
        parameters.put("msg", "test message from script");
        parameters.put("thName", "test name");
        parameters.put("assetName", "coreServicesAsset");
        
        List<MapEntry> mapParameters = MapTranslator.translateMap(parameters);
        MissionProgramParameters params = new MissionProgramParameters()
            .withTemplateName("core-services-template")
            .withSchedule(schedule)
            .withParameters(mapParameters)
            .withProgramName("core-services-test");

        EventHandlerSyncer executionSyncer = new EventHandlerSyncer(m_Context, 
                new String[] { Program.TOPIC_PROGRAM_EXECUTED, Program.TOPIC_PROGRAM_EXECUTED_FAILURE }, 
                String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, "core-services-test"));
        
        //the test actually happens from within the script
        Program program = m_MissionProgramManager.loadParameters(params);
        
        executionSyncer.waitForEvent(10);
        
        assertThat(program.getProgramStatus(), is(ProgramStatus.EXECUTED));
    }
/**
     * Test that multiple core services (see mission program bindings) can work from within a script. 
     */
Test that multiple core services  can work from within a script.
Test that multiple core services can work from within a script .
public void testCoreService() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        Asset asset = assetDirectoryService.createAsset(ExampleAsset.class.getName()); 
        asset.setName("coreServicesAsset");
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
            withImmediately(true).withActive(true);
        Map<String, Object> parameters = new HashMap<>();
        parameters.put("msg", "test message from script");
        parameters.put("thName", "test name");
        parameters.put("assetName", "coreServicesAsset");
        List<MapEntry> mapParameters = MapTranslator.translateMap(parameters);
        MissionProgramParameters params = new MissionProgramParameters()
            .withTemplateName("core-services-template")
            .withSchedule(schedule)
            .withParameters(mapParameters)
            .withProgramName("core-services-test");
        EventHandlerSyncer executionSyncer = new EventHandlerSyncer(m_Context, 
                new String[] { Program.TOPIC_PROGRAM_EXECUTED, Program.TOPIC_PROGRAM_EXECUTED_FAILURE }, 
                String.format("(%s=%s)", Program.EVENT_PROP_PROGRAM_NAME, "core-services-test"));
        Program program = m_MissionProgramManager.loadParameters(params);
        executionSyncer.waitForEvent(10);
        assertThat(program.getProgramStatus(), is(ProgramStatus.EXECUTED));
    }
public void testCoreService ( ) throws Exception { AssetDirectoryService assetDirectoryService = ServiceUtils . getService ( m_Context , AssetDirectoryService . class ) ; Asset asset = assetDirectoryService . createAsset ( ExampleAsset . class . getName ( ) ) ; asset . setName ( "coreServicesAsset" ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) . withImmediately ( true ) . withActive ( true ) ; Map < String , Object > parameters = new HashMap < > ( ) ; parameters . put ( "msg" , "test message from script" ) ; parameters . put ( "thName" , "test name" ) ; parameters . put ( "assetName" , "coreServicesAsset" ) ; List < MapEntry > mapParameters = MapTranslator . translateMap ( parameters ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withTemplateName ( "core-services-template" ) . withSchedule ( schedule ) . withParameters ( mapParameters ) . withProgramName ( "core-services-test" ) ; EventHandlerSyncer executionSyncer = new EventHandlerSyncer ( m_Context , new String [ ] { Program . TOPIC_PROGRAM_EXECUTED , Program . TOPIC_PROGRAM_EXECUTED_FAILURE } , String . format ( "(%s=%s)" , Program . EVENT_PROP_PROGRAM_NAME , "core-services-test" ) ) ; Program program = m_MissionProgramManager . loadParameters ( params ) ; executionSyncer . waitForEvent ( 10 ) ; assertThat ( program . getProgramStatus ( ) , is ( ProgramStatus . EXECUTED ) ) ; }
Test that multiple core services (see mission program bindings) can work from within a script.
Test that multiple core services ( see mission program bindings ) can work from within a script .
//variable data //the test actually happens from within the script