2014-04-24 19:58:10 +00:00
|
|
|
"
|
|
|
|
(C) 2014 by Holger Hans Peter Freyther
|
|
|
|
All Rights Reserved
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"
|
|
|
|
|
|
|
|
TestCase subclass: SMPPMessageTest [
|
|
|
|
<category: 'OsmoSMPP-Test'>
|
|
|
|
<comment: 'I test reading and writing most of the SMPP header and body'>
|
|
|
|
|
|
|
|
examplePdu [
|
|
|
|
^#[16r00 16r00 16r00 16r2F 16r00 16r00 16r00 16r02
|
|
|
|
16r00 16r00 16r00 16r00 16r00 16r00 16r00 16r01
|
|
|
|
16r53 16r4D 16r50 16r50 16r33 16r54 16r45 16r53
|
|
|
|
16r54 16r00 16r73 16r65 16r63 16r72 16r65 16r74
|
|
|
|
16r30 16r38 16r00 16r53 16r55 16r42 16r4D 16r49
|
|
|
|
16r54 16r31 16r00 16r00 16r01 16r01 16r00]
|
|
|
|
]
|
|
|
|
|
|
|
|
testReadMessage [
|
|
|
|
| msg |
|
|
|
|
msg := SMPPMessage readFrom: self examplePdu readStream.
|
|
|
|
self assert: msg header commandId equals: 2.
|
|
|
|
self assert: msg header commandStatus equals: 0.
|
|
|
|
self assert: msg header sequenceNumber equals: 1.
|
2014-05-12 08:02:36 +00:00
|
|
|
|
|
|
|
self assert: msg body systemdId equals: 'SMPP3TEST'.
|
|
|
|
self assert: msg body password equals: 'secret08'.
|
|
|
|
self assert: msg body systemType equals: 'SUBMIT1'.
|
|
|
|
self assert: msg body version equals: 0.
|
|
|
|
self assert: msg body typeOfNumber equals: 1.
|
|
|
|
self assert: msg body numberingPlanIndicator equals: 1.
|
|
|
|
self assert: msg body addressRange equals: ''.
|
2014-04-24 19:58:10 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
testWriteMessage [
|
|
|
|
| data |
|
|
|
|
data := (SMPPMessage new
|
|
|
|
header: (SMPPPDUHeader new
|
|
|
|
commandId: 2;
|
|
|
|
commandStatus: 0;
|
|
|
|
sequenceNumber: 1;
|
|
|
|
yourself);
|
|
|
|
body: (self examplePdu copyFrom: 17);
|
|
|
|
toMessage) asByteArray.
|
|
|
|
self assert: data equals: self examplePdu.
|
|
|
|
]
|
|
|
|
]
|