-
Notifications
You must be signed in to change notification settings - Fork 2
Sample Code
The installation Models
directory contains a "hello world" example. A compiled version of this
activity can be found in the installation UML
directory. The distribution directory also includes zip archives
with more extensive samples, all of which are described further below.
The Models
directory included in the installation archive contains an
Alf "Hello World" activity. To run this, use the command
alf Hello
from the installation directory.
The UML
directory included in the installation archive contains a compiled version of this
activity. To run this, use the command
fuml Hello
from the installation directory.
To recompile the Hello activity from Alf to UML, use the command
alfc Hello
from the installation directory.
The archive tests-x.zip
unzips into a directory containing a set of simple
execution tests. These can be run with a command of the form
alf -m tests-x
testUnitName
Replace tests-x
with the complete path to the directory, as
necessary. To run with trace output, use either the -d INFO
or
-d DEBUG
option.
To run the entire suite of tests, use the command
alf -m tests-x _RunTests
The archive tests-uml.zip
unzips into a directory containing compiled files
for all the tests found in tests-x
. These can be run with a command of the
form
fuml -u tests-uml
testUnitName
To run the entire suite of compoiled tests, use the command
fuml -u tests-uml _RunTests
A single test unit can be recompiled from Alf to UML using a command of the form
alfc -m tests-x -u tests-uml
testUnitName
Note that the testUnitName
is the same as the file
name, but without the .alf
extension. I.e., the file
Expressions_Assignment.alf
contains the unit named
Expressions_Assignment
. However, the units _TestRunner
, AssertTrue
,
AssertFalse
, AssertList
and Write
are helper
activities, not tests, and are not individually executable.
The archive PropertyManagementExample.zip
unzips into a directory
containing a complete Alf implementation of the Property Management example from
Annex B.3 of the Alf specification. This example defines a service, rather than
an application. However, the activity Test
sends one of each of the service
requests, printing out the results. To run this activity, use the command
alf -m PropertyManagementExample Test
Replace PropertyMangementExample
with the complete path to the model
directory, as necessary. (This should be run without trace output,
so use the -d OFF
option if the debug level default has been
changed from OFF
.)
The archive OnlineBookstore.zip
unzips into a directory containing a
complete Alf implementation of the Online Bookstore example from Appendix B
of the book Executable UML by Stephen Mellor and Marc Balcer. It also
includes a simple textual user interface for customer interaction. By default,
the inventory consists of a single book (the Executable UML book,
actually). To run the application, use the command
alf -m OnlineBookstore Main
Replace OnlineBookstore
with the complete path to the model directory,
as necessary. (This should be run without trace output, so use the -d OFF
option if the debug level default has been changed from OFF
.)
The tests-uml
archive described above also contains a compiled version
of the Online Bookstore example. To run this version, use the command
fuml -u tests-uml Main
Replace tests-uml
with the complete path to the directory as necessary.
(Back to Home)