1 /******************************************************************************
2 * Copyright (c) 2000-2015 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
12 // Testing the behavior of erroneous messages with dual-faced ports
14 const ControlRequest c_cr := { "howdy" }
15 with { erroneous (text) "value := omit" }
17 const PDUType1 c_pdu1 := { text := "trunk" } // U.S. version
18 with { erroneous (text) "value := ""car-boot"" " } // British version
19 // Length must be exactly eight to fit FIELDLENGTH(8)
21 const PDUType2 c_pdu2 := { text := "hello" }
22 with { erroneous (text) "value := ""good bye"" " }
24 testcase tc_DUALFACED_erroneous() runs on MTC_CT system SYSTEM_SCT
26 map(mtc:MTC_PORT, system:SYSTEM_PORT);
27 timer patience := 1.0;
31 // simple mapping: PT1_PROVIDER for ControlRequest does not encode the sent value,
32 // so the effect of the erroneous attribute can not be seen.
33 // Because the text in the ControlRequest does not start with a 'C',
34 // the port sends back an ErrorSignal... which is discarded by the incoming mapping.
36 [] MTC_PORT.receive /* anything */ {
37 setverdict(fail, "It wasn't supposed to receive anything yet");
39 [else] /* nothing received */ { setverdict(pass); }
44 MTC_PORT.send(c_pdu1); // function(enc_PDUType1_gen), compiler-generated ext func
46 [] MTC_PORT.receive(PDUType2 : { "car-boot" } ) { // erroneous is taken into account
49 [] MTC_PORT.receive /* anything else */ { setverdict(fail, "got unknown response"); }
50 [] patience.timeout { setverdict(fail, "time-out at ", __LINE__); }
55 MTC_PORT.send(c_pdu2); // encode(RAW), built-in encoder function
57 [] MTC_PORT.receive(PDUType2 : { "good bye" } ) { // erroneous is taken into account
60 [] MTC_PORT.receive /* anything else */ { setverdict(fail, "got unknown response"); }
61 [] patience.timeout { setverdict(fail, "time-out at ", __LINE__); }
65 unmap(mtc:MTC_PORT, system:SYSTEM_PORT);
69 execute(tc_DUALFACED_erroneous());