mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPowerManager.java
public void testCreateWakeLockIndefinite()
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        
        // Create wake lock
        WakeLock testLock = powerManager.createWakeLock(TestPowerManager.class, "TestCreatedIndefLock");
        
        // Activate it indefinitely
        testLock.activate();  
        
        // Check logged method call
        ExamplePowerManagerMethodLog[] pDataColl = m_PlatformPowerManager.getMethodLog();
        assertThat(pDataColl.length, is(1));
        ExamplePowerManagerMethodLog log = pDataColl[0];
        outputLogVaules(log);          
        assertThat(log.getWakeLockId(), is("TestCreatedIndefLock"));
        assertThat(log.getCalledMethod(), is(ExamplePowerManagerMethodLog.MethodCalled.Activate));
        assertThat(log.getEndTimeMs(), is(PlatformPowerManager.INDEFINITE));
        
        // Check that lock has been made active
        Set<WakeLock> activeLocks = powerManager.getWakeLocks(WakeLockState.Active);
        assertThat(activeLocks, hasItem(testLock));               
    }
/**
     * Verifies that a WakeLock can be created to be active indefinitely
     */
Verifies that a WakeLock can be created to be active indefinitely
Verifies that a WakeLock can be created to be active indefinitely
public void testCreateWakeLockIndefinite()
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        WakeLock testLock = powerManager.createWakeLock(TestPowerManager.class, "TestCreatedIndefLock");
        testLock.activate();  
        ExamplePowerManagerMethodLog[] pDataColl = m_PlatformPowerManager.getMethodLog();
        assertThat(pDataColl.length, is(1));
        ExamplePowerManagerMethodLog log = pDataColl[0];
        outputLogVaules(log);          
        assertThat(log.getWakeLockId(), is("TestCreatedIndefLock"));
        assertThat(log.getCalledMethod(), is(ExamplePowerManagerMethodLog.MethodCalled.Activate));
        assertThat(log.getEndTimeMs(), is(PlatformPowerManager.INDEFINITE));
        Set<WakeLock> activeLocks = powerManager.getWakeLocks(WakeLockState.Active);
        assertThat(activeLocks, hasItem(testLock));               
    }
public void testCreateWakeLockIndefinite ( ) { PowerManager powerManager = ServiceUtils . getService ( m_Context , PowerManager . class ) ; assertThat ( powerManager , is ( notNullValue ( ) ) ) ; WakeLock testLock = powerManager . createWakeLock ( TestPowerManager . class , "TestCreatedIndefLock" ) ; testLock . activate ( ) ; ExamplePowerManagerMethodLog [ ] pDataColl = m_PlatformPowerManager . getMethodLog ( ) ; assertThat ( pDataColl . length , is ( 1 ) ) ; ExamplePowerManagerMethodLog log = pDataColl [ 0 ] ; outputLogVaules ( log ) ; assertThat ( log . getWakeLockId ( ) , is ( "TestCreatedIndefLock" ) ) ; assertThat ( log . getCalledMethod ( ) , is ( ExamplePowerManagerMethodLog . MethodCalled . Activate ) ) ; assertThat ( log . getEndTimeMs ( ) , is ( PlatformPowerManager . INDEFINITE ) ) ; Set < WakeLock > activeLocks = powerManager . getWakeLocks ( WakeLockState . Active ) ; assertThat ( activeLocks , hasItem ( testLock ) ) ; }
Verifies that a WakeLock can be created to be active indefinitely
Verifies that a WakeLock can be created to be active indefinitely
// Create wake lock // Activate it indefinitely // Check logged method call // Check that lock has been made active