Author: tchemit Date: 2011-08-22 17:15:47 +0200 (Mon, 22 Aug 2011) New Revision: 2177 Url: http://nuiton.org/repositories/revision/nuiton-utils/2177 Log: add a test Added: trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/ trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/MyNuitonTrace.java trunk/nuiton-profiling/src/test/resources/log4j.properties Modified: trunk/nuiton-profiling/pom.xml Modified: trunk/nuiton-profiling/pom.xml =================================================================== --- trunk/nuiton-profiling/pom.xml 2011-08-22 10:58:03 UTC (rev 2176) +++ trunk/nuiton-profiling/pom.xml 2011-08-22 15:15:47 UTC (rev 2177) @@ -83,6 +83,18 @@ <scope>compile</scope> </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> + </dependencies> @@ -109,6 +121,30 @@ <!-- *** Build Environment ************************************** --> <!-- ************************************************************* --> + <build> + + <plugins> + + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + <silent>true</silent> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> <profiles> <profile> <id>reporting</id> Added: trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/MyNuitonTrace.java =================================================================== --- trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/MyNuitonTrace.java (rev 0) +++ trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/MyNuitonTrace.java 2011-08-22 15:15:47 UTC (rev 2177) @@ -0,0 +1,64 @@ +/* + * #%L + * Nuiton Utils :: Nuiton Profiling + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2011 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>. + * #L% + */ +package org.nuiton.profiling; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.aspectwerkz.annotation.Aspect; +import org.codehaus.aspectwerkz.annotation.Expression; +import org.codehaus.aspectwerkz.definition.Pointcut; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since TODO + */ +@Aspect("perJVM") +public class MyNuitonTrace extends NuitonTrace { + + @Expression("execution(* org.apache.commons.logging.Log.*(..))") + Pointcut executeMethod; + + /** Logger. */ + private static final Log log = LogFactory.getLog(MyNuitonTrace.class); + + public static void main(String[] args) { + + log.debug("DEBUG"); + log.info("INFO"); + log.warn("WARN"); + log.warn("TRACE"); + + // trace should have somethin inside it... + String statisticsAndClear = getStatisticsAndClear(); +// Assert.assertTrue(StringUtils.isNotEmpty(statisticsAndClear)); + + if (log.isInfoEnabled()) { + log.info("First trace = " + statisticsAndClear); + } + } + +} Property changes on: trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/MyNuitonTrace.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/nuiton-profiling/src/test/resources/log4j.properties (from rev 2176, trunk/nuiton-utils/src/test/resources/log4j.properties) =================================================================== --- trunk/nuiton-profiling/src/test/resources/log4j.properties (rev 0) +++ trunk/nuiton-profiling/src/test/resources/log4j.properties 2011-08-22 15:15:47 UTC (rev 2177) @@ -0,0 +1,41 @@ +### +# #%L +# Nuiton Utils +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric +# %% +# 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>. +# #L% +### +# Global logging configuration +log4j.rootLogger=DEBUG, stdout, fileout + +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n + +log4j.appender.fileout=org.apache.log4j.FileAppender +log4j.appender.fileout.File=target/nuitontrace.log +log4j.appender.fileout.Append=true +log4j.appender.fileout.Threshold=DEBUG +log4j.appender.fileout.layout=org.apache.log4j.PatternLayout +log4j.appender.fileout.layout.ConversionPattern=%5p (%F:%L) %m%n + +# package level +#log4j.logger.org.apache.commons.logging.Log=DEBUG