Showing posts with label crud. Show all posts
Showing posts with label crud. Show all posts

Monday, January 6, 2014

how-to cloudbees minuteproject 4 openxava

Minuteproject releases a demo Openxava application to be hosted on cloudbees at http://petshopox.minuteproject.cloudbees.net/

Following those steps, you can recreate an Openxava application with minuteproject and host it on cloudbees.
All those steps are IDE-free (i.e. productivity oriented) all is done by command line!
This is a requirement for automation, since it is very easy to integrate with a CI tool such as Jenkins.
Meanwhile the code is compatible with Eclipse (for java), Mysql Workbench (for DB design + release) and Cloudbees website for manual release.

Principles

Generate an openxava application with minuteproject base on an DB structure.
The database use here is petshop; for the generation the database can be local or already hosted on cloudbees PaaS. At running the database is the one of the cloudbees PaaS.

The generated Openxava compliant artifacts are built into an Openxava application.
The application is to be deployed on a tomcat server.
The application relies on a JNDI Datasource on the tomcat server.

After setting the database on cloudbees and the connection pool cloudbees tomcat server, the application can be deployed.

Ingredients

Infrastructure

JDK 1.6+
Minuteproject last version
Openxava 4.9
Mysql DB
Tomcat
Cloudbees

  • sdk
  • account

Set up Cloudbees

Database

Create a mysql db schema on cloudbees
bees db:create petshopDB
   
Retrieve the DB info (connection info: server, port, user...) all you need to create you connection pool

bees app:info -db petshopDB 


Application

Create application

bees app:create -petshopox
     

Datasource

This is use get the alias use in the persistence.xml datasource (java:comp/env/jdbc/petshopDS)

bees app:bind -db petshopDB -a petshopox -as petshopDS 


Database setup

Run you database script from the information receive via $bees db:info -db petshopDB

Sample
mysql --host=ec2-50-19-213-178.compute-1.amazonaws.com --user=xxxx --password=xxxx --port=3306 xxx < petshop.sql
petshop-mysql.sql can be found in MP_HOME/sample/schema/

Generation

Full details at http://minuteproject.wikispaces.com/OpenXava
The generation is done by Minuteproject.
Minuteproject generation by command line comes by passing a configuration file name to model-generation.

Sample
model-generation petshop.xml

Sample petshop.xml configuration
<!DOCTYPE root>
<generator-config xmlns="http://minuteproject.sf.net/xsd/mp-config"
	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
	xs:noNamespaceSchemaLocation="mp-config.xsd">
	<!-- adapted for cloudbees petshop model -->
	<configuration>
		<conventions>
			<target-convention type="enable-updatable-code-feature" />
		</conventions>
		<model name="petshop" version="1.0" package-root="net.sf.mp.demo">
			<data-model>
				<driver name="mysql" version="5.1.16" groupId="mysql"
					artifactId="mysql-connector-java"></driver>
				<dataSource>
					<driverClassName>org.gjt.mm.mysql.Driver</driverClassName>
					<url>jdbc:mysql://localhost:3306/petshop</url>
					<username>root</username>
					<password>mysql</password>
				</dataSource>
				<primaryKeyPolicy oneGlobal="false">
					<primaryKeyPolicyPattern name="autoincrementPattern"></primaryKeyPolicyPattern>
				</primaryKeyPolicy>
			</data-model>
			<business-model>
				<generation-condition>
					<condition type="exclude" startsWith="DUAL"></condition>
					<condition type="exclude" startsWith="ID_GEN"></condition>
					<condition type="exclude" startsWith="SEQUENCE"></condition>
				</generation-condition>
				<business-package default="pet">
					<condition type="package" startsWith="PRODUCT" result="product"></condition>
					<condition type="package" startsWith="ITEM" result="product"></condition>
				</business-package>
				<enrichment>
					<conventions>
						<entity-naming-convention type="apply-strip-table-name-prefix"
							pattern-to-strip="SYS,FIN" />
						<reference-naming-convention
							type="apply-referenced-alias-when-no-ambiguity" is-to-plurialize="true"></reference-naming-convention>
					</conventions>
					<package name="product">
						<entity-group entities="PRODUCT"></entity-group>
						<entity-group entities="ITEM"></entity-group>
					</package>
					<entity name="PRODUCT" alias="MY_GOOD_PRODUCT">
					</entity>
					<entity name="ITEM" alias="MY_GOOD_ITEM" comment="my item table">
						<field name="PRODUCTID" alias="THIS_IS_MY_PRODUCT" comment="my product field reference"></field>
					</entity>
					<entity name="CATEGORY" content-type="reference-data">
						<field name="DESCRIPTION" ordering="asc" label="my description"
							is-searchable="true"></field>
						<field name="NAME" ordering="asc"></field>
					</entity>
					<entity name="TAG" content-type="reference-data">
						<field name="TAG" ordering="asc">
							<semantic-reference>
								<sql-path path="NAME" />
							</semantic-reference>
						</field>
					</entity>
				</enrichment>
			</business-model>
			<statement-model>
				<enrichment>
					<conventions>
						<sdd-dummy-primarykey-convention add="true" />
					</conventions>
				</enrichment>
				<queries>
					<query name="get address abstract" id="dashAddress" type="dashboard"
						category="pie-chart">
						<query-body> <!-- dimensions column first -->
							<value>
<![CDATA[select city, count(*) as nb from address group by city order by count(*) desc limit ?]]>
                            </value>
						</query-body>
						<query-params>
							<query-param name="top city" is-mandatory="false"
								type="INT" sample="37" default="10"></query-param>
						</query-params>
					</query>
					<query name="get address summary" id="dashCity" type="dashboard"
						category="bar-chart">
						<query-body> <!-- dimensions column first -->
							<value>
<![CDATA[select city, count(*) as nb, count(*) as nb2 from address group by city order by count(*) desc]]>
                            </value>
						</query-body>
					</query>
					<query name="get addresses by criteria" id="c">
						<query-body>
							<value>
<![CDATA[select * from address where lcase(city) like ?]]>
                            </value>
						</query-body>
						<query-params>
							<query-param name="city" type="STRING" sample="'S'"
								convert="lowercase,append%" default="%">
							</query-param>
						</query-params>
					</query>
				</queries>
			</statement-model>
		</model>
		<targets catalog-entry="OpenXava" >
			<property name="environment" value="remote"></property>
			<property name="cloud-platform" value="cloudbees"></property>
			<property name="embed-driver" value="true"></property>
		</targets>
	</configuration>
</generator-config>

Appart from the 'classical' enrichment facilities, the interesting point are the properties under the targets node:
name="environment" value="remote" 
Implies to use a connection pool (for persistence.xml)
name="cloud-platform" value="cloudbees" 
Performs additional build facilities for Openxava on cloudbees
The OX war has to hold jta.jar, ejb.jar, mysql driver jar.
  • jta.jar and ejb.jar are embedded in tomcat/lib on the OX delivery.
name="embed-driver" value="true" 

  • mysql driver jar is shipped on MP delivery

  • Remark: the last 2 options are available on Minuteproject 0.8.6

    Build

    On the generated directory
    set/export OX_HOME
    set/export MP_HOME
    Run

    build-petshop.cmd/sh

    The application petshop.war goes into OX_HOME/workspace/petshop.dist

    The application is ready to be deployed on Cloudbees.

    Deploy

    bees app:deploy -a petshopox -t tomcat7 -Rjava_version=1.7 petshop.war

    petshopox is the name of the application on cloudbees

    Enjoy

    Thursday, September 6, 2012

    Adding MP 4 ADF-BC-SDO track

    Intro

    In order to add a new track on minuteproject we have to understand the target architecture, the target architecture artifacts and the link between them.
    This article focuses on what contains ADF Faces project for manipulating (CRUD) RDBMS contains, and how are ADF Faces artifacts reference each other.
    The goal is to provide a MP 4 ADF roadmap: to have an ADF application very quickly based on reverse-engineering facilities of minuteproject using some navigation defaulting.
    On top of this a SDO stack can also be generated.
    This is a lean process so, comments are welcomed!

     

    Context

    I am a ADF newbie so point discussed here might changed.
    I start from what is generated by JDeveloper and follow the tutorials to create an ADF web app.

     

    ADF Model Artifact Overview

     When create a webapp 2 ADF projects are created: Model and ViewControler.
    This part focuses on the model artifacts.
    The following artifacts are placed under the technical package 'model'.
    The overview help defining the minuteproject artifact metadata.

    AppModule.xml

    It catalogs the views and view links usage.
    One Artifact per model, and has a fix name.

    Entity.xml

    Holds the description of the database entity, mapping information, keys with validation, accessorAttributes. Can be considered to some extends as Domain Objects.
    It is per DB entity, it does not depend of other xml artifacts.
    Can sometimes reference Impl.java that gives custom implementation.

    View-name.xml

    Correspond to a access (select) of some Domain Object, contains view attributes.
    It depends on .xml, it is referenced by AppModule.xml
    Multiple view can exist for an entity. So the question is how to deduce the name of the view.
    The view can be deduced:
    • a default one: with all selection
    • a reference one: based on the semantic reference of the entity
    • search ones: based on the fact that a field is searchable (entity enrichment in MP).

     Assoc.xml

     Define a relationship between entity, master part, cardinality...
    Is dependent on the .xml
    One per relationship

    View-link.xml

     Define the view of the Assoc.xml. 
    One per Assoc.xml file.
    Referenced in AppModule.xml

    Bundles artifacts for views 

    View can have bundles for internationalisation

    Other artifacts

    Model.jpx
    ModelBundle.properties


    ViewController artifacts overview


    Todo

    SDO artifacts overview

    At the view Level

    View-nameSDOImpl.java

    Linked to the view-name.xml

    View-nameSDO.java

    Linked to the view-name.xml

    View-nameSDO.xsd

    Linked to the view-name.xml


    Service interface

    At the application level

    AppModuleServiceImpl.java

    Java class
    Stateless webservice done with EJB and Oracle annotations

    AppModuleService.java

    Java interface
    JAX-WS annotation
    Defines methods of WS

    AppModuleService.wsdl

    Wsdl containing messages, portType, binding, services
    Importing static schema as well as AppModuleService.xsd

    AppModuleService.xsd

    xsd that import static oracle xsd as well as view-nameSDO.xsd
    defines types used in AppModuleService.wsdl

    ADF artifacts

    Todo

     

    References

    http://docs.oracle.com/cd/E18941_01/tutorials/toc.htm

    http://www.oracle.com/technetwork/developer-tools/adf/documentation/adf-faces-rc-demo-083799.html

    http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html

    http://go2kavinkumar.wordpress.com/2011/08/28/using-viewcriteria-in-find-operation-of-adf-bc-service/



    Saturday, February 25, 2012

    Productivity by example: Liferay with JOOQ

    This article shows how to use jOOQ for the Liferay data model.
    Minuteproject generates jOOQ artifacts for Liferay.
    The main interest of using minuteproject to generate jOOQ artefacts are 
    • Liferay database does not have any foreign key, but minuteproject is able to detect relationship based on patterns.
    •  Some DB naming convention might need to be adapted at Java level
      • DB tables ending with '_' will have underscore stripped
      • Column name ending with '_id' corresponding to PK or FK will have this particule stripped when not coliding with other variable
    • Code is updatable, meaning that you can change part of it or entirely and consecutive generation will keep your alterations
    For more information about the enrichment made on top of Liferay by minuteproject check another post targeting Liferay with JPA2.
    Here the reverse-engineering targets jOOQ framework and the configuration mentions jOOQ track reference

    Configuration
    mp-config-LIFERAY-JOOQ.xml
    <!DOCTYPE root>
    <generator-config>
     <configuration>
      <conventions>
       <target-convention type="enable-updatable-code-feature" />
      </conventions>
      <model name="liferay" version="1.0" package-root="net.sf.mp.demo">
       <data-model>
        <driver name="mysql" version="5.1.16" groupId="mysql"
         artifactId="mysql-connector-java"></driver>
        <dataSource>
         <driverClassName>org.gjt.mm.mysql.Driver</driverClassName>
         <url>jdbc:mysql://127.0.0.1:3306/lportal</url>
         <username>root</username>
         <password>mysql</password>
        </dataSource>
        <schema>lportal</schema>
        <primaryKeyPolicy oneGlobal="true">
         <primaryKeyPolicyPattern name="none"></primaryKeyPolicyPattern>
        </primaryKeyPolicy>
       </data-model>
       <business-model>
        <generation-condition>
         <condition type="exclude" startsWith="QUARTZ"></condition>
        </generation-condition>
        <enrichment>
         <conventions>
          <entity-naming-convention type="apply-strip-table-name-suffix"
           pattern-to-strip="_" />
          <!-- manipulate the structure and entities BEFORE manipulating the 
           entities -->
          <foreign-key-convention
           type="autodetect-foreign-key-based-on-similarity-and-map"
           column-ending="id" column-starting="" />
          <column-naming-convention type="apply-strip-column-name-suffix"
           pattern-to-strip="ID" />
          <reference-naming-convention
           type="apply-referenced-alias-when-no-ambiguity" is-to-plurialize="true" />
         </conventions>
        </enrichment>
       </business-model>
      </model>
      <targets>
       <target refname="JOOQ" name="JOOQ" fileName="mp-template-config-JOOQ.xml"
        outputdir-root="../../dev/JOOQ/liferay" templatedir-root="../../template/framework/jooq">
        <property name="jooq-version" value="2.0.4"></property>
       </target>
       <target refname="LIB" fileName="mp-template-config-bsla-LIB-features.xml"
        templatedir-root="../../template/framework/bsla">
       </target>
      </targets>
     </configuration>
    </generator-config>
    Execution
    Install Liferay mysql 6.0.6 running
    Download minuteproject
    Drop this config in /mywork/config
    And execute model-generation.(sh/cmd) mp-config-LIFERAY-JOOQ.xml

    Result 
    Artifacts
    The resulting artefacts are
    • A maven project with following dependencies
      • jOOQ
      • jUnit
      •  mysql drive
    • jOOQ artifacts
      • factory, keys, tables, records...
    • unit test
    The artifacts are generated in /dev/JOOQ/liferay
    If you build there will be a compilation error in jOOQ artifacts:
    Table 'expandotable' has a field call 'table' that collides with a Jooq method. 
    But just by altering the code to remove the compilation error and flaging to take into account this modification:
    In ExpandotableRecord 
    • Change getTable into getTable_ 
    • Exclude code from been overwritten: line 24 //MP-MANAGED-UPDATABLE-BEGINNING-ENABLE
     //MP-MANAGED-UPDATABLE-BEGINNING-ENABLE @jooq-record-pk-liferay@
     /**
      * An uncommented item
      * 
      * PRIMARY KEY
      */
        public void setTable(java.lang.Long value) {
            setValue(net.sf.mp.demo.liferay.tables.Expandotable.__EXPANDOTABLE.TABLE, value);
        }
     /**
      * An uncommented item
      * 
      * PRIMARY KEY
      */
        public java.lang.Long getTable_() {
            return getValue(net.sf.mp.demo.liferay.tables.Expandotable.__EXPANDOTABLE.TABLE);
        }
     //MP-MANAGED-UPDATABLE-ENDING
    
    
    Remark: Future version will handle this issue but it is interesting to see how the code can be customized without losing the productivity of consecutive generations.

    Eventually run: mvn clean package
    • A set of unittest are executed:
      • The default unit test consist to retrieve the first row of each entity.
    • A JOOQ package is released
    Code
    The code can be downloaded from minuteproject googlecode here.

    Sample
    Active record:
    Providing the Foreign key gives the ability to provide jOOQ records with some methods
    One to many
    //todo
    Testing

    /**
     * This class is generated by minuteproject 4 jOOQ
     */
    package net.sf.mp.demo.liferay.tables;
    
    import net.sf.mp.demo.liferay.tables.records.UserRecord;
    import net.sf.mp.demo.liferay.Liferay;
    import net.sf.mp.demo.liferay.Keys;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    
    import net.sf.mp.demo.liferay.LiferayFactory;
    import static net.sf.mp.demo.liferay.tables.User.__USER;
    
    import org.jooq.Record;
    import org.jooq.Result;
    import org.junit.Test;
    
    //MP-MANAGED-ADDED-AREA-BEGINNING @import@
    import static net.sf.mp.demo.liferay.tables.Company.__COMPANY;
    import static net.sf.mp.demo.liferay.tables.Account.__ACCOUNT;
    //MP-MANAGED-ADDED-AREA-ENDING @import@
    
    //MP-MANAGED-ADDED-AREA-BEGINNING @class-annotation@
    //MP-MANAGED-ADDED-AREA-ENDING @class-annotation@
    @javax.annotation.Generated(value = { "http://www.jooq.org", "2.0.4" }, comments = "This class is generated by minuteproject 4 jOOQ")
    public class TestUser {
    
     @Test
     public void testUser() {
      Connection conn = null;
      String userName = "root";
      String password = "mysql";
      String url = "jdbc:mysql://127.0.0.1:3306/lportal";
    
      try {
       Class.forName("org.gjt.mm.mysql.Driver").newInstance();
       conn = DriverManager.getConnection(url, userName, password);
       LiferayFactory create = new LiferayFactory(conn);
    
       // MP-MANAGED-UPDATABLE-BEGINNING-ENABLE
       // @jooq-unittest-testUser-liferay@
       // write your own tests, just set DISABLE to ENABLE in the comment
       // above
       // future generation will not erase your code ;)
       Result<Record> result = create
         .select(__USER.FIRSTNAME, __USER.LASTNAME, __COMPANY.WEB, __ACCOUNT.NAME)
         .from(__USER).join(__COMPANY)
         .on(__USER.COMPANY.equal(__COMPANY.COMPANY))
         .join(__ACCOUNT)
         .on(__COMPANY.ACCOUNT.equal(__ACCOUNT.ACCOUNT))
         .where(__COMPANY.WEB.like("%ray.com"))
         .orderBy(__USER.LASTNAME.asc().nullsFirst()).limit(10)
         .fetch();
       for (Record r : result) {
        String firstname = r.getValue(__USER.FIRSTNAME);
        String lastname = r.getValue(__USER.LASTNAME);
        String web = r.getValue(__COMPANY.WEB);
        String accountname = r.getValue(__ACCOUNT.NAME);
    
        System.out.println(" firstname : " + firstname + " lastname : "
          + lastname + " web : " + web + " accountname : "
          + accountname);
       }
       // MP-MANAGED-UPDATABLE-ENDING
    
      } catch (Exception e) {
       e.printStackTrace();
      } finally {
       if (conn != null) {
        try {
         conn.close();
        } catch (SQLException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
        }
       }
      }
     }
    
     // MP-MANAGED-ADDED-AREA-BEGINNING @implementation@
     // MP-MANAGED-ADDED-AREA-ENDING @implementation@
    
    }
    
    Giving at execution
     firstname :  lastname :  web : liferay.com accountname : Liferay
     firstname : Joe lastname : Bloggs web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 1 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 10 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 2 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 3 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 4 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 5 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 6 web : liferay.com accountname : Liferay
     firstname : Test lastname : DLC 7 web : liferay.com accountname : Liferay
    
    JOOQ quick review
    //todo
    • Typesafe query speeds up the development process
    • No ORM 
    • Focus on CRUD and complexe query 
    • No configuration loading meaning fast to test



    Monday, October 31, 2011

    FitNessize your JEE dev with minuteproject


    This article shows you how-to setup FitNesse in your development environment when dealing with Relation Database CRUD operations. MinuteProject 4 FitNesse generates entire set of FitNesse wiki pages and associated java fixtures allowing you to reset the database as well as performing intuitively CRUD operations on top of tables and Select on top of views.
    To illustrate this MinuteProject track, the Database used comes from the Lazuly showcase.
    The sources can be found under lazuly-fitnesse.
    This page will show you:
    • FitNesse + Minuteproject operating mechanism in Agile development
    • How-to Generate CRUD fixture
    • Integrate then in your own scenario to gain QA
    Overview




    Install FitNesse and Generate A Custom CRUD wiki for you model
    Prerequisites
    • Use Java 6
    • Install Lazuly DB (sql script here)
    Installation
    Download FitNesse
    Execute java -jar fitnesse.jar
    On a browser go to http://localhost to view the FitNesse wiki
    Generate a FitNesse wiki for your model
    • Download MinuteProject
    • Generate using the following minuteproject configuration script: mp-config-LAZULY-FITNESSE.xml
    • Set this script in /mywork/config and run generate-model.(cmd/sh) mp-config-LAZULY-FITNESSE.xml
    The mp-config-LAZULY-FITNESSE.xml configuration file
    <!DOCTYPE root>
    <generator-config>
     <configuration>
      <conventions>
       <target-convention type="enable-updatable-code-feature" />
      </conventions> 
      <model name="conference" version="1.0" package-root="net.sf.mp.demo">
       <data-model>
        <dataSource>
         <driverClassName>org.gjt.mm.mysql.Driver</driverClassName>
         <url>jdbc:mysql://127.0.0.1:3306/conference</url>
         <username>root</username>
         <password>mysql</password>
        </dataSource>
       </data-model>
       <business-model>
             <business-package default="conference">
                 <condition type="package" startsWith="STAT" result="statistics"></condition>
                 <condition type="package" startsWith="COUNTRY" result="admin"></condition>
                 <condition type="package" startsWith="ROLE" result="admin"></condition>        
             </business-package>   
        <enrichment>
         <conventions>
             <view-primary-key-convention 
                type="apply-default-primary-key-otherwise-first-one" 
                default-primary-key-names="ID" >
             </view-primary-key-convention>
         </conventions>
        </enrichment>
       </business-model>
      </model>
      <targets> 
       <target refname="FitNesse" 
          name="default" 
          fileName="mp-template-config-fitnesse.xml" 
          outputdir-root="D:/DEV/LAZULY/lazuly-fitnesse"
          templatedir-root="../../template/framework/fitnesse">
       </target> 
       <target refname="LIB" 
          fileName="mp-template-config-bsla-LIB-features.xml" 
          templatedir-root="../../template/framework/bsla">
       </target>
      </targets>  
    
     </configuration>
    </generator-config>
    
    What is generated
    Wiki Fixtures for CRUD operations


    Wiki source to be copied in your FitNesse Root Directory
















    FitNesse CRUD Wiki generated for you model.
    Pick-up the snippet you need to:
    • SetUp you DB model
    • Perform sanity check 
      • after X UCs in a scenario, are my data correctly stored?
    Lazuly FitNesse subwiki for select operations













    Details of Select wiki fixtures for view 'stat_mb_by_role'
     
















    Lazuly FitNesse subwiki for insert update delete operations











    Details of Insert, Update, Delete wiki fixtures for table 'address'















    Associated Java Fixture 























    Assemble for your need
    Build Java Fixture Project
    Compile the code in an IDE
    • add src-generated to your source directories
    • add MP 4 FitNesse depencies libraries
      • For the moment they are provided in MP package under /target/fitnesse/ and /target/fitnesse/dep
    • Lazuly-fitnesse is shipped with an eclipse project that compiles the code to /bin
    • The compilation directory is to be reference by the FitNesse wiki path directives.
    SetUp FitNesse Lazuly Wiki
    Althought MinuteProject provides CRUD wiki ready to use, the purpose of this section is to setup a custom wiki that will be used for your UC.
    • Create your FitNesse Application Wiki HomePage
      • Edit main page add a section called 'FitNesseLazulyScenario'
        • Add snippet [[Lazuly][FitNesse.LazulyScenario]]
    • Click on Lazuly ? or go to http://localhost/FitNesse.LazulyScenario
    • Compose a simple structure
      • Simple structure proposal
        • HomePage section (define the path to use)
        • Setup section (Used to reset DB)
        • Data Definition section (Used to define common variables referenced in scenario)
        • Populate section (Used to initialize DB with data)
        • Couple of UC section
    Write a sample scenario
    This scenario will populate couple of tables of the Lazuly DB and check if the result expected in the views is correct.
    HomePage section
    Defines 
    • different pages (SetUp, VariableDefinition, UC sections) 
    • classpath

     
    Setup section 
    • Reset Database
      • Reference Reset script executed by Scriptella (etl.xml)
        • Adapt the variable resetfilepathvar to point to your file path.
      • etl.xml references 3 sql script
        • reset_db.sql that proposed a Delete statement per table
          • It can be altered since the delete order might not be correct
          • In this case please add -- MP-MANAGED-STOP-GENERATING to prevent your modification to be lost for consecutive generation
        • insert_reference_data.sql
          • Add the data you wish
        • commit.sql that just perform a commit
    • Connection parameter to point to the database that include
      • DB URL
      • JDBC driver
      • Username
      • Password
    • All this code is generate in /ConferenceFitnesseWikiSetup/content.txt. It can also be copied from http://localhost/ConferenceFitnesseWikiSetup
     
    Variable Definition section
    Use Fitnesse directive !define to add relevant variable name for your scenario
    Those variables will be later refered in your UCs

    Populate section 
    The SetUp page is automatically included at the beginning of your scenario.
    But you have to reference the Variable Definition section. For that use the FitNesse directive !include (!include VariableDefinition)

    Pick-up CRUD snippet from MP generated FitNesse Wiki to create you own customed DB initialization.
    Insert reference data Country, Role
    Insert business data: Address, Conference, ConferenceMember






     

















    UC Check section
    Pick-up CRUD snippet from MP generated FitNesse Wiki to create you own customed DB initialization.
    In this case, I simply check that the data are stored correctly.
    There is a view that gather BI information and I use it to validate the correctness of the information.


















    Conclusion
    This example shows that you can have use very easily CRUD fitnesse fixture (Zero LOC of development are required) customized for your data model.
    To sum-up, here are the main points:
    • Reset DB
    • Initialize DB
    • Perform sanity check
    • Set-up FitNesse for your hadoc UCs for JEE data centric application


    MinuteProject Spin-offs
    At this point on you can guarante that the data retrieved from the view are correct.
    That means that you have QA on your model.
    If the views have a field containing unique values then you can benefit of MinuteProject spin-off i.e. use other track to generate out-of-the-box:
    • Web2.0 application in Openxava on top of views. See on this blog the following article 
    • REST application.
    • Web service application.
    For Real UCs
    Here the UCs demonstrated concern only CRUD operations on top of DB entities.
    2 next articles in prepartion will show how to integrate with:
    • JPA2 ORM backend
    • Spring/JPA/Hibernate backend
    Additional information
    MinuteProject 4 FitNesse