From a0c96ac76fa65fc5cfa7e159cf35d4d90e9e502f Mon Sep 17 00:00:00 2001 From: "Esteban A. Maringolo" Date: Tue, 13 Sep 2022 16:12:48 -0300 Subject: [PATCH 1/2] Modifies WAServerManager to support subclasses to be defined as default. --- .../WAServerManager.class/class/beDefault.st | 5 +++++ .../WAServerManager.class/class/default.st | 6 ++++-- .../class/initializeDefaultValueHolder.st | 4 ++-- .../WAServerManager.class/class/setDefault..st | 6 ++++++ .../WAServerManager.class/properties.json | 8 ++++---- .../instance/testBeDefault.st | 13 +++++++++++++ .../instance/testSetDefault.st | 13 +++++++++++++ .../WATestServerManager.class/README.md | 1 + .../WATestServerManager.class/properties.json | 11 +++++++++++ 9 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st create mode 100644 repository/Seaside-Core.package/WAServerManager.class/class/setDefault..st create mode 100644 repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testBeDefault.st create mode 100644 repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testSetDefault.st create mode 100644 repository/Seaside-Tests-Core.package/WATestServerManager.class/README.md create mode 100644 repository/Seaside-Tests-Core.package/WATestServerManager.class/properties.json diff --git a/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st b/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st new file mode 100644 index 000000000..431fc7753 --- /dev/null +++ b/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st @@ -0,0 +1,5 @@ +configuring +beDefault + "Set an instance of receiver to be the default Server Manager." + + Default contents: self new \ No newline at end of file diff --git a/repository/Seaside-Core.package/WAServerManager.class/class/default.st b/repository/Seaside-Core.package/WAServerManager.class/class/default.st index 98bb59935..21001b140 100644 --- a/repository/Seaside-Core.package/WAServerManager.class/class/default.st +++ b/repository/Seaside-Core.package/WAServerManager.class/class/default.st @@ -1,4 +1,6 @@ accessing default - default contents ifNil: [ default contents: self new ]. - ^ default contents \ No newline at end of file + + self initializeDefaultValueHolder. + Default contents ifNil: [ Default contents: self new ]. + ^ Default contents \ No newline at end of file diff --git a/repository/Seaside-Core.package/WAServerManager.class/class/initializeDefaultValueHolder.st b/repository/Seaside-Core.package/WAServerManager.class/class/initializeDefaultValueHolder.st index 1730ec079..1742c3cbc 100644 --- a/repository/Seaside-Core.package/WAServerManager.class/class/initializeDefaultValueHolder.st +++ b/repository/Seaside-Core.package/WAServerManager.class/class/initializeDefaultValueHolder.st @@ -1,4 +1,4 @@ class initialization initializeDefaultValueHolder - default isNil ifTrue: [ - default := GRPlatform current newTransientValueHolder ] \ No newline at end of file + Default isNil ifTrue: [ + Default := GRPlatform current newTransientValueHolder ] \ No newline at end of file diff --git a/repository/Seaside-Core.package/WAServerManager.class/class/setDefault..st b/repository/Seaside-Core.package/WAServerManager.class/class/setDefault..st new file mode 100644 index 000000000..70678638d --- /dev/null +++ b/repository/Seaside-Core.package/WAServerManager.class/class/setDefault..st @@ -0,0 +1,6 @@ +configuring +setDefault: aWAServerManager + "Private - Sets aWAServerManager as the default instance of receiver." + + self initializeDefaultValueHolder. + Default contents: aWAServerManager. \ No newline at end of file diff --git a/repository/Seaside-Core.package/WAServerManager.class/properties.json b/repository/Seaside-Core.package/WAServerManager.class/properties.json index c8d2f5730..509674ddf 100644 --- a/repository/Seaside-Core.package/WAServerManager.class/properties.json +++ b/repository/Seaside-Core.package/WAServerManager.class/properties.json @@ -2,11 +2,11 @@ "commentStamp" : "TorstenBergmann 9/18/2021 23:06", "super" : "WAObject", "category" : "Seaside-Core-Server", - "classinstvars" : [ - "default" - ], + "classinstvars" : [ ], "pools" : [ ], - "classvars" : [ ], + "classvars" : [ + "Default" + ], "instvars" : [ "adaptors" ], diff --git a/repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testBeDefault.st b/repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testBeDefault.st new file mode 100644 index 000000000..8a5aad339 --- /dev/null +++ b/repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testBeDefault.st @@ -0,0 +1,13 @@ +tests +testBeDefault + + | previous | + previous := WAServerManager default. + [ + WATestServerManager beDefault. + self + assert: WAServerManager default class + equals: WATestServerManager + ] ensure: [ + WAServerManager setDefault: previous + ] \ No newline at end of file diff --git a/repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testSetDefault.st b/repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testSetDefault.st new file mode 100644 index 000000000..42bc23065 --- /dev/null +++ b/repository/Seaside-Tests-Core.package/WAServerManagerTest.class/instance/testSetDefault.st @@ -0,0 +1,13 @@ +tests +testSetDefault + + | previous | + previous := WAServerManager default. + [ + WAServerManager setDefault: WATestServerManager new. + self + assert: WAServerManager default class + equals: WATestServerManager + ] ensure: [ + WAServerManager setDefault: previous + ] \ No newline at end of file diff --git a/repository/Seaside-Tests-Core.package/WATestServerManager.class/README.md b/repository/Seaside-Tests-Core.package/WATestServerManager.class/README.md new file mode 100644 index 000000000..5e361f93e --- /dev/null +++ b/repository/Seaside-Tests-Core.package/WATestServerManager.class/README.md @@ -0,0 +1 @@ +I am a server manager used as an alternative of the WAServerManager, because some Smalltalk dialects have subclasses of WAServerManager. \ No newline at end of file diff --git a/repository/Seaside-Tests-Core.package/WATestServerManager.class/properties.json b/repository/Seaside-Tests-Core.package/WATestServerManager.class/properties.json new file mode 100644 index 000000000..3f096824e --- /dev/null +++ b/repository/Seaside-Tests-Core.package/WATestServerManager.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "EstebanMaringolo 9/13/2022 16:08", + "super" : "WAServerManager", + "category" : "Seaside-Tests-Core-Server", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "WATestServerManager", + "type" : "normal" +} \ No newline at end of file From f66f47dc1aa2d6a0d09eedbb5832861cbf80c9fb Mon Sep 17 00:00:00 2001 From: "Esteban A. Maringolo" Date: Tue, 13 Sep 2022 17:52:48 -0300 Subject: [PATCH 2/2] Change beDefault to call setDefault: --- .../WAServerManager.class/class/beDefault.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st b/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st index 431fc7753..26095f51c 100644 --- a/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st +++ b/repository/Seaside-Core.package/WAServerManager.class/class/beDefault.st @@ -2,4 +2,4 @@ configuring beDefault "Set an instance of receiver to be the default Server Manager." - Default contents: self new \ No newline at end of file + self setDefault: self new \ No newline at end of file