Skip to content

Commit

Permalink
Make LaunchpadApplication transient using Tonel options
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Apr 3, 2024
1 parent 2258012 commit 5e0eafa
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 37 deletions.
37 changes: 0 additions & 37 deletions rowan/components/scripts/deploymentPostload.st
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.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Class {
#classVars : [
'uniqueInstance'
],
#gs_options : [
'dbTransient'
],
#category : 'Launchpad-Applications',
#package : 'Launchpad-Applications'
}
Expand Down
3 changes: 3 additions & 0 deletions source/Launchpad-Applications/LaunchpadApplication.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Class {
'mode',
'commandServer'
],
#gs_options : [
'dbTransient'
],
#category : 'Launchpad-Applications',
#package : 'Launchpad-Applications'
}
Expand Down
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.
]

0 comments on commit 5e0eafa

Please sign in to comment.