Next: , Up: Individual Armour cases   [Contents]


7.3.1 ArmourIBVIRR (IllegalBooleanValueInRequiresReply)

A reply value from a required interface can contain a boolean value that is not allowed. The system diagram shows the armour at the requires port of the Dezyne component:

ArmourIBVIRR

We only deal with one in-event returning a boolean result value. The Strict interface specifies that only a boolean value of ’true’ can be replied.

interface IStrict
{
  in bool ia();

  behaviour
  {
    on ia: reply (true);
  }
}

The Robust interface allows both boolean reply values of ’true’ and ’false’.

interface IRobust
{
  in bool ia();

  behaviour
  {
    on ia: reply (true);
    on ia: reply (false);
  }
}

In the armour the result from the requires interface is captured in a local bool b. If it is false we log it as an error. In all cases we simply return the boolean value ’true’ to the provides interface.

component ArmourIBVIRR // IStrict to IRobust
{
  provides IStrict pStrict;
  requires IRobust rRobust;
  requires injected ILogger iLog;

  behaviour {
    on pStrict.ia(): {
        bool b = rRobust.ia();
        if (!b) iLog.Log($"Reply value false from ia not allowed by port"$);
        reply(true);
    } // armour ignore (false) case
  }
}

The full armour example code including the client and overall system component is here:

Basic example: ArmourIBVIRR
Example with error handling: ArmourIBVIRRError