mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestProgramImpl.java
@Test
    public void testExecSetting()
    {
        // Set up program with example parameters
        Map<String, Object> arguments = new HashMap<String, Object>();
        arguments.put("test", 8);
        UUID progUuid = UUID.randomUUID();
        ProgramImpl program = new ProgramImpl(m_Manager, m_EventAdmin, new MissionProgramTemplate().
            withSource("something").withName("test"), new MissionProgramParameters().withParameters(MapTranslator.
                translateMap(arguments)).withSchedule(new MissionProgramSchedule().withIndefiniteInterval(false).
                    withImmediately(true)), progUuid); 
        assertThat(program.getScheduleFlag(ScheduleEnum.START_IMMEDIATELY), is(true));
        assertThat(program.getExecParams(), hasEntry("test", (Object)8));
        
        try
        {
            program.getExecParams().put("blah", 56);
            fail("expecting exception");
        }
        catch (UnsupportedOperationException e)
        {
            // Check that new parameters cannot be added
        }
        
        //try setting the immediate flag to false
        program.getMissionSchedule().setImmediately(false);
        //the value should still be true, because this field cannot be set through the program interface
        assertThat(program.getScheduleFlag(ScheduleEnum.START_IMMEDIATELY), is(true));
    }
/**
     * Tests that execution parameter setting does not allow illegal parameter changes.
     */
Tests that execution parameter setting does not allow illegal parameter changes.
Tests that execution parameter setting does not allow illegal parameter changes .
@Test
    public void testExecSetting()
    {
        Map<String, Object> arguments = new HashMap<String, Object>();
        arguments.put("test", 8);
        UUID progUuid = UUID.randomUUID();
        ProgramImpl program = new ProgramImpl(m_Manager, m_EventAdmin, new MissionProgramTemplate().
            withSource("something").withName("test"), new MissionProgramParameters().withParameters(MapTranslator.
                translateMap(arguments)).withSchedule(new MissionProgramSchedule().withIndefiniteInterval(false).
                    withImmediately(true)), progUuid); 
        assertThat(program.getScheduleFlag(ScheduleEnum.START_IMMEDIATELY), is(true));
        assertThat(program.getExecParams(), hasEntry("test", (Object)8));
        try
        {
            program.getExecParams().put("blah", 56);
            fail("expecting exception");
        }
        catch (UnsupportedOperationException e)
        {
        }
        program.getMissionSchedule().setImmediately(false);
        assertThat(program.getScheduleFlag(ScheduleEnum.START_IMMEDIATELY), is(true));
    }
@ Test public void testExecSetting ( ) { Map < String , Object > arguments = new HashMap < String , Object > ( ) ; arguments . put ( "test" , 8 ) ; UUID progUuid = UUID . randomUUID ( ) ; ProgramImpl program = new ProgramImpl ( m_Manager , m_EventAdmin , new MissionProgramTemplate ( ) . withSource ( "something" ) . withName ( "test" ) , new MissionProgramParameters ( ) . withParameters ( MapTranslator . translateMap ( arguments ) ) . withSchedule ( new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) . withImmediately ( true ) ) , progUuid ) ; assertThat ( program . getScheduleFlag ( ScheduleEnum . START_IMMEDIATELY ) , is ( true ) ) ; assertThat ( program . getExecParams ( ) , hasEntry ( "test" , ( Object ) 8 ) ) ; try { program . getExecParams ( ) . put ( "blah" , 56 ) ; fail ( "expecting exception" ) ; } catch ( UnsupportedOperationException e ) { } program . getMissionSchedule ( ) . setImmediately ( false ) ; assertThat ( program . getScheduleFlag ( ScheduleEnum . START_IMMEDIATELY ) , is ( true ) ) ; }
Tests that execution parameter setting does not allow illegal parameter changes.
Tests that execution parameter setting does not allow illegal parameter changes .
// Set up program with example parameters // Check that new parameters cannot be added //try setting the immediate flag to false //the value should still be true, because this field cannot be set through the program interface