disassociate_event.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?xml version="1.0" ?>
  2. <diagram author="Glenn De Jonghe" name="TestDisassociateEvent">
  3. <description>
  4. Testing the object manager
  5. </description>
  6. <inport name="test_input" />
  7. <outport name="test_output" />
  8. <class name="Class1" default="true">
  9. <relationships>
  10. <association class="Class2" name="test2_association" />
  11. <association class="Class2" name="test3_association" />
  12. </relationships>
  13. <scxml initial="start">
  14. <state id="start">
  15. <transition port="test_input" event="create" target="../wait">
  16. <raise scope="cd" event="create_instance">
  17. <parameter expr='"test2_association"'/>
  18. </raise>
  19. <raise port="test_output" event="request_send"/>
  20. </transition>
  21. </state>
  22. <state id="wait">
  23. <transition event="instance_created" target="../waiting_for_associate">
  24. <parameter name="association_name" type="string"/>
  25. <raise port="test_output" event="instance_created"/>
  26. <raise scope="cd" event="start_instance">
  27. <parameter expr='"test2_association"'/>
  28. </raise>
  29. <raise scope="cd" event="associate_instance">
  30. <parameter expr='"test2_association"'/>
  31. <parameter expr='"test3_association"'/>
  32. </raise>
  33. </transition>
  34. </state>
  35. <state id="waiting_for_associate">
  36. <transition event="instance_associated" target="../waiting_for_hello">
  37. <raise port="test_output" event="instance_associated"/>
  38. <raise target='"test3_association"' event="hello" />
  39. </transition>
  40. </state>
  41. <state id="waiting_for_hello">
  42. <transition target="../waiting_for_disassociate" after="0.01">
  43. <raise scope="cd" event="disassociate_instance">
  44. <parameter expr="'test3_association'" />
  45. </raise>
  46. </transition>
  47. </state>
  48. <state id="waiting_for_disassociate">
  49. <transition event="instance_disassociated" target="../sending_hello">
  50. <raise port="test_output" event="instance_disassociated"/>
  51. <!-- This should no longer work. -->
  52. <raise scope="narrow" target="'test3_association'" event="hello" />
  53. </transition>
  54. </state>
  55. <state id="sending_hello">
  56. <transition target="../done">
  57. <!-- This should still work. -->
  58. <raise scope="narrow" target="'test2_association'" event="hello" />
  59. </transition>
  60. </state>
  61. <state id="done" />
  62. </scxml>
  63. </class>
  64. <class name="Class2" default="false">
  65. <scxml>
  66. <state id="start">
  67. <transition event="hello" target=".">
  68. <raise port="test_output" event="second_working" />
  69. </transition>
  70. </state>
  71. </scxml>
  72. </class>
  73. <test>
  74. <input>
  75. <event name="create" port="test_input" time="0.0"/>
  76. </input>
  77. <expected>
  78. <slot>
  79. <event name="request_send" port="test_output"/>
  80. </slot>
  81. <slot>
  82. <event name="instance_created" port="test_output"/>
  83. </slot>
  84. <slot>
  85. <event name="instance_associated" port="test_output"/>
  86. </slot>
  87. <slot>
  88. <event name="second_working" port="test_output"/>
  89. </slot>
  90. <slot>
  91. <event name="instance_disassociated" port="test_output"/>
  92. </slot>
  93. <slot>
  94. <event name="second_working" port="test_output"/>
  95. </slot>
  96. </expected>
  97. </test>
  98. </diagram>