JBoss.orgCommunity Documentation

Scribble Developers Guide

This section outlines the technology used to manage the different aspects of the project.

The issue management is handled through the JIRA system located at https://jira.jboss.org/browse/SCRIBBLE .

Issues can be created for bugs, feature requests and tasks. Bugs are used to report unexpected behaviour, and will generally be created by language/tool users. Feature requests can equally be used by users to request new language or tool features.

Tasks will only generally be created by project developers, as a way of keeping track of work that needs to be done, potentially in support of bugs or feature requests.

Issues in JIRA can be linked, where a dependency exists. It is also possible to create a simple hierarchiy with tasks, such that a parent task can contain related sub-tasks.

An important usage of the issue management system is to keep track of what issues are associated released versions of the tools, and what target release they will be implemented or fixed within. This enables users to understand the schedule of features and bug fixes, aswell as providing an automated mechanism for providing release notes describing the work associated with a particular release.

The runtime branch of the project is concerned with providing integration of the OSGi bundles, defined in the tools/bundles branch, in different execution environments.

The Scribble tools architecture is based on OSGi, which means that the OSGi compliant bundles can run within any OSGi compliant service container. However OSGi is a service framework, intended to manage services in a service container (or server).

Therefore, to leverage OSGi bundles (or services), from a command line invoked application, we need to select a specific OSGi implementation that supports this approach, as it is not defined as part of the OSGi standard.

Therefore, to provide this command line capability, we have selected the Apache Felix OSGi implementation. This is the reason that the Felix jars are included in the distribution's lib sub-folder, rather than just implementation independent OSGi jars.

Although it is possible to define new modules as part of the Scribble project, it is also possible to develop them independently and just place them within the bundle folder of the installed (unpacked) Scribble distribution. This will make them available as part of the command line commands (e.g. if the bundle represents an additional validation module).

There are two types of QA that are performed as part of the project:

This part of the project structure provides a set of tests to check that the parser (being tested) processes the supplied set of test 'protocol' descriptions, and returns the correct object model.

The test protocol descriptions are stored in the src/test/resources/tests folder. The global sub-folder provides the global representation of the protocols, with the local representation of these protocols (for all of the relevant roles) being defined in the local sub-folder.

Each test is accompanied by a junit test, defined in the class org.scribble.protocol.parser.ctk . For example:

The CTKUtil.getModel() method retrieves the protocol description from a named file, and invokes the parser implementation being tested.

The parser implementation is defined using the scribble.protocol.parser system property. If this property is not set, then it will default to the ANTLR based implementation.

Once the model has been retrieved using the parser, the unit test will construct an 'expected' object model.

The final step in the unit test is to invoke the CTKUtil.verify() method to compare the model retrieved against the 'expected' version.

To perform the verification, each model is flattened to produce a list of 'model objects'. Then the verification mechanism iterates through the list, checking that the same entry in each list is identical - first checking they are the same class, and then invoking a 'comparator' implementation for that class.

The 'comparator' implementations are defined in the org.scribble.protocol.parser.ctk.comparators package. The comparator implementations are registered in the static initializer for the org.scribble.protocol.parser.ctk.ProtocolParserTest class.

As with the parser, the CTK provides a set of tests that can be used to test the projection implementation.

The projector implementation is defined using the scribble.protocol.projector system property. If this property is not set, then it will use the default implementation.

The tests are performed by initially retrieving the global representation of a Protocol, and then the local representation that is associated with the particular role that will be projected. This local representation effectively becomes the 'expected' projection.

The project is then invoked, for the required role, which will produce another local representation. All that is then left to do is verify that the projected local representation is identical to the local representation loaded from the file.

An example of a projection test is shown below, where the global model is being projected to the Buyer role:

There is a generic logging API within the Scribble framework that can be used for reporting errors, warnings, information or debuging details. This API is org.scribble.common.logging.Journal .

The methods generally take two parameters, a message and a property map. The message is simply a description of the issue being reported. The property map contain specific details about the issue being reported.

For example, when the parser detects a problem, it can report the nature of the problem, and provide the location of the issue in the source file.

This section will describe how to create a validator, using the 'simple validator' example within the Scribble distribution samples/validator/simple.validator folder.

Revision History
Revision 2.0.0Sept 20 2011Gary Brown
Initial version of developer guide