mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPowerManager.java
public void testGetWakeLockContexts()
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        
        // Create active wake lock
        WakeLock testLock1 = powerManager.createWakeLock(TestPowerManager.class, "TestAllCurrentContext");        
        testLock1.activate();
        
        // Create second active wake lock
        WakeLock testLock2 = powerManager.createWakeLock(ExamplePlatformPowerManager.class, "TestAllOtherContext");
        testLock2.activate();         
        
        // Check that both contexts are returned
        Set<Class <?>> currentLockContexts = powerManager.getWakeLockContexts(); 
        printWakeLockContexts(currentLockContexts);
        assertThat(currentLockContexts, hasItem(TestPowerManager.class));
        assertThat(currentLockContexts, hasItem(ExamplePlatformPowerManager.class));       
                
        removeOtherLocks();
    }
/**
     * Verifies that the proper WakeLock contexts are returned from the PowerManager
     */
Verifies that the proper WakeLock contexts are returned from the PowerManager
Verifies that the proper WakeLock contexts are returned from the PowerManager
public void testGetWakeLockContexts()
    {
        PowerManager powerManager = ServiceUtils.getService(m_Context, PowerManager.class);
        assertThat(powerManager, is(notNullValue()));
        WakeLock testLock1 = powerManager.createWakeLock(TestPowerManager.class, "TestAllCurrentContext");        
        testLock1.activate();
        WakeLock testLock2 = powerManager.createWakeLock(ExamplePlatformPowerManager.class, "TestAllOtherContext");
        testLock2.activate();         
        Set<Class <?>> currentLockContexts = powerManager.getWakeLockContexts(); 
        printWakeLockContexts(currentLockContexts);
        assertThat(currentLockContexts, hasItem(TestPowerManager.class));
        assertThat(currentLockContexts, hasItem(ExamplePlatformPowerManager.class));       
        removeOtherLocks();
    }
public void testGetWakeLockContexts ( ) { PowerManager powerManager = ServiceUtils . getService ( m_Context , PowerManager . class ) ; assertThat ( powerManager , is ( notNullValue ( ) ) ) ; WakeLock testLock1 = powerManager . createWakeLock ( TestPowerManager . class , "TestAllCurrentContext" ) ; testLock1 . activate ( ) ; WakeLock testLock2 = powerManager . createWakeLock ( ExamplePlatformPowerManager . class , "TestAllOtherContext" ) ; testLock2 . activate ( ) ; Set < Class < ? > > currentLockContexts = powerManager . getWakeLockContexts ( ) ; printWakeLockContexts ( currentLockContexts ) ; assertThat ( currentLockContexts , hasItem ( TestPowerManager . class ) ) ; assertThat ( currentLockContexts , hasItem ( ExamplePlatformPowerManager . class ) ) ; removeOtherLocks ( ) ; }
Verifies that the proper WakeLock contexts are returned from the PowerManager
Verifies that the proper WakeLock contexts are returned from the PowerManager
// Create active wake lock // Create second active wake lock // Check that both contexts are returned