-
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.
Make LaunchpadApplication transient using Tonel options
- Loading branch information
Showing
4 changed files
with
36 additions
and
37 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
30 changes: 30 additions & 0 deletions
30
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,30 @@ | ||
" | ||
That class tests the API given by AbstractUserInput. Since that class is obviously abstract, it can't be instantiated, the tests are running on CommandLine (which inherits from AbstractUserInput) | ||
" | ||
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. | ||
] |