diff --git a/ttool/src/test/java/cli/CLIAvatar2SysMLV2Test.java b/ttool/src/test/java/cli/CLIAvatar2SysMLV2Test.java index 4e3660e95a1b8ba95ec37606743d0b61cec6914e..0733b76ff4c6b8ee6be636d52148ba53031dc528 100644 --- a/ttool/src/test/java/cli/CLIAvatar2SysMLV2Test.java +++ b/ttool/src/test/java/cli/CLIAvatar2SysMLV2Test.java @@ -90,24 +90,24 @@ public class CLIAvatar2SysMLV2Test extends AbstractTest implements InterpreterOu "ERROR (l34,c9): Field x of out-message is associated to a field (a) in in-message that does not exist (c.f. l25,c5)", "ERROR (l53,c5): Channel @syn:B0.out0>B1.in1 of in-message associated to out-message has only one associated signal" + " (missing binding?) (c.f. l40,c5)", - "ERROR (l120,c26): ident b is used but not declared in block B0", //6 + "ERROR (l105,c26): ident b is used but not declared in block B0", //6 "ERROR (l188,c9): output profile of signal out1 has not been set", "", "", "ERROR (l0,c0): outgoing transitions from pre-send state must be sending transitions leading to some sending" + - " state (send/set timer /reset timer) (c.f. l137,c13)", // A - "ERROR (l127,c21): sending transition should have an associated signal (c.f. l137,c13)", - "ERROR (l141,c21): transition request in state @st:random.0 of block B0 has no associated declaration", + " state (send/set timer /reset timer) (c.f. l122,c13)", // A + "ERROR (l112,c21): sending transition should have an associated signal (c.f. l122,c13)", + "ERROR (l131,c21): transition request in state @st:random.0 of block B0 has no associated declaration", "", - "WARNING (l129,c25): channel parameter has already been set (c.f. l128,c25)", // E + "WARNING (l114,c25): channel parameter has already been set (c.f. l113,c25)", // E "ERROR (l67,c9): datatype Point of attribute p does not exist", "ERROR : block B0 has been used but has not been declared", "", - "ERROR (l131,c22): timer of expire-timer state does not exist (c.f. l102,c25)", - "ERROR (l149,c17): set-timer transition has no associated timer (c.f. l138,c25)", // J + "ERROR (l119,c22): timer of expire-timer state does not exist (c.f. l97,c25)", + "ERROR (l154,c17): set-timer transition has no associated timer (c.f. l143,c25)", // J "ERROR (l84,c13): Attribute p is already declared (or there is an attribute with same name) (c.f. l83,c13)", "ERROR (l91,c13): Timer t cannot be added: name already used for constant or attribute (c.f. l84,c13)", // L - "ERROR (l152,c17): receive payload of transition has not been set", + "ERROR (l157,c17): receive payload of transition has not been set", "" }; // private final boolean[] errorFromNull = { @@ -156,7 +156,7 @@ public class CLIAvatar2SysMLV2Test extends AbstractTest implements InterpreterOu outputResult.append(s); } - //@Test + @Test public void testToThenFrom() { String filePath = getBaseResourcesDir() + PATH_TO_TEST_FILE + "scriptavsysml_tothenfrom"; String script; @@ -210,7 +210,7 @@ public class CLIAvatar2SysMLV2Test extends AbstractTest implements InterpreterOu assertTrue(oritrans == tgttrans); } } - // @Test + @Test public void okFrom() { String filePath = getBaseResourcesDir() + PATH_TO_TEST_FILE + "scriptavsysml_okfrom"; String script; @@ -255,7 +255,7 @@ public class CLIAvatar2SysMLV2Test extends AbstractTest implements InterpreterOu assertTrue(oritrans == tgttrans); } } - // @Test + @Test public void errFrom() { outputResult = new StringBuilder(); diff --git a/ttool/src/test/resources/cli/models/avSysML_missingSndPayloadN.sysml b/ttool/src/test/resources/cli/models/avSysML_missingSndPayloadN.sysml index f63d4a43f74b5ae444bb49d00407b7eecfc696ae..650d9568230bb512a6a3e9c63f9c69c5bd57d509 100644 --- a/ttool/src/test/resources/cli/models/avSysML_missingSndPayloadN.sysml +++ b/ttool/src/test/resources/cli/models/avSysML_missingSndPayloadN.sysml @@ -6,256 +6,6 @@ package AvatarInstance { // DATATYPES $$$$$$$$$$$$$$$$$$$$$$$$ - attribute def '@dt:Point' :> '#AvatarDataType' { - attribute 'x' : Integer default := 0; - attribute 'y' : Integer default := 0; - } - - // COMMUNICATIONS $$$$$$$$$$$$$$$$$$$$$$$$ - - // Relation '@SYN0:B0-B1_0'============= - part '@SYN0:B0-B1_0': '#Sync_Rel' = '#Sync_Rel'('@block1' = '@blk:B0', '@block2' = '@blk:B1_0', '@private'=true); - - // Channel '@syn:B0.in0<B1_0.out1'------------- - part '@syn:B0.in0<B1_0.out1' : '#Sync' = '#Sync'('@relation' = '@SYN0:B0-B1_0'); - binding : '#InSignalBinding' bind '@blk:B0'.'@sig:in0' = '@syn:B0.in0<B1_0.out1'; - binding : '#OutSignalBinding' bind '@blk:B1_0'.'@sig:out1' = '@syn:B0.in0<B1_0.out1'; - -// Message of signal '@blk:B0'.'@sig:in0'............ - part def '@MSG:B0.in0' :> '#InMessage' { - private part '@channel' : '#Channel' = '@syn:B0.in0<B1_0.out1'; - attribute 'x' : Integer; - attribute 'p' : '@dt:Point'; - attribute 'b' : Boolean; - } - -// Message of signal '@blk:B1_0'.'@sig:out1'............ - part def '@MSG:B1_0.out1' :> '#OutMessage', '@MSG:B0.in0' { - attribute 'x' redefines 'x'; - attribute 'p' redefines 'p'; - attribute 'b' redefines 'b'; - } - - // Channel '@syn:B0.out0>B1_0.in1'------------- - part '@syn:B0.out0>B1_0.in1' : '#Sync' = '#Sync'('@relation' = '@SYN0:B0-B1_0'); - binding : '#OutSignalBinding' bind '@blk:B0'.'@sig:out0' = '@syn:B0.out0>B1_0.in1'; - binding : '#InSignalBinding' bind '@blk:B1_0'.'@sig:in1' = '@syn:B0.out0>B1_0.in1'; - -// Message of signal '@blk:B1_0'.'@sig:in1'............ - part def '@MSG:B1_0.in1' :> '#InMessage' { - private part '@channel' : '#Channel' = '@syn:B0.out0>B1_0.in1'; - attribute 'x' : Integer; - attribute 'p' : '@dt:Point'; - attribute 'b' : Boolean; - } - -// Message of signal '@blk:B0'.'@sig:out0'............ - part def '@MSG:B0.out0' :> '#OutMessage', '@MSG:B1_0.in1' { - attribute 'x' redefines 'x'; - attribute 'p' redefines 'p'; - attribute 'b' redefines 'b'; - } - - // BLOCKS $$$$$$$$$$$$$$$$$$$$$$$$ - - // Block '@blk:B1'============= - part '@blk:B1' : '#AvatarBlock' { - - // state-machine ------------------- - exhibit state '@statemachine' : '#AvatarStateMachine' { - - exit action '@st:stop' :'#AvatarStopState'; - - entry action '@st:start' :'#AvatarStartState'; - - transition : '#AvatarTransition' first '@st:start' - then '@st:stop'; - } - - // Sub-Blocks øøøøøøøøøøøøøøøøøøøøøøø - - // Block '@blk:B1_0'============= - part '@blk:B1_0' : '#AvatarBlock' { - - // Attributes --------------------- - attribute '$x' : Integer := 0; - attribute '$b' : Boolean := false; - attribute '$p' : '@dt:Point'; - - // Signals --------------------- - part '@sig:in1' : '#Channel'; - part '@sig:out1' : '#Channel'; - - // Timers --------------------- - part '@tmr:t': '#AvatarTimer' = '#AvatarTimer'(); - - // state-machine ------------------- - exhibit state '@statemachine' : '#AvatarStateMachine' { - - state '@st:reset.t.0' : '#AvatarResetTimerState'; - - transition : '#AvatarTransition' first '@st:reset.t.0' - then '@st:standard.state2'; - - state '@st:standard.state2' : '#AvatarStandardState' = '#AvatarStandardState'( - '@pool' = {( - '#AvatarExpireTimerRequest'( - '@channel'= '@tmr:t'.'@expire' - ), - '#AvatarResetTimerRequest'( - '@index' = 2, - '@channel'= '@tmr:t'.'@reset', - '@payload' = '#TimerResetMsg'() - ) - )} - ); - - transition : '#AvatarTransition' first '@st:standard.state2' if '@index' == 1 - then '@st:expire.t.0'; - - transition : '#AvatarTransition' first '@st:standard.state2' if '@index' == 2 - then '@st:reset.t.0'; - - exit action '@st:stop' :'#AvatarStopState'; - - state '@st:set.t.0' : '#AvatarSetTimerState'; - - transition : '#AvatarTransition' first '@st:set.t.0' - then '@st:standard.state2'; - - entry action '@st:start' :'#AvatarStartState'; - - transition : '#AvatarTransition' first '@st:start' - then '@st:standard.state1'; - - state '@st:expire.t.0' : '#AvatarExpireTimerState'; - - transition : '#AvatarTransition' first '@st:expire.t.0' - then '@st:standard.state1'; - - state '@st:standard.state1' : '#AvatarStandardState' = '#AvatarStandardState'( - '@pool' = {( - '#AvatarSetTimerRequest'( - '@channel'= '@tmr:t'.'@set', - '@payload' = '#TimerSetMsg'(10) - ), - '#ReceiveRequest'( - '@index' = 2, - '@channel'= '@sig:in1' - ) - )} - ); - - transition : '#AvatarTransition' first '@st:standard.state1' if '@index' == 1 - then '@st:set.t.0'; - - transition : '#AvatarTransition' first '@st:standard.state1' if '@index' == 2 - do action : '#ReceiveAction' { - item '@msg' : '@MSG:B1_0.in1' = '@payload' as '@MSG:B1_0.in1'; - first start; - then assign '$x' := '@msg'.'x'; - then assign '$p' := '@msg'.'p'; - then assign '$b' := '@msg'.'b'; - then done; - } then '@st:receive.in1.0'; - - state '@st:receive.in1.0' : '#AvatarReceiveState' = '#AvatarReceiveState'( - '@request' = { - '#SendRequest'( - '@channel'= '@sig:out1', - '@payload' = '@MSG:B1_0.out1'( - '$x', - '$p', - '$b' ) - ) - } - ); - - transition : '#AvatarTransition' first '@st:receive.in1.0' - then '@st:send.out1.0'; - - state '@st:send.out1.0' : '#AvatarSendState'; - - transition : '#AvatarTransition' first '@st:send.out1.0' - then '@st:stop'; - } - } - } - - // Block '@blk:B0'============= - part '@blk:B0' : '#AvatarBlock' { - - // Attributes --------------------- - attribute '$x' : Integer default := 0; - attribute '$b' : Boolean default := false; - attribute '$p' : '@dt:Point'; - attribute '$y' : Integer default := 0; - - // Methods --------------------- - calc '$make': '#AvatarCalcMethod' { - attribute 'x' : Integer; - attribute 'y' : Integer; - return : '@dt:Point'; - } - calc '$getx': '#AvatarCalcMethod' { - attribute 'p' : '@dt:Point'; - return : Integer; - } - action '$foo': '#AvatarVoidMethod' { - attribute 'b' : Boolean; - attribute 'p' : '@dt:Point'; - attribute 'x' : Integer; - } - - // Signals --------------------- - part '@sig:in0' : '#Channel'; - part '@sig:out0' : '#Channel'; - - // state-machine ------------------- - exhibit state '@statemachine' : '#AvatarStateMachine' { - - state '@st:receive.in0.0' : '#AvatarReceiveState'; - - transition : '#AvatarTransition' first '@st:receive.in0.0' - then '@st:stop'; - - exit action '@st:stop' :'#AvatarStopState'; - - state '@st:random.0' : '#AvatarRandomState' = '#AvatarRandomState'( - '@request' = { - if '$p'.'x' > 4 ? - '#immediate_request' - else '#nok_request'(1) - }, - '@state_action' = '#Assignment'( - '@target' = '$x', - '@value' = '#bound_random'(0, '$p'.'y') - ) - ); - - transition : '#AvatarTransition' first '@st:random.0' - do action : '#TransitionAction' { - first start; - then action = '$foo'('$b', '$p', '$x'); - then done; - } then '@st:prereceive.in0.0'; - - state '@st:prereceive.in0.0' : '#AvatarPreReceiveState' = '#AvatarPreReceiveState' ( - '@request' = { - '#ReceiveRequest'( - '@channel'= '@sig:in0' - ) - } - ); - - transition : '#AvatarTransition' first '@st:prereceive.in0.0'package AvatarInstance { - private import AvatarGeneral::*; - private import AvatarBlockTypes::*; - private import AvatarCommunication::*; - private import AvatarTransitionServer::*; - - // DATATYPES $$$$$$$$$$$$$$$$$$$$$$$$ - attribute def '@dt:Point' :> '#AvatarDataType' { attribute 'x' : Integer default := 0; attribute 'y' : Integer default := 0; @@ -547,52 +297,3 @@ package AvatarInstance { // Block Shortcut Links $$$$$$$$$$$$ part '@blk:B1_0' : '#AvatarBlock' :> '@blk:B1'.'@blk:B1_0' = '@blk:B1'.'@blk:B1_0'; } - - do action : '#ReceiveAction' { - item '@msg' : '@MSG:B0.in0' = '@payload' as '@MSG:B0.in0'; - first start; - then assign '$x' := '@msg'.'x'; - then assign '$p' := '@msg'.'p'; - then assign '$b' := '@msg'.'b'; - then done; - } then '@st:receive.in0.0'; - - entry action '@st:start' :'#AvatarStartState' = '#AvatarStartState'( - '@request' = { - '#TrivialRequest'('@delay' = '#bound_random'(1, '$p'.'x')) - } - ); - - transition : '#AvatarTransition' first '@st:start' - do action : '#TransitionAction' { - first start; - then assign '$x':= 1; - then assign '$b':= true; - then assign '$p'::'x':= '$x'; - then done; - } then '@st:presend.out0.0'; - - state '@st:presend.out0.0' : '#AvatarPreSendState' = '#AvatarPreSendState' ( - '@request' = { - '#SendRequest'( - '@channel'= '@sig:out0' - ) - } - ); - - transition : '#AvatarTransition' first '@st:presend.out0.0' then '@st:send.out0.0'; - - state '@st:send.out0.0' : '#AvatarSendState'; - - transition : '#AvatarTransition' first '@st:send.out0.0' - do action : '#TransitionAction' { - first start; - then assign '$p':= '$make'('$x', '$y'); - then assign '$x':= '$getx'('$p'); - then done; - } then '@st:random.0'; - } - } - // Block Shortcut Links $$$$$$$$$$$$ - part '@blk:B1_0' : '#AvatarBlock' :> '@blk:B1'.'@blk:B1_0' = '@blk:B1'.'@blk:B1_0'; -}