aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-09 21:15:20 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-09 21:15:20 +0200
commit0ffe0afcb511d3abb2c0dda69c15f2b1bf74c770 (patch)
treed30a4e841e1a29a34b9cd3c6dac1c627ee7bbcec
parentaa8d9b64c62440f11f71226da1dd507fc0af4cc1 (diff)
Add >>#endpointNumber and add some test cases for it.
-rw-r--r--callagent/MGCPEndpoint.st5
-rw-r--r--callagent/Tests.st4
2 files changed, 9 insertions, 0 deletions
diff --git a/callagent/MGCPEndpoint.st b/callagent/MGCPEndpoint.st
index c373e3b..d28615a 100644
--- a/callagent/MGCPEndpoint.st
+++ b/callagent/MGCPEndpoint.st
@@ -39,6 +39,11 @@ Object subclass: MGCPEndpoint [
^ trunk endpointName: nr.
]
+ endpointNumber [
+ <category: 'accessing'>
+ ^ nr
+ ]
+
multiplex [
<category: 'names'>
^ trunk multiplexFor: nr.
diff --git a/callagent/Tests.st b/callagent/Tests.st
index 975ce14..918ec45 100644
--- a/callagent/Tests.st
+++ b/callagent/Tests.st
@@ -115,8 +115,10 @@ TestCase subclass: MGCPCommandTest [
| trunk |
trunk := MGCPDSTrunk createWithDest: '0.0.0.0' trunkNr: 3.
+ self assert: (self trunk endpointAt: 1) endpointNumber equals: 1.
self assert: (self trunk endpointAt: 1) multiplex = 0.
self assert: (self trunk endpointAt: 1) timeslot = 1.
+ self assert: (self trunk endpointAt: 31) endpointNumber equals: 31.
self assert: (self trunk endpointAt: 31) multiplex = 0.
self assert: (self trunk endpointAt: 31) timeslot = 31.
@@ -282,6 +284,7 @@ TestCase subclass: MGCPEndpointAllocTest [
"Initial..."
self assert: endp isUnused.
+ self assert: endp endpointNumber equals: 1.
"Reserve..."
endp reserve.
@@ -332,6 +335,7 @@ TestCase subclass: MGCPEndpointAllocTest [
self assert: (trunk allocateEndpointIfFailure: [true]).
"now free some endpoints"
+ self assert: (trunk endpointAt: 20) endpointNumber equals: 20.
(trunk endpointAt: 20) free.
(trunk endpointAt: 5) free.
endp := (trunk allocateEndpointIfFailure: []).