Skip to content

Commit

Permalink
Merge pull request #59 from ba-st/transient_gs64
Browse files Browse the repository at this point in the history
Make LaunchpadApplication transient using Tonel options
  • Loading branch information
gcotelli authored Apr 3, 2024
2 parents 2258012 + c74f8a0 commit 9442c21
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 40 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
@@ -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
]

0 comments on commit 9442c21

Please sign in to comment.