mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPowerManager.java
public void testScheduledWakeLock() throws InterruptedException
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        
        // Create wake lock
        WakeLock testLock = powerManager.createWakeLock(TestPowerManager.class, "TestScheduledLockId");
        long futureWakeTimeMs = m_Calendar.getTimeInMillis() + (10 * 1000); // current time plus 10 seconds in ms
        Date wakeTime = new Date(futureWakeTimeMs);
        
        // schedule lock for a future time
        testLock.scheduleWakeTime(wakeTime);
        
        // Check logged method call
        ExamplePowerManagerMethodLog[] pDataColl = m_PlatformPowerManager.getMethodLog();
        assertThat(pDataColl.length, is(1));
        ExamplePowerManagerMethodLog log = pDataColl[0];
        outputLogVaules(log);          
        assertThat(log.getWakeLockId(), is("TestScheduledLockId"));
        assertThat(log.getCalledMethod(), is(ExamplePowerManagerMethodLog.MethodCalled.Activate));
        assertThat(log.getStartTimeMs(), is(futureWakeTimeMs));
    }
/**
     * Verifies that a WakeLock can be created for a scheduled time
     */
Verifies that a WakeLock can be created for a scheduled time
Verifies that a WakeLock can be created for a scheduled time
public void testScheduledWakeLock() throws InterruptedException
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        WakeLock testLock = powerManager.createWakeLock(TestPowerManager.class, "TestScheduledLockId");
        long futureWakeTimeMs = m_Calendar.getTimeInMillis() + (10 * 1000); 
        Date wakeTime = new Date(futureWakeTimeMs);
        testLock.scheduleWakeTime(wakeTime);
        ExamplePowerManagerMethodLog[] pDataColl = m_PlatformPowerManager.getMethodLog();
        assertThat(pDataColl.length, is(1));
        ExamplePowerManagerMethodLog log = pDataColl[0];
        outputLogVaules(log);          
        assertThat(log.getWakeLockId(), is("TestScheduledLockId"));
        assertThat(log.getCalledMethod(), is(ExamplePowerManagerMethodLog.MethodCalled.Activate));
        assertThat(log.getStartTimeMs(), is(futureWakeTimeMs));
    }
public void testScheduledWakeLock ( ) throws InterruptedException { PowerManager powerManager = ServiceUtils . getService ( m_Context , PowerManager . class ) ; assertThat ( powerManager , is ( notNullValue ( ) ) ) ; WakeLock testLock = powerManager . createWakeLock ( TestPowerManager . class , "TestScheduledLockId" ) ; long futureWakeTimeMs = m_Calendar . getTimeInMillis ( ) + ( 10 * 1000 ) ; Date wakeTime = new Date ( futureWakeTimeMs ) ; testLock . scheduleWakeTime ( wakeTime ) ; ExamplePowerManagerMethodLog [ ] pDataColl = m_PlatformPowerManager . getMethodLog ( ) ; assertThat ( pDataColl . length , is ( 1 ) ) ; ExamplePowerManagerMethodLog log = pDataColl [ 0 ] ; outputLogVaules ( log ) ; assertThat ( log . getWakeLockId ( ) , is ( "TestScheduledLockId" ) ) ; assertThat ( log . getCalledMethod ( ) , is ( ExamplePowerManagerMethodLog . MethodCalled . Activate ) ) ; assertThat ( log . getStartTimeMs ( ) , is ( futureWakeTimeMs ) ) ; }
Verifies that a WakeLock can be created for a scheduled time
Verifies that a WakeLock can be created for a scheduled time
// Create wake lock // current time plus 10 seconds in ms // schedule lock for a future time // Check logged method call