-
Notifications
You must be signed in to change notification settings - Fork 3
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 #59 from ba-st/transient_gs64
Make LaunchpadApplication transient using Tonel options
- Loading branch information
Showing
5 changed files
with
33 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1 @@ | ||
"Recompile LaunchpadApplication and CurrentlyRunningLaunchpadApplication with dbTransient option | ||
so that instances are not persistent because they store session-dependent information only" | ||
|
||
| removeNonTransientVersionsOf | | ||
removeNonTransientVersionsOf := [:class | | ||
| nonTransientVersions | | ||
nonTransientVersions := class classHistory reject: [:classVersion | classVersion instancesDbTransient]. | ||
nonTransientVersions do: [:classVersion | class classHistory removeVersion: classVersion]]. | ||
|
||
LaunchpadApplication instancesDbTransient | ||
ifFalse: [ | ||
Object subclass: 'LaunchpadApplication' | ||
instVarNames: LaunchpadApplication instVarNames | ||
classVars: LaunchpadApplication classVarNames | ||
classInstVars: LaunchpadApplication class instVarNames | ||
poolDictionaries: LaunchpadApplication _poolDictionaries | ||
inDictionary: Launchpad | ||
options: #( dbTransient ). | ||
(OrderedCollection new | ||
add: LaunchpadApplication; | ||
addAll: LaunchpadApplication allSubclasses; | ||
yourself) | ||
do: [:applicationClass | removeNonTransientVersionsOf value: applicationClass]. | ||
]. | ||
|
||
CurrentlyRunningLaunchpadApplication instancesDbTransient | ||
ifFalse: [ | ||
Object subclass: 'CurrentlyRunningLaunchpadApplication' | ||
instVarNames: CurrentlyRunningLaunchpadApplication instVarNames | ||
classVars: CurrentlyRunningLaunchpadApplication classVarNames | ||
classInstVars: CurrentlyRunningLaunchpadApplication class instVarNames | ||
poolDictionaries: CurrentlyRunningLaunchpadApplication _poolDictionaries | ||
inDictionary: Launchpad | ||
options: #( dbTransient ). | ||
removeNonTransientVersionsOf value: CurrentlyRunningLaunchpadApplication. | ||
]. | ||
|
||
CurrentlyRunningLaunchpadApplication initializeUniqueInstance. |
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
3 changes: 0 additions & 3 deletions
3
source/Launchpad-GS64-Extensions-Tests/CommandLineArgumentsTest.class.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
27 changes: 27 additions & 0 deletions
27
source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.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,27 @@ | ||
Class { | ||
#name : #LaunchpadApplicationTransientTest, | ||
#superclass : #TestCase, | ||
#instVars : [ ], | ||
#category : #'Launchpad-GS64-Extensions-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
LaunchpadApplicationTransientTest >> testAccessingRunningApplication [ | ||
| application | | ||
|
||
application := LaunchpadBrokenApplication | ||
runningIn: DebuggingApplicationMode new | ||
configuredBy: NullConfigurationProvider new | ||
controlledBy: NullCommandServer new. | ||
|
||
LaunchpadApplication setAsCurrentlyRunning: application. | ||
System abortTransaction. | ||
self assert: LaunchpadApplication currentlyRunning equals: application | ||
] | ||
|
||
{ #category : #running } | ||
LaunchpadApplicationTransientTest >> tearDown [ | ||
|
||
CurrentlyRunningLaunchpadApplication new resetCurrentlyRunning. | ||
super tearDown | ||
] |