Fire up your applications with Jetfire
RSS
Jetfire Wiki


Quick Search
»
Advanced Search »

Example Code - Unit Tests

The Jetfire download contains example code contained in two projects, JetfireCoreExampleTests and JetfireCode.

The core examples (project:JetfireCoreExampleTests) demonstrate use of the Jetfire code through documented unit tests.

Project 'JetfireCoreExampleTests' Directories

The following directories are contained in the 'JetfireCoreExampleTests' project in the 'ExampleCode' directory.

  • CLR - Contains example tests on using CLR code within Jetfire.
  • DBQuery - Demonstrates how to search for Jetfire objects using a database query.
  • DLR - Contains example of working with Jetfire objects (DLR) within a .net C# program.
  • Dynamic Access Modifier Tests
  • General Applications
  • Specific Contructs
  • System Library
  • Void Safety

Application Examples

Hello World Unit Test

Hello world unit test demonstrates persistence of Jetfire objects with this variant of the classical 'Hello World' program. See Hello World description for a detailed explanation.

DVD Library Example Unit Test

This example demonstrates how Jetfire can be used to create a DVD library using the 'state' first class construct. The 'state' construct prevents methods, in this example, from being executed when the workflow is not in the proper state. For example the 'Borrow' method can not be executed when the workflow is in the 'Borrowed' state.

There is just one Jetfire workflow class, called 'DVD' required for the solution. Individual DVDs can be borrowed and returned using the 'Borrow' and 'Return' methods. The status of each individual DVD is determined by the state, 'CheckedIn' or 'Borrowed'.

See DVD Library Example description for a detailed explanation.

'ToDo' List Unit Test

The ToDo Workflows consist of:
  • ToDoItem: something that is to be done by a user
  • ToDoList: a list of ToDoItems. (It also has a Subject and ToolTip.)

Notes
  • The ToDoList is a nicety that provides a mechanism for grouping ToDoItems.
  • At the GUI, the user can access the ToDoList, track the status of individual ToDoItems.
  • ToDoItem states: Started, Scheduled, Cancelled, Completed.
  • ToDoList states: Started, Locked, Completed.
  • Anyone can change anything in a Started object.
  • Once the ToDoList is 'Locked', only the Owner (the logged user who created the object) can change properties in the ToDo List.
  • Once the ToDoItem is 'Scheduled', only the Owner (the logged user who created the object) can change properties in the ToDo Item.
  • Note the use of an access property to track who and when properties can be set and methods can be executed.

See Also

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.