Here is a small checklist, you need to have this:
Now, you must compile Gerbo and run it. The default xml file that will be read, is the one inside examples/portal.xml. You can change the target xml file inside build.xml.
The classes will be generated for package test.tester, you can also change this inside build.xml.
Compiling and running:
$ ant run
You should not receive any errors, neither compile time, neither run time. Send me an email if something occurs (remember to use jdk1.4).
This will create all necessaries directories, compile Gerbo, that is inside /src, and then generate some java classes, inside /generated/src.
Take a good look inside /generated/src, you will see some classes named as the tables from the xml file and some other ones. You will also realize that the classes have been javadoced 100%, with examples and good explanations, this is nice.
Now, before compiling and running the generated classes, we will need to setup the database.properties file. It is inside your /generated/src directory, if you didnt change the package name, follow inside /generated/src/test/tester/model/config/Database.properties.
# This will make the DatabaseBroker singleton be initilized with a property file with # the name of the vendor plus ".sql". Case sensitive. database.vendor=MySQL database.connection.driver=org.gjt.mm.mysql.Driver database.connection.string=jdbc:mysql://localhost/NAME?user=root&password=root # for the connection pool, not in use right now database.connection.pool=false database.connection.pool.min=5 database.connection.pool.max=20
You should change the database.connection.string property, to use your username and password name.
The user should have access to fully use the specified database named NAME. And the database NAME should be created by yourself, so log in MySQL and CREATE DATABASE NAME; or the name that you like most.
Now we can compile these classes, and run a JUnit test, (you can see it inside generated/src/test/tester/GerboTest.java).
This JUnit test case is generated exclusive for your xml file, when running it, it will create the tables, and then insert, delete, select and make some assertions based on the number of rows for each table, PRETTY cool.
$ ant run-generated
You should get:
..... Time: 1.021 OK (5 tests)
If you get something different from this, with an error, please send me an email. Remember to check first for your MySQL configuration,
the username and password must be valid, and the database must be already created.
If you would like, you can uncomment a line inside GerboTest.java, making a GUI test instead of a text based test:
junit.textui.TestRunner.run(GerboTest.class); // if you want a graphical front end // you can uncommnet the following line // or run your runner //junit.swingui.TestRunner.run(GerboTest.class);