Skip to content

Commit

Permalink
Issue #16: add a transactional test case ...
Browse files Browse the repository at this point in the history
  • Loading branch information
dalehenrich committed Jan 12, 2015
1 parent 72fa2e0 commit a312674
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
persistentRoot
PersistentRoot ifNil: [ PersistentRoot := Dictionary new ].
^ PersistentRoot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
resetPersistentRoot
PersistentRoot := nil
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ handleAction
actionSymbol == #'halt'
ifTrue: [ ^ self performHalt ].
actionSymbol == #'serverStarted'
ifTrue: [ ^ self performServerStarted ] ]
ifTrue: [ ^ self performServerStarted ].
actionSymbol == #'transaction'
ifTrue: [ ^ self performTransaction ] ]
ensure: [ actionSymbol := nil ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
actions
performTransaction
actionResult := messageObject + 1.
self class persistentRoot at: #'performTransaction' put: actionResult.
self logAction: #'performTransaction'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"class" : {
"persistentRoot" : "dkh 01/12/2015 08:25",
"resetPersistentRoot" : "dkh 01/12/2015 08:26",
"serverClass" : "dkh 12/21/2014 15:19" },
"instance" : {
"actionCount" : "dkh 12/21/2014 15:10",
Expand All @@ -9,7 +11,7 @@
"basicServerOn:" : "dkh 01/09/2015 15:47",
"forceBeginTransaction" : "dkh 12/22/2014 16:41",
"forceInternalServerError" : "dkh 12/22/2014 16:41",
"handleAction" : "dkh 01/09/2015 15:53",
"handleAction" : "dkh 01/12/2015 08:31",
"handleBeforeUnwind:" : "dkh 12/30/2014 12:21",
"initialize" : "dkh 01/02/2015 17:21",
"interactiveErrorCommit:" : "dkh 01/09/2015 15:47",
Expand All @@ -28,7 +30,7 @@
"performNoop" : "dkh 12/22/2014 16:17",
"performReentrantTransactionError" : "dkh 01/09/2015 15:55",
"performServerStarted" : "dkh 12/22/2014 16:17",
"performTransaction" : "dkh 01/12/2015 08:26",
"port" : "dkh 01/06/2015 16:05",
"stop" : "dkh 01/02/2015 17:16",
"testReentrantTransactionError" : "dkh 01/09/2015 15:52",
"unitTestStartServiceOn:" : "dkh 01/06/2015 15:50" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"classinstvars" : [
],
"classvars" : [
],
"PersistentRoot" ],
"commentStamp" : "",
"instvars" : [
"messageCount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ testReentrantTransactionError
self assert: (gemServer actionException isKindOf: Error).
gemServer performMessage: #'add' with: 41.
self waitForActionResult: gemServer.
self assert: gemServer actionResult == 42.
gemServer performMessage: #'reentrantTransactionError'.
self waitForActionResult: gemServer.
self assert: gemServer actionResult == self errorLoggedSymbol.
self assert: (gemServer actionException isKindOf: Error).
gemServer performMessage: #'add' with: 41.
self waitForActionResult: gemServer.
self assert: gemServer actionResult == 42 ]
ensure: [ self stopGems: gemServer ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tests
testTransaction
| gemServer |
gemServer := self createGemServer.
gemServer class resetPersistentRoot.
System commitTransaction.
gemServer scriptLogEvent: '---->testTransaction' object: gemServer.
[
self startGems: gemServer.
self waitForActionResult: gemServer.
self assert: gemServer actionResult == #'started'.
gemServer performMessage: #'transaction' with: 41.
self waitForActionResult: gemServer.
self assert: gemServer actionResult == 42.
self assert: (gemServer class persistentRoot at: #'performTransaction') = 42.
gemServer performMessage: #'transaction' with: 45.
self waitForActionResult: gemServer.
self assert: gemServer actionResult == 46.
self assert: (gemServer class persistentRoot at: #'performTransaction') = 46 ]
ensure: [ self stopGems: gemServer ]
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"testForceInternalServerError" : "dkh 01/09/2015 14:04",
"testHalt" : "dkh 01/09/2015 14:04",
"testPerformMessage" : "dkh 01/09/2015 14:04",
"testReentrantTransactionError" : "dkh 01/09/2015 15:58",
"testReentrantTransactionError" : "dkh 01/09/2015 17:39",
"testStartServer" : "dkh 01/09/2015 14:04",
"testTransaction" : "dkh 01/12/2015 08:29",
"waitForActionResult:" : "dkh 12/22/2014 12:30" } }

Large diffs are not rendered by default.

0 comments on commit a312674

Please sign in to comment.