package test.org.itscool.commons.pool;

import junit.framework.TestCase;

import org.itscool.commons.pool.ObjectPool;
import org.itscool.commons.pool.ObjectPoolEventListener;

public class ObjectPoolTest extends TestCase {
	public void testCreatePool(){
		SamplePoolMgr poolMgr = new SamplePoolMgr();
		
	}
}

class SamplePoolMgr implements ObjectPoolEventListener{
	ObjectPool pool = null;
	int id = 0;
	
	public SamplePoolMgr(){
		pool = new ObjectPool(this, 1, 3);
		pool.addNewElement(String.valueOf(id++));
	}
	
	public Object getElement(){
		return pool.getElement();
	}
	
	public void returnElement(Object element){
		pool.returnElement(element);
	}
	
	public void doReleaseElementEvent(Object obj){
		
	}
	
	public Object doMissingElementEvent(){
		String str = String.valueOf(id++);
		return str;
	}
}