Hi tmni,
About the authentication exception that you're getting, I cannot guess
neither cause nor solution, but I think the following source code could
be helpful.
The first point is the problem you're getting with the oracle driver
load. I think that the point is that you have not defined where Ant can
find the class that implements the driver. I've never used Oracle, but I
don't think it differs much on mysql. In the following source code you
can check that the .jar file where the driver is implemented is directly
pointed out by the classpath argument, so try adding the .jar file to
the classpath.
<sql
driver = "com.mysql.jdbc.Driver"
password = "pass"
url = "jdbc:mysql://127.0.0.1/"
userid = "pass"
autocommit = "true"
classpath = "${lib}/mysql-connector-java-5.0.4-bin.jar"
>
.
.
.
</sql>
Regarding now to the second problem to set the tests you want to be
executed, have a look at the code below, instead of dbunit I use Junit
as you can see, but I don't think they are very different.
As for the previous situation, you'll have to define a classpath from
which your tests will be compiled, and then, include them in a <fileset>
resource into the <batchtest> task.
The formatter elements that you can see over specify the output that the
junit task will produce.
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
classpath="${scripts}/tools/ant-junit.jar"
/>
<junit haltonfailure="no" printsummary="on" fork="yes">
<classpath >
<pathelement location="${build}"/>
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml" />
<batchtest todir="${results}" >
<fileset dir="${src}" includes="**/*Tests/Test*.java"/>
</batchtest>
</junit>
I hope it may help you.
Regards.
Carlos
tmni escribió:
I am relatively new to ant and am having trouble setting up a target to run a
series of junit tests.
These tests all run fine when I launch them via eclipse. But if I try to
run ant directly via command prompt, I get errors. First, I was getting
error like:
Error 'Unexpected failure during bean definition parsing in resource URL
[file:spring-misc-junit.xml] at:
Bean 'mailSender'; nested exception is java.lang.SecurityException: class
“javax.mail.AuthenticationFailedException”’s signer information does not
match signer information of other classes in the same package.
I thought it might have something to do with authenticating to database, so
tried adding the following
dbunit info. I got an error that there must be at least 1 step in a dbunit
task. I tried adding a task to do
an insert, but don't know why this would be necessary since the test
themselves set up the test data, accessing a test data xml file. Even with
that change, I get error that oracle driver cannot be loaded.
The tests use dbunit and the underlying database is Oracle (accessed via
Hibernate in application).
I can't figure out how to define the test target and I cannot find a sample
that does this. Does
anyone have a sample ant build file that runs junit tests that use
dbunit/hibernate/oracle combination??
<target name="test2" depends="init,compile">
<taskdef classpathref="project.class.path" name="dbunit"
classname="org.dbunit.ant.DbUnitTask" />
<dbunit driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@server:port:dbname"
userid="me"
password="password">
</dbunit>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]