Vincent, When I put in the cactus:single, I knew the duplicated code as a code "smell". Just wasn't sure how to fix it! I will look into learning more about Jelly Tags. Basically, it would be to take the duplicated code, and put it into it's own jelly tag, correct?
Then call that from cactus:test and cactus:single... ERic -----Original Message----- From: Vincent Massol To: 'Maven Developers List' Sent: 7/10/03 8:35 AM Subject: RE: cvs commit: maven/src/plugins-build/cactus plugin.jelly Hi Eric, Can you add a comment mentioning that the code you have added needs to be refactored so that there is no duplication. If you run "Simian" or CPD on the plugin it will currently scream... :-) Of course, if you could the refactoring... ;-) An idea: use a jelly tag. Thanks -Vincent > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 10 July 2003 14:10 > To: [EMAIL PROTECTED] > Subject: cvs commit: maven/src/plugins-build/cactus plugin.jelly > > epugh 2003/07/10 05:09:38 > > Modified: src/plugins-build/cactus/xdocs changes.xml goals.xml > src/plugins-build/cactus plugin.jelly > Log: > Added new cactus:single target to run just one testcase. > > Revision Changes Path > 1.14 +6 -2 maven/src/plugins-build/cactus/xdocs/changes.xml > > Index: changes.xml > =================================================================== > RCS file: /home/cvs/maven/src/plugins-build/cactus/xdocs/changes.xml,v > retrieving revision 1.13 > retrieving revision 1.14 > diff -u -r1.13 -r1.14 > --- changes.xml 8 Jul 2003 11:01:06 -0000 1.13 > +++ changes.xml 10 Jul 2003 12:09:38 -0000 1.14 > @@ -7,10 +7,14 @@ > > <body> > > - <release version="3.0" date="in CVS"> > + <release version="3.0" date="in CVS"> > + <action dev="epugh" type="add"> > + New goal cactus:single added that allows you to run just a > single testcase. > + Pass the testcase in using -Dtestcase=my.single.TestCase. > + </action> > <action dev="evenisse" type="fix"> > Add xml declaration to generated report. Fixed for character > encoding. > - </action> > + </action> > <action dev="epugh" type="add"> > Ability to optionally specify for Tomcat 4x and 5x a directory > to which > the container will be installed for the tests. > > > > 1.6 +8 -0 maven/src/plugins-build/cactus/xdocs/goals.xml > > Index: goals.xml > =================================================================== > RCS file: /home/cvs/maven/src/plugins-build/cactus/xdocs/goals.xml,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -u -r1.5 -r1.6 > --- goals.xml 23 May 2003 21:05:56 -0000 1.5 > +++ goals.xml 10 Jul 2003 12:09:38 -0000 1.6 > @@ -29,6 +29,14 @@ > </description> > </goal> > <goal> > + <name>cactus:single</name> > + <description> > + Run a single Cactus test on the containers for which you have > defined > + a <code>cactus.home.[container name]</code> property. Pass > the name > + of the testcase in using -Dtestcase=my.single.TestCase. > + </description> > + </goal> > + <goal> > <name>cactus:report</name> > <description> > Generate an HTML report for the Cactus tests that been run. > In order > > > > 1.28 +117 -22 maven/src/plugins-build/cactus/plugin.jelly > > Index: plugin.jelly > =================================================================== > RCS file: /home/cvs/maven/src/plugins-build/cactus/plugin.jelly,v > retrieving revision 1.27 > retrieving revision 1.28 > diff -u -r1.27 -r1.28 > --- plugin.jelly 8 Jul 2003 11:01:06 -0000 1.27 > +++ plugin.jelly 10 Jul 2003 12:09:38 -0000 1.28 > @@ -59,6 +59,29 @@ > <j:set var="cactusSourcePresent" value="true"/> > </util:available> > > + <!-- Prepare the directories for the JUnit reports --> > + <ant:mkdir dir="${cactus.reports.dir}"/> > + > + <j:if test="${context.getVariable('cactus.home.jboss3x') != null}"> > + <ant:mkdir dir="${cactus.reports.dir}/jboss3x"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.home.orion1x') != null}"> > + <ant:mkdir dir="${cactus.reports.dir}/orion1x"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.home.orion2x') != null}"> > + <ant:mkdir dir="${cactus.reports.dir}/orion2x"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.home.resin2x') != null}"> > + <ant:mkdir dir="${cactus.reports.dir}/resin2x"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.home.tomcat4x') != > null}"> > + <ant:mkdir dir="${cactus.reports.dir}/tomcat4x"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.home.tomcat5x') != > null}"> > + <ant:mkdir dir="${cactus.reports.dir}/tomcat5x"/> > + </j:if> > + > + > </goal> > > <!-- > @@ -190,28 +213,6 @@ > <goal name="cactus:test" prereqs="cactus:init,cactus:cactifywar" > description="Run all Cactus Test Cases"> > > - <!-- Prepare the directories for the JUnit reports --> > - <ant:mkdir dir="${cactus.reports.dir}"/> > - > - <j:if test="${context.getVariable('cactus.home.jboss3x') != null}"> > - <ant:mkdir dir="${cactus.reports.dir}/jboss3x"/> > - </j:if> > - <j:if test="${context.getVariable('cactus.home.orion1x') != null}"> > - <ant:mkdir dir="${cactus.reports.dir}/orion1x"/> > - </j:if> > - <j:if test="${context.getVariable('cactus.home.orion2x') != null}"> > - <ant:mkdir dir="${cactus.reports.dir}/orion2x"/> > - </j:if> > - <j:if test="${context.getVariable('cactus.home.resin2x') != null}"> > - <ant:mkdir dir="${cactus.reports.dir}/resin2x"/> > - </j:if> > - <j:if test="${context.getVariable('cactus.home.tomcat4x') != > null}"> > - <ant:mkdir dir="${cactus.reports.dir}/tomcat4x"/> > - </j:if> > - <j:if test="${context.getVariable('cactus.home.tomcat5x') != > null}"> > - <ant:mkdir dir="${cactus.reports.dir}/tomcat5x"/> > - </j:if> > - > <cactus warfile="${maven.build.dir}/${pom.artifactId}-cactus.war" > fork="yes" errorproperty="cactustests.error" > failureproperty="cactustests.failure" > @@ -345,6 +346,100 @@ > <ant:fail if="cactustests.error">At least one test had an > error!</ant:fail> > </j:if> > > + </goal> > + > + <!-- > + > ======================================================================== > + Execute a single Cactus test on all containers which have been > defined, > + i.e. which have a ${cactus.home.[container name]} property > + defined. Specify the case with -Dcactus.testcase=my.test.Case > + > ======================================================================== > + --> > + <goal name="cactus:single" prereqs="cactus:init,cactus:cactifywar" > + description="Run a single Cactus Test Case"> > + > + <j:set var="testcase__" value="${testcase}X"/> > + <j:if test="${testcase__ == 'X'}"> > + <ant:fail>You must provide a test case using - > Dtestcase=my.single.TestCase</ant:fail> > + </j:if> > + > + <cactus warfile="${maven.build.dir}/${pom.artifactId}-cactus.war" > + fork="yes" errorproperty="cactustests.error" > + failureproperty="cactustests.failure" > + printsummary="${maven.cactus.printsummary}"> > + <ant:classpath> > + <ant:pathelement path="${maven.build.dest}"/> > + <ant:pathelement location="${cactus.target.classes.dir}"/> > + <ant:path refid="maven.dependency.classpath"/> > + <ant:path refid="cactus.classpath"/> > + </ant:classpath> > + <containerset> > + <!-- TODO: Find how to set the port for JBoss 3x --> > + <jboss3x if="cactus.home.jboss3x" > + dir="${cactus.home.jboss3x}" > + output="${cactus.reports.dir}/jboss3x.out" > + todir="${cactus.reports.dir}/jboss3x" > + config="${cactus.jboss3x.config.name}"/> > + > + <orion1x if="cactus.home.orion1x" > + dir="${cactus.home.orion1x}" port="${cactus.port}" > + output="${cactus.reports.dir}/orion1x.out" > + todir="${cactus.reports.dir}/orion1x"/> > + > + <orion2x if="cactus.home.orion2x" > + dir="${cactus.home.orion2x}" port="${cactus.port}" > + output="${cactus.reports.dir}/orion2x.out" > + todir="${cactus.reports.dir}/orion2x"/> > + > + <resin2x if="cactus.home.resin2x" > + dir="${cactus.home.resin2x}" port="${cactus.port}" > + output="${cactus.reports.dir}/resin2x.out" > + todir="${cactus.reports.dir}/resin2x"> > + <j:if test="${context.getVariable('cactus.resin2x.config') != > null}"> > + <ant:setProperty name="resinconf" > value="${cactus.resin2x.config}"/> > + </j:if> > + </resin2x> > + > + <tomcat4x if="cactus.home.tomcat4x" > + dir="${cactus.home.tomcat4x}" port="${cactus.port}" > + output="${cactus.reports.dir}/tomcat4x.out" > + todir="${cactus.reports.dir}/tomcat4x"> > + <j:if test="${context.getVariable('cactus.tomcat4x.config') > != null}"> > + <ant:setProperty name="serverxml" > value="${cactus.tomcat4x.config}"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.tomcat4x.tmpdir') > != null}"> > + <ant:setProperty name="tmpdir" > value="${cactus.tomcat4x.tmpdir}"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.tomcat4x.conf.dir') > != null}"> > + <conf dir="${cactus.tomcat4x.conf.dir}" > + includes="${cactus.tomcat4x.conf.includes}" > + excludes="${cactus.tomcat4x.conf.excludes}"/> > + </j:if> > + </tomcat4x> > + > + <tomcat5x if="cactus.home.tomcat5x" > + dir="${cactus.home.tomcat5x}" port="${cactus.port}" > + output="${cactus.reports.dir}/tomcat5x.out" > + todir="${cactus.reports.dir}/tomcat5x"> > + <j:if test="${context.getVariable('cactus.tomcat5x.config') > != null}"> > + <ant:setProperty name="serverxml" > value="${cactus.tomcat5x.config}"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.tomcat5x.tmpdir') > != null}"> > + <ant:setProperty name="tmpdir" > value="${cactus.tomcat5x.tmpdir}"/> > + </j:if> > + <j:if test="${context.getVariable('cactus.tomcat5x.conf.dir') > != null}"> > + <conf dir="${cactus.tomcat5x.conf.dir}" > + includes="${cactus.tomcat5x.conf.includes}" > + excludes="${cactus.tomcat5x.conf.excludes}"/> > + </j:if> > + </tomcat5x> > + > + </containerset> > + <ant:formatter type="plain" usefile="${cactus.junit.usefile}"/> > + <ant:formatter type="xml"/> > + <!-- Run only a single testcase passed in via - > Dtestcase=my.single.TestCase--> > + <ant:test name="${testcase}"/> > + </cactus> > </goal> > > <!-- > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
