disassociate_event.xml 3.4 KB

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