View source | View content page | Page history | Printable version   

Projects:BuildValidationsAndModuleScripts

Contents

Introduction

In some cases the need to execute manual actions (java-code) while doing an ERP core or a module update arises to handle special situations.

Those could include checking data for compliance with some rules or doing automated data changes which cannot be done using the normal update.database task.

This project will provide a means to do both types of actions.

Objectives

This project will add a new artifact (java-code) called BuildValidation which can be included in core or a module. It will be executed before the update and can stop the update process with an error message shown to the user. BuildValidations are not supposed to do any data-modifications.

It also adds a second artifact (java-code) called ModuleScript which can be again included in core or a module which is executed inside the update.database process and is allowed to do data changes.

Example Use-case

An update to existing code, either a core ERP maintenance pack or a new module version wants to make an existing database unique constraint stricter by removing one of it fields.

In this case users which have data which is valid with the old version of the constraint but not the new one will be faced with an error on the upgrade.

A new BuildValidation can check the local data verifying that it is complying with the tighter constraint and otherwise stop the update process providing a message to the user, which manual steps need to be done to update the data.

Developers Documentation

A howto explaining how to write and use a BuildValidation or a ModuleScript can be found here.


Description

This project aims to create an infrastructure to support Build Validations (which will be checks executed at the beginning of the Build Process) and Module Scripts (which will be actions executed during the Build Process). Build Validations and Module Scripts can be added both in Openbravo Core, and through modules.


The main tasks which this project will have are:

Test cases

The main objectives of the test cases are to test the compilation tasks, to verify that the correct validations and modulescripts are executed in each possible situation, and that the correct action is taken in each case.

Taking this objectives into account, several test cases have been defined. In order to execute them, it's necessary to have two modules in the system, in addition to Core.

Test 1: Compilation test

ant compile.buildvalidation -Dmodule=org.openbravo

ant compile.modulescript -Dmodule=org.openbravo


ant compile.buildvalidation -Dmodule=javapackage1

ant compile.modulescript -Dmodule=javapackage1


ant compile.buildvalidation -Dmodule=javapackage2

ant compile.modulescript -Dmodule=javapackage2

And the binaries should be in src-util/buildvalidation/build/classes and src-util/modulescript/build/classes for the Core ones, and in modules/eachmodule/src-util/buildvalidation/build/classes and modules/eachmodule/src-util/modulescript/build/classes for the modules ones.

Test 2: Verify that the correct script is executed

Test 3: Verify that the correct validations are executed, and that the correct action is taken

Test 4: Verify that everything works without validations or scripts

Test 5: Behaviour with broken validation and script

Retrieved from "http://wiki.openbravo.com/wiki/Projects:BuildValidationsAndModuleScripts"

This page has been accessed 4,848 times. This page was last modified on 8 June 2012, at 05:26. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.