mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/mp/TestMissionProgramSchedulerImpl.java
@Test
    public void testSchdeuledExecution() throws InterruptedException, PrivilegedActionException
    {
        //activate the component
        m_SUT.activate();
        
        //quick schedule, shouldn't be able to remove will already be gone
        MissionProgramSchedule schedule = TestProgramImpl.createMissionSchedule(System.currentTimeMillis() + 200L, 
            System.currentTimeMillis() + 205L, 
            false, true, true, true);
        
        when(m_Program1.getMissionSchedule()).thenReturn(schedule);
        
        //mock power management
        WakeLock wakeLock = mock(WakeLock.class);
        when(m_PowerManager.createWakeLock(m_SUT.getClass(), PROG1_NAME)).thenReturn(wakeLock);
        when(m_PowerManager.createWakeLock(m_SUT.getClass(), PROG1_NAME + "_Stop")).thenReturn(wakeLock);

        m_SUT.executeProgram(m_Program1);

        //verify interactions
        verify(m_Script, timeout(1000)).execute();
        verify(m_Script, timeout(1500)).shutdown();

        verify(wakeLock, timeout(1000).times(2)).delete();
    }
/**
     * Test submitting a program for scheduled execution with an ending time.
     */
Test submitting a program for scheduled execution with an ending time.
Test submitting a program for scheduled execution with an ending time .
@Test
    public void testSchdeuledExecution() throws InterruptedException, PrivilegedActionException
    {
        m_SUT.activate();
        MissionProgramSchedule schedule = TestProgramImpl.createMissionSchedule(System.currentTimeMillis() + 200L, 
            System.currentTimeMillis() + 205L, 
            false, true, true, true);
        when(m_Program1.getMissionSchedule()).thenReturn(schedule);
        WakeLock wakeLock = mock(WakeLock.class);
        when(m_PowerManager.createWakeLock(m_SUT.getClass(), PROG1_NAME)).thenReturn(wakeLock);
        when(m_PowerManager.createWakeLock(m_SUT.getClass(), PROG1_NAME + "_Stop")).thenReturn(wakeLock);
        m_SUT.executeProgram(m_Program1);
        verify(m_Script, timeout(1000)).execute();
        verify(m_Script, timeout(1500)).shutdown();
        verify(wakeLock, timeout(1000).times(2)).delete();
    }
@ Test public void testSchdeuledExecution ( ) throws InterruptedException , PrivilegedActionException { m_SUT . activate ( ) ; MissionProgramSchedule schedule = TestProgramImpl . createMissionSchedule ( System . currentTimeMillis ( ) + 200L , System . currentTimeMillis ( ) + 205L , false , true , true , true ) ; when ( m_Program1 . getMissionSchedule ( ) ) . thenReturn ( schedule ) ; WakeLock wakeLock = mock ( WakeLock . class ) ; when ( m_PowerManager . createWakeLock ( m_SUT . getClass ( ) , PROG1_NAME ) ) . thenReturn ( wakeLock ) ; when ( m_PowerManager . createWakeLock ( m_SUT . getClass ( ) , PROG1_NAME + "_Stop" ) ) . thenReturn ( wakeLock ) ; m_SUT . executeProgram ( m_Program1 ) ; verify ( m_Script , timeout ( 1000 ) ) . execute ( ) ; verify ( m_Script , timeout ( 1500 ) ) . shutdown ( ) ; verify ( wakeLock , timeout ( 1000 ) . times ( 2 ) ) . delete ( ) ; }
Test submitting a program for scheduled execution with an ending time.
Test submitting a program for scheduled execution with an ending time .
//activate the component //quick schedule, shouldn't be able to remove will already be gone //mock power management //verify interactions