RegressionTests__SocketTests.st
author Claus Gittinger <cg@exept.de>
Tue, 29 Nov 2011 18:15:35 +0100
changeset 646 715c95096676
child 647 588836b3ec73
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
646
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'exept:regression' }"
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
TestCase subclass:#SocketTests
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
	category:'tests-Regression'
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
!SocketTests methodsFor:'tests - open-close'!
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
test10_concurrentOpenClose
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
    |p1 p2 sock host port n1 n2|
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
    host := 'www.exept.de'.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
    port := 80.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
    n1 := n2 := 0.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
    p1 := 
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
        [
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
            [true] whileTrue:[
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
                sock := Socket newTCPclientToAddress:host port:port.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
                Processor yield.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
                n1 := n1 + 1.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
                sock close
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
            ]
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
        ] newProcess.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
    p2 := 
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
        [
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
            [true] whileTrue:[
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
                sock := Socket newTCPclientToAddress:host port:port.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
                Processor yield.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
                n2 := n2 + 1.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
                sock close
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
            ]
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
        ] newProcess.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    p1 resume.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    p2 resume.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    Delay waitForSeconds:20.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    p1 terminate.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    p2 terminate.
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    Transcript showCR:'n1: %1; n2: %2' with:n1 with:n2
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    "Created: / 29-11-2011 / 14:43:57 / cg"
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
! !
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
!SocketTests class methodsFor:'documentation'!
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
version
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    ^ '$Header$'
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
!
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
version_CVS
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    ^ '$Header$'
715c95096676 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
! !