-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from svenvc/master
Use SocketError next to PrimitiveFailed
- Loading branch information
Showing
11 changed files
with
49 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
8 changes: 0 additions & 8 deletions
8
repository/Zinc-HTTP.package/ZnMultiThreadedServer.class/instance/exceptionSet..st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
repository/Zinc-HTTP.package/ZnUtils.class/class/exceptionSet..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
converting | ||
exceptionSet: classNames | ||
^ classNames inject: ExceptionSet new into: [ :set :each | | ||
(Smalltalk globals includesKey: each) | ||
ifTrue: [ | ||
set | ||
add: (Smalltalk at: each); | ||
yourself ] | ||
ifFalse: [ set ] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
SystemOrganization addCategory: #'Zinc-HTTP'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Client-Server'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Core'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Exceptions'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Logging'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Streaming'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Support'! | ||
SystemOrganization addCategory: #'Zinc-HTTP-Variables'! | ||
self packageOrganizer ensurePackage: #'Zinc-HTTP' withTags: #(#'Client-Server' #Core #Exceptions #Logging #Streaming #Support #Variables)! |
12 changes: 8 additions & 4 deletions
12
repository/Zinc-Tests.package/ZnClientTest.class/instance/testLogging.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
testing | ||
testLogging | ||
|
||
| client logEventCollection count | | ||
logEventCollection := OrderedCollection new. | ||
ZnLogEvent announcer | ||
when: ZnLogEvent do: [ :event | logEventCollection add: event ]. | ||
when: ZnLogEvent | ||
do: [ :event | logEventCollection add: event ] | ||
for: self. | ||
(client := ZnClient new) | ||
clientId: #C1; | ||
beOneShot. | ||
client get: self smallHtmlUrl. | ||
client close. | ||
count := ZnLogEvent announcer numberOfSubscriptions. | ||
ZnLogEvent announcer | ||
unsubscribe: self. | ||
self assert: ZnLogEvent announcer numberOfSubscriptions equals: count -1. | ||
ZnLogEvent announcer unsubscribe: self. | ||
self | ||
assert: ZnLogEvent announcer numberOfSubscriptions | ||
equals: count - 1. | ||
self deny: logEventCollection isEmpty. | ||
self assert: logEventCollection anyOne clientId equals: #C1 |
33 changes: 23 additions & 10 deletions
33
repository/Zinc-Tests.package/ZnServerTest.class/instance/testLogging.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,40 @@ | ||
tests | ||
testLogging | ||
|
||
| client logEventCollection count renderedLogEvents | | ||
logEventCollection := OrderedCollection new. | ||
ZnLogEvent announcer | ||
when: ZnLogEvent do: [ :event | logEventCollection add: event ]. | ||
when: ZnLogEvent | ||
do: [ :event | logEventCollection add: event ] | ||
for: self. | ||
self withServerDo: [ :server | | ||
1 to: 3 do: [ :logLevel | | ||
server serverId: ('S' , logLevel asString) ; logLevel: logLevel. | ||
server | ||
serverId: 'S' , logLevel asString; | ||
logLevel: logLevel. | ||
client := ZnClient new. | ||
client clientId: ('C' , logLevel asString); logLevel: logLevel. | ||
client | ||
clientId: 'C' , logLevel asString; | ||
logLevel: logLevel. | ||
client get: (server localUrl addPathSegment: #small). | ||
self assert: client isSuccess. | ||
client get: (server localUrl addPathSegment: #error). | ||
self deny: client isSuccess. | ||
server delegate map: #redirect to: [ :request | ZnResponse redirect: #welcome ]. | ||
server delegate | ||
map: #redirect | ||
to: [ :request | ZnResponse redirect: #welcome ]. | ||
client get: (server localUrl addPathSegment: #redirect). | ||
self assert: client isSuccess. | ||
self assert: client isSuccess. | ||
client close ] ]. | ||
count := ZnLogEvent announcer numberOfSubscriptions. | ||
ZnLogEvent announcer | ||
unsubscribe: self. | ||
self assert: ZnLogEvent announcer numberOfSubscriptions equals: count -1. | ||
ZnLogEvent announcer unsubscribe: self. | ||
self | ||
assert: ZnLogEvent announcer numberOfSubscriptions | ||
equals: count - 1. | ||
self deny: logEventCollection isEmpty. | ||
renderedLogEvents := String streamContents: [ :out | | ||
logEventCollection do: [ :event | out print: event; cr ] ]. | ||
renderedLogEvents := String streamContents: [ :out | | ||
logEventCollection do: [ :event | | ||
out | ||
print: event; | ||
cr ] ]. | ||
self deny: renderedLogEvents isEmpty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SystemOrganization addCategory: #'Zinc-Tests'! | ||
self packageOrganizer ensurePackage: #'Zinc-Tests' withTags: #()! |