ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r833758 - in /ibatis/java/ibator/trunk/core/ibator-core: ./ src/test/java/org/apache/ibatis/ibator/ src/test/resources/
Date Sat, 07 Nov 2009 20:36:15 GMT
Author: jgbutler
Date: Sat Nov  7 20:36:14 2009
New Revision: 833758

URL: http://svn.apache.org/viewvc?rev=833758&view=rev
Log:
[ibator] switch build to maven

Added:
    ibatis/java/ibator/trunk/core/ibator-core/pom.xml
    ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/IbatisGenerationTest.java
    ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/SqlScriptRunner.java
    ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java2.sql
    ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java5.sql
    ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java2.xml
    ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java5.xml
Modified:
    ibatis/java/ibator/trunk/core/ibator-core/   (props changed)

Propchange: ibatis/java/ibator/trunk/core/ibator-core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Nov  7 20:36:14 2009
@@ -0,0 +1 @@
+target

Added: ibatis/java/ibator/trunk/core/ibator-core/pom.xml
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/pom.xml?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/pom.xml (added)
+++ ibatis/java/ibator/trunk/core/ibator-core/pom.xml Sat Nov  7 20:36:14 2009
@@ -0,0 +1,129 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ibatis.ibator</groupId>
+  <artifactId>ibator-core</artifactId>
+  <packaging>jar</packaging>
+  <version>1.2.2-SNAPSHOT</version>
+  <name>Apache iBATIS Ibator</name>
+  <url>http://ibatis.apache.org/ibator.html</url>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.3</version>
+        <configuration>
+          <forkMode>once</forkMode>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+              <mainClass>org.apache.ibatis.ibator.api.IbatorRunner</mainClass>
+            </manifest>
+            <manifestEntries>
+              <url>${pom.url}</url>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+      	<groupId>org.apache.maven.plugins</groupId>
+      	<artifactId>maven-source-plugin</artifactId>
+      	<version>2.1</version>
+        <executions>
+          <execution>
+            <id>attach-sources</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>jar-no-fork</goal>
+            </goals>
+          </execution>
+        </executions>      	
+      </plugin>
+      
+      <plugin>
+      	<groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-4</version>
+        <configuration>
+          <descriptors>
+            <descriptor>src/main/assembly/main.xml</descriptor>
+          </descriptors>
+        </configuration>        
+      </plugin>
+      
+    </plugins>
+  </build>
+
+  <reporting>    
+    <plugins>  
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+      </plugin>      
+      <plugin>
+      	<groupId>org.codehaus.mojo</groupId>
+      	<artifactId>emma-maven-plugin</artifactId>
+      	<version>1.0-alpha-1</version>
+      </plugin>      
+    </plugins>      
+  </reporting>  
+  
+  <licenses>
+    <license>
+      <name>Apache 2</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://www.apache.org</url>
+  </organization>
+
+  <dependencies>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.13</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ant</groupId>
+      <artifactId>ant</artifactId>
+      <version>1.7.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.6</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.8.0.10</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/IbatisGenerationTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/IbatisGenerationTest.java?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/IbatisGenerationTest.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/IbatisGenerationTest.java
Sat Nov  7 20:36:14 2009
@@ -0,0 +1,72 @@
+package org.apache.ibatis.ibator;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ibatis.ibator.api.Ibator;
+import org.apache.ibatis.ibator.api.ProgressCallback;
+import org.apache.ibatis.ibator.api.VerboseProgressCallback;
+import org.apache.ibatis.ibator.config.IbatorConfiguration;
+import org.apache.ibatis.ibator.config.xml.IbatorConfigurationParser;
+import org.apache.ibatis.ibator.internal.DefaultShellCallback;
+import org.junit.Test;
+
+public class IbatisGenerationTest {
+
+    @Test
+    public void testGenerateIbatis2Java2() throws Exception {
+        SqlScriptRunner scriptRunner = new SqlScriptRunner(
+                this.getClass().getClassLoader().getResourceAsStream("CreateDbIbatis2Java2.sql"),
+                "org.hsqldb.jdbcDriver",
+                "jdbc:hsqldb:mem:aname",
+                "sa",
+                "");
+        
+        scriptRunner.executeScript();
+        
+        File file = new File("target/generated-sources/ibator/ibatis2/java2");
+        file.mkdirs();
+        
+        List<String> warnings = new ArrayList<String>();
+        IbatorConfigurationParser cp = new IbatorConfigurationParser(
+                warnings);
+        IbatorConfiguration config = cp.parseIbatorConfiguration(this.getClass().getClassLoader().getResourceAsStream("ibatorConfigIbatis2Java2.xml"));
+            
+        DefaultShellCallback shellCallback = new DefaultShellCallback(true);
+            
+        Ibator ibator = new Ibator(config, shellCallback, warnings);
+            
+        ProgressCallback progressCallback = new VerboseProgressCallback();
+            
+        ibator.generate(progressCallback, null, null);
+    }
+
+    @Test
+    public void testGenerateIbatis2Java5() throws Exception {
+        SqlScriptRunner scriptRunner = new SqlScriptRunner(
+                this.getClass().getClassLoader().getResourceAsStream("CreateDbIbatis2Java5.sql"),
+                "org.hsqldb.jdbcDriver",
+                "jdbc:hsqldb:mem:aname",
+                "sa",
+                "");
+        
+        scriptRunner.executeScript();
+        
+        File file = new File("target/generated-sources/ibator/ibatis2/java5");
+        file.mkdirs();
+        
+        List<String> warnings = new ArrayList<String>();
+        IbatorConfigurationParser cp = new IbatorConfigurationParser(
+                warnings);
+        IbatorConfiguration config = cp.parseIbatorConfiguration(this.getClass().getClassLoader().getResourceAsStream("ibatorConfigIbatis2Java5.xml"));
+            
+        DefaultShellCallback shellCallback = new DefaultShellCallback(true);
+            
+        Ibator ibator = new Ibator(config, shellCallback, warnings);
+            
+        ProgressCallback progressCallback = new VerboseProgressCallback();
+            
+        ibator.generate(progressCallback, null, null);
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/SqlScriptRunner.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/SqlScriptRunner.java?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/SqlScriptRunner.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-core/src/test/java/org/apache/ibatis/ibator/SqlScriptRunner.java
Sat Nov  7 20:36:14 2009
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2009 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ibatis.ibator;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.apache.ibatis.ibator.internal.util.StringUtility;
+
+/**
+ * This class is used to execute an SQL script before a code generation
+ * run.
+ * 
+ * @author Jeff Butler
+ */
+public class SqlScriptRunner {
+    private String driver;
+    private String url;
+    private String userid;
+    private String password;
+    private InputStream sourceFile;
+
+    public SqlScriptRunner(InputStream sourceFile, String driver, String url,
+            String userId, String password) throws Exception {
+        
+        if (!StringUtility.stringHasValue(driver)) {
+            throw new Exception("JDBC Driver is required");
+        }
+        
+        if (!StringUtility.stringHasValue(url)) {
+            throw new Exception("JDBC URL is required");
+        }
+        
+        this.sourceFile = sourceFile;
+        this.driver = driver;
+        this.url = url;
+        this.userid = userId;
+        this.password = password;
+    }
+
+    public void executeScript() throws Exception {
+
+        Connection connection = null;
+
+        try {
+            Class.forName(driver);
+            connection = DriverManager.getConnection(url, userid, password);
+
+            Statement statement = connection.createStatement();
+
+            BufferedReader br = new BufferedReader(new InputStreamReader(sourceFile));
+
+            String sql;
+
+            while ((sql = readStatement(br)) != null) {
+                statement.execute(sql);
+            }
+
+            closeStatement(statement);
+            connection.commit();
+            br.close();
+        } finally {
+            closeConnection(connection);
+        }
+    }
+
+    public String getDriver() {
+        return driver;
+    }
+
+    public void setDriver(String driver) {
+        this.driver = driver;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    private void closeConnection(Connection connection) {
+        if (connection != null) {
+            try {
+                connection.close();
+            } catch (SQLException e) {
+                // ignore
+                ;
+            }
+        }
+    }
+
+    private void closeStatement(Statement statement) {
+        if (statement != null) {
+            try {
+                statement.close();
+            } catch (SQLException e) {
+                // ignore
+                ;
+            }
+        }
+    }
+
+    private String readStatement(BufferedReader br) throws IOException {
+        StringBuffer sb = new StringBuffer();
+
+        String line;
+
+        while ((line = br.readLine()) != null) {
+            if (line.startsWith("--")) { //$NON-NLS-1$
+                continue;
+            }
+
+            if (!StringUtility.stringHasValue(line)) {
+                continue;
+            }
+
+            if (line.endsWith(";")) { //$NON-NLS-1$
+                sb.append(line.substring(0, line.length() - 1));
+                break;
+            } else {
+                sb.append(' ');
+                sb.append(line);
+            }
+        }
+
+        String s = sb.toString().trim();
+
+        return s.length() > 0 ? s : null;
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java2.sql
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java2.sql?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java2.sql
(added)
+++ ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java2.sql
Sat Nov  7 20:36:14 2009
@@ -0,0 +1,87 @@
+drop table FieldsOnly if exists;
+drop table PKOnly if exists;
+drop table PKFields if exists;
+drop table PKBlobs if exists;
+drop table PKFieldsBlobs if exists;
+drop table FieldsBlobs if exists;
+drop table "awful table" if exists;
+drop table BlobsOnly if exists;
+
+create table FieldsOnly (
+  IntegerField int,
+  DoubleField double,
+  FloatField float
+);
+
+create table PKOnly (
+  id int not null,
+  seq_num int not null,
+  primary key(id, seq_num)
+);
+
+create table PKFields (
+  id1 int not null,
+  id2 int not null,
+  firstName varchar(20),
+  lastName varchar(20),
+  dateField date,
+  timeField time,
+  timestampField timestamp,
+  decimal30Field decimal(3, 0),
+  decimal60Field decimal(6, 0),
+  decimal100Field decimal(10, 0),
+  decimal155Field decimal(15, 5),
+  wierd$Field int,
+  "birth date" date,
+  primary key (id1, id2)
+);
+
+create table PKBlobs (
+  id int not null,
+  blob1 longvarbinary,
+  blob2 longvarbinary,
+  primary key (id)
+);
+
+create table PKFieldsBlobs (
+  id1 int not null,
+  id2 int not null,
+  firstName varchar(20),
+  lastName varchar(20),
+  blob1 longvarbinary,
+  primary key (id1, id2)
+);
+
+create table FieldsBlobs (
+  firstName varchar(20),
+  lastName varchar(20),
+  blob1 longvarbinary,
+  blob2 longvarbinary
+);
+
+create table "awful table" (
+  "CuStOmEr iD" int generated by default as identity (start with 57) not null,
+  "customer id" int,
+  "first name" varchar(20) default 'Mabel',
+  "First Name" varchar(20),
+  "first Name" varchar(20),
+  first_name varchar(20),
+  firstName varchar(20),
+  "last name" varchar(20),
+  E_MAIL varchar(20),
+  _id1 int not null,
+  $id2 int not null,
+  id5_ int not null,
+  id6$ int not null,
+  id7$$ int not null,
+  EmailAddress varchar(30),
+  "from" varchar(30),
+  active bit not null,
+  primary key("CuStOmEr iD")
+);
+
+-- this table should be ignored, nothing generated
+create table BlobsOnly (
+  blob1 longvarbinary,
+  blob2 longvarbinary
+);

Added: ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java5.sql
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java5.sql?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java5.sql
(added)
+++ ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/CreateDbIbatis2Java5.sql
Sat Nov  7 20:36:14 2009
@@ -0,0 +1,106 @@
+drop table FieldsOnly if exists;
+drop table PKOnly if exists;
+drop table PKFields if exists;
+drop table PKBlobs if exists;
+drop table PKFieldsBlobs if exists;
+drop table FieldsBlobs if exists;
+drop table "awful table" if exists;
+drop table BlobsOnly if exists;
+drop table RegexRename if exists;
+drop table AnotherAwfulTable if exists;
+
+create table FieldsOnly (
+  IntegerField int,
+  DoubleField double,
+  FloatField float
+);
+
+create table PKOnly (
+  id int not null,
+  seq_num int not null,
+  primary key(id, seq_num)
+);
+
+create table PKFields (
+  id1 int not null,
+  id2 int not null,
+  firstName varchar(20),
+  lastName varchar(20),
+  dateField date,
+  timeField time,
+  timestampField timestamp,
+  decimal30Field decimal(3, 0),
+  decimal60Field decimal(6, 0),
+  decimal100Field decimal(10, 0),
+  decimal155Field decimal(15, 5),
+  wierd$Field int,
+  "birth date" date,
+  primary key (id1, id2)
+);
+
+create table PKBlobs (
+  id int not null,
+  blob1 longvarbinary,
+  blob2 longvarbinary,
+  primary key (id)
+);
+
+create table PKFieldsBlobs (
+  id1 int not null,
+  id2 int not null,
+  firstName varchar(20),
+  lastName varchar(20),
+  blob1 longvarbinary,
+  primary key (id1, id2)
+);
+
+create table FieldsBlobs (
+  firstName varchar(20),
+  lastName varchar(20),
+  blob1 longvarbinary,
+  blob2 longvarbinary
+);
+
+create table "awful table" (
+  "CuStOmEr iD" int generated by default as identity (start with 57) not null,
+  "customer id" int,
+  "first name" varchar(20) default 'Mabel',
+  "First Name" varchar(20),
+  "first Name" varchar(20),
+  first_name varchar(20),
+  firstName varchar(20),
+  "last name" varchar(20),
+  E_MAIL varchar(20),
+  _id1 int not null,
+  $id2 int not null,
+  id5_ int not null,
+  id6$ int not null,
+  id7$$ int not null,
+  EmailAddress varchar(30),
+  "from" varchar(30),
+  active bit not null,
+  primary key("CuStOmEr iD")
+);
+
+-- this table should be ignored, nothing generated
+create table BlobsOnly (
+  blob1 longvarbinary,
+  blob2 longvarbinary
+);
+
+create table RegexRename (
+  CUST_ID integer,
+  CUST_NAME varchar(30),
+  CUST_ADDRESS varchar(30),
+  ZIP_CODE char(5),
+  primary key(CUST_ID)
+);
+
+create table AnotherAwfulTable (
+  id int not null,
+  "select" varchar(30),
+  "insert" varchar(30),
+  "update" varchar(30),
+  "delete" varchar(30),
+  primary key(id)
+);

Added: ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java2.xml
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java2.xml?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java2.xml
(added)
+++ ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java2.xml
Sat Nov  7 20:36:14 2009
@@ -0,0 +1,166 @@
+<?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>
+  
+  <ibatorContext id="FlatJava2" targetRuntime="Ibatis2Java2" defaultModelType="flat">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.SqlMapConfigPlugin" >
+      <property name="targetPackage" value="generated.flat" />
+      <property name="targetProject" value="target/generated-sources/ibator/ibatis2/java2"
/>
+    </ibatorPlugin>
+    
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="generated.flat.java2.model" targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="generated.flat.java2.xml"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-SI" targetPackage="generated.flat.java2.dao"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="HierarchicalJava2" targetRuntime="Ibatis2Java2" defaultModelType="hierarchical">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="generated.hierarchical.java2.model" targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="generated.hierarchical.java2.xml"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="generated.hierarchical.java2.dao" 
targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="ConditionalJava2" targetRuntime="Ibatis2Java2" defaultModelType="conditional">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="generated.conditional.java2.model" targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="generated.conditional.java2.xml"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="SPRING" targetPackage="generated.conditional.java2.dao"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="miscellaneousTests" targetRuntime="Ibatis2Java2">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="generated.miscellaneous.model" targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="trimStrings" value="true" />
+      <property name="rootClass" value="org.apache.ibatis.ibator.systests.java2.miscellaneous.BaseClass"
/>
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="generated.miscellaneous.xml"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="generated.miscellaneous.dao"  targetProject="target/generated-sources/ibator/ibatis2/java2">
+      <property name="rootInterface" value="org.apache.ibatis.ibator.systests.java2.miscellaneous.BaseInterface"
/>
+      <property name="methodNameCalculator" value="EXTENDED"/>
+    </daoGenerator>
+
+    <table tableName="BlobsOnly" /> <!-- should generate a warning -->
+    <table tableName="NonExistantTable" /> <!-- should generate a warning -->
+    <table tableName="PKFields" domainObjectName="MyObject" alias="A" >
+      <ignoreColumn column="fred" /> <!-- should generate a warning -->
+      <ignoreColumn column="decimal30Field" />
+      <columnOverride column="datefield" property="startDate"/>
+      <columnOverride column="decimal155Field" javaType="java.lang.Double" />
+      <columnOverride column="decimal60Field" javaType="int" />
+      <columnOverride column="firstName" javaType="org.apache.ibatis.ibator.systests.java2.miscellaneous.FirstName"
+         typeHandler="org.apache.ibatis.ibator.systests.java2.miscellaneous.FirstNameTypeHandler"/>
+      <columnOverride column="timeField" javaType="org.apache.ibatis.ibator.systests.java2.miscellaneous.MyTime"
+         typeHandler="org.apache.ibatis.ibator.systests.java2.miscellaneous.MyTimeTypeHandler"/>
+    </table>
+  </ibatorContext>
+</ibatorConfiguration>

Added: ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java5.xml
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java5.xml?rev=833758&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java5.xml
(added)
+++ ibatis/java/ibator/trunk/core/ibator-core/src/test/resources/ibatorConfigIbatis2Java5.xml
Sat Nov  7 20:36:14 2009
@@ -0,0 +1,324 @@
+<?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>
+  <ibatorContext id="FlatJava5" targetRuntime="Ibatis2Java5" defaultModelType="flat">
+    <property name="suppressTypeWarnings" value="true" /> <!-- should be ignored
-->
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.SqlMapConfigPlugin" >
+      <property name="targetPackage" value="ibatortest.generated.flat" />
+      <property name="targetProject" value="target/generated-sources/ibator/ibatis2/java5"
/>
+    </ibatorPlugin>
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.flat.java5.model" targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.flat.java5.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.generated.flat.java5.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="FlatJava2" targetRuntime="Ibatis2Java2" defaultModelType="flat">
+    <property name="suppressTypeWarnings" value="true" />
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.flat.java2.model" targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.flat.java2.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-SI" targetPackage="ibatortest.generated.flat.java2.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="HierarchicalJava5" targetRuntime="Ibatis2Java5" defaultModelType="hierarchical">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.hierarchical.java5.model"
targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.hierarchical.java5.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="SPRING" targetPackage="ibatortest.generated.hierarchical.java5.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="HierarchicalJava2" targetRuntime="Ibatis2Java2" defaultModelType="hierarchical">
+    <property name="suppressTypeWarnings" value="true" />
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.hierarchical.java2.model"
targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.hierarchical.java2.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.generated.hierarchical.java2.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="ConditionalJava5" targetRuntime="Ibatis2Java5" defaultModelType="conditional">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.SerializablePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.conditional.java5.model" targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.conditional.java5.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-SI" targetPackage="ibatortest.generated.conditional.java5.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="ConditionalJava2" targetRuntime="Ibatis2Java2" defaultModelType="conditional">
+    <property name="suppressTypeWarnings" value="true" />
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.conditional.java2.model" targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.conditional.java2.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="SPRING" targetPackage="ibatortest.generated.conditional.java2.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="miscellaneousTests" targetRuntime="Ibatis2Java5">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.CaseInsensitiveLikePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.RenameExampleClassPlugin" >
+      <property name="searchString" value="Example$"/>
+      <property name="replaceString" value="Criteria"/>
+    </ibatorPlugin>
+
+    <commentGenerator>
+      <property name="suppressDate" value="true"/>
+    </commentGenerator>
+    
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.miscellaneous.model" targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="trimStrings" value="true" />
+      <property name="rootClass" value="ibatortest.execute.miscellaneous.BaseClass" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.miscellaneous.xml"  targetProject="target/generated-sources/ibator/ibatis2/java5">
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.generated.miscellaneous.dao"
 targetProject="target/generated-sources/ibator/ibatis2/java5"
+        implementationPackage="ibatortest.generated.miscellaneous.dao.impl">
+      <property name="rootInterface" value="ibatortest.execute.miscellaneous.BaseInterface"
/>
+      <property name="methodNameCalculator" value="EXTENDED"/>
+    </daoGenerator>
+
+    <table tableName="BlobsOnly" /> <!-- should generate a warning -->
+    <table tableName="NonExistantTable" /> <!-- should generate a warning -->
+    <table tableName="PKFields" domainObjectName="MyObject" alias="A" >
+      <ignoreColumn column="fred" /> <!-- should generate a warning -->
+      <ignoreColumn column="decimal30Field" />
+      <columnOverride column="datefield" property="startDate"/>
+      <columnOverride column="decimal155Field" javaType="java.lang.Double" />
+      <columnOverride column="decimal60Field" javaType="int" />
+      <columnOverride column="firstName" javaType="ibatortest.execute.miscellaneous.FirstName"
+         typeHandler="ibatortest.execute.miscellaneous.FirstNameTypeHandler"/>
+      <columnOverride column="timeField" javaType="ibatortest.execute.miscellaneous.MyTime"
+         typeHandler="ibatortest.execute.miscellaneous.MyTimeTypeHandler"/>
+    </table>
+    <table tableName="RegexRename">
+      <columnRenamingRule searchString="^CUST" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="miscellaneousTests_NoDAO" targetRuntime="Ibatis2Java5">
+    <property name="autoDelimitKeywords" value="true" />
+    
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.miscellaneous.model" targetProject="target/generated-sources/ibator/ibatis2/java5">
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.miscellaneous.xml"
+                     targetProject="target/generated-sources/ibator/ibatis2/java5"/>
+
+    <table tableName="AnotherAwfulTable" />
+  </ibatorContext>
+</ibatorConfiguration>



Mime
View raw message