Index: lutinutil/src/test/org/codelutin/log/LutinLogTest.java diff -u /dev/null lutinutil/src/test/org/codelutin/log/LutinLogTest.java:1.1 --- /dev/null Wed Sep 13 13:27:45 2006 +++ lutinutil/src/test/org/codelutin/log/LutinLogTest.java Wed Sep 13 13:27:40 2006 @@ -0,0 +1,97 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * LutinLogTest.java + * + * Created: 13 sept. 06 12:41:39 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/09/13 13:27:40 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.log; + +import junit.framework.TestCase; + + +/** + * @author poussin + * + */ + +public class LutinLogTest extends TestCase { + + public void testMonitor() throws Exception { + LutinLog log = LutinLogFactory.getLutinLog(LutinLogTest.class); + + if (log.isTraceEnabled()) { + log.trace("Titi called"); + } + + log.setActivateProgressMonitorTime(1000); + log.user("task started"); + log.setMin(1); + log.setMax(100); + log.start(); + + for (int i=1; i<=100; i++) { + if (log.isAskStopTask()) { + break; + } + log.setValue(i); + Thread.sleep(50); + } + + log.user("task finished"); + log.end(); + } + + public void testTimeout() throws Exception { + LutinLog log = LutinLogFactory.getLutinLog(LutinLogTest.class); + + if (log.isTraceEnabled()) { + log.trace("Titi called"); + } + + log.setActivateProgressMonitorTime(1000); + log.setTimeout(3000); + log.user("task started"); + log.setMin(1); + log.setMax(100); + log.start(); + + for (int i=1; i<=100; i++) { + if (log.isAskStopTask()) { + break; + } + log.setValue(i); + Thread.sleep(50); + } + + log.user("task finished"); + log.end(); + } + +} + +