From 5e0eafa933d8c0bf2f89077478eb13c93d6d6e4a Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Wed, 3 Apr 2024 12:05:51 -0300 Subject: [PATCH 1/4] Make LaunchpadApplication transient using Tonel options --- .../components/scripts/deploymentPostload.st | 37 ------------------- ...rentlyRunningLaunchpadApplication.class.st | 3 ++ .../LaunchpadApplication.class.st | 3 ++ ...LaunchpadApplicationTransientTest.class.st | 30 +++++++++++++++ 4 files changed, 36 insertions(+), 37 deletions(-) create mode 100644 source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st diff --git a/rowan/components/scripts/deploymentPostload.st b/rowan/components/scripts/deploymentPostload.st index 5757f5c..239e73a 100644 --- a/rowan/components/scripts/deploymentPostload.st +++ b/rowan/components/scripts/deploymentPostload.st @@ -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. diff --git a/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st b/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st index 753a38c..f4a5c0e 100644 --- a/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st +++ b/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st @@ -7,6 +7,9 @@ Class { #classVars : [ 'uniqueInstance' ], + #gs_options : [ + 'dbTransient' + ], #category : 'Launchpad-Applications', #package : 'Launchpad-Applications' } diff --git a/source/Launchpad-Applications/LaunchpadApplication.class.st b/source/Launchpad-Applications/LaunchpadApplication.class.st index a795b77..9235b29 100644 --- a/source/Launchpad-Applications/LaunchpadApplication.class.st +++ b/source/Launchpad-Applications/LaunchpadApplication.class.st @@ -7,6 +7,9 @@ Class { 'mode', 'commandServer' ], + #gs_options : [ + 'dbTransient' + ], #category : 'Launchpad-Applications', #package : 'Launchpad-Applications' } diff --git a/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st b/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st new file mode 100644 index 0000000..0412042 --- /dev/null +++ b/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st @@ -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. +] From 2bdeb40fcb1a57225658790a8df4f8308e832cec Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Wed, 3 Apr 2024 12:13:45 -0300 Subject: [PATCH 2/4] Fix test --- .../LaunchpadApplicationTransientTest.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st b/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st index 0412042..59d1773 100644 --- a/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st +++ b/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st @@ -25,6 +25,6 @@ LaunchpadApplicationTransientTest >> testAccessingRunningApplication [ { #category : #running } LaunchpadApplicationTransientTest >> tearDown [ - CurrentlyRunningLaunchpadApplication new resetCurrentlyRunning - super tearDown. + CurrentlyRunningLaunchpadApplication new resetCurrentlyRunning. + super tearDown ] From 5a42be90343e05ecf901b695b020c78b494dd6c0 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Wed, 3 Apr 2024 12:20:16 -0300 Subject: [PATCH 3/4] Fix tabs --- .../CurrentlyRunningLaunchpadApplication.class.st | 4 ++-- source/Launchpad-Applications/LaunchpadApplication.class.st | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st b/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st index f4a5c0e..73cfa67 100644 --- a/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st +++ b/source/Launchpad-Applications/CurrentlyRunningLaunchpadApplication.class.st @@ -8,8 +8,8 @@ Class { 'uniqueInstance' ], #gs_options : [ - 'dbTransient' - ], + 'dbTransient' + ], #category : 'Launchpad-Applications', #package : 'Launchpad-Applications' } diff --git a/source/Launchpad-Applications/LaunchpadApplication.class.st b/source/Launchpad-Applications/LaunchpadApplication.class.st index 9235b29..05ae25e 100644 --- a/source/Launchpad-Applications/LaunchpadApplication.class.st +++ b/source/Launchpad-Applications/LaunchpadApplication.class.st @@ -8,8 +8,8 @@ Class { 'commandServer' ], #gs_options : [ - 'dbTransient' - ], + 'dbTransient' + ], #category : 'Launchpad-Applications', #package : 'Launchpad-Applications' } From c74f8a0e90f01308c67f439400f02ece0966951b Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Wed, 3 Apr 2024 12:21:35 -0300 Subject: [PATCH 4/4] Remove invalid comments --- .../CommandLineArgumentsTest.class.st | 3 --- .../LaunchpadApplicationTransientTest.class.st | 3 --- 2 files changed, 6 deletions(-) diff --git a/source/Launchpad-GS64-Extensions-Tests/CommandLineArgumentsTest.class.st b/source/Launchpad-GS64-Extensions-Tests/CommandLineArgumentsTest.class.st index 94b4d01..5736f6f 100644 --- a/source/Launchpad-GS64-Extensions-Tests/CommandLineArgumentsTest.class.st +++ b/source/Launchpad-GS64-Extensions-Tests/CommandLineArgumentsTest.class.st @@ -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, diff --git a/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st b/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st index 59d1773..d03d82d 100644 --- a/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st +++ b/source/Launchpad-GS64-Extensions-Tests/LaunchpadApplicationTransientTest.class.st @@ -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 : #LaunchpadApplicationTransientTest, #superclass : #TestCase,