// Path: src/info/xuluan/podcast/utils/LockHandler.java
// public class LockHandler {
// 	
// 	private ReentrantReadWriteLock lock;
// 	private Boolean status;
// 	
// 	public LockHandler()
// 	{
// 		lock = new ReentrantReadWriteLock();
// 		status = false;
// 	}
// 
// 	public boolean getStatus()
// 	{
// 		return status;
// 	}
// 	
// 	public boolean locked()
// 	{
// 		lock.readLock().lock();
// 		if (status) {
// 			lock.readLock().unlock();
// 			return false;
// 
// 		}
// 		lock.readLock().unlock();
// 
// 		lock.writeLock().lock();
// 		status = true;
// 		lock.writeLock().unlock();
// 		
// 		return true;
// 	}
// 	
// 	public void release()
// 	{
// 		lock.writeLock().lock();
// 		status = false;
// 		lock.writeLock().unlock();
// 	}	
// 
// 		
// 
// }


import junit.framework.TestCase;
import info.xuluan.podcast.utils.LockHandler;
/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package info.xuluan.podcast.tests;




public class LockTest extends TestCase {

    public void testLock() throws Exception {
    	LockHandler lock = new LockHandler();
    	boolean rc;

    	rc = lock.locked();
        assertTrue(rc);
        assertTrue(lock.getStatus());
        lock.release();
    }

    public void testRelease() throws Exception {
    	LockHandler lock = new LockHandler();;
    	boolean rc;
    	rc = lock.locked();
        assertTrue(lock.getStatus());
        assertTrue(rc);        
// Path: src/info/xuluan/podcast/utils/LockHandler.java
// public class LockHandler {
// 	
// 	private ReentrantReadWriteLock lock;
// 	private Boolean status;
// 	
// 	public LockHandler()
// 	{
// 		lock = new ReentrantReadWriteLock();
// 		status = false;
// 	}
// 
// 	public boolean getStatus()
// 	{
// 		return status;
// 	}
// 	
// 	public boolean locked()
// 	{
// 		lock.readLock().lock();
// 		if (status) {
// 			lock.readLock().unlock();
// 			return false;
// 
// 		}
// 		lock.readLock().unlock();
// 
// 		lock.writeLock().lock();
// 		status = true;
// 		lock.writeLock().unlock();
// 		
// 		return true;
// 	}
// 	
// 	public void release()
// 	{
// 		lock.writeLock().lock();
// 		status = false;
// 		lock.writeLock().unlock();
// 	}	
// 
// 		
// 
// }


// Path: src/info/xuluan/podcast/tests/LockTest.java
import junit.framework.TestCase;
import info.xuluan.podcast.utils.LockHandler;

/*
 * Copyright (C) 2008 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package info.xuluan.podcast.tests;




public class LockTest extends TestCase {

    public void testLock() throws Exception {
    	LockHandler lock = new LockHandler();
    	boolean rc;

    	rc = lock.locked();
        assertTrue(rc);
        assertTrue(lock.getStatus());
        lock.release();
    }

    public void testRelease() throws Exception {
    	LockHandler lock = new LockHandler();;
    	boolean rc;
    	rc = lock.locked();
        assertTrue(lock.getStatus());
        assertTrue(rc);        
        lock.release();