aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes using ant/junit for the assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "using ant/junit for the assignment" Watch "using ant/junit for the assignment" New topic
Author

using ant/junit for the assignment

Richard Yip
Greenhorn

Joined: Nov 24, 2002
Posts: 11
Hello,
I have just started the assignment about a month ago. I have learnt quite a lot from the previous threads posted.
I have setup my ant/junit environment and have created some tests for my lock/unlock tasks.
I have followed some of the previous threads idea of creating a bookFlight(int recordNumber, int numberOfSeats) method within a DataServer class that handles all the clients' requests for Data services.
Although each single bookFlight transaction works, my unittest that contains multiple concurrent clients calling the DataServer still have some problems. Any suggestions?
Meanwhile, I have started looking into the criteriaFind task.
I have a source tree that contains my source code and build tree which hold my compiled classes. My test code are in the same package as my source code.
I have a TestCase class that reads the db.db file for me to run my tests.
Just want to say that the ant/junit really speeds up coding/testing although it is a pain to setup initially. Took me a week as I am a ant greenhorn.
Richard
Bernhard Woditschka
Ranch Hand

Joined: Sep 16, 2002
Posts: 89
I had the same experience
Especially when it comes to sumbit the assignment the packaging automation with ant took away a lot of stress.
In addition to the Junit tests i wrote a small programm that changed random flights with random seats and then chaecked the value. I than started 6 clients that concurently talked to the server. Helped me to find bugs in the locking code and to gain confidence (after ~40000 transactions ) )
Bern
[ January 10, 2003: Message edited by: Bernhard Woditschka ]
[ January 10, 2003: Message edited by: Bernhard Woditschka ]
Richard Yip
Greenhorn

Joined: Nov 24, 2002
Posts: 11
Hello Bernhard,
I got some problems in configuring my build file for rmic to generate the stubs and skeletons from my server class.
I got the packages suncertify/db, suncertify/server and suncertify/client.
Here's what I did in my build.xml.
<target name="rmic" depends="compile"
description="Generate stubs and skeletons for the server">
<rmic classname="RemoteData" base="${build.class.dir}/suncertify/server/ /">
<classpath refid="test.compile.classpath"/>
</rmic>
</target>
The build.class.dir refers to my build dir which is from
<property name="build.dir" location="${basedir}/build" />
<property name="build.classes.dir" location="${build.dir}/classes" />
and my test.compile.classpath refers to
<path id="test.compile.classpath">
<!--path to testing libraries needed-->
<pathelement location="${junit.jar}" />
<pathelement location="${ant.optional.jar}" />
<!--path of complied source code needed-->
<pathelement location="${build.classes.dir}" />
</path>
and RemoteData is
public class RemoteData extends UnicastRemoteObject implements RemoteDataInterface {
and RemoteDataInterface is from the interface DataInterface that has all the common public methods of Data.
public interface RemoteDataInterface extends DataInterface {

Need your help in cracking this build.xml.
Thanks.

Richard
Bernhard Woditschka
Ranch Hand

Joined: Sep 16, 2002
Posts: 89
Hi,
haven't got the build file here at work, but I'll post you in the evening
Bern
Bernhard Woditschka
Ranch Hand

Joined: Sep 16, 2002
Posts: 89
I use a similar structure my rmic command is:

It compiles the Remote Implementation class in the classes folder to the stub and skel class fiels in the classes folder.
I hope this is of any help for you
Bern
[ January 16, 2003: Message edited by: Bernhard Woditschka ]
Richard Yip
Greenhorn

Joined: Nov 24, 2002
Posts: 11
Hello Bern,
Got it working! Thanks. Here's my rmic stuff.
<target name="rmic" depends="compile"
description="Generate stubs and skeletons for the server">
<rmic base="${build.classes.dir}"
classpath="test.complie.classpath"
classname="suncertify.server.RemoteData">
</rmic>
</target>

Richard
 
wood burning stoves
 
subject: using ant/junit for the assignment