Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LaunchpadApplication transient using Tonel options #59

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -1,6 +1,3 @@
"
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 : #CommandLineArgumentsTest,
#superclass : #TestCase,
Expand Down
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
]
Loading