mil.dod.th.ose.integration/src/mil/dod/th/ose/controller/integration/core/TestMissionProgramManager.java
@Test
    public void testRemoval() throws MissionProgramException, IOException, PersistenceFailedException, 
        InterruptedException
    {
        MissionProgramSchedule schedule = new MissionProgramSchedule().
                withStartInterval(System.currentTimeMillis() + 500).
                withStopInterval(System.currentTimeMillis() + 1000).
                withActive(true);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("simple-template").
            withSchedule(schedule).withParameters(new MapEntry("a", 10)).withProgramName("Removal");
        EventHandlerSyncer syncer = new EventHandlerSyncer(Program.TOPIC_PROGRAM_SHUTDOWN);
        
        Program program = m_MissionProgramManager.loadParameters(params);

        syncer.waitForEvent(20);
        
        //remove the program
        program.remove();

        //verify the program is not found
        try
        {
            m_MissionProgramManager.getProgram("Removal");
            fail("Expecting exception as this program was just called to be removed.");
        }
        catch(IllegalArgumentException e)
        {
           //Expecting this exception as the program was just removed.
        }
    }
/**
     * Test that a mission is correctly removed. See {@link TestPersistedMissionPrograms#testMissionRemoved()}.
     */
Test that a mission is correctly removed.
Test that a mission is correctly removed .
@Test
    public void testRemoval() throws MissionProgramException, IOException, PersistenceFailedException, 
        InterruptedException
    {
        MissionProgramSchedule schedule = new MissionProgramSchedule().
                withStartInterval(System.currentTimeMillis() + 500).
                withStopInterval(System.currentTimeMillis() + 1000).
                withActive(true);
        MissionProgramParameters params = new MissionProgramParameters().withTemplateName("simple-template").
            withSchedule(schedule).withParameters(new MapEntry("a", 10)).withProgramName("Removal");
        EventHandlerSyncer syncer = new EventHandlerSyncer(Program.TOPIC_PROGRAM_SHUTDOWN);
        Program program = m_MissionProgramManager.loadParameters(params);
        syncer.waitForEvent(20);
        program.remove();
        try
        {
            m_MissionProgramManager.getProgram("Removal");
            fail("Expecting exception as this program was just called to be removed.");
        }
        catch(IllegalArgumentException e)
        {
        }
    }
@ Test public void testRemoval ( ) throws MissionProgramException , IOException , PersistenceFailedException , InterruptedException { MissionProgramSchedule schedule = new MissionProgramSchedule ( ) . withStartInterval ( System . currentTimeMillis ( ) + 500 ) . withStopInterval ( System . currentTimeMillis ( ) + 1000 ) . withActive ( true ) ; MissionProgramParameters params = new MissionProgramParameters ( ) . withTemplateName ( "simple-template" ) . withSchedule ( schedule ) . withParameters ( new MapEntry ( "a" , 10 ) ) . withProgramName ( "Removal" ) ; EventHandlerSyncer syncer = new EventHandlerSyncer ( Program . TOPIC_PROGRAM_SHUTDOWN ) ; Program program = m_MissionProgramManager . loadParameters ( params ) ; syncer . waitForEvent ( 20 ) ; program . remove ( ) ; try { m_MissionProgramManager . getProgram ( "Removal" ) ; fail ( "Expecting exception as this program was just called to be removed." ) ; } catch ( IllegalArgumentException e ) { } }
Test that a mission is correctly removed.
Test that a mission is correctly removed .
//remove the program //verify the program is not found //Expecting this exception as the program was just removed.