This page lists scripts for testing the different parts of the Ibator UI. This information may also be helpful in learning how to use the different parts of the Eclipse user interface for Ibator.
root
is also root
drop schema if exists ibatortest; create schema ibatortest; use ibatortest; create table a (id int not null, description varchar(50), primary key(id)); create table b (id int not null, description varchar(50), primary key(id)); create table c (id int not null, description varchar(50), primary key(id)); create table d (id int not null, description varchar(50), primary key(id)); create table e (id int not null, description varchar(50), primary key(id)); create table f (id int not null, description varchar(50), primary key(id)); create table g (id int not null, description varchar(50), primary key(id)); create table h (id int not null, description varchar(50), primary key(id)); create table i (id int not null, description varchar(50), primary key(id)); create table j (id int not null, description varchar(50), primary key(id));
The following tests are intended to be executed in the order listed. Some tests build on items created in previous tests.
src
generatedsrc
src
folder called config
config
package<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd"> <ibatorConfiguration> <classPathEntry location="/JavaTools/mysql-connector-java-5.1.12/mysql-connector-java-5.1.12-bin.jar" /> <ibatorContext id="context1" targetRuntime="Ibatis2Java5" > <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/ibatortest" userId="root" password="root" > </jdbcConnection> <javaModelGenerator targetPackage="gen.model" targetProject="IbatorTest" /> <sqlMapGenerator targetPackage="gen.sql" targetProject="IbatorTest" /> <daoGenerator targetPackage="gen.dao" targetProject="IbatorTest" type="GENERIC-CI" /> <table tableName="a" /> </ibatorContext> <ibatorContext id="context2" targetRuntime="Ibatis2Java5" > <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/ibatortest" userId="root" password="root" > </jdbcConnection> <javaModelGenerator targetPackage="gen.src.model" targetProject="IbatorTest/generatedsrc" /> <sqlMapGenerator targetPackage="gen.src.sql" targetProject="IbatorTest/generatedsrc" /> <daoGenerator targetPackage="gen.src.dao" targetProject="IbatorTest/generatedsrc" type="GENERIC-SI" /> <table schema="ibatortest" tableName="%" /> </ibatorContext> </ibatorConfiguration>
<classPathEntry>
element
if different on your systemgen.dao.ADAOImpl.java
in the "src" folder@ibatorgenerated
commentsmergetest
and generate a getter and setter
for the field.gen.dao.ADAOImpl.java
in the "src" foldermergetest
, and its getter and setter remain
in the file (they will have been moved to the bottom of the file)context1
to SPRING
src.dao.ADAOImpl
now extends SqlMapClientDaoSupport
.
Note that there will be several errors in the workspace now because of the new dependencies
on Spring that were generated.context1
back to GENERIC-CI
src.dao.ADAOImpl
doesn't extend anything. There will be one
error in the file related to the Spring import (the Java merger does not reconcile all
imports). Delete the import and verify that there are no other errors in the
workspace. Also, verify that the field mergetest
and its
associated getter and setter still exist.<classPathEntry>
element from the file.build.xml
in the "IbatorTest/src/config" package.<project default="runIbator"> <target name="runIbator"> <eclipse.convertPath resourcepath="IbatorTest/src/config/ibatorConfig.xml" property="thePath"/> <ibator.generate configfile="${thePath}" > </ibator.generate> </target> </project>
gen.dao.ADAO.java
. There will now be errors in the
workspace.build.xml
file, then select the
menu option "Run As>Ant Build...". You should see the Ant launch configuration
dialog open.build.xml
file, then select the
menu option "Run As>Ant Build...". You should see the Ant launch configuration
dialog open.plugin
.plugin.TestPlugin
that extends
IbatorPluginAdapter
.validate
method so that it returns
true
.modelBaseRecordClassGenerated
method and make
the method match the following:
@Override public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("java.io.Serializable"); topLevelClass.addImportedType(fqjt); topLevelClass.addSuperInterface(fqjt); return true; }
plugin.TestPlugin
as a JAR file to "/Temp/TestPlugin.jar".
We need to export as a JAR file because Eclipse can't add class folders to an
Ant launch :(ibatorConfig.xml
file from the previous tests.<ibatorContext id="context1" targetRuntime="Ibatis2Java5" > <ibatorPlugin type="plugin.TestPlugin"/> ...
build.xml
file from the previous tests, then select the
menu option "Run As>Ant Build...". You should see the Ant launch configuration
dialog open.gen.model.A.java
now implements java.io.Serializable
.
Note that Eclipse may show a warning related to the missing serialVersionUID
field. This is expected and can be ignored.