hammant 2003/02/01 12:18:18 Modified: altrmi build.xml altrmi/src/java/org/apache/excalibur/altrmi/javacompiler JavaCompiler.java SunJavaCompiler.java Added: altrmi/src/test/org/apache/excalibur/altrmi/test/misc DefaultConnectionPingerTestCase.java Removed: altrmi/src/test/org/apache/excalibur/altrmi/client/impl DefaultConnectionPingerTestCase.java Log: Pinger testcase moved. Clover coverage added. start of work increasing coverage. 57% not enough. Revision Changes Path 1.67 +47 -14 jakarta-avalon-excalibur/altrmi/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- build.xml 27 Jan 2003 23:56:16 -0000 1.66 +++ build.xml 1 Feb 2003 20:18:17 -0000 1.67 @@ -10,11 +10,20 @@ <property file="${user.home}/.ant.properties"/> <property file="default.properties"/> <property name="test.filter" value="*TestCase"/> + <property name="clover.excludes" value="org/apache/excalibur/altrmi/test/**"/> - + <property name="clover.initstring" location="build/clover_coverage.db"/> <property name ="jetty.rel" value="4.2.2"/> + <!-- use 'ant get-clover' to get these --> + <!-- Optional only - build does not rquire these --> + <path id="clover.classpath"> + <pathelement path="${basedir}/lib/clover_coverage/clover-1.0.jar"/> + <pathelement path="${basedir}/lib/clover_coverage/velocity-1.4-dev.jar"/> + <pathelement path="${basedir}/lib/clover_coverage/commons-collections-2.1.jar"/> + </path> + <!-- Classpath for product --> <path id="project.class.path"> <pathelement location="${build.classes}"/> @@ -36,6 +45,7 @@ <pathelement location="${qdox.jar}"/> <pathelement path="${phoenix-metagenerate.jar}"/> <pathelement location="${serialver.jar}"/> + <path refid="clover.classpath"/> </path> <path id="tools.class.path"> @@ -65,7 +75,6 @@ <path refid="project.class.path"/> </path> - <property name="cp" refid="test.class.path"/> <target name="main" depends="compile, compile-test" description="Build the project"/> @@ -74,27 +83,20 @@ <target name="prepare"> <available property="phoenix-client.present" classname="org.apache.avalon.phoenix.BlockEvent" - classpathref="project.class.path"/> - + classpathref="project.class.path"/> </target> - <target name="checkBCEL"> - <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkRequiredClass"> - <property name="proj.jar.name" value="jakarta-bcel.jar"/> - <property name="class" value="org.apache.bcel.generic.ClassGen"/> - <property name="classpath" value="${cp}"/> - <property name="remedy" value="Download BCEL from http://jakarta.apache.org/builds/jakarta-bcel/release/v5.0rc1/ and copy bcel.jar ${nl} - | to ${ant.home}/lib"/> + <target name="with.clover"> - </ant> + <property name="build.compiler" + value="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/> </target> <target name="dependencies" description="Check dependencies" unless="skip.dependencies"> <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkCommon"/> <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkFramework"/> <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkPool"/> - <ant antfile="${basedir}/build.xml" target="checkBCEL"/> </target> <target name="dependencies-test" depends="dist-jar, dependencies" @@ -117,7 +119,8 @@ optimize="${build.optimize}" deprecation="${build.deprecation}" target="1.2"> - <classpath refid="project.class.path" /> + <classpath refid="clover.classpath"/> + <classpath refid="project.class.path" /> <include name="**/*.java"/> <exclude name="org/apache/excalibur/altrmi/server/impl/http/*.java" unless="jetty.present"/> <exclude name="org/apache/excalibur/altrmi/blocks/**" unless="phoenix-client.present"/> @@ -156,6 +159,8 @@ <mkdir dir="${build.testclasses}"/> + <property file="clover.enable" value="false"/> + <!-- Compile all test classes. --> <javac srcdir="${build.testsrc}" destdir="${build.testclasses}" @@ -621,5 +626,33 @@ <unzip src="jetty-download/Jetty-${jetty.rel}.zip" dest="jetty-download/Jetty-${jetty.rel}" /> </target> + + <target name="get-clover"> + + <mkdir dir="lib/clover_coverage"/> + + <get src="http://www.ibiblio.org/maven/clover/jars/clover-1.0.jar" + dest="lib/clover_coverage/clover-1.0.jar" + verbose="true" + usetimestamp="true"/> + + <get src="http://www.ibiblio.org/maven/velocity/jars/velocity-1.4-dev.jar" + dest="lib/clover_coverage/velocity-1.4-dev.jar" + verbose="true" + usetimestamp="true"/> + + <get src="http://www.ibiblio.org/maven/commons-collections/jars/commons-collections-2.1.jar" + dest="lib/clover_coverage/commons-collections-2.1.jar" + verbose="true" + usetimestamp="true"/> + + </target> + + <target name="clover.report"> + <java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter" fork="true"> + <arg line="--outputdir build/clover_html --showSrc --initstring ${clover.initstring} --title 'AltRMI'"/> + <classpath refid="clover.classpath"/> + </java> + </target> </project> 1.6 +0 -100 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/javacompiler/JavaCompiler.java Index: JavaCompiler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/javacompiler/JavaCompiler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- JavaCompiler.java 4 Jan 2003 22:17:19 -0000 1.5 +++ JavaCompiler.java 1 Feb 2003 20:18:18 -0000 1.6 @@ -97,14 +97,6 @@ } /** - * Set the class path for the compiler - */ - public void setClasspath( String m_classpath ) - { - this.m_classpath = m_classpath; - } - - /** * Method addClassPath * * @@ -148,23 +140,6 @@ return m_out.toString(); } - /** - * Set if you want debugging information in the class file - */ - public void setClassDebugInfo( boolean classDebugInfo ) - { - this.m_classDebugInfo = classDebugInfo; - } - - /** - * Method recycle - * - * - */ - public void recycle() - { - } - /** Reset all compilation state, but keep the settings. * The compiler can be used again. */ @@ -173,26 +148,6 @@ m_out = new ByteArrayOutputStream( 256 ); } - // -------------------- Compile method -------------------- - - /** The main method - compile the source, using the previous settings. - */ - public boolean compile( String source ) - { - - try - { - File f = new File( source ); - - source = f.getCanonicalPath(); - } - catch( IOException ex ) - { - ex.printStackTrace(); - } - - return doCompile( source ); - } /** * Execute the compiler @@ -200,32 +155,6 @@ */ public abstract boolean doCompile( String source ); - // -------------------- Utils -------------------- - - /** - * Method getCompilerPluginClass - * - * - * @param compilerClassName the compiler class name. - * - * @return - * - */ - public static Class getCompilerPluginClass( String compilerClassName ) - { - - try - { - Class c = JavaCompiler.class.getClassLoader().loadClass( compilerClassName ); - - return c; - } - catch( Exception ex ) - { - return null; - } - } - /** * Method getDefaultCompiler * @@ -240,33 +169,4 @@ //-------------------- Class path utils -------------------- - /** Create a m_classpath string from a URL[] ( used in URLClassLoader ) - */ - public static String extractClassPath( URL urls[] ) - { - - String separator = System.getProperty( "path.separator", ":" ); - String cpath = ""; - - for( int i = 0; i < urls.length; i++ ) - { - URL cp = urls[ i ]; - - if( cp == null ) - { - continue; - } - - File f = new File( cp.getFile() ); - - if( cpath.length() > 0 ) - { - cpath += separator; - } - - cpath += f; - } - - return cpath; - } } 1.5 +1 -14 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/javacompiler/SunJavaCompiler.java Index: SunJavaCompiler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/javacompiler/SunJavaCompiler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SunJavaCompiler.java 4 Jan 2003 22:17:19 -0000 1.4 +++ SunJavaCompiler.java 1 Feb 2003 20:18:18 -0000 1.5 @@ -81,22 +81,9 @@ */ public boolean doCompile( String source ) { - Main compiler = new Main( m_out, "jsp->javac" ); String[] args; - - if( m_classDebugInfo ) - { - args = new String[] - { - "-g", "-classpath", m_classpath, "-d", m_outdir, source - }; - } - else - { - args = new String[]{"-classpath", m_classpath, "-d", m_outdir, source}; - } - + args = new String[]{"-classpath", m_classpath, "-d", m_outdir, source}; return compiler.compile( args ); } } 1.1 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/misc/DefaultConnectionPingerTestCase.java Index: DefaultConnectionPingerTestCase.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.test.misc; import junit.framework.TestCase; import org.apache.excalibur.altrmi.test.DummyInvocationHandler; import org.apache.excalibur.altrmi.client.impl.DefaultConnectionPinger; public class DefaultConnectionPingerTestCase extends TestCase { public DefaultConnectionPingerTestCase(String name) { super(name); } protected void setUp() throws Exception { super.setUp(); } public void testBasic() throws Exception { DefaultConnectionPinger pinger = new DefaultConnectionPinger(1L,10000L); DummyInvocationHandler dummy = new DummyInvocationHandler(); pinger.start(); pinger.setInvocationHandler(dummy); Thread.sleep(1000); assertTrue("Should have pinged", dummy.isPinged()); pinger.stop(); dummy.reset(); Thread.sleep(1000); assertTrue("Should have stopped pinging", !dummy.isPinged()); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]