umplerun

Timothy Lethbridge edited this page Jun 14, 2016 · 2 revisions
Clone this wiki locally

THIS IS AN UN-RELEASED TOOL. IT CAN BE BUILT LOCALLY FOR EXPERIMENTAL PURPOSES. ONCE AN INITIAL VERSION IS READY, WE WILL PROVIDE A DOWNLOAD.

Usage

Usage: java -jar umplerun.jar <umple_file> <cmd_file>
Example: java -jar umple.jar airline.ump airline.cmd

To Build Local Copy

Build the Umple project, and the umplerun.jar will appear in your ./dist directory

cd build/
ant -Dmyenv=local
cd ../dist
ls -la | grep umplerun.jar

Run A Simple Example

After you have built the project, create a tmp directory within ./dist.

cd ./dist
mkdir tmp
cd tmp
vi my.ump # see file below
vi my.cmd # see file below

The contents of my.ump should be

class Jump
{
  Integer i = 0;

  public void jump()
  {
    i+=1;
  }

}

The contents of my.cmd should be

commands
new Jump
jump
show getI
jump
show getI
jump
show getI

Now to run your example (again from ./trunk/dist/tmp)

java -jar ../umplerun.jar my.ump my.cmd

The output should look similar to

Compiling my.ump... success.
Building model... success.
Loading model into memory... success.
Running commands:
  Created Jump
  Executed #jump
  getI = 1
  Executed #jump
  getI = 2
  Executed #jump
  getI = 3
Done.

Run an Example and Check Attributes Along The Way

The command file can also be a CSV file, where the first row presents the command being run and the attributes (read: method names) are loaded. Subsequent rows show the command to be executed, and the values to expect in the attributes (read: return values of method names provided in header).

Let's adapt the commands above (with an 'error' on purpose to demonstrate the output).

commands, getI
new Jump, 0
jump, 1
jump, 22
jump, 3

The results would be similar to:

Compiling my.ump... success.
Building model... success.
Loading model into memory... success.
Running commands:
  Created Jump
  getI = 0
  Executed #jump
  getI = 1
  Executed #jump
  !!! ASSERTION FAILED on getI, EXPECTED 22, ACTUAL 2
  Executed #jump
  getI = 3
Done.

Run State Machine Example

The state machine example has been uploaded to https://github.com/umple/umple/tree/master/examples/smtrace

To execute:

cd ./examples/smtrace
.go

To change the model, edit

  sm.model

To change the event execution sequence, edit

  trace.cmd

The results should look similar to:

Compiling ex1.model... success.
Building model... success.
Loading model into memory... success.
Running commands:
  Created StateMachineTest
  Executed #e2
  getStatusFullName = S3.S2C
  Executed #e5
  getStatusFullName = S3.S1A.S2C
  Executed #e2
  getStatusFullName = S3.S1A.S2C
Done.