The Source for Java Technology Collaboration

As the new Java.net infrastructure contains project-level wikis, this main wiki will be shut down in the near future. For wiki page export and general wiki questions please contact the site admin at communitymanager@java.net.
InfinityMetrics Continuous Integration and Test-Driven Development Process

Maintained by Marcello de Sales

Please, before continuing make sure you have updated your system with the most updated required artifacts. Go to the following issues and do the required configurations. If you are here and wants to find more about the Data layer (ORM PROPEL) and how to use the CRUD, you can:

* go to the basics at persisting objects 
http://propel.phpdb.org/docs/user_guide/chapters/ManipulatingObjects.html

* go to the basics on finding objects 
http://propel.phpdb.org/docs/user_guide/chapters/FindingObjects.html

ALSO USE THE ONLINE CRITERIA BUILDER
http://propel.jondh.me.uk/criteria/analyse

* go to the basics on object relationships 
http://propel.phpdb.org/docs/user_guide/chapters/Relationships.html

* go to the advanced object model 
http://propel.phpdb.org/docs/user_guide/chapters/AdvancedObjectModel.html

91      ORM-CRUD Framework PEAR PROPEL not working during installation
115    Propel deployment NOT CONFIGURED PROPERLY

Other bugs were solved for propel to run properly. In case of problems, please make sure you have the following patches applied:

* Replace PHPObjectBuilder .php at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\propel\engine\builder\om\php5 with the version at C:\ppm8-dev\thirdparty\propel *

* Replace propel-gen from C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear with the version at C:\ppm8-dev\thirdparty\propel *

The Building System, first step on ORM and patches

1. Run SVN update on the root directory of the trunk directory

2. You will notice a few different artifacts: build.xml, build.properties, /trunk/propel

3. Execute the follow command in the prompt: phing build

Buildfile: C:\ppm8-dev\build.xml
 [property] Loading C:\ppm8-dev\build.properties
 [property] Loading C:\ppm8-dev\propel\build.properties

InfinityMetrics > prepare:

     [echo] Phing is working then...

InfinityMetrics > build:

[phingcall] Calling Buildfile 'C:\ppm8-dev\build.xml' with target 'propel-creole'
 [property] Loading C:\ppm8-dev\build.properties
 [property] Loading C:\ppm8-dev\propel\build.properties

InfinityMetrics > prepare-creole:

   [delete] Deleting 2 files from C:\ppm8-dev\propel

InfinityMetrics > propel-creole:

     [echo] Generating XML schema with Propel Creole
     [exec] Executing command: propel-gen C:\ppm8-dev/propel creole 2>&1
     [exec] Buildfile: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\pear-build.xml
     [exec] [resolvepath] Resolved C:\ppm8-dev/propel to C:\ppm8-dev\propel
     [exec] 
     [exec] propel-project-builder > projdircheckExists:
     [exec] 
     [exec] 
     [exec] propel-project-builder > projdircheck:
     [exec] 
     [exec] 
     [exec] propel-project-builder > configure:
     [exec] 
     [exec]      [echo] Loading project-specific props from C:\ppm8-dev/propel/build.properties
     [exec]  [property] Loading C:\ppm8-dev\propel\build.properties
     [exec] 
     [exec] propel-project-builder > creole:
     [exec] 
     [exec]     [phing] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'creole'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > creole:
     [exec] 
     [exec]      [echo] +-----------------------------------------------+
     [exec]      [echo] |                                               |
     [exec]      [echo] | Generating XML from Creole connection !       |
     [exec]      [echo] |                                               |
     [exec]      [echo] +-----------------------------------------------+
     [exec] [propel-creole-transform] Propel - CreoleToXMLSchema starting
     [exec] [propel-creole-transform] Your DB settings are:
     [exec] [propel-creole-transform] driver : (default)
     [exec] [propel-creole-transform] URL : mysql://root:1234@localhost/im
     [exec] [propel-creole-transform] DB connection established
     [exec] [propel-creole-transform] Processing database
     [exec] [propel-creole-transform] Processing table: channel
     [exec] [propel-creole-transform] Processing table: custom_event
     [exec] [propel-creole-transform] Processing table: custom_event_entry
     [exec] [propel-creole-transform] Processing table: event
     [exec] [propel-creole-transform] Processing table: institution
     [exec] [propel-creole-transform] Processing table: project
     [exec] [propel-creole-transform] Processing table: user
     [exec] [propel-creole-transform] Processing table: user_x_institution
     [exec] [propel-creole-transform] Processing table: user_x_project
     [exec] [propel-creole-transform] Processing table: workspace
     [exec] [propel-creole-transform] Processing table: workspace_share
     [exec] [propel-creole-transform] Writing XML to file: C:\ppm8-dev\propel/schema.xml
     [exec] [propel-creole-transform] Propel - CreoleToXMLSchema finished
     [exec] 
     [exec] BUILD FINISHED
     [exec] 
     [exec] Total time: 2.8077 seconds
     [exec] 
[phingcall] Calling Buildfile 'C:\ppm8-dev\build.xml' with target 'propel-gen'
 [property] Loading C:\ppm8-dev\build.properties
 [property] Loading C:\ppm8-dev\propel\build.properties

InfinityMetrics > prepare-propel-gen:

   [delete] Deleting 59 files from C:\ppm8-dev\app\classes\infinitymetrics\orm

InfinityMetrics > propel-gen:

     [echo] Generating OOP classes with Propel-gen
     [exec] Executing command: propel-gen C:\ppm8-dev/propel 2>&1
     [exec] Buildfile: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\pear-build.xml
     [exec] [resolvepath] Resolved C:\ppm8-dev/propel to C:\ppm8-dev\propel
     [exec] 
     [exec] propel-project-builder > projdircheckExists:
     [exec] 
     [exec] 
     [exec] propel-project-builder > projdircheck:
     [exec] 
     [exec] 
     [exec] propel-project-builder > configure:
     [exec] 
     [exec]      [echo] Loading project-specific props from C:\ppm8-dev/propel/build.properties
     [exec]  [property] Loading C:\ppm8-dev\propel\build.properties
     [exec] 
     [exec] propel-project-builder > main:
     [exec] 
     [exec]     [phing] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'main'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > mysqli-check:
     [exec] 
     [exec] 
     [exec] propel > main:
     [exec] 
     [exec] [phingcall] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'sql'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > check-run-only-on-schema-change:
     [exec] 
     [exec] 
     [exec] propel > sql-check:
     [exec] 
     [exec] 
     [exec] propel > pgsql-quoting-check:
     [exec] 
     [exec] 
     [exec] propel > mysqli-check:
     [exec] 
     [exec] 
     [exec] propel > sql:
     [exec] 
     [exec]      [echo] +------------------------------------------+
     [exec]      [echo] |                                          |
     [exec]      [echo] | Generating SQL for YOUR Propel project!  |
     [exec]      [echo] |                                          |
     [exec]      [echo] +------------------------------------------+
     [exec] [phingcall] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'sql-template'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > sql-template:
     [exec] 
     [exec] [propel-sql] Processing: schema.xml
     [exec] [propel-sql] Writing to SQL file: C:\ppm8-dev\app\classes\infinitymetrics\orm\sql\schema.sql
     [exec] [propel-sql]    + channel [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + custom_event [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + custom_event_entry [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + event [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + institution [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + project [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + user [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + user_x_institution [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + user_x_project [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + workspace [builder: MysqlDDLBuilder]
     [exec] [propel-sql]    + workspace_share [builder: MysqlDDLBuilder]
     [exec] [phingcall] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'om'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > check-run-only-on-schema-change:
     [exec] 
     [exec] 
     [exec] propel > om-check:
     [exec] 
     [exec] 
     [exec] propel > mysqli-check:
     [exec] 
     [exec] 
     [exec] propel > om:
     [exec] 
     [exec]      [echo] +------------------------------------------+
     [exec]      [echo] |                                          |
     [exec]      [echo] | Generating Peer-based Object Model for   |
     [exec]      [echo] | YOUR Propel project!                     |
     [exec]      [echo] |                                          |
     [exec]      [echo] +------------------------------------------+
     [exec] [phingcall] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'om-template'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > om-template:
     [exec] 
     [exec] [propel-om] Processing: schema.xml
     [exec] [propel-om] Processing Datamodel : schema.xml
     [exec] [propel-om]   - processing database : im
     [exec] [propel-om]    + channel
     [exec] [propel-om]       -> PersistentBaseChannelPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseChannel [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentChannelMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentChannelPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentChannel [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + custom_event
     [exec] [propel-om]       -> PersistentBaseCustomEventPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseCustomEvent [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentCustomEventMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentCustomEventPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentCustomEvent [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + custom_event_entry
     [exec] [propel-om]       -> PersistentBaseCustomEventEntryPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseCustomEventEntry [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentCustomEventEntryMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentCustomEventEntryPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentCustomEventEntry [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + event
     [exec] [propel-om]       -> PersistentBaseEventPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseEvent [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentEventMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentEventPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentEvent [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + institution
     [exec] [propel-om]       -> PersistentBaseInstitutionPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseInstitution [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentInstitutionMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentInstitutionPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentInstitution [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + project
     [exec] [propel-om]       -> PersistentBaseProjectPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseProject [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentProjectMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentProjectPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentProject [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + user
     [exec] [propel-om]       -> PersistentBaseUserPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseUser [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentUserMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentUserPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentUser [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + user_x_institution
     [exec] [propel-om]       -> PersistentBaseUserXInstitutionPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseUserXInstitution [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentUserXInstitutionMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentUserXInstitutionPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentUserXInstitution [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + user_x_project
     [exec] [propel-om]       -> PersistentBaseUserXProjectPeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseUserXProject [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentUserXProjectMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentUserXProjectPeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentUserXProject [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + workspace
     [exec] [propel-om]       -> PersistentBaseWorkspacePeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseWorkspace [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentWorkspaceMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentWorkspacePeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentWorkspace [builder: PHP5ExtensionObjectBuilder]
     [exec] [propel-om]    + workspace_share
     [exec] [propel-om]       -> PersistentBaseWorkspaceSharePeer [builder: PHP5PeerBuilder]
     [exec] [propel-om]       -> PersistentBaseWorkspaceShare [builder: PHP5ObjectBuilder]
     [exec] [propel-om]       -> PersistentWorkspaceShareMapBuilder [builder: PHP5MapBuilderBuilder]
     [exec] [propel-om]       -> PersistentWorkspaceSharePeer [builder: PHP5ExtensionPeerBuilder]
     [exec] [propel-om]       -> PersistentWorkspaceShare [builder: PHP5ExtensionObjectBuilder]
     [exec] [phingcall] Calling Buildfile 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\build-propel.xml' with target 'convert-conf'
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\build.properties
     [exec]  [property] Loading C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\data\propel_generator\.\default.properties
     [exec] 
     [exec] propel > convert-conf:
     [exec] 
     [exec]      [echo] +------------------------------------------+
     [exec]      [echo] |                                          |
     [exec]      [echo] | Converting runtime config file to an     |
     [exec]      [echo] | array dump for improved performance.     |
     [exec]      [echo] |                                          |
     [exec]      [echo] +------------------------------------------+
     [exec]      [echo] Output file: om-conf.php
     [exec]      [echo] XMLFile: C:\ppm8-dev\propel/runtime-conf.xml
     [exec] [propel-convert-conf] Processing: schema.xml
     [exec] [propel-convert-conf] Adding class mapping: PersistentChannelMapBuilder => infinitymetrics/orm/map/PersistentChannelMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentChannelPeer => infinitymetrics/orm/PersistentChannelPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentChannel => infinitymetrics/orm/PersistentChannel.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentCustomEventMapBuilder => infinitymetrics/orm/map/PersistentCustomEventMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentCustomEventPeer => infinitymetrics/orm/PersistentCustomEventPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentCustomEvent => infinitymetrics/orm/PersistentCustomEvent.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentCustomEventEntryMapBuilder => infinitymetrics/orm/map/PersistentCustomEventEntryMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentCustomEventEntryPeer => infinitymetrics/orm/PersistentCustomEventEntryPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentCustomEventEntry => infinitymetrics/orm/PersistentCustomEventEntry.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentEventMapBuilder => infinitymetrics/orm/map/PersistentEventMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentEventPeer => infinitymetrics/orm/PersistentEventPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentEvent => infinitymetrics/orm/PersistentEvent.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentInstitutionMapBuilder => infinitymetrics/orm/map/PersistentInstitutionMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentInstitutionPeer => infinitymetrics/orm/PersistentInstitutionPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentInstitution => infinitymetrics/orm/PersistentInstitution.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentProjectMapBuilder => infinitymetrics/orm/map/PersistentProjectMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentProjectPeer => infinitymetrics/orm/PersistentProjectPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentProject => infinitymetrics/orm/PersistentProject.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserMapBuilder => infinitymetrics/orm/map/PersistentUserMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserPeer => infinitymetrics/orm/PersistentUserPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUser => infinitymetrics/orm/PersistentUser.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserXInstitutionMapBuilder => infinitymetrics/orm/map/PersistentUserXInstitutionMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserXInstitutionPeer => infinitymetrics/orm/PersistentUserXInstitutionPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserXInstitution => infinitymetrics/orm/PersistentUserXInstitution.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserXProjectMapBuilder => infinitymetrics/orm/map/PersistentUserXProjectMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserXProjectPeer => infinitymetrics/orm/PersistentUserXProjectPeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentUserXProject => infinitymetrics/orm/PersistentUserXProject.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentWorkspaceMapBuilder => infinitymetrics/orm/map/PersistentWorkspaceMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentWorkspacePeer => infinitymetrics/orm/PersistentWorkspacePeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentWorkspace => infinitymetrics/orm/PersistentWorkspace.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentWorkspaceShareMapBuilder => infinitymetrics/orm/map/PersistentWorkspaceShareMapBuilder.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentWorkspaceSharePeer => infinitymetrics/orm/PersistentWorkspaceSharePeer.php
     [exec] [propel-convert-conf] Adding class mapping: PersistentWorkspaceShare => infinitymetrics/orm/PersistentWorkspaceShare.php
     [exec] [propel-convert-conf] Creating PHP runtime conf file: C:\ppm8-dev\app\classes\infinitymetrics\orm\config\om-conf.php
     [exec] [propel-convert-conf] Creating PHP classmap runtime file: C:\ppm8-dev\app\classes\infinitymetrics\orm\config\om-classmap.php
     [exec] 
     [exec] BUILD FINISHED
     [exec] 
     [exec] Total time: 23.4395 seconds
     [exec] 
[phingcall] Calling Buildfile 'C:\ppm8-dev\build.xml' with target 'apply-patches'
 [property] Loading C:\ppm8-dev\build.properties
 [property] Loading C:\ppm8-dev\propel\build.properties

InfinityMetrics > apply-patches:

     [echo] Applying patches (just overriding)
     [copy] Copying 7 files to C:\ppm8-dev

BUILD FINISHED

Total time: 34.2519 seconds

This build system generates all the necessary ORM artifacts and classes necessary to connect the Data and the Model using PROPEL. It reads the database configuration in the build.properties and connects to MySQL in order to read the database and extract the database tables in the infinitymetrics database. In the end of the process, it generates the ORM classes in the following directory:

/trunk/app/classes/infinitymetrics/orm

It also uses the patches to update PropelGenerated files in case you need to add functionality, such as Retrieve users by email, etc (example provided under the /trunk/patches)

Note that this directory is NOT under revision control, and therefore, under SVN IGNORE list.

Updating your Model Classes to be Persistent

4. In your Model class, extend the PersistentClass counterpart. For example, User class extends PersistentUser . Note that the class PersistentUser was the one automatically generated from Propel.

5. Delete all the getters/setters for the attributes that are available at the persistent classes, but keep the ones that are necessary for the customization of the classes.

For classes that MUST be generalized, e.g. Student extends User or Instructor extends User, the OOP->DB strategy used by Propel is One class per entire class hierarchy. In this way, the Student class for example looks like this one:

require_once 'infinitymetrics/model/user/User.class.php';
/**
 * The Student class for the metrics workspace.
 *
 * @author Gurdeep Singh <gurdeepsingh03@gmail.com>
 * @author Marcello de Sales <marcello.sales@gmail.com>
 *
 * Student class with support to Persistence.
 */
class Student extends User {

    public function  __construct() {
        parent::__construct();
        $this->setType("S");
    }
}

Testing your Persistent Model Classes with System Tests

Although we still use Unit Tests to verify in-memory object integrity, at this point Unit Tests are only necessary to Test methods like equals, compare, etc, used during execution time.

System Tests are used to test the persistent scenarios. They are NEEDED to test the persistence scenarios of the most specific classes. For example, only the classes Student and Instructor needs to be tested, as they will be also exercising the User class.

6. Look at the notes on the wiki http://wiki.java.net/bin/view/Projects/PhpTestCases#System_Tests_for_the_Persistent for more information. Here's an example of the Student System Tests.

<?php
require_once 'propel/Propel.php';
Propel::init('infinitymetrics/orm/config/om-conf.php');

require_once 'PHPUnit/Framework.php';
require_once 'infinitymetrics/model/institution/Student.class.php';
require_once 'infinitymetrics/model/institution/Institution.class.php';
require_once 'infinitymetrics/orm/PersistentUserPeer.php';
require_once 'infinitymetrics/orm/PersistentInstitutionPeer.php';
/**
 * Tests for the Student class.
 *
 * @author Marcello de Sales <marcello.sales@gmail.com>
 */
class StudentSystemTest extends PHPUnit_Framework_TestCase {

    private $student;
    private $institution;

    const USERNAME = "marcellosales";
    const INST_ABBREVIATION = "SFSU";

    private function deleteUser() {
        echo "\nDeleting the user and institution for setting up";
        $crit = new Criteria();
        $crit->add(PersistentUserPeer::JN_USERNAME, self::USERNAME);
        PersistentUserPeer::doDelete($crit);

        $crit->add(PersistentInstitutionPeer::ABBREVIATION, self::INST_ABBREVIATION);
        PersistentUserPeer::doDelete($crit);
    }

    protected function setUp() {
        parent::setUp();
        $this->deleteUser();
        echo "Setting up new student\nObject only in MEMORY\n";
        $this->student = new Student();
        $this->student->setFirstName("Marcello");
        $this->student->setLastName("de Sales");
        $this->student->setEmail("marcello.sales@gmail.com");
        $this->student->setJnUsername(self::USERNAME);
        $this->student->setJnPassword("blabalbal");

        $this->institution = new Institution();
        $this->institution->setName("San Francisco State University");
        $this->institution->setAbbreviation(self::INST_ABBREVIATION);
        $this->institution->setCity("San Francisco");
        $this->institution->setStateProvince("California");
        $this->institution->setCountry("United States");

        $this->student->setInstitution($this->institution);
    }

    public function testCreationAndRetrival() {
        echo "Object to be saved on DB\n";
        $this->student->save();
        $userDb = PersistentUserPeer::retrieveByEmail("marcello.sales@gmail.com");
        $this->assertNotNull($userDb);
        $this->assertTrue($this->student->equals($userDb), 
                              "Persistent and transient students are different");
    }

    public function testCreationWithExistingUser() {
        $otheruser = new Student();
        try {
            $otheruser->setFirstName("Other");
            $otheruser->setLastName("Student");
            $otheruser->setEmail("marcello.sales@gmail.com");
            $otheruser->setJnUsername(self::USERNAME);
            $otheruser->setJnPassword("blabalbal");
            $otheruser->setInstitution($this->institution);

            $otheruser->save();
            $this->fail("The user should not be created with the 
                                                                            same username...");
        } catch (Exception $e) {
            $this->assertNotNull($e, "The exception is not created");
        }
        try {
            $otheruser->setFirstName("Other");
            $otheruser->setLastName("Student");
            //same username
            $otheruser->setEmail("marcello.sales@gmail.com");
            $otheruser->setJnUsername("otherusername");
            $otheruser->setJnPassword("blabalbal");
            $otheruser->setInstitution($this->institution);

            $otheruser->save();
            $this->fail("The user should not be created with the same 
                                                                      email address...");
        } catch (Exception $e) {
            $this->assertNotNull($e, "The exception is not created");
        }
    }

    public function testUserUpdateWithAndWithValidAndInvalidDataAndDelete() {
        $this->student->save();
        $otherUsername = "gurdeep";
        $otherEmail = "differentemail@email.com";
        $otheruser = new Student();
        //testing the user save and update with correct and incorrect values
        try {
            $otheruser->setFirstName("Other");
            $otheruser->setLastName("Student");
            $otheruser->setEmail($otherEmail);
            $otheruser->setJnUsername($otherUsername);
            $otheruser->setJnPassword("blabalbal");
            $otheruser->setInstitution($this->institution);
            $otheruser->save();
            //Saves ok
            $userDb = PersistentUserPeer::retrieveByEmail($otherEmail);
            $this->assertNotNull($userDb);
            $this->assertTrue($otheruser->equals($userDb), 
                                "Persistent and transient students are different");

            $otheruser->setJnUsername(self::USERNAME);
            $otheruser->save();
            $this->fail("The otheruser should not be created with the same 
                               username as another user ".self::USERNAME);
        } catch (Exception $e) {
            $this->assertNotNull($e, "The exception is not created");
        }
        //testing the deletion of the user by username
        $crit = new Criteria();
        $crit->add(PersistentUserPeer::JN_USERNAME, 
                                                                   $otherUsername);
        PersistentUserPeer::doDelete($crit);

        $userDb = PersistentUserPeer::retrieveByJNUsername($otherUsername);
        $this->assertNull($userDb, "The user ".$userDb." 
                  should not have been deleted from the database");
    }

    protected function tearDown() {
        echo "Tearing down...";
        $this->student->delete();
    }
}
?>

Here's the execution for this test case:

C:\ppm8-dev\app\classes\infinitymetrics\tests\system\user>phpunit StudentSystemTest.class
PHPUnit 3.3.1 by Sebastian Bergmann.

Deleting the user and institution for setting upSetting up new student
Object only in MEMORY
Object to be saved on DB
Tearing down....Deleting the user and institution for setting upSetting up new student
Object only in MEMORY
Tearing down....Deleting the user and institution for setting upSetting up new student
Object only in MEMORY
Tearing down....

Time: 2 seconds

OK (3 tests, 8 assertions)

It is extremely important that you perform "smoke" tests and run a new "regression" tests before committing the changed source-code to the Subversion repository. This will show that you haven't broken any previously developed code. Specially because PHP is not a Strong-Typed programming language.

Run the command "phing tests-report" to run all the previous-defined source-code.

C:\ppm8-dev>phing tests-report

Buildfile: C:\ppm8-dev\build.xml
 [property] Loading C:\ppm8-dev\build.properties
 [property] Loading C:\ppm8-dev\propel\build.properties

InfinityMetrics > prepare-tests-report:

   [delete] Deleting 192 files from C:\ppm8-dev\app\dev\reports

InfinityMetrics > tests-report:

     [exec] Executing command: phpunit                 --report C:\ppm8-dev\app\dev/reports/tests/coverage                 --log-metrics C:\ppm8-dev\app\dev/reports/tests/logs/metrics.xml                 --log-pmd C:\ppm8-dev\app\dev/reports/tests/logs/violations-pmd.xml                 --log-xml C:\ppm8-dev\app\dev/reports/tests/logs/agile-high-level.xml                 --log-graphviz C:\ppm8-dev\app\dev/reports/tests/logs/InfinityMetrics.dot                 --testdox-html C:\ppm8-dev\app\dev/reports/tests/agile.html                 --testdox-text C:\ppm8-dev\app\dev/reports/tests/agile.txt                 --story-html C:\ppm8-dev\app\dev/reports/tests/story-bbd.html                 --story-text C:\ppm8-dev\app\dev/reports/tests/story-bbd.txt                 --verbose                 C:\ppm8-dev/app/classes/infinitymetrics/tests/AllTestSuites.class 2>&1
     [exec] o
     [exec] 
     [exec] 
     [exec] PHPUnit 3.3.5 by Sebastian Bergmann.
     [exec] 
     [exec] PHPUnit
     [exec]  PHPUnit
     [exec]   PHPUnit Framework
     [exec]    AbstractCollectionTest
     [exec]    ....
     [exec] 
     [exec]    ArrayListTest
     [exec]    ...
     [exec] 
     [exec]    DateTimeUtilTest
     [exec]    ....
     [exec] 
     [exec]   PHPUnit Framework
     [exec]    PersonalAgentTest
     [exec]    ..
     [exec] 
     [exec]   PHPUnit Framework
     [exec]    InstructorTest
     [exec]    .
     [exec] 
     [exec]    StudentTest
     [exec]    .
     [exec] 
     [exec]    UserTest
     [exec]    ..
     [exec] 
     [exec]  PHPUnit
     [exec]   PHPUnit Framework
     [exec]    UserSystemTest
     [exec]    ...
     [exec] 
     [exec]    StudentSystemTest
     [exec]    ...
     [exec] 
     [exec]    InstructorSystemTest
     [exec]    ...
     [exec] 
     [exec]   PHPUnit Framework
     [exec]    CustomEventSystemTest
     [exec]    ....
     [exec] 
     [exec]   PHPUnit Framework
     [exec]    PersonalAgentSystemTests
     [exec]    E.FEEEE
     [exec] 
     [exec]    FullnameJNUsernameInMemoryCacheSystemTests
     [exec] 
     [exec] 
     [exec] PHP  12. FullnameJNUsernameInMemoryCacheSystemTests->setUp() C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\pear\PEAR\PHPUnit\Framework\TestCase.php:394
     [exec] PHP  13. UserManagementController::registerUser() C:\ppm8-dev\app\classes\infinitymetrics\tests\system\agent\FullnameJNUsernameInMemoryCacheSystemTest.class.php:65
     [exec] Executing command: dot -T png -o InfinityMetrics.png InfinityMetrics.dot 2>&1

BUILD FINISHED

Total time: 1 minutes  29.35 seconds

Improving Code Quality - Code Sniffers

One optional activity is to check the quality of your code. Depending on the current Sprint and the size of the Product Backlog, it is important to make sure your code "smells good". So, run the command "phing codesniffer". It uses the PHP CodeSniffer , a PHP PEAR module that is similar to the Java Checkstyle quality monitoring script.

Commit Policy

After making sure that the tests pass, you are ready to commit the code to the repository. The commit log message must explain the changes with more depth details, covering the Model and System Tests for the Student class:

Issue 57
Branch: trunk
Release: M3

Description:
------------
 
     Final implementation of the Model classes for the Student, based 
     on the implementation of the User, including test System Tests
     instead of Unit Tests. This should be the DEFAULT standard for 
     Persistent classes.

     The OOP->DB strategy used by Propel only supports one table 
     class hierarchy. Thus, this implementation follows the SQL 
     updated on the Propel revisions (located at the sql file
     /trunk/propel/infinitymetrics.sql, which centralized users
     in a single table called user, and uses the type as the 
     strategy. 

Details:
--------

* trunk/apps/classes/infintymetrics/model/institution/Student.class.php
* trunk/apps/classes/infintymetrics/model/institution/Institution.class.php
* trunk/apps/classes/infintymetrics/model/user/User.class.php
 
     For the implementation of Model classes, the following 
     refactoring is necessary: 
       - Remove all setters/getters from the previous class;
         In this case, User extends from PersistentUser (from
         the ORM) and Student extends from User, and adds the
         type. The same should be done with the Instructor 
         class.
       - Extend your Persistent class counter part;
       - Methods that are necessary for the retrieval of 
         instances by other columns (see patch example on 
         how the retrieve user by email or username were
         implemented. The entire patch should be added)
       - Any method for comparing objects should be added
         into the Transient classes that extend the 
         Persistent classes (equals and compare methods, 
         for example).

* /trunk/apps/classes/tests/system/StudentSystemTest.class.php
      
     The system tests for the Student covers User Tests. First
     difference is that the focus of the tests is to verify if
     the persistent information is correctly done, thus exercising
     the correct values to be used during object persistence. 

     Considering that the Persistent classes are automatically 
     generated, the tests for the setters/getters are not even
     necessary for the simple attributes. However, if the class
     contains collections, that should be tested under the 
     functional tests. (Retrieve of Students and the Projects
     they are associated with, etc.) 

Documentation of the source-code and API

The documentation can be generated using the command "phing docs-gen", which uses the PHPDokumentator. The resulting API is similar to the Java Docs and will be placed in the directory "C:\ppm8-dev\app\dev/docs/api".

C:\ppm8-dev>phing docs-gen
Buildfile: C:\ppm8-dev\build.xml
 [property] Loading C:\ppm8-dev\build.properties
 [property] Loading C:\ppm8-dev\propel\build.properties

InfinityMetrics > prepare:

     [echo] Phing is working then...

InfinityMetrics > docs-gen:

   [delete] Deleting 360 files from C:\ppm8-dev\app\dev\docs\api
     [exec] Executing command: phpdoc -d C:\ppm8-dev/app/classes/infinitymetrics -dc 'api' -pp -ti 'Infinity Metrics API'  -t C:\ppm8-dev\app\dev/docs/api  2>&1

BUILD FINISHED

Total time: 11 minutes  10.56 seconds

Everything else continues the same... There's NO NEED to update the include_path of php.ini NOR the ones in netbeans...

7. The database system name and usr/pwd is located at the build.properties file inside of the /trunk/propel directory (C:\ppm8-dev\propel). So, delete the existing database in the virtualbox since it has an older version of the structure (still with the dispute tables). In this way, just drop the database system and create again, using the SQL file located at the /app/classes/infinitymetrics/orm/sql/schema.sql...

-- Main.marcellosales - 16 Nov 2008

Topic PhpMvcStepByStep . { Edit | Ref-By | Printable | Diffs r9 < r8 < r7 < r6 < r5 | More }
 XML java.net RSS

  

Revision r9 - 2010-01-15 - 20:27:35 - marcellosales
Parents: WebHome > InfinityMetrics