maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Ho" <...@paymentone.com>
Subject RE: [m2] Migrating mockobject calls to Maven2
Date Thu, 29 Dec 2005 16:50:06 GMT
Hi,

	I didn't try the testSourceRoot soluction but I got it to work
in the following way:

1) Use testIncludes to add specify my test source with the
maven-compiler-plugin.
2) Use the antrun plug in to run the ant tasks for mock object creation.

	Thanks for everyone's help.

See the following for my pom:

		<plugins>
			
			<plugin>
	
<groupId>org.apache.maven.plugins</groupId>
	
<artifactId>maven-compiler-plugin</artifactId>				
				<configuration>
	
<compilerVersion>1.5</compilerVersion>
					<source>1.4</source>
					<target>1.4</target>
					
					<testIncludes>
                		<testInclude
implementation="java.lang.String">src/test/java/**/*.java</testInclude>
                		<testInclude
implementation="java.lang.String">target/generated-test-src/mocked/**/*.
java</testInclude>
           	 		</testIncludes>	
				</configuration>

			</plugin>
			<plugin>
	
<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
	
<phase>generate-test-sources</phase>
						<configuration>
							<tasks>
								<path
id="mockcreator.classpath">
	
<path refid="maven.dependency.classpath"/>
								</path>
								<java
fork="yes"
classname="de.abstrakt.tools.codegeneration.file.MockCreatorFile"
failonerror="true" classpathref="mockcreator.classpath">
	
<!--<arg line="-o
${project.build.outputDirectory}/generated-test-src/mocked"/> -->
	
<arg line="-o target/generated-test-src/mocked"/>
	
<arg value="com.paymentone.soap.connector.SoapPPOClient"/>
					
							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
				<dependencies>
					<dependency>
	
<groupId>mockcreator</groupId>
	
<artifactId>MockCreator</artifactId>
						<version>2.8.0</version>
						<type>jar</type>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>

-----Original Message-----
From: Scokart Gilles [mailto:Gilles.Scokart@be.fujitsu.com] 
Sent: Thursday, December 29, 2005 12:29 AM
To: Maven Users List
Subject: RE: [m2] Migrating mockobject calls to Maven2

I'm not sure if it was already in 2.0, but in the latest version there
is a
parameter testSourceRoot you can add.  This will add a directory to the
test
source directories.

Your configuration will look like this :

<configuration>
	<tasks>
		<ant antfile="src/test/ant/build.xml"
inheritRefs="true"/>
	</tasks>
	
<testSourceRoot>target/generated-sources/nextmock</testSourceRoot>
</configuration>



> -----Original Message-----
> From: Dennis Ho [mailto:dho@paymentone.com]
> Sent: 29 December 2005 01:52
> To: Maven Users List
> Subject: RE: [m2] Migrating mockobject calls to Maven2
> 
> Hi,
> 
> 
> 
>             I managed to add the mock generator using the
> maven-antrun-plugin but I am having trouble adding the generated test
> sources to the test compile source directory.  How can I make the
> maven-compiler-plugin to compile both the src/test/java and
> target/generated-test-src directories?
> 
> 
> 
> Thanks,
> 
> 
> 
> Dennis.
> 
> 
> 
> -----Original Message-----
> From: David Sag [mailto:dsag@epo.org]
> Sent: Wednesday, December 28, 2005 2:48 AM
> To: Maven Users List
> Subject: Re: [m2] Migrating mockobject calls to Maven2
> 
> 
> 
> 
> We use EasyMock and all that needs is to put the folllowwing in the
pom.
> there are no generated files like with what you describe however.  it
> makes great little mockobjects though using the cglib.
> 
>         <dependency>
>             <groupId>easymock</groupId>
>             <artifactId>easymock</artifactId>
>             <version>1.2_Java1.3</version>
>             <scope>test</scope>
>         </dependency>
> 
>         <dependency>
>             <groupId>easymock</groupId>
>             <artifactId>easymockclassextension</artifactId>
>             <version>1.1</version>
>             <scope>test</scope>
>         </dependency>
> 
> Kind regards,
> Dave Sag
> 
> 
> 
> 
> 
> 
> "Dennis Ho" <dho@paymentone.com> wrote on 28-12-2005 07:08:42:
> 
> > Hi,
> >
> >    I am in the process of migrating some existing maven tasks to
> > use maven 2.  We use mockobjects in our code for testing purposes,
and
> I
> > would like to know if anyone has experience using maven2 with
> > mockobjects can give me some pointer as to how the pom should look
> like.
> >
> >    When we did it with maven 1.x we have to use ant like the
> > following:
> >
> >     <ant:java
> > classname="de.abstrakt.tools.codegeneration.file.MockCreatorFile"
> >       fork="yes" failonerror="true"
> > classpathref="mockcreator.classpath">
> >
> >       <ant:arg line="-o
${maven.build.dir}/generated-sources/mocked"/>
> >       <!--       For each class to mock add one line with full
> > classname      -->
> >
> >       <ant:arg value="SomeClass"/>
> >
> >       <ant:classpath>
> >         <ant:pathelement path="${maven.build.dest}"/>
> >       </ant:classpath>
> >     </ant:java>
> >
> > Is there a more natural way to do it in Maven 2?   I can't find
> anything
> > from the web so any advice is welcome.
> >
> > Thanks in advance for your help!
> >
> > Regards,
> >
> > Dennis Ho.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message