-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ZnLogEventTest with some sanity elementary unit tests
- Loading branch information
Showing
11 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/clientId.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,3 @@ | ||
accessing | ||
clientId | ||
^ 'client-1' |
3 changes: 3 additions & 0 deletions
3
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/request.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,3 @@ | ||
accessing | ||
request | ||
^ ZnRequest get: 'http://foo.com/test' |
3 changes: 3 additions & 0 deletions
3
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/response.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,3 @@ | ||
accessing | ||
response | ||
^ ZnResponse ok: (ZnEntity text: 'OK') |
3 changes: 3 additions & 0 deletions
3
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/serverId.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,3 @@ | ||
accessing | ||
serverId | ||
^ 'server-1' |
19 changes: 19 additions & 0 deletions
19
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/testClientTransactionEvent.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,19 @@ | ||
testing | ||
testClientTransactionEvent | ||
| event | | ||
(event := ZnClientTransactionEvent new) | ||
clientId: self clientId; | ||
request: self request; | ||
response: self response; | ||
requestDuration: self timing requestDuration; | ||
responseDuration: self timing responseDuration. | ||
self assert: event id isInteger. | ||
self assert: event processId isInteger. | ||
self assert: event timestamp <= DateAndTime now. | ||
self assert: event clientId equals: self clientId. | ||
self assert: event request uri equals: self request uri. | ||
self assert: event request method equals: self request method. | ||
self assert: event response code equals: self response code. | ||
self assert: event duration equals: self timing requestDuration + self timing responseDuration. | ||
self assert: event printString isString. | ||
^ event |
18 changes: 18 additions & 0 deletions
18
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/testServerTransactionEvent.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,18 @@ | ||
testing | ||
testServerTransactionEvent | ||
| event | | ||
(event := ZnServerTransactionEvent new) | ||
serverId: self serverId; | ||
request: self request; | ||
response: self response; | ||
timing: self timing. | ||
self assert: event id isInteger. | ||
self assert: event processId isInteger. | ||
self assert: event timestamp <= DateAndTime now. | ||
self assert: event serverId equals: self serverId. | ||
self assert: event request uri equals: self request uri. | ||
self assert: event request method equals: self request method. | ||
self assert: event response code equals: self response code. | ||
self assert: event duration equals: self timing totalDuration. | ||
self assert: event printString isString. | ||
^ event |
20 changes: 20 additions & 0 deletions
20
.../Zinc-Tests.package/ZnLogEventTest.class/instance/testSimplifiedClientTransactionEvent.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,20 @@ | ||
testing | ||
testSimplifiedClientTransactionEvent | ||
| event | | ||
(event := ZnSimplifiedClientTransactionEvent new) | ||
clientId: self clientId; | ||
request: self request; | ||
response: self response; | ||
requestDuration: self timing requestDuration; | ||
responseDuration: self timing responseDuration. | ||
self assert: event id isInteger. | ||
self assert: event processId isInteger. | ||
self assert: event timestamp <= DateAndTime now. | ||
self assert: event clientId equals: self clientId. | ||
self assert: event url equals: self request uri. | ||
self assert: event method equals: self request method. | ||
self assert: event responseCode equals: self response code. | ||
self assert: event size equals: self response contentLength. | ||
self assert: event duration equals: self timing requestDuration + self timing responseDuration. | ||
self assert: event printString isString. | ||
^ event |
19 changes: 19 additions & 0 deletions
19
.../Zinc-Tests.package/ZnLogEventTest.class/instance/testSimplifiedServerTransactionEvent.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,19 @@ | ||
testing | ||
testSimplifiedServerTransactionEvent | ||
| event | | ||
(event := ZnSimplifiedServerTransactionEvent new) | ||
serverId: self serverId; | ||
request: self request; | ||
response: self response; | ||
timing: self timing. | ||
self assert: event id isInteger. | ||
self assert: event processId isInteger. | ||
self assert: event timestamp <= DateAndTime now. | ||
self assert: event serverId equals: self serverId. | ||
self assert: event url equals: self request uri. | ||
self assert: event method equals: self request method. | ||
self assert: event responseCode equals: self response code. | ||
self assert: event size equals: self response contentLength. | ||
self assert: event duration equals: self timing totalDuration. | ||
self assert: event printString isString. | ||
^ event |
6 changes: 6 additions & 0 deletions
6
repository/Zinc-Tests.package/ZnLogEventTest.class/instance/timing.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,6 @@ | ||
accessing | ||
timing | ||
^ ZnServerTransactionTiming new | ||
requestDuration: 1; | ||
responseDuration: 2; | ||
yourself |
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