Author: tchemit Date: 2010-03-07 18:23:03 +0100 (Sun, 07 Mar 2010) New Revision: 1788 Log: - Evolution #160: Remove deprecated 'log' package - fix FileUtilTest since now there is less thant 100 java files in project... Removed: trunk/src/main/java/org/nuiton/log/ trunk/src/test/java/org/nuiton/log/LutinLogTest.java Modified: trunk/src/test/java/org/nuiton/util/FileUtilTest.java Deleted: trunk/src/test/java/org/nuiton/log/LutinLogTest.java =================================================================== --- trunk/src/test/java/org/nuiton/log/LutinLogTest.java 2010-03-07 16:23:21 UTC (rev 1787) +++ trunk/src/test/java/org/nuiton/log/LutinLogTest.java 2010-03-07 17:23:03 UTC (rev 1788) @@ -1,156 +0,0 @@ -/* *##% Nuiton utilities library - * Copyright (C) 2004 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ - -/* * - * LutinLogTest.java - * - * Created: 13 sept. 06 12:41:39 - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ - -package org.nuiton.log; - -import junit.framework.TestCase; -import org.apache.log4j.Layout; - -import java.io.PrintWriter; -import java.io.StringWriter; - - -/** @author poussin */ - -class Toto { - - static public void stack() throws Exception { - LutinLog log = LutinLogFactory.getLutinLog(LutinLogTest.class); - log.info("Titi called"); - - Throwable t = new Throwable(); - String fqnOfCallingClass = LutinLogTest.class.getName(); - - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - -/* 99*/ - if (t == null) -/* 100*/ return; - String s; -/* 104*/ - synchronized (sw) { -/* 105*/ - t.printStackTrace(pw); -/* 106*/ - s = sw.toString(); -/* 107*/ - sw.getBuffer().setLength(0); - } - - System.err.println(s); - -/* 119*/ - int ibegin = s.lastIndexOf(fqnOfCallingClass); -/* 120*/ - if (ibegin == -1) -/* 121*/ return; -/* 124*/ - ibegin = s.indexOf(Layout.LINE_SEP, ibegin); -/* 125*/ - if (ibegin == -1) -/* 126*/ return; -/* 127*/ - ibegin += Layout.LINE_SEP_LEN; -/* 130*/ - int iend = s.indexOf(Layout.LINE_SEP, ibegin); -/* 131*/ - if (iend == -1) -/* 132*/ return; - String fullInfo = s.substring(ibegin, iend); - System.out.println(fullInfo); - } - -} - -/** - * @deprecated since 20090327 this class seam to produce a frame on each - * log call (produce huge memory consumption), will be deleted soon. - */ -@Deprecated -public class LutinLogTest extends TestCase { - - public void testStack() throws Exception { - Toto.stack(); - } - - 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(); - } - -} - - Modified: trunk/src/test/java/org/nuiton/util/FileUtilTest.java =================================================================== --- trunk/src/test/java/org/nuiton/util/FileUtilTest.java 2010-03-07 16:23:21 UTC (rev 1787) +++ trunk/src/test/java/org/nuiton/util/FileUtilTest.java 2010-03-07 17:23:03 UTC (rev 1788) @@ -138,7 +138,8 @@ Map<File, List<CharSequence>> results = FileUtil.grep("CodeLutin", rootDir , ".*\\.java", "UTF-8"); - Assert.assertTrue(results.size() > 100); + Assert.assertTrue("should have more than 50 files, but found : "+ + results.size(), results.size() > 50); } @@ -189,7 +190,8 @@ FileUtil.copyRecursively(new File("src").getAbsoluteFile(), testDirectory); Map<File, List<CharSequence>> results = FileUtil.grep("CodeLutin", testDirectory , ".*\\.java", "UTF-8"); - Assert.assertTrue(results.size() > 100); + Assert.assertTrue("should have more than 50 files, but found : "+ + results.size(), results.size() > 50); FileUtil.sed("CodeLutin", "Nuiton", testDirectory, ".*\\.java" , "UTF-8"); @@ -197,7 +199,9 @@ Assert.assertTrue(results.isEmpty()); results = FileUtil.grep("Nuiton", testDirectory , ".*\\.java", "UTF-8"); - Assert.assertTrue(results.size() > 100); + Assert.assertTrue("should have more than 50 files, but found : "+ + results.size(), results.size() > 50); + // clean FileUtil.deleteRecursively(testDirectory);