mil.dod.th.ose.integration/src/mil/dod/th/ose/controller/integration/core/TestMissionProgramManager.java
@Test
    public void testInactiveProgram() throws IllegalArgumentException, PersistenceFailedException, 
        MissionProgramException
    {
        //template and parameters
        MissionProgramTemplate progTemplate = new MissionProgramTemplate().
            withSource("obj = {};").withName("TestInactive");
        m_TemplateProgramManager.loadMissionTemplate(progTemplate);
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
                withImmediately(true).withActive(false);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("TestInactive").
            withSchedule(schedule).withProgramName("TestInactive");
        Program program = m_MissionProgramManager.loadParameters(params);
        //a mission that has not attempted to execute should be unsatisfied
        assertThat(program.getProgramStatus(), is(ProgramStatus.UNSATISFIED));
        //Mission is not active this should execute
        try
        {
            program.execute();
            fail("Expected Exception");
        }
        catch (IllegalStateException exception)
        {
            //expected exception
        }
        assertThat(program.getProgramStatus(), is(not(ProgramStatus.EXECUTED)));
    }
/**
     * Test that mission programs that are inactive do not execute. 
     * Rechecked in {@link TestPersistedMissionPrograms#testInactiveProgram()}.
     */
Test that mission programs that are inactive do not execute.
Test that mission programs that are inactive do not execute .
@Test
    public void testInactiveProgram() throws IllegalArgumentException, PersistenceFailedException, 
        MissionProgramException
    {
        MissionProgramTemplate progTemplate = new MissionProgramTemplate().
            withSource("obj = {};").withName("TestInactive");
        m_TemplateProgramManager.loadMissionTemplate(progTemplate);
        MissionProgramSchedule schedule = new MissionProgramSchedule().withIndefiniteInterval(false).
                withImmediately(true).withActive(false);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("TestInactive").
            withSchedule(schedule).withProgramName("TestInactive");
        Program program = m_MissionProgramManager.loadParameters(params);
        assertThat(program.getProgramStatus(), is(ProgramStatus.UNSATISFIED));
        try
        {
            program.execute();
            fail("Expected Exception");
        }
        catch (IllegalStateException exception)
        {
        }
        assertThat(program.getProgramStatus(), is(not(ProgramStatus.EXECUTED)));
    }
@ Test public void testInactiveProgram ( ) throws IllegalArgumentException , PersistenceFailedException , MissionProgramException { MissionProgramTemplate progTemplate = new MissionProgramTemplate ( ) . withSource ( "obj = {};" ) . withName ( "TestInactive" ) ; m_TemplateProgramManager . loadMissionTemplate ( progTemplate ) ; MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withIndefiniteInterval ( false ) . withImmediately ( true ) . withActive ( false ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withTemplateName ( "TestInactive" ) . withSchedule ( schedule ) . withProgramName ( "TestInactive" ) ; Program program = m_MissionProgramManager . loadParameters ( params ) ; assertThat ( program . getProgramStatus ( ) , is ( ProgramStatus . UNSATISFIED ) ) ; try { program . execute ( ) ; fail ( "Expected Exception" ) ; } catch ( IllegalStateException exception ) { } assertThat ( program . getProgramStatus ( ) , is ( not ( ProgramStatus . EXECUTED ) ) ) ; }
Test that mission programs that are inactive do not execute.
Test that mission programs that are inactive do not execute .
//template and parameters //a mission that has not attempted to execute should be unsatisfied //Mission is not active this should execute //expected exception