From 6b722781a90bb6b239f6ef1544cedce709679b40 Mon Sep 17 00:00:00 2001 From: Christophe Demarey Date: Thu, 17 Oct 2024 10:50:49 +0200 Subject: [PATCH] move to Tonel v3 --- .../BaselineOfTeapot.class.st | 11 +-- source/BaselineOfTeapot/package.st | 2 +- .../ConfigurationOfTeapot.class.st | 83 ++++++++++--------- source/ConfigurationOfTeapot/package.st | 2 +- source/Teapot-Core/BlockClosure.extension.st | 8 +- source/Teapot-Core/Collection.extension.st | 4 +- source/Teapot-Core/IsInteger.class.st | 11 +-- source/Teapot-Core/IsNumber.class.st | 11 +-- source/Teapot-Core/IsObject.class.st | 11 +-- source/Teapot-Core/IsUUID.class.st | 11 +-- source/Teapot-Core/Object.extension.st | 8 +- source/Teapot-Core/RxMatcher.extension.st | 4 +- source/Teapot-Core/Send.class.st | 19 +++-- source/Teapot-Core/String.extension.st | 4 +- .../Tea405AwareNotFoundHandler.class.st | 11 +-- source/Teapot-Core/TeaAbort.class.st | 13 +-- source/Teapot-Core/TeaAfterFilter.class.st | 9 +- source/Teapot-Core/TeaBeforeFilter.class.st | 9 +- .../Teapot-Core/TeaCompositeRouter.class.st | 37 +++++---- source/Teapot-Core/TeaDynamicRouter.class.st | 15 ++-- source/Teapot-Core/TeaErrorHandler.class.st | 17 ++-- source/Teapot-Core/TeaFilter.class.st | 17 ++-- source/Teapot-Core/TeaGlobUrlPattern.class.st | 23 ++--- source/Teapot-Core/TeaGlobUrlSegment.class.st | 9 +- source/Teapot-Core/TeaLiteral.class.st | 15 ++-- source/Teapot-Core/TeaLiteralStop.class.st | 9 +- source/Teapot-Core/TeaMethodMatcher.class.st | 19 +++-- source/Teapot-Core/TeaNoSuchParam.class.st | 13 +-- .../Teapot-Core/TeaNotFoundHandler.class.st | 13 +-- source/Teapot-Core/TeaOutput.class.st | 29 +++---- source/Teapot-Core/TeaPadding.class.st | 7 +- source/Teapot-Core/TeaPlaceholder.class.st | 19 +++-- .../Teapot-Core/TeaPlaceholderStop.class.st | 9 +- source/Teapot-Core/TeaRequest.class.st | 25 +++--- source/Teapot-Core/TeaRequestMatcher.class.st | 21 ++--- source/Teapot-Core/TeaResponse.class.st | 51 ++++++------ source/Teapot-Core/TeaRoute.class.st | 23 ++--- source/Teapot-Core/TeaRouter.class.st | 9 +- source/Teapot-Core/TeaRxUrlPattern.class.st | 17 ++-- source/Teapot-Core/TeaStaticRouter.class.st | 11 +-- source/Teapot-Core/TeaUrlPattern.class.st | 9 +- source/Teapot-Core/TeaUrlPatternSet.class.st | 15 ++-- source/Teapot-Core/TeaWildcard.class.st | 13 +-- source/Teapot-Core/TeaWildcardStop.class.st | 9 +- source/Teapot-Core/Teapot.class.st | 57 ++++++------- source/Teapot-Core/ZnResponse.extension.st | 4 +- source/Teapot-Core/package.st | 2 +- .../BookNotFound.class.st | 13 +-- .../Teapot-Library-Example/BookShelf.class.st | 21 ++--- .../LibraryClient.class.st | 29 +++---- .../LibraryServer.class.st | 35 ++++---- .../LibraryServerTest.class.st | 27 +++--- source/Teapot-Library-Example/package.st | 2 +- source/Teapot-Tests/TeaTestClient.class.st | 25 +++--- .../Teapot-Tests/TeaUrlPatternTest.class.st | 35 ++++---- source/Teapot-Tests/TeapotAbortTest.class.st | 15 ++-- source/Teapot-Tests/TeapotAfterTest.class.st | 13 +-- source/Teapot-Tests/TeapotBeforeTest.class.st | 19 +++-- .../TeapotDefaultFormatTest.class.st | 15 ++-- .../Teapot-Tests/TeapotEncodingTest.class.st | 13 +-- .../TeapotErrorHandlingTest.class.st | 21 ++--- .../TeapotFormParamsTest.class.st | 15 ++-- source/Teapot-Tests/TeapotFormatTest.class.st | 19 +++-- .../TeapotMessageSendTest.class.st | 23 ++--- .../Teapot-Tests/TeapotPathParamTest.class.st | 19 +++-- .../TeapotQueryParamsTest.class.st | 15 ++-- source/Teapot-Tests/TeapotRegexpTest.class.st | 17 ++-- .../Teapot-Tests/TeapotResponseTest.class.st | 13 +-- .../TeapotReturnResponseTest.class.st | 17 ++-- .../Teapot-Tests/TeapotRouteSetTest.class.st | 19 +++-- .../Teapot-Tests/TeapotRoutingTest.class.st | 29 +++---- source/Teapot-Tests/TeapotSslTest.class.st | 19 +++-- .../TeapotStaticFilesTest.class.st | 21 ++--- .../Teapot-Tests/TeapotStreamingTest.class.st | 19 +++-- .../TeapotTeaResponseTest.class.st | 29 +++---- .../TeapotWhenClauseTest.class.st | 15 ++-- .../TeapotWithTypeConstraintTest.class.st | 17 ++-- source/Teapot-Tests/package.st | 2 +- source/Teapot-Tools/Cupboard.class.st | 62 +++++++------- .../Teapot-Tools/ManifestTeapotTools.class.st | 10 ++- source/Teapot-Tools/TeaFormTab.class.st | 24 +++--- .../TeaGlobUrlPattern.extension.st | 4 +- source/Teapot-Tools/TeaIconProvider.class.st | 40 ++++----- source/Teapot-Tools/TeaKeyValueInput.class.st | 24 +++--- source/Teapot-Tools/TeaKeyValueList.class.st | 26 +++--- .../Teapot-Tools/TeaRequestBodyTabs.class.st | 24 +++--- .../TeaRequestMatcher.extension.st | 4 +- source/Teapot-Tools/TeaRoute.extension.st | 4 +- .../Teapot-Tools/TeaRxUrlPattern.extension.st | 4 +- .../TeaUrlPatternSet.extension.st | 6 +- source/Teapot-Tools/Teapot.extension.st | 22 ++--- source/Teapot-Tools/Teaspoon.class.st | 50 +++++------ source/Teapot-Tools/package.st | 2 +- 93 files changed, 864 insertions(+), 781 deletions(-) diff --git a/source/BaselineOfTeapot/BaselineOfTeapot.class.st b/source/BaselineOfTeapot/BaselineOfTeapot.class.st index b2f767d..2be1bc2 100644 --- a/source/BaselineOfTeapot/BaselineOfTeapot.class.st +++ b/source/BaselineOfTeapot/BaselineOfTeapot.class.st @@ -1,10 +1,11 @@ Class { - #name : #BaselineOfTeapot, - #superclass : #BaselineOf, - #category : #BaselineOfTeapot + #name : 'BaselineOfTeapot', + #superclass : 'BaselineOf', + #category : 'BaselineOfTeapot', + #package : 'BaselineOfTeapot' } -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfTeapot >> baseline: spec [ @@ -31,7 +32,7 @@ BaselineOfTeapot >> baseline: spec [ ] ] -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfTeapot >> setUpDependencies: spec [ spec diff --git a/source/BaselineOfTeapot/package.st b/source/BaselineOfTeapot/package.st index b536fc3..dc9270c 100644 --- a/source/BaselineOfTeapot/package.st +++ b/source/BaselineOfTeapot/package.st @@ -1 +1 @@ -Package { #name : #BaselineOfTeapot } +Package { #name : 'BaselineOfTeapot' } diff --git a/source/ConfigurationOfTeapot/ConfigurationOfTeapot.class.st b/source/ConfigurationOfTeapot/ConfigurationOfTeapot.class.st index d47a672..beac788 100644 --- a/source/ConfigurationOfTeapot/ConfigurationOfTeapot.class.st +++ b/source/ConfigurationOfTeapot/ConfigurationOfTeapot.class.st @@ -4,18 +4,19 @@ Configuration for Teapot micro web framework. See http://smalltalkhub.com/#!/~zeroflag/Teapot " Class { - #name : #ConfigurationOfTeapot, - #superclass : #Object, + #name : 'ConfigurationOfTeapot', + #superclass : 'Object', #instVars : [ 'project' ], #classVars : [ 'LastVersionLoad' ], - #category : #ConfigurationOfTeapot + #category : 'ConfigurationOfTeapot', + #package : 'ConfigurationOfTeapot' } -{ #category : #'development support' } +{ #category : 'development support' } ConfigurationOfTeapot class >> DevelopmentSupport [ "See the methods in the 'development support' category on the class-side of MetacelloBaseConfiguration. Decide what development support methods you would like to use and copy them the the class-side of your configuration." @@ -23,7 +24,7 @@ ConfigurationOfTeapot class >> DevelopmentSupport [ ] -{ #category : #private } +{ #category : 'private' } ConfigurationOfTeapot class >> baseConfigurationClassIfAbsent: aBlock [ ^Smalltalk @@ -34,43 +35,43 @@ ConfigurationOfTeapot class >> baseConfigurationClassIfAbsent: aBlock [ ] -{ #category : #catalog } +{ #category : 'catalog' } ConfigurationOfTeapot class >> catalogChangeLog [ "Returns a paragraph describing the most important changes in the configuration class." ^ ' ' ] -{ #category : #catalog } +{ #category : 'catalog' } ConfigurationOfTeapot class >> catalogContactInfo [ "Returns a paragraph describing contact information such as email, mailing lists and website." ^ 'Contact the authors on the Pharo developer list (http://lists.pharo.org)' ] -{ #category : #catalog } +{ #category : 'catalog' } ConfigurationOfTeapot class >> catalogDescription [ "Returns a paragraph describing the project" ^ 'Teapot is micro web framework on top of the Zinc HTTP components, that focuses on simplicity and ease of use.' ] -{ #category : #catalog } +{ #category : 'catalog' } ConfigurationOfTeapot class >> catalogKeyClassesAndExample [ "Returns a paragraph or more describing the key classes of your project. You can use Pillar/Pier syntax to layout out the text i.e., ==Code== and - for bullet." ^ 'Checkout the class ==Teapot==' ] -{ #category : #catalog } +{ #category : 'catalog' } ConfigurationOfTeapot class >> catalogKeywords [ "Returns an array of symbols" ^ #(micro web framework http sinatra) ] -{ #category : #private } +{ #category : 'private' } ConfigurationOfTeapot class >> ensureMetacello [ (self baseConfigurationClassIfAbsent: []) ensureMetacello ] -{ #category : #private } +{ #category : 'private' } ConfigurationOfTeapot class >> ensureMetacelloBaseConfiguration [ Smalltalk @@ -86,14 +87,14 @@ ConfigurationOfTeapot class >> ensureMetacelloBaseConfiguration [ version workingCopy repositoryGroup addRepository: repository ] ] ] -{ #category : #'metacello tool support' } +{ #category : 'metacello tool support' } ConfigurationOfTeapot class >> isMetacelloConfig [ "Answer true and the Metacello tools will operate on you" ^true ] -{ #category : #loading } +{ #category : 'loading' } ConfigurationOfTeapot class >> load [ "Load the #stable version defined for this platform. The #stable version is the version that is recommended to be used on this platform." @@ -103,7 +104,7 @@ ConfigurationOfTeapot class >> load [ ^(self project version: #stable) load ] -{ #category : #loading } +{ #category : 'loading' } ConfigurationOfTeapot class >> loadBleedingEdge [ "Load the latest versions of the mcz files defined for this project. It is not likely that the #bleedingEdge has been tested." @@ -113,7 +114,7 @@ ConfigurationOfTeapot class >> loadBleedingEdge [ ^(self project version: #bleedingEdge) load ] -{ #category : #loading } +{ #category : 'loading' } ConfigurationOfTeapot class >> loadDevelopment [ "Load the #development version defined for this platform. The #development version will change over time and is not expected to be stable." @@ -123,13 +124,13 @@ ConfigurationOfTeapot class >> loadDevelopment [ ^(self project version: #development) load ] -{ #category : #accessing } +{ #category : 'accessing' } ConfigurationOfTeapot class >> project [ ^self new project ] -{ #category : #'development support' } +{ #category : 'development support' } ConfigurationOfTeapot class >> validate [ "Check the configuration for Errors, Critical Warnings, and Warnings (see class comment for MetacelloMCVersionValidator for more information). Errors identify specification issues that will result in unexpected behaviour when you load the configuration. @@ -143,7 +144,7 @@ ConfigurationOfTeapot class >> validate [ ^ ((Smalltalk at: #MetacelloToolBox) validateConfiguration: self debug: #() recurse: false) explore ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline01: spec [ @@ -154,7 +155,7 @@ ConfigurationOfTeapot >> baseline01: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline20: spec [ @@ -182,7 +183,7 @@ ConfigurationOfTeapot >> baseline20: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline21: spec [ @@ -215,7 +216,7 @@ ConfigurationOfTeapot >> baseline21: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline22: spec [ @@ -248,7 +249,7 @@ ConfigurationOfTeapot >> baseline22: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline23: spec [ @@ -281,7 +282,7 @@ ConfigurationOfTeapot >> baseline23: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline24: spec [ @@ -314,7 +315,7 @@ ConfigurationOfTeapot >> baseline24: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline25: spec [ @@ -342,7 +343,7 @@ ConfigurationOfTeapot >> baseline25: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline26: spec [ @@ -370,7 +371,7 @@ ConfigurationOfTeapot >> baseline26: spec [ ] -{ #category : #baselines } +{ #category : 'baselines' } ConfigurationOfTeapot >> baseline27: spec [ @@ -398,7 +399,7 @@ ConfigurationOfTeapot >> baseline27: spec [ ] -{ #category : #accessing } +{ #category : 'accessing' } ConfigurationOfTeapot >> customProjectAttributes [ "Edit to return a collection of any custom attributes e.g. for conditional loading: Array with: #'Condition1' with: #'Condition2. For more information see: http://code.google.com/p/metacello/wiki/CustomProjectAttrributes" @@ -406,7 +407,7 @@ ConfigurationOfTeapot >> customProjectAttributes [ ^ #(). ] -{ #category : #'symbolic versions' } +{ #category : 'symbolic versions' } ConfigurationOfTeapot >> development: spec [ @@ -414,7 +415,7 @@ ConfigurationOfTeapot >> development: spec [ ] -{ #category : #accessing } +{ #category : 'accessing' } ConfigurationOfTeapot >> project [ ^ project ifNil: [ @@ -427,7 +428,7 @@ ConfigurationOfTeapot >> project [ project ] ] -{ #category : #'symbolic versions' } +{ #category : 'symbolic versions' } ConfigurationOfTeapot >> stable: spec [ @@ -435,7 +436,7 @@ ConfigurationOfTeapot >> stable: spec [ spec for: #'pharo7.x' version: '2.6'. ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version08: spec [ @@ -448,7 +449,7 @@ ConfigurationOfTeapot >> version08: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version091: spec [ @@ -461,7 +462,7 @@ ConfigurationOfTeapot >> version091: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version09: spec [ @@ -474,7 +475,7 @@ ConfigurationOfTeapot >> version09: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version20: spec [ @@ -491,7 +492,7 @@ ConfigurationOfTeapot >> version20: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version21: spec [ @@ -510,7 +511,7 @@ ConfigurationOfTeapot >> version21: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version22: spec [ @@ -529,7 +530,7 @@ ConfigurationOfTeapot >> version22: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version23: spec [ @@ -548,7 +549,7 @@ ConfigurationOfTeapot >> version23: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version24: spec [ @@ -567,7 +568,7 @@ ConfigurationOfTeapot >> version24: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version25: spec [ @@ -585,7 +586,7 @@ ConfigurationOfTeapot >> version25: spec [ ] -{ #category : #versions } +{ #category : 'versions' } ConfigurationOfTeapot >> version26: spec [ diff --git a/source/ConfigurationOfTeapot/package.st b/source/ConfigurationOfTeapot/package.st index 5b480d3..cae1141 100644 --- a/source/ConfigurationOfTeapot/package.st +++ b/source/ConfigurationOfTeapot/package.st @@ -1 +1 @@ -Package { #name : #ConfigurationOfTeapot } +Package { #name : 'ConfigurationOfTeapot' } diff --git a/source/Teapot-Core/BlockClosure.extension.st b/source/Teapot-Core/BlockClosure.extension.st index da01ff1..2f0652c 100644 --- a/source/Teapot-Core/BlockClosure.extension.st +++ b/source/Teapot-Core/BlockClosure.extension.st @@ -1,16 +1,16 @@ -Extension { #name : #BlockClosure } +Extension { #name : 'BlockClosure' } -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } BlockClosure >> teaEvalActionOnException: anException request: aTeaRequest [ ^ self cull: anException cull: aTeaRequest ] -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } BlockClosure >> teaEvalActionOnRequest: aTeaRequest [ ^ self cull: aTeaRequest ] -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } BlockClosure >> teaEvalActionOnRequest: aTeaRequest response: aZnResponse [ ^ self cull: aTeaRequest cull: aZnResponse ] diff --git a/source/Teapot-Core/Collection.extension.st b/source/Teapot-Core/Collection.extension.st index f44aa49..e8e00c2 100644 --- a/source/Teapot-Core/Collection.extension.st +++ b/source/Teapot-Core/Collection.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Collection } +Extension { #name : 'Collection' } -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } Collection >> asTeaUrlPattern [ ^ TeaUrlPatternSet fromCollection: self ] diff --git a/source/Teapot-Core/IsInteger.class.st b/source/Teapot-Core/IsInteger.class.st index 582338f..0781fe0 100644 --- a/source/Teapot-Core/IsInteger.class.st +++ b/source/Teapot-Core/IsInteger.class.st @@ -3,17 +3,18 @@ I'm a type constraint that matches to positive or negative integers. " Class { - #name : #IsInteger, - #superclass : #IsObject, - #category : #'Teapot-Core' + #name : 'IsInteger', + #superclass : 'IsObject', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsInteger class >> matchesTo: aString [ ^ '-?\d+' asRegex matches: aString ] -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsInteger class >> parseString: aString [ ^ aString asInteger ] diff --git a/source/Teapot-Core/IsNumber.class.st b/source/Teapot-Core/IsNumber.class.st index 433b9bc..164d9fe 100644 --- a/source/Teapot-Core/IsNumber.class.st +++ b/source/Teapot-Core/IsNumber.class.st @@ -3,18 +3,19 @@ I'm a type constraint that matches to positive or negative floats or integers. " Class { - #name : #IsNumber, - #superclass : #IsObject, - #category : #'Teapot-Core' + #name : 'IsNumber', + #superclass : 'IsObject', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsNumber class >> matchesTo: aString [ Number readFrom: aString ifFail: [ ^false ]. ^ true ] -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsNumber class >> parseString: aString [ ^ aString asNumber ] diff --git a/source/Teapot-Core/IsObject.class.st b/source/Teapot-Core/IsObject.class.st index efee134..d21f076 100644 --- a/source/Teapot-Core/IsObject.class.st +++ b/source/Teapot-Core/IsObject.class.st @@ -12,17 +12,18 @@ This route matches to the '/users/12' but does not match to '/users/foobar'. In You can extend the built in type constraints with your own constraints, by implementing the ""placeholder type constraint"" protocol. Then you can use the class name in the URL. " Class { - #name : #IsObject, - #superclass : #Object, - #category : #'Teapot-Core' + #name : 'IsObject', + #superclass : 'Object', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsObject class >> matchesTo: aString [ ^ true ] -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsObject class >> parseString: aString [ ^ aString ] diff --git a/source/Teapot-Core/IsUUID.class.st b/source/Teapot-Core/IsUUID.class.st index e3b8f66..3eea344 100644 --- a/source/Teapot-Core/IsUUID.class.st +++ b/source/Teapot-Core/IsUUID.class.st @@ -3,17 +3,18 @@ I'm a type constraint that matches to an UUID. " Class { - #name : #IsUUID, - #superclass : #IsObject, - #category : #'Teapot-Core' + #name : 'IsUUID', + #superclass : 'IsObject', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsUUID class >> matchesTo: aString [ ^ '[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}' asRegex matches: aString ] -{ #category : #'type constraint' } +{ #category : 'type constraint' } IsUUID class >> parseString: aString [ ^ UUID fromString: aString ] diff --git a/source/Teapot-Core/Object.extension.st b/source/Teapot-Core/Object.extension.st index f52cebf..2470c3f 100644 --- a/source/Teapot-Core/Object.extension.st +++ b/source/Teapot-Core/Object.extension.st @@ -1,16 +1,16 @@ -Extension { #name : #Object } +Extension { #name : 'Object' } -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } Object >> teaEvalActionOnException: anException request: aTeaRequest [ ^ self ] -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } Object >> teaEvalActionOnRequest: aTeaRequest [ ^ self ] -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } Object >> teaTransform: aResponseTransformer request: aTeaRequest [ ^ aResponseTransformer cull: (TeaResponse ok body: self) cull: aTeaRequest ] diff --git a/source/Teapot-Core/RxMatcher.extension.st b/source/Teapot-Core/RxMatcher.extension.st index 824612e..7007b12 100644 --- a/source/Teapot-Core/RxMatcher.extension.st +++ b/source/Teapot-Core/RxMatcher.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RxMatcher } +Extension { #name : 'RxMatcher' } -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } RxMatcher >> asTeaUrlPattern [ ^ TeaRxUrlPattern fromRxMatcher: self ] diff --git a/source/Teapot-Core/Send.class.st b/source/Teapot-Core/Send.class.st index 13e6752..8be91f3 100644 --- a/source/Teapot-Core/Send.class.st +++ b/source/Teapot-Core/Send.class.st @@ -9,23 +9,24 @@ Teapot on " Class { - #name : #Send, - #superclass : #Object, + #name : 'Send', + #superclass : 'Object', #instVars : [ 'selector', 'receiver' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } Send class >> message: aSymbol to: anObject [ ^ self new setSelector: aSymbol receiver: anObject ] -{ #category : #printing } +{ #category : 'printing' } Send >> printOn: aStream [ aStream nextPutAll: '(Send message: '; @@ -35,14 +36,14 @@ Send >> printOn: aStream [ aStream nextPut: $) ] -{ #category : #initialization } +{ #category : 'initialization' } Send >> setSelector: aSymbol receiver: anObject [ selector := aSymbol. receiver := anObject. ^ self ] -{ #category : #'tea action' } +{ #category : 'tea action' } Send >> teaEvalActionOnException: anException request: aTeaRequest [ ^ receiver perform: selector @@ -51,7 +52,7 @@ Send >> teaEvalActionOnException: anException request: aTeaRequest [ ] -{ #category : #'tea action' } +{ #category : 'tea action' } Send >> teaEvalActionOnRequest: aTeaRequest [ ^ receiver perform: selector @@ -60,7 +61,7 @@ Send >> teaEvalActionOnRequest: aTeaRequest [ ] -{ #category : #'tea action' } +{ #category : 'tea action' } Send >> teaEvalActionOnRequest: aTeaRequest response: aZnResponse [ ^ receiver perform: selector diff --git a/source/Teapot-Core/String.extension.st b/source/Teapot-Core/String.extension.st index 4907572..a3fae01 100644 --- a/source/Teapot-Core/String.extension.st +++ b/source/Teapot-Core/String.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #String } +Extension { #name : 'String' } -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } String >> asTeaUrlPattern [ ^ TeaGlobUrlPattern parseString: self ] diff --git a/source/Teapot-Core/Tea405AwareNotFoundHandler.class.st b/source/Teapot-Core/Tea405AwareNotFoundHandler.class.st index 12e3568..81a1f56 100644 --- a/source/Teapot-Core/Tea405AwareNotFoundHandler.class.st +++ b/source/Teapot-Core/Tea405AwareNotFoundHandler.class.st @@ -2,12 +2,13 @@ I'm a smarter not found handler that returns 405 instead of 404 when the url part of some routes matched but the HTTP method didn't. " Class { - #name : #Tea405AwareNotFoundHandler, - #superclass : #TeaNotFoundHandler, - #category : #'Teapot-Core' + #name : 'Tea405AwareNotFoundHandler', + #superclass : 'TeaNotFoundHandler', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #private } +{ #category : 'private' } Tea405AwareNotFoundHandler >> populateAllowedHeaderOf: response withAllowedRoutes: allowedRoutes [ allowedRoutes do: [ :route | response headers @@ -17,7 +18,7 @@ Tea405AwareNotFoundHandler >> populateAllowedHeaderOf: response withAllowedRoute ^ response ] -{ #category : #'not found handler' } +{ #category : 'not found handler' } Tea405AwareNotFoundHandler >> requestNotFound: aZnRequest [ | allowedRoutes | allowedRoutes := routes diff --git a/source/Teapot-Core/TeaAbort.class.st b/source/Teapot-Core/TeaAbort.class.st index 89da58d..ce0c783 100644 --- a/source/Teapot-Core/TeaAbort.class.st +++ b/source/Teapot-Core/TeaAbort.class.st @@ -2,25 +2,26 @@ I'm an exception that immediately stops a request within a filter or route. " Class { - #name : #TeaAbort, - #superclass : #Error, + #name : 'TeaAbort', + #superclass : 'Error', #instVars : [ 'response' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaAbort class >> response: aZnResponse [ ^ self new setResponse: aZnResponse ] -{ #category : #converting } +{ #category : 'converting' } TeaAbort >> response [ ^ response ] -{ #category : #initialization } +{ #category : 'initialization' } TeaAbort >> setResponse: aZnResponse [ response := aZnResponse. ^ self diff --git a/source/Teapot-Core/TeaAfterFilter.class.st b/source/Teapot-Core/TeaAfterFilter.class.st index 934aace..6925003 100644 --- a/source/Teapot-Core/TeaAfterFilter.class.st +++ b/source/Teapot-Core/TeaAfterFilter.class.st @@ -2,12 +2,13 @@ An after filter is evaluated after each (matching) request. This filter has access to the response object generated by the matching route. The response can be modified from the filter, e.g. addition headers can be added. " Class { - #name : #TeaAfterFilter, - #superclass : #TeaFilter, - #category : #'Teapot-Core' + #name : 'TeaAfterFilter', + #superclass : 'TeaFilter', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'response handling' } +{ #category : 'response handling' } TeaAfterFilter >> handleRequest: aZnRequest response: aZnResponse [ requestMatcher matchRequest: aZnRequest diff --git a/source/Teapot-Core/TeaBeforeFilter.class.st b/source/Teapot-Core/TeaBeforeFilter.class.st index 3135bf2..5542116 100644 --- a/source/Teapot-Core/TeaBeforeFilter.class.st +++ b/source/Teapot-Core/TeaBeforeFilter.class.st @@ -2,12 +2,13 @@ A before filter is evaluated before (matching) each request. This filter has access to the request object. For example, a before filter can be used to validate session attributes for authentication. " Class { - #name : #TeaBeforeFilter, - #superclass : #TeaFilter, - #category : #'Teapot-Core' + #name : 'TeaBeforeFilter', + #superclass : 'TeaFilter', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'request handling' } +{ #category : 'request handling' } TeaBeforeFilter >> handleRequest: aZnRequest [ requestMatcher matchRequest: aZnRequest diff --git a/source/Teapot-Core/TeaCompositeRouter.class.st b/source/Teapot-Core/TeaCompositeRouter.class.st index 49bdd06..6b9f849 100644 --- a/source/Teapot-Core/TeaCompositeRouter.class.st +++ b/source/Teapot-Core/TeaCompositeRouter.class.st @@ -2,8 +2,8 @@ I'm a composite zn delegate, built from other zn delegates. I forward the request to the first delegate that returns other than 404 as response. Errors are handled with the help of the registered error handlers. " Class { - #name : #TeaCompositeRouter, - #superclass : #TeaRouter, + #name : 'TeaCompositeRouter', + #superclass : 'TeaRouter', #instVars : [ 'routers', 'errorhandlers', @@ -11,52 +11,53 @@ Class { 'afterFilters', 'notFoundHandler' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaCompositeRouter class >> routers: teaRouterCollection [ ^ self new setRouters: teaRouterCollection ] -{ #category : #filters } +{ #category : 'filters' } TeaCompositeRouter >> addAfterFilter: aTeaFilter [ ^ afterFilters add: aTeaFilter ] -{ #category : #filters } +{ #category : 'filters' } TeaCompositeRouter >> addBeforeFilter: aTeaFilter [ ^ beforeFilters add: aTeaFilter ] -{ #category : #'error handing' } +{ #category : 'error handing' } TeaCompositeRouter >> addErrorHandler: aTeaErrorHandler [ ^ errorhandlers add: aTeaErrorHandler ] -{ #category : #accessing } +{ #category : 'accessing' } TeaCompositeRouter >> afterFilters [ ^afterFilters ] -{ #category : #accessing } +{ #category : 'accessing' } TeaCompositeRouter >> beforeFilters [ ^beforeFilters ] -{ #category : #private } +{ #category : 'private' } TeaCompositeRouter >> evaluateAfterFilters: aZnRequest response: aZnResponse [ afterFilters do: [ :each | each handleRequest: aZnRequest response: aZnResponse ] ] -{ #category : #private } +{ #category : 'private' } TeaCompositeRouter >> evaluateBeforeFilters: aZnRequest [ beforeFilters do: [ :each | each handleRequest: aZnRequest ] ] -{ #category : #private } +{ #category : 'private' } TeaCompositeRouter >> evaluateRouters: aZnRequest ifUnhandled: aBlock [ routers do: [ :each | | response | response := each handleRequest: aZnRequest ifUnhandled: nil. @@ -64,7 +65,7 @@ TeaCompositeRouter >> evaluateRouters: aZnRequest ifUnhandled: aBlock [ ^ aBlock value ] -{ #category : #private } +{ #category : 'private' } TeaCompositeRouter >> exceptionOccurred: anException request: aZnRequest [ | handler | handler := errorhandlers @@ -74,14 +75,14 @@ TeaCompositeRouter >> exceptionOccurred: anException request: aZnRequest [ ] -{ #category : #'zn delegate' } +{ #category : 'zn delegate' } TeaCompositeRouter >> handleRequest: aZnRequest [ ^ self handleRequest: aZnRequest ifUnhandled: [ notFoundHandler requestNotFound: aZnRequest ] ] -{ #category : #'zn delegate' } +{ #category : 'zn delegate' } TeaCompositeRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ | response | ^ [ self evaluateBeforeFilters: aZnRequest. @@ -92,7 +93,7 @@ TeaCompositeRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ do: [ :ex | self exceptionOccurred: ex request: aZnRequest ] ] -{ #category : #initialization } +{ #category : 'initialization' } TeaCompositeRouter >> initialize [ super initialize. errorhandlers := OrderedCollection new. @@ -101,12 +102,12 @@ TeaCompositeRouter >> initialize [ notFoundHandler := TeaNotFoundHandler new. ] -{ #category : #'error handing' } +{ #category : 'error handing' } TeaCompositeRouter >> notFoundHandler: aTeaNotFoundHandler [ notFoundHandler := aTeaNotFoundHandler ] -{ #category : #initialization } +{ #category : 'initialization' } TeaCompositeRouter >> setRouters: teaRouterCollection [ routers := teaRouterCollection asArray. ^ self diff --git a/source/Teapot-Core/TeaDynamicRouter.class.st b/source/Teapot-Core/TeaDynamicRouter.class.st index 28c1cf3..9b616b3 100644 --- a/source/Teapot-Core/TeaDynamicRouter.class.st +++ b/source/Teapot-Core/TeaDynamicRouter.class.st @@ -2,20 +2,21 @@ I'm a ZnDelegate. I serve dynamically generated contents. The request is handled by the first route object, that returns other than 404 as response. " Class { - #name : #TeaDynamicRouter, - #superclass : #TeaRouter, + #name : 'TeaDynamicRouter', + #superclass : 'TeaRouter', #instVars : [ 'routes' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'route dispatcher' } +{ #category : 'route dispatcher' } TeaDynamicRouter >> addRoute: aRoute [ ^ routes add: aRoute ] -{ #category : #'zn delegate' } +{ #category : 'zn delegate' } TeaDynamicRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ routes do: [ :each | | response | response := each handleRequest: aZnRequest ifUnhandled: nil. @@ -23,13 +24,13 @@ TeaDynamicRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ ^ aBlock value ] -{ #category : #initialization } +{ #category : 'initialization' } TeaDynamicRouter >> initialize [ super initialize. routes := OrderedCollection new. ] -{ #category : #accessing } +{ #category : 'accessing' } TeaDynamicRouter >> routes [ ^routes diff --git a/source/Teapot-Core/TeaErrorHandler.class.st b/source/Teapot-Core/TeaErrorHandler.class.st index ab2ff4e..e9c1f85 100644 --- a/source/Teapot-Core/TeaErrorHandler.class.st +++ b/source/Teapot-Core/TeaErrorHandler.class.st @@ -2,17 +2,18 @@ An error handler handles Exceptions signaled by the Routes or before actions. " Class { - #name : #TeaErrorHandler, - #superclass : #Object, + #name : 'TeaErrorHandler', + #superclass : 'Object', #instVars : [ 'action', 'responseTransformer', 'exceptions' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaErrorHandler class >> for: anExceptionSet action: aTeaAction responseTransformer: aResponseTransformer [ ^ self new setExceptions: anExceptionSet @@ -20,12 +21,12 @@ TeaErrorHandler class >> for: anExceptionSet action: aTeaAction responseTransfor responseTransformer: aResponseTransformer ] -{ #category : #'error handler' } +{ #category : 'error handler' } TeaErrorHandler >> canHandleError: anException [ ^ exceptions handles: anException ] -{ #category : #'error handler' } +{ #category : 'error handler' } TeaErrorHandler >> handleError: anException request: aTeaRequest [ | result | ^ (self canHandleError: anException) @@ -36,12 +37,12 @@ TeaErrorHandler >> handleError: anException request: aTeaRequest [ [ self error: 'Cannot handle ', anException printString ] ] -{ #category : #'error handler' } +{ #category : 'error handler' } TeaErrorHandler >> responseTransformer: aResponseTransformer [ responseTransformer := aResponseTransformer ] -{ #category : #initialization } +{ #category : 'initialization' } TeaErrorHandler >> setExceptions: anExceptionSet action: aTeaAction responseTransformer: aResponseTransformer [ exceptions := anExceptionSet. action := aTeaAction. diff --git a/source/Teapot-Core/TeaFilter.class.st b/source/Teapot-Core/TeaFilter.class.st index 28d9827..4a81b11 100644 --- a/source/Teapot-Core/TeaFilter.class.st +++ b/source/Teapot-Core/TeaFilter.class.st @@ -2,16 +2,17 @@ After and Before filters " Class { - #name : #TeaFilter, - #superclass : #Object, + #name : 'TeaFilter', + #superclass : 'Object', #instVars : [ 'action', 'requestMatcher' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaFilter class >> urlPattern: anUrlPattern action: aTeaAction [ ^ self new setMatcher: (TeaRequestMatcher method: TeaMethodMatcher any url: anUrlPattern) @@ -19,26 +20,26 @@ TeaFilter class >> urlPattern: anUrlPattern action: aTeaAction [ ] -{ #category : #acccessing } +{ #category : 'acccessing' } TeaFilter >> action [ ^action ] -{ #category : #acccessing } +{ #category : 'acccessing' } TeaFilter >> requestMatcher [ ^requestMatcher ] -{ #category : #initialization } +{ #category : 'initialization' } TeaFilter >> setMatcher: aTeaRequestMatcher action: aTeaAction [ requestMatcher := aTeaRequestMatcher. action := aTeaAction. ^ self ] -{ #category : #acccessing } +{ #category : 'acccessing' } TeaFilter >> whenClause: aBlockClosure [ requestMatcher whenClause: aBlockClosure ] diff --git a/source/Teapot-Core/TeaGlobUrlPattern.class.st b/source/Teapot-Core/TeaGlobUrlPattern.class.st index a9066b5..821fd51 100644 --- a/source/Teapot-Core/TeaGlobUrlPattern.class.st +++ b/source/Teapot-Core/TeaGlobUrlPattern.class.st @@ -10,15 +10,16 @@ Which will create a pattern that matches to an URL like this: /foo/xyz/12/bar " Class { - #name : #TeaGlobUrlPattern, - #superclass : #TeaUrlPattern, + #name : 'TeaGlobUrlPattern', + #superclass : 'TeaUrlPattern', #instVars : [ 'segments' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #private } +{ #category : 'private' } TeaGlobUrlPattern class >> createSegment: aString atLast: aBoolean [ aString = '*' ifTrue: [ ^ TeaWildcard atLast: aBoolean ]. @@ -27,7 +28,7 @@ TeaGlobUrlPattern class >> createSegment: aString atLast: aBoolean [ ^ TeaLiteral fromString: aString atLast: aBoolean ] -{ #category : #private } +{ #category : 'private' } TeaGlobUrlPattern class >> parseSegments: aString [ | tokens | tokens := aString findTokens: '/'. @@ -35,12 +36,12 @@ TeaGlobUrlPattern class >> parseSegments: aString [ self createSegment: each atLast: idx = tokens size ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaGlobUrlPattern class >> parseString: aString [ ^ self new setSegments: (self parseSegments: aString) ] -{ #category : #'url matcher' } +{ #category : 'url matcher' } TeaGlobUrlPattern >> matchesUrl: anUrl placeholders: aDictionary [ | urlSegments | urlSegments := self padUrlSegments: anUrl with: TeaPadding size: segments size. @@ -52,7 +53,7 @@ TeaGlobUrlPattern >> matchesUrl: anUrl placeholders: aDictionary [ placeholders: aDictionary ] -{ #category : #private } +{ #category : 'private' } TeaGlobUrlPattern >> padUrlSegments: anUrl with: padding size: anInteger [ | urlSegments | urlSegments := anUrl segments isEmptyOrNil @@ -63,7 +64,7 @@ TeaGlobUrlPattern >> padUrlSegments: anUrl with: padding size: anInteger [ ^ urlSegments ] -{ #category : #printing } +{ #category : 'printing' } TeaGlobUrlPattern >> printOn: aStream [ aStream nextPut: $'. segments @@ -72,13 +73,13 @@ TeaGlobUrlPattern >> printOn: aStream [ aStream nextPut: $'. ] -{ #category : #initialization } +{ #category : 'initialization' } TeaGlobUrlPattern >> setSegments: anArray [ segments := anArray. ^ self ] -{ #category : #private } +{ #category : 'private' } TeaGlobUrlPattern >> trimTrailingSlash: urlSegments [ ^ (urlSegments isNotEmpty and: [ urlSegments last asString = '/' ]) ifTrue: [ urlSegments allButLast ] diff --git a/source/Teapot-Core/TeaGlobUrlSegment.class.st b/source/Teapot-Core/TeaGlobUrlSegment.class.st index e805923..9325840 100644 --- a/source/Teapot-Core/TeaGlobUrlSegment.class.st +++ b/source/Teapot-Core/TeaGlobUrlSegment.class.st @@ -3,12 +3,13 @@ My subclasses form the elements of TeaGlobUrlPatterns " Class { - #name : #TeaGlobUrlSegment, - #superclass : #Object, - #category : #'Teapot-Core' + #name : 'TeaGlobUrlSegment', + #superclass : 'Object', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaGlobUrlSegment >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ self subclassResponsibility ] diff --git a/source/Teapot-Core/TeaLiteral.class.st b/source/Teapot-Core/TeaLiteral.class.st index c81d65b..3e8dcaa 100644 --- a/source/Teapot-Core/TeaLiteral.class.st +++ b/source/Teapot-Core/TeaLiteral.class.st @@ -2,22 +2,23 @@ A literal url pattern segment that matches to a string. " Class { - #name : #TeaLiteral, - #superclass : #TeaGlobUrlSegment, + #name : 'TeaLiteral', + #superclass : 'TeaGlobUrlSegment', #instVars : [ 'literal' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaLiteral class >> fromString: aString atLast: aBoolean [ | class | class := aBoolean ifTrue: [ TeaLiteralStop ] ifFalse: [ TeaLiteral ]. ^ class new setLiteral: aString ] -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaLiteral >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ ^ literal = urlSegments first and: [ adjacentPatterns first @@ -26,13 +27,13 @@ TeaLiteral >> matches: urlSegments rest: adjacentPatterns placeholders: aDiction placeholders: aDictionary ] ] -{ #category : #printing } +{ #category : 'printing' } TeaLiteral >> printOn: aStream [ aStream nextPutAll: literal. ] -{ #category : #initialization } +{ #category : 'initialization' } TeaLiteral >> setLiteral: aString [ literal := aString. ^ self diff --git a/source/Teapot-Core/TeaLiteralStop.class.st b/source/Teapot-Core/TeaLiteralStop.class.st index 666e5a9..8ebe5c3 100644 --- a/source/Teapot-Core/TeaLiteralStop.class.st +++ b/source/Teapot-Core/TeaLiteralStop.class.st @@ -2,12 +2,13 @@ I'm a placeholder at the last position. " Class { - #name : #TeaLiteralStop, - #superclass : #TeaLiteral, - #category : #'Teapot-Core' + #name : 'TeaLiteralStop', + #superclass : 'TeaLiteral', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaLiteralStop >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ ^ urlSegments size = 1 and: [ literal = urlSegments first ] ] diff --git a/source/Teapot-Core/TeaMethodMatcher.class.st b/source/Teapot-Core/TeaMethodMatcher.class.st index 46ad016..fecb61e 100644 --- a/source/Teapot-Core/TeaMethodMatcher.class.st +++ b/source/Teapot-Core/TeaMethodMatcher.class.st @@ -2,47 +2,48 @@ I can be matched against an HTTP method. I will return either true or false. " Class { - #name : #TeaMethodMatcher, - #superclass : #Object, + #name : 'TeaMethodMatcher', + #superclass : 'Object', #instVars : [ 'matcherBlock', 'name' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaMethodMatcher class >> any [ ^ self new setMatcherBlock: [ :anyMethod | true ] name: 'ANY' ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaMethodMatcher class >> exactly: aSymbol [ ^ self new setMatcherBlock: [ :actual | actual = aSymbol ] name: aSymbol asString ] -{ #category : #converting } +{ #category : 'converting' } TeaMethodMatcher >> asString [ ^ name ] -{ #category : #'http method matcher' } +{ #category : 'http method matcher' } TeaMethodMatcher >> matchesHttpMethod: aSymbol [ ^ matcherBlock value: aSymbol ] -{ #category : #printing } +{ #category : 'printing' } TeaMethodMatcher >> printOn: aStream [ aStream nextPutAll: name; nextPut: $: ] -{ #category : #initialization } +{ #category : 'initialization' } TeaMethodMatcher >> setMatcherBlock: aBlockClosure name: aString [ matcherBlock := aBlockClosure. name := aString. diff --git a/source/Teapot-Core/TeaNoSuchParam.class.st b/source/Teapot-Core/TeaNoSuchParam.class.st index 945eed3..8bf9b81 100644 --- a/source/Teapot-Core/TeaNoSuchParam.class.st +++ b/source/Teapot-Core/TeaNoSuchParam.class.st @@ -3,25 +3,26 @@ This exception indicates that the given parameter was not found in the TeaReques " Class { - #name : #TeaNoSuchParam, - #superclass : #KeyNotFound, + #name : 'TeaNoSuchParam', + #superclass : 'KeyNotFound', #instVars : [ 'param' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #signaling } +{ #category : 'signaling' } TeaNoSuchParam class >> signalWithParam: aSymbol [ (self new setParam: aSymbol) signal: 'Param ', aSymbol printString, ' not found' ] -{ #category : #accessing } +{ #category : 'accessing' } TeaNoSuchParam >> param [ ^ param ] -{ #category : #initialization } +{ #category : 'initialization' } TeaNoSuchParam >> setParam: aSymbol [ param := aSymbol. ^ self diff --git a/source/Teapot-Core/TeaNotFoundHandler.class.st b/source/Teapot-Core/TeaNotFoundHandler.class.st index 13b4d6f..fdc8d47 100644 --- a/source/Teapot-Core/TeaNotFoundHandler.class.st +++ b/source/Teapot-Core/TeaNotFoundHandler.class.st @@ -2,27 +2,28 @@ I decides what response to return when there were not matching routes (and no static path) for the incoming request. By default I just return 404. " Class { - #name : #TeaNotFoundHandler, - #superclass : #Object, + #name : 'TeaNotFoundHandler', + #superclass : 'Object', #instVars : [ 'routes' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #initialization } +{ #category : 'initialization' } TeaNotFoundHandler >> initialize [ super initialize. routes := OrderedCollection new. ] -{ #category : #initialization } +{ #category : 'initialization' } TeaNotFoundHandler >> initializeRoutes: aTeaRouteCollection [ routes := aTeaRouteCollection. ^ self ] -{ #category : #'not found handler' } +{ #category : 'not found handler' } TeaNotFoundHandler >> requestNotFound: aZnRequest [ ^ ZnResponse notFound: aZnRequest url ] diff --git a/source/Teapot-Core/TeaOutput.class.st b/source/Teapot-Core/TeaOutput.class.st index 51a1257..1bf10af 100644 --- a/source/Teapot-Core/TeaOutput.class.st +++ b/source/Teapot-Core/TeaOutput.class.st @@ -9,17 +9,18 @@ Some of the transformers require optional dependencies, like Neo-JSON, STON, or " Class { - #name : #TeaOutput, - #superclass : #Object, - #category : #'Teapot-Core' + #name : 'TeaOutput', + #superclass : 'Object', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> html [ ^ self stringWithContentType: ZnMimeType textHtml ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> json [ ^ [ :aTeaResponse | | entity | entity := ZnStringEntity @@ -31,7 +32,7 @@ TeaOutput class >> json [ headers: aTeaResponse headers ] ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> mustache: templateStringOrStream contentType: contentType [ ^ [ :aTeaResponse | | model object entity | object := aTeaResponse body. @@ -46,19 +47,19 @@ TeaOutput class >> mustache: templateStringOrStream contentType: contentType [ ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> mustacheHtml: templateString [ ^ self mustache: templateString contentType: ZnMimeType textHtml. ] -{ #category : #private } +{ #category : 'private' } TeaOutput class >> optionalClass: aSymbol [ [ ^ Smalltalk at: aSymbol ] on: KeyNotFound do: [ self error: 'An optional dependency ', aSymbol, ' was not found. Please load it first.' ] ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> ston [ ^ [ :aTeaResponse | | entity | entity := ZnStringEntity @@ -70,12 +71,12 @@ TeaOutput class >> ston [ headers: aTeaResponse headers ] ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> stream [ ^ self stream: ZnMimeType applicationOctetStream ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> stream: aZnMimeType [ ^ [ :aTeaResponse | | entity | entity := ZnStreamingEntity @@ -89,7 +90,7 @@ TeaOutput class >> stream: aZnMimeType [ ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> stringWithContentType: aZnMimeType [ ^ [ :aTeaResponse | | entity | entity := ZnStringEntity new @@ -102,13 +103,13 @@ TeaOutput class >> stringWithContentType: aZnMimeType [ headers: aTeaResponse headers ] ] -{ #category : #'response transformers' } +{ #category : 'response transformers' } TeaOutput class >> text [ ^ self stringWithContentType: ZnMimeType textPlain ] -{ #category : #private } +{ #category : 'private' } TeaOutput class >> znEntity: aZnEntity code: anInteger headers: aDictionary [ | headers | headers := ZnHeaders defaultResponseHeaders. diff --git a/source/Teapot-Core/TeaPadding.class.st b/source/Teapot-Core/TeaPadding.class.st index 75c0d68..4420344 100644 --- a/source/Teapot-Core/TeaPadding.class.st +++ b/source/Teapot-Core/TeaPadding.class.st @@ -2,7 +2,8 @@ An url is padded by me, if its size is to short. I don't match to any literal URL, so it's like I'm not there. " Class { - #name : #TeaPadding, - #superclass : #Object, - #category : #'Teapot-Core' + #name : 'TeaPadding', + #superclass : 'Object', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } diff --git a/source/Teapot-Core/TeaPlaceholder.class.st b/source/Teapot-Core/TeaPlaceholder.class.st index 4d265fb..e72dddb 100644 --- a/source/Teapot-Core/TeaPlaceholder.class.st +++ b/source/Teapot-Core/TeaPlaceholder.class.st @@ -2,16 +2,17 @@ I'm a placeholder with a key. My content is substituted with a value. " Class { - #name : #TeaPlaceholder, - #superclass : #TeaGlobUrlSegment, + #name : 'TeaPlaceholder', + #superclass : 'TeaGlobUrlSegment', #instVars : [ 'placeholderName', 'typeConstraint' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #private } +{ #category : 'private' } TeaPlaceholder class >> createPlaceholderName: key typeConstraint: aTypeConstraint atLast: aBoolean [ | class | class := aBoolean @@ -22,7 +23,7 @@ TeaPlaceholder class >> createPlaceholderName: key typeConstraint: aTypeConstrai typeConstraint: aTypeConstraint ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaPlaceholder class >> fromString: aString atLast: aBoolean [ | spec typeConstraint key | self mustBeValidPlaceholder: aString. @@ -35,13 +36,13 @@ TeaPlaceholder class >> fromString: aString atLast: aBoolean [ atLast: aBoolean ] -{ #category : #private } +{ #category : 'private' } TeaPlaceholder class >> mustBeValidPlaceholder: aString [ ((aString beginsWith: '<') and: [ aString endsWith: '>' ]) ifFalse: [ self error: 'Invalid placeholder name: ', aString ] ] -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaPlaceholder >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ (urlSegments first = TeaPadding or: [ (typeConstraint matchesTo: urlSegments first) not]) ifTrue: [ ^ false ]. @@ -54,7 +55,7 @@ TeaPlaceholder >> matches: urlSegments rest: adjacentPatterns placeholders: aDic placeholders: aDictionary ] -{ #category : #printing } +{ #category : 'printing' } TeaPlaceholder >> printOn: aStream [ aStream nextPut: $<; @@ -62,7 +63,7 @@ TeaPlaceholder >> printOn: aStream [ nextPut: $> ] -{ #category : #initialization } +{ #category : 'initialization' } TeaPlaceholder >> setPlaceholderName: aString typeConstraint: aTypeConstraint [ placeholderName := aString asSymbol. typeConstraint := aTypeConstraint. diff --git a/source/Teapot-Core/TeaPlaceholderStop.class.st b/source/Teapot-Core/TeaPlaceholderStop.class.st index 8fda57f..9d14148 100644 --- a/source/Teapot-Core/TeaPlaceholderStop.class.st +++ b/source/Teapot-Core/TeaPlaceholderStop.class.st @@ -2,12 +2,13 @@ I'm a placeholder at the last position. " Class { - #name : #TeaPlaceholderStop, - #superclass : #TeaPlaceholder, - #category : #'Teapot-Core' + #name : 'TeaPlaceholderStop', + #superclass : 'TeaPlaceholder', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaPlaceholderStop >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ | match | match := urlSegments size = 1 diff --git a/source/Teapot-Core/TeaRequest.class.st b/source/Teapot-Core/TeaRequest.class.st index 7cfbd4c..4e46142 100644 --- a/source/Teapot-Core/TeaRequest.class.st +++ b/source/Teapot-Core/TeaRequest.class.st @@ -2,38 +2,39 @@ I extend the ZnRequest with addition methods for convenience. " Class { - #name : #TeaRequest, - #superclass : #Object, + #name : 'TeaRequest', + #superclass : 'Object', #instVars : [ 'znRequest', 'pathParams' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaRequest class >> fromZnRequest: aZnRequest [ ^ self fromZnRequest: aZnRequest pathParams: Dictionary new ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaRequest class >> fromZnRequest: aZnRequest pathParams: aDictionary [ ^ self new setZnRequest: aZnRequest pathParams: aDictionary ] -{ #category : #aborting } +{ #category : 'aborting' } TeaRequest >> abort: response [ (TeaAbort response: response) signal ] -{ #category : #'acccessing - params' } +{ #category : 'acccessing - params' } TeaRequest >> at: aSymbol [ ^ self at: aSymbol ifAbsent: [ TeaNoSuchParam signalWithParam: aSymbol ] ] -{ #category : #'acccessing - params' } +{ #category : 'acccessing - params' } TeaRequest >> at: aSymbol ifAbsent: aBlock [ "Gets the value of a path parameter, query parameter for form parameter. E.g. /foo//bar @@ -42,26 +43,26 @@ TeaRequest >> at: aSymbol ifAbsent: aBlock [ ^ pathParams at: aSymbol ifAbsent: [ self queryOrFormParam: aSymbol ifAbsent: aBlock "XXX do something better" ] ] -{ #category : #'reflective operations' } +{ #category : 'reflective operations' } TeaRequest >> doesNotUnderstand: aMessage [ ^ aMessage sendTo: znRequest ] -{ #category : #private } +{ #category : 'private' } TeaRequest >> formParam: aSymbol ifAbsent: aBlock [ ^ (znRequest entity isKindOf: ZnApplicationFormUrlEncodedEntity) "XXX do something better" ifTrue: [ znRequest entity at: aSymbol ifAbsent: aBlock ] ifFalse: aBlock ] -{ #category : #private } +{ #category : 'private' } TeaRequest >> queryOrFormParam: aSymbol ifAbsent: aBlock [ ^ znRequest uri queryAt: aSymbol ifAbsent: [ self formParam: aSymbol ifAbsent: aBlock ] ] -{ #category : #initialization } +{ #category : 'initialization' } TeaRequest >> setZnRequest: aZnRequest pathParams: aDictionary [ znRequest := aZnRequest. pathParams := aDictionary. diff --git a/source/Teapot-Core/TeaRequestMatcher.class.st b/source/Teapot-Core/TeaRequestMatcher.class.st index 83dd04b..f4cec9e 100644 --- a/source/Teapot-Core/TeaRequestMatcher.class.st +++ b/source/Teapot-Core/TeaRequestMatcher.class.st @@ -2,23 +2,24 @@ I can be matched against a ZnRequest. I check the http method and url of the request. " Class { - #name : #TeaRequestMatcher, - #superclass : #Object, + #name : 'TeaRequestMatcher', + #superclass : 'Object', #instVars : [ 'urlPattern', 'methodMatcher', 'whenClause' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaRequestMatcher class >> method: aMethodMatcher url: anUrlPattern [ ^ self new setPattern: anUrlPattern method: aMethodMatcher ] -{ #category : #'request matcher' } +{ #category : 'request matcher' } TeaRequestMatcher >> matchRequest: aZnRequest ifMatch: matchBlock ifNoMatch: noMatchBlock [ | placeholders matches | (methodMatcher matchesHttpMethod: aZnRequest method) ifFalse: [ ^ noMatchBlock value ]. @@ -30,24 +31,24 @@ TeaRequestMatcher >> matchRequest: aZnRequest ifMatch: matchBlock ifNoMatch: noM ifFalse: noMatchBlock ] -{ #category : #'request matcher' } +{ #category : 'request matcher' } TeaRequestMatcher >> matchesUrl: aZnUrl [ ^ urlPattern matchesUrl: aZnUrl placeholders: Dictionary new ] -{ #category : #accessing } +{ #category : 'accessing' } TeaRequestMatcher >> methodMatcher [ ^ methodMatcher ] -{ #category : #printing } +{ #category : 'printing' } TeaRequestMatcher >> printOn: aStream [ methodMatcher printOn: aStream. aStream space. urlPattern printOn: aStream. ] -{ #category : #initialization } +{ #category : 'initialization' } TeaRequestMatcher >> setPattern: anUrlPattern method: aMethodMatcher [ urlPattern := anUrlPattern. methodMatcher := aMethodMatcher. @@ -55,7 +56,7 @@ TeaRequestMatcher >> setPattern: anUrlPattern method: aMethodMatcher [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } TeaRequestMatcher >> whenClause: aBlockClosure [ whenClause := aBlockClosure ] diff --git a/source/Teapot-Core/TeaResponse.class.st b/source/Teapot-Core/TeaResponse.class.st index 43f2369..187ef09 100644 --- a/source/Teapot-Core/TeaResponse.class.st +++ b/source/Teapot-Core/TeaResponse.class.st @@ -2,120 +2,121 @@ A TeaResponse represents an HTTP response returned by a Route. The ZnResponse is generated from the TeaResponse by the given response transformer. " Class { - #name : #TeaResponse, - #superclass : #Object, + #name : 'TeaResponse', + #superclass : 'Object', #instVars : [ 'code', 'body', 'headers', 'charSet' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> badRequest [ ^ self code: ZnStatusLine badRequest code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> code: anInteger [ ^ self new code: anInteger ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> created [ ^ self code: ZnStatusLine created code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> methodNotAllowed [ ^ self code: ZnStatusLine methodNotAllowed code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> notFound [ ^ self code: ZnStatusLine notFound code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> notModified [ ^ self code: ZnStatusLine notModified code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> ok [ ^ self code: ZnStatusLine ok code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> redirect [ ^ self code: ZnStatusLine redirect code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> serverError [ ^ self code: ZnStatusLine internalServerError code ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaResponse class >> unauthorized [ ^ self code: ZnStatusLine unauthorized code ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> body [ ^ body ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> body: anObject [ body := anObject. ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> charSet [ ^ charSet ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> charSet: aString [ charSet := aString. ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> code [ ^ code ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> code: anInteger [ code := anInteger. ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> headerName: nameString value: valueString [ headers at: nameString put: valueString. ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> headers [ ^ headers ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> headers: aDictionary [ headers := aDictionary asDictionary. ^ self ] -{ #category : #initialization } +{ #category : 'initialization' } TeaResponse >> initialize [ super initialize. headers := Dictionary new. @@ -124,13 +125,13 @@ TeaResponse >> initialize [ charSet := 'utf-8'. ] -{ #category : #accessing } +{ #category : 'accessing' } TeaResponse >> location: url [ self headerName: 'Location' value: url asString. ^ self ] -{ #category : #'response transforming' } +{ #category : 'response transforming' } TeaResponse >> teaTransform: aResponseTransformer request: aTeaRequest [ ^ aResponseTransformer cull: self cull: aTeaRequest ] diff --git a/source/Teapot-Core/TeaRoute.class.st b/source/Teapot-Core/TeaRoute.class.st index 5153a57..8c4adc3 100644 --- a/source/Teapot-Core/TeaRoute.class.st +++ b/source/Teapot-Core/TeaRoute.class.st @@ -7,18 +7,19 @@ A route handles http requests if it matches to the route. I have four major part - A response transformer for creating ZnResponse from the object returned by the handler. " Class { - #name : #TeaRoute, - #superclass : #Object, + #name : 'TeaRoute', + #superclass : 'Object', #instVars : [ 'responseTransformer', 'action', 'requestMatcher', 'port' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaRoute class >> matcher: aTeaRequestMatcher action: aTeaAction transformer: aResponseTransformer port: portNumber [ ^ self new setMatcher: aTeaRequestMatcher @@ -27,13 +28,13 @@ TeaRoute class >> matcher: aTeaRequestMatcher action: aTeaAction transformer: aR port: portNumber "XXX only used by teapsoon inspector" ] -{ #category : #'request handling' } +{ #category : 'request handling' } TeaRoute >> canHandleUrl: aZnUrl [ "only check the URL not without checking HTTP Method or when clause" ^ requestMatcher matchesUrl: aZnUrl ] -{ #category : #'request handling' } +{ #category : 'request handling' } TeaRoute >> handleRequest: aZnRequest ifUnhandled: aBlock [ ^ requestMatcher matchRequest: aZnRequest @@ -44,24 +45,24 @@ TeaRoute >> handleRequest: aZnRequest ifUnhandled: aBlock [ ifNoMatch: aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } TeaRoute >> methodMatcher [ ^ requestMatcher methodMatcher ] -{ #category : #printing } +{ #category : 'printing' } TeaRoute >> printOn: aStream [ requestMatcher printOn: aStream. aStream nextPutAll: ' -> '. action printOn: aStream. ] -{ #category : #accessing } +{ #category : 'accessing' } TeaRoute >> responseTransformer: aBlock [ responseTransformer := aBlock ] -{ #category : #initialization } +{ #category : 'initialization' } TeaRoute >> setMatcher: aTeaRequestMatcher action: aTeaAction transformer: aResponseTransformer port: portNumber [ requestMatcher := aTeaRequestMatcher. action := aTeaAction. @@ -70,7 +71,7 @@ TeaRoute >> setMatcher: aTeaRequestMatcher action: aTeaAction transformer: aResp ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } TeaRoute >> whenClause: aBlockClosure [ requestMatcher whenClause: aBlockClosure ] diff --git a/source/Teapot-Core/TeaRouter.class.st b/source/Teapot-Core/TeaRouter.class.st index 46edcb4..e908b12 100644 --- a/source/Teapot-Core/TeaRouter.class.st +++ b/source/Teapot-Core/TeaRouter.class.st @@ -2,12 +2,13 @@ A zn delegate baseclass " Class { - #name : #TeaRouter, - #superclass : #Object, - #category : #'Teapot-Core' + #name : 'TeaRouter', + #superclass : 'Object', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #router } +{ #category : 'router' } TeaRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ self subclassResponsibility ] diff --git a/source/Teapot-Core/TeaRxUrlPattern.class.st b/source/Teapot-Core/TeaRxUrlPattern.class.st index e8dec24..d619fc6 100644 --- a/source/Teapot-Core/TeaRxUrlPattern.class.st +++ b/source/Teapot-Core/TeaRxUrlPattern.class.st @@ -2,34 +2,35 @@ I'm an URL pattern that uses a regular expression internally. I collect subexpressions in case of matching. " Class { - #name : #TeaRxUrlPattern, - #superclass : #TeaUrlPattern, + #name : 'TeaRxUrlPattern', + #superclass : 'TeaUrlPattern', #instVars : [ 'regexp', 'lock' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaRxUrlPattern class >> fromRxMatcher: aRxMatcher [ ^ self new initializeRxMatcher: aRxMatcher ] -{ #category : #private } +{ #category : 'private' } TeaRxUrlPattern >> hasMatched: aZnUrl [ "XXX RxMatcher has state. Consider something better" ^ lock critical: [ (regexp matches: aZnUrl path) or: [ regexp matches: '/', aZnUrl path ] ] ] -{ #category : #initialization } +{ #category : 'initialization' } TeaRxUrlPattern >> initializeRxMatcher: aRxMatcher [ regexp := aRxMatcher. lock := Mutex new. ^ self ] -{ #category : #'url matcher' } +{ #category : 'url matcher' } TeaRxUrlPattern >> matchesUrl: aZnUrl placeholders: aDictionary [ | match | match := self hasMatched: aZnUrl. @@ -40,7 +41,7 @@ TeaRxUrlPattern >> matchesUrl: aZnUrl placeholders: aDictionary [ ] -{ #category : #printing } +{ #category : 'printing' } TeaRxUrlPattern >> printOn: aStream [ aStream nextPutAll: ''. ] diff --git a/source/Teapot-Core/TeaStaticRouter.class.st b/source/Teapot-Core/TeaStaticRouter.class.st index cc1a672..3d42d73 100644 --- a/source/Teapot-Core/TeaStaticRouter.class.st +++ b/source/Teapot-Core/TeaStaticRouter.class.st @@ -2,15 +2,16 @@ I'm a ZnDelegate based on ZnStaticFileServerDelegate. I serve static content from a file system directory. " Class { - #name : #TeaStaticRouter, - #superclass : #TeaRouter, + #name : 'TeaStaticRouter', + #superclass : 'TeaRouter', #instVars : [ 'delegate' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'zn delegate' } +{ #category : 'zn delegate' } TeaStaticRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ | response | delegate ifNil: [ ^ aBlock value ]. @@ -18,7 +19,7 @@ TeaStaticRouter >> handleRequest: aZnRequest ifUnhandled: aBlock [ ^ response isNotFound ifTrue: aBlock ifFalse: [ response ] ] -{ #category : #acccessing } +{ #category : 'acccessing' } TeaStaticRouter >> urlPrefix: urlPrefixString path: pathString [ delegate ifNil: [ delegate := ZnStaticFileServerDelegate new ]. delegate diff --git a/source/Teapot-Core/TeaUrlPattern.class.st b/source/Teapot-Core/TeaUrlPattern.class.st index 1c2ec93..b794fdd 100644 --- a/source/Teapot-Core/TeaUrlPattern.class.st +++ b/source/Teapot-Core/TeaUrlPattern.class.st @@ -2,12 +2,13 @@ An URL pattern can be matched agains actual urls. The pattern may collect named parameters from the URL in case of match. " Class { - #name : #TeaUrlPattern, - #superclass : #Object, - #category : #'Teapot-Core' + #name : 'TeaUrlPattern', + #superclass : 'Object', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'url matcher' } +{ #category : 'url matcher' } TeaUrlPattern >> matchesUrl: anUrl placeholders: aDictionary [ self subclassResponsibility ] diff --git a/source/Teapot-Core/TeaUrlPatternSet.class.st b/source/Teapot-Core/TeaUrlPatternSet.class.st index d0fcb3d..f3fd0ff 100644 --- a/source/Teapot-Core/TeaUrlPatternSet.class.st +++ b/source/Teapot-Core/TeaUrlPatternSet.class.st @@ -10,25 +10,26 @@ Teapot on Both ZnEasy get: '/a' and ZnEasy get: '/b' returns 'ab' " Class { - #name : #TeaUrlPatternSet, - #superclass : #TeaUrlPattern, + #name : 'TeaUrlPatternSet', + #superclass : 'TeaUrlPattern', #instVars : [ 'patterns' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaUrlPatternSet class >> fromCollection: aCollection [ ^ self new setPatterns: (aCollection collect: #asTeaUrlPattern) ] -{ #category : #'url matcher' } +{ #category : 'url matcher' } TeaUrlPatternSet >> matchesUrl: anUrl placeholders: aDictionary [ ^ patterns anySatisfy: [ :each | each matchesUrl: anUrl placeholders: aDictionary ] ] -{ #category : #printing } +{ #category : 'printing' } TeaUrlPatternSet >> printOn: aStream [ aStream nextPut: ${. patterns @@ -37,7 +38,7 @@ TeaUrlPatternSet >> printOn: aStream [ aStream nextPut: $}. ] -{ #category : #initialization } +{ #category : 'initialization' } TeaUrlPatternSet >> setPatterns: aCollection [ patterns := aCollection. ^ self diff --git a/source/Teapot-Core/TeaWildcard.class.st b/source/Teapot-Core/TeaWildcard.class.st index fd09d63..b075646 100644 --- a/source/Teapot-Core/TeaWildcard.class.st +++ b/source/Teapot-Core/TeaWildcard.class.st @@ -2,19 +2,20 @@ A wildcard url pattern segment that matches to anything. " Class { - #name : #TeaWildcard, - #superclass : #TeaGlobUrlSegment, - #category : #'Teapot-Core' + #name : 'TeaWildcard', + #superclass : 'TeaGlobUrlSegment', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } TeaWildcard class >> atLast: aBoolean [ ^ aBoolean ifTrue: [ TeaWildcardStop new ] ifFalse: [ TeaWildcard new ] ] -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaWildcard >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ ^ adjacentPatterns first matches: urlSegments allButFirst @@ -22,7 +23,7 @@ TeaWildcard >> matches: urlSegments rest: adjacentPatterns placeholders: aDictio placeholders: aDictionary ] -{ #category : #printing } +{ #category : 'printing' } TeaWildcard >> printOn: aStream [ aStream nextPut: $* ] diff --git a/source/Teapot-Core/TeaWildcardStop.class.st b/source/Teapot-Core/TeaWildcardStop.class.st index 984822c..4b78849 100644 --- a/source/Teapot-Core/TeaWildcardStop.class.st +++ b/source/Teapot-Core/TeaWildcardStop.class.st @@ -2,12 +2,13 @@ I'm a Wildcard at the last position. " Class { - #name : #TeaWildcardStop, - #superclass : #TeaWildcard, - #category : #'Teapot-Core' + #name : 'TeaWildcardStop', + #superclass : 'TeaWildcard', + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'url pattern segment' } +{ #category : 'url pattern segment' } TeaWildcardStop >> matches: urlSegments rest: adjacentPatterns placeholders: aDictionary [ ^ true ] diff --git a/source/Teapot-Core/Teapot.class.st b/source/Teapot-Core/Teapot.class.st index 0132866..3d4b202 100644 --- a/source/Teapot-Core/Teapot.class.st +++ b/source/Teapot-Core/Teapot.class.st @@ -15,8 +15,8 @@ Teapot on For more configuration option see the Teapot class>>configure method. " Class { - #name : #Teapot, - #superclass : #Object, + #name : 'Teapot', + #superclass : 'Object', #instVars : [ 'server', 'dynamicRouter', @@ -25,10 +25,11 @@ Class { 'defaultOutput', 'current' ], - #category : #'Teapot-Core' + #category : 'Teapot-Core', + #package : 'Teapot-Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } Teapot class >> configure: optionsAssociations [ "Create a new Teapot instance with optional properties. - Teapot properties: #defaultOutput, #znServer @@ -44,19 +45,19 @@ Teapot class >> configure: optionsAssociations [ ^ self new initializeOptions: optionsAssociations asDictionary ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } Teapot class >> on [ "Create Teapot with default properties." ^ self configure: { } ] -{ #category : #controlling } +{ #category : 'controlling' } Teapot class >> stopAll [ self allInstancesDo: #stop ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> CONNECT: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #CONNECT) @@ -64,7 +65,7 @@ Teapot >> CONNECT: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> DELETE: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #DELETE) @@ -72,7 +73,7 @@ Teapot >> DELETE: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> GET: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #GET) @@ -80,7 +81,7 @@ Teapot >> GET: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> HEAD: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #HEAD) @@ -88,7 +89,7 @@ Teapot >> HEAD: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> OPTIONS: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #OPTIONS) @@ -96,7 +97,7 @@ Teapot >> OPTIONS: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> PATCH: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #PATCH) @@ -104,7 +105,7 @@ Teapot >> PATCH: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> POST: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #POST) @@ -112,7 +113,7 @@ Teapot >> POST: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> PUT: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #PUT) @@ -120,7 +121,7 @@ Teapot >> PUT: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> TRACE: patternActionAssoc [ self addRouteMethod: (TeaMethodMatcher exactly: #TRACE) @@ -128,7 +129,7 @@ Teapot >> TRACE: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #private } +{ #category : 'private' } Teapot >> addRouteMethod: aTeaMethodMatcher pattern: pattern action: aTeaAction [ current := dynamicRouter addRoute: (TeaRoute @@ -138,7 +139,7 @@ Teapot >> addRouteMethod: aTeaMethodMatcher pattern: pattern action: aTeaAction port: server port) ] -{ #category : #filters } +{ #category : 'filters' } Teapot >> after: patternActionAssoc [ current := compositeRouter addAfterFilter: (TeaAfterFilter @@ -146,7 +147,7 @@ Teapot >> after: patternActionAssoc [ action: patternActionAssoc value) ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> any: patternActionAssoc [ self addRouteMethod: TeaMethodMatcher any @@ -154,7 +155,7 @@ Teapot >> any: patternActionAssoc [ action: patternActionAssoc value ] -{ #category : #filters } +{ #category : 'filters' } Teapot >> before: patternActionAssoc [ current := compositeRouter addBeforeFilter: (TeaBeforeFilter @@ -162,7 +163,7 @@ Teapot >> before: patternActionAssoc [ action: patternActionAssoc value) ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> exception: anExceptionSetActionAssoc [ current := compositeRouter addErrorHandler: (TeaErrorHandler @@ -171,7 +172,7 @@ Teapot >> exception: anExceptionSetActionAssoc [ responseTransformer: defaultOutput) ] -{ #category : #initialization } +{ #category : 'initialization' } Teapot >> initializeOptions: optionsDictionary [ dynamicRouter := TeaDynamicRouter new. staticRouter := TeaStaticRouter new. @@ -189,40 +190,40 @@ Teapot >> initializeOptions: optionsDictionary [ ^ self ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> output: transformerBlockOrSymbol [ current responseTransformer: (self responseTransformer: transformerBlockOrSymbol) ] -{ #category : #private } +{ #category : 'private' } Teapot >> responseTransformer: transformerBlockOrSymbol [ ^ transformerBlockOrSymbol isSymbol ifTrue: [ TeaOutput perform: transformerBlockOrSymbol ] ifFalse: [ transformerBlockOrSymbol ] ] -{ #category : #'url mapping' } +{ #category : 'url mapping' } Teapot >> serveStatic: urlPrefixString from: pathString [ staticRouter urlPrefix: urlPrefixString path: pathString ] -{ #category : #accessing } +{ #category : 'accessing' } Teapot >> server [ ^ server ] -{ #category : #controlling } +{ #category : 'controlling' } Teapot >> start [ server start ] -{ #category : #controlling } +{ #category : 'controlling' } Teapot >> stop [ server stop ] -{ #category : #filters } +{ #category : 'filters' } Teapot >> when: aBlockClosure [ current whenClause: aBlockClosure diff --git a/source/Teapot-Core/ZnResponse.extension.st b/source/Teapot-Core/ZnResponse.extension.st index 6dde9f6..b8d72a3 100644 --- a/source/Teapot-Core/ZnResponse.extension.st +++ b/source/Teapot-Core/ZnResponse.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #ZnResponse } +Extension { #name : 'ZnResponse' } -{ #category : #'*Teapot-Core' } +{ #category : '*Teapot-Core' } ZnResponse >> teaTransform: aResponseTransformer request: aTeaRequest [ ^ self ] diff --git a/source/Teapot-Core/package.st b/source/Teapot-Core/package.st index b6c1e93..e287ab2 100644 --- a/source/Teapot-Core/package.st +++ b/source/Teapot-Core/package.st @@ -1 +1 @@ -Package { #name : #'Teapot-Core' } +Package { #name : 'Teapot-Core' } diff --git a/source/Teapot-Library-Example/BookNotFound.class.st b/source/Teapot-Library-Example/BookNotFound.class.st index 6e6d974..bf95ad9 100644 --- a/source/Teapot-Library-Example/BookNotFound.class.st +++ b/source/Teapot-Library-Example/BookNotFound.class.st @@ -2,25 +2,26 @@ Signaled when a book was not found. " Class { - #name : #BookNotFound, - #superclass : #NotFound, + #name : 'BookNotFound', + #superclass : 'NotFound', #instVars : [ 'bookId' ], - #category : #'Teapot-Library-Example' + #category : 'Teapot-Library-Example', + #package : 'Teapot-Library-Example' } -{ #category : #signaling } +{ #category : 'signaling' } BookNotFound class >> signalWithBookId: anInteger [ (self new initializeBookId: anInteger) signal: 'Book not found: ', anInteger asString ] -{ #category : #acccessing } +{ #category : 'acccessing' } BookNotFound >> bookId [ ^ bookId ] -{ #category : #initialization } +{ #category : 'initialization' } BookNotFound >> initializeBookId: anInteger [ bookId := anInteger. ^ self diff --git a/source/Teapot-Library-Example/BookShelf.class.st b/source/Teapot-Library-Example/BookShelf.class.st index bb5cf2d..15ff274 100644 --- a/source/Teapot-Library-Example/BookShelf.class.st +++ b/source/Teapot-Library-Example/BookShelf.class.st @@ -4,16 +4,17 @@ A simple in-memory storage for books with basic CRUD operations. Books are store Books are represented by simple Dictionaries. " Class { - #name : #BookShelf, - #superclass : #Object, + #name : 'BookShelf', + #superclass : 'Object', #instVars : [ 'books', 'sequence' ], - #category : #'Teapot-Library-Example' + #category : 'Teapot-Library-Example', + #package : 'Teapot-Library-Example' } -{ #category : #'book library' } +{ #category : 'book library' } BookShelf >> addBook: aDictionary [ | bookId | bookId := self uniqueId. @@ -22,40 +23,40 @@ BookShelf >> addBook: aDictionary [ put: (aDictionary copyWith: #id -> bookId) ] -{ #category : #'book library' } +{ #category : 'book library' } BookShelf >> books [ ^ books values ] -{ #category : #'book library' } +{ #category : 'book library' } BookShelf >> findBook: bookId [ ^ books at: bookId ifAbsent: [ BookNotFound signalWithBookId: bookId ] ] -{ #category : #initialization } +{ #category : 'initialization' } BookShelf >> initialize [ super initialize. books := Dictionary new. sequence := 0. ] -{ #category : #'book library' } +{ #category : 'book library' } BookShelf >> removeBook: bookId [ ^ books removeKey: bookId ifAbsent: [ BookNotFound signalWithBookId: bookId ] ] -{ #category : #'book library' } +{ #category : 'book library' } BookShelf >> replaceBook: bookId with: aDictionary [ ^ books at: bookId put: (aDictionary copyWith: #id -> bookId) ] -{ #category : #private } +{ #category : 'private' } BookShelf >> uniqueId [ ^ sequence := sequence + 1 ] diff --git a/source/Teapot-Library-Example/LibraryClient.class.st b/source/Teapot-Library-Example/LibraryClient.class.st index 58fe793..a24127e 100644 --- a/source/Teapot-Library-Example/LibraryClient.class.st +++ b/source/Teapot-Library-Example/LibraryClient.class.st @@ -2,20 +2,21 @@ A simple HTTP Client for communication with the LibraryServer " Class { - #name : #LibraryClient, - #superclass : #Object, + #name : 'LibraryClient', + #superclass : 'Object', #instVars : [ 'port' ], - #category : #'Teapot-Library-Example' + #category : 'Teapot-Library-Example', + #package : 'Teapot-Library-Example' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } LibraryClient class >> port: anInteger [ ^ self new initializePort: anInteger ] -{ #category : #'book library' } +{ #category : 'book library' } LibraryClient >> addBook: aDictionary [ | response | response := ZnClient new @@ -27,12 +28,12 @@ LibraryClient >> addBook: aDictionary [ ^ self parseResponse: response ] -{ #category : #private } +{ #category : 'private' } LibraryClient >> baseUrl [ ^ 'http://localhost:', self port asString ] -{ #category : #'book library' } +{ #category : 'book library' } LibraryClient >> books [ | response | response := ZnClient new @@ -44,13 +45,13 @@ LibraryClient >> books [ ] -{ #category : #private } +{ #category : 'private' } LibraryClient >> checkForNotFound: aZnResponse book: bookId [ 404 = aZnResponse code ifTrue: [ BookNotFound signalWithBookId: bookId ] ] -{ #category : #'book library' } +{ #category : 'book library' } LibraryClient >> findBook: bookId [ | response | response := ZnClient new @@ -61,25 +62,25 @@ LibraryClient >> findBook: bookId [ ^ self parseResponse: response ] -{ #category : #initialization } +{ #category : 'initialization' } LibraryClient >> initializePort: anInteger [ port := anInteger. ^ self ] -{ #category : #private } +{ #category : 'private' } LibraryClient >> parseResponse: aZnResponse [ ^ aZnResponse isSuccess ifTrue: [ (NeoJSONReader on: aZnResponse entity readStream) next ] ifFalse: [ self error: 'Unexpected response: ', aZnResponse code asString ] ] -{ #category : #private } +{ #category : 'private' } LibraryClient >> port [ ^ port ] -{ #category : #'book library' } +{ #category : 'book library' } LibraryClient >> removeBook: bookId [ | response | response := ZnClient new @@ -90,7 +91,7 @@ LibraryClient >> removeBook: bookId [ ^ self parseResponse: response ] -{ #category : #'book library' } +{ #category : 'book library' } LibraryClient >> replaceBook: bookId with: aDictionary [ | response | response := ZnClient new diff --git a/source/Teapot-Library-Example/LibraryServer.class.st b/source/Teapot-Library-Example/LibraryServer.class.st index 6135aef..7454df6 100644 --- a/source/Teapot-Library-Example/LibraryServer.class.st +++ b/source/Teapot-Library-Example/LibraryServer.class.st @@ -75,24 +75,25 @@ List all 200 [{""title"":""book1"",""id"":3,""authors"":""author2""}] " Class { - #name : #LibraryServer, - #superclass : #Object, + #name : 'LibraryServer', + #superclass : 'Object', #instVars : [ 'port', 'teapot', 'bookShelf' ], - #category : #'Teapot-Library-Example' + #category : 'Teapot-Library-Example', + #package : 'Teapot-Library-Example' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } LibraryServer class >> serveOn: portNumber [ ^ self new initializePort: portNumber; start ] -{ #category : #'error handlers' } +{ #category : 'error handlers' } LibraryServer >> bookNotFound: aBookNotFound request: aZnRequest [ ^ TeaResponse notFound body: { @@ -101,7 +102,7 @@ LibraryServer >> bookNotFound: aBookNotFound request: aZnRequest [ } asDictionary ] -{ #category : #routes } +{ #category : 'routes' } LibraryServer >> createBook: request [ | book | book := bookShelf addBook: (self makeBook: request). @@ -110,14 +111,14 @@ LibraryServer >> createBook: request [ location: '/books/', (book at: #id) asString ] -{ #category : #routes } +{ #category : 'routes' } LibraryServer >> deleteBook: request [ ^ bookShelf removeBook: (request at: #id) ] -{ #category : #initialization } +{ #category : 'initialization' } LibraryServer >> initializePort: anInteger [ bookShelf := BookShelf new. teapot := Teapot configure: { @@ -131,13 +132,13 @@ LibraryServer >> initializePort: anInteger [ yourself ] -{ #category : #private } +{ #category : 'private' } LibraryServer >> makeBook: request [ ^ {#title -> (request at: #title). #authors -> (request at: #authors)} asDictionary. ] -{ #category : #'error handlers' } +{ #category : 'error handlers' } LibraryServer >> missingParam: aTeaNoSuchParam request: aZnRequest [ ^ TeaResponse badRequest body: { @@ -146,17 +147,17 @@ LibraryServer >> missingParam: aTeaNoSuchParam request: aZnRequest [ } asDictionary ] -{ #category : #routes } +{ #category : 'routes' } LibraryServer >> readBook: request [ ^ bookShelf findBook: (request at: #id) ] -{ #category : #routes } +{ #category : 'routes' } LibraryServer >> readBooks: aTeaRequest [ ^ bookShelf books ] -{ #category : #initialization } +{ #category : 'initialization' } LibraryServer >> registerErrorHandlers [ teapot exception: TeaNoSuchParam -> (Send message: #missingParam:request: to: self); @@ -164,7 +165,7 @@ LibraryServer >> registerErrorHandlers [ exception: Error -> (TeaResponse serverError body: { #code -> 'ERROR' } asDictionary ) ] -{ #category : #initialization } +{ #category : 'initialization' } LibraryServer >> registerRoutes [ teapot GET: '/' -> '

A simple book library server

'; output: #html; @@ -175,18 +176,18 @@ LibraryServer >> registerRoutes [ DELETE: '/books/' -> (Send message: #deleteBook: to: self) ] -{ #category : #controlling } +{ #category : 'controlling' } LibraryServer >> start [ teapot start. ^ self ] -{ #category : #controlling } +{ #category : 'controlling' } LibraryServer >> stop [ teapot stop ] -{ #category : #routes } +{ #category : 'routes' } LibraryServer >> updateBook: request [ ^ bookShelf replaceBook: (request at: 'id') diff --git a/source/Teapot-Library-Example/LibraryServerTest.class.st b/source/Teapot-Library-Example/LibraryServerTest.class.st index b72989d..20048a1 100644 --- a/source/Teapot-Library-Example/LibraryServerTest.class.st +++ b/source/Teapot-Library-Example/LibraryServerTest.class.st @@ -1,21 +1,22 @@ Class { - #name : #LibraryServerTest, - #superclass : #TestCase, + #name : 'LibraryServerTest', + #superclass : 'TestCase', #instVars : [ 'client', 'server', 'book1', 'book2' ], - #category : #'Teapot-Library-Example' + #category : 'Teapot-Library-Example', + #package : 'Teapot-Library-Example' } -{ #category : #private } +{ #category : 'private' } LibraryServerTest >> port [ ^ 17834 ] -{ #category : #running } +{ #category : 'running' } LibraryServerTest >> setUp [ client := LibraryClient port: self port. server := LibraryServer serveOn: self port. @@ -23,12 +24,12 @@ LibraryServerTest >> setUp [ book2 := {#title -> 'book 2'. #authors -> 'author 2'} asDictionary ] -{ #category : #running } +{ #category : 'running' } LibraryServerTest >> tearDown [ server stop ] -{ #category : #'tests - an empty library' } +{ #category : 'tests - an empty library' } LibraryServerTest >> testAllowsReplacing [ client replaceBook: 1 @@ -39,7 +40,7 @@ LibraryServerTest >> testAllowsReplacing [ ] -{ #category : #'tests - a non empty library' } +{ #category : 'tests - a non empty library' } LibraryServerTest >> testDoesNotFindDeletedBook [ book1 := client addBook: book1. book2 := client addBook: book2. @@ -58,14 +59,14 @@ LibraryServerTest >> testDoesNotFindDeletedBook [ ] -{ #category : #'tests - a new library' } +{ #category : 'tests - a new library' } LibraryServerTest >> testHasNoBooks [ self assert: client books size equals: 0 ] -{ #category : #'tests - a non empty library' } +{ #category : 'tests - a non empty library' } LibraryServerTest >> testReplacesExistingBook [ | old new id | old := client addBook: book1. @@ -81,7 +82,7 @@ LibraryServerTest >> testReplacesExistingBook [ equals: (book2 copyWith: #id -> id) ] -{ #category : #'tests - a non empty library' } +{ #category : 'tests - a non empty library' } LibraryServerTest >> testReturnsAllBooks [ | books | books := client @@ -96,7 +97,7 @@ LibraryServerTest >> testReturnsAllBooks [ ] -{ #category : #'tests - an empty library' } +{ #category : 'tests - an empty library' } LibraryServerTest >> testReturnsSingleAddedBook [ | added found | added := client addBook: book1. @@ -105,7 +106,7 @@ LibraryServerTest >> testReturnsSingleAddedBook [ self assert: found equals: added. ] -{ #category : #'tests - an empty library' } +{ #category : 'tests - an empty library' } LibraryServerTest >> testSignalsErrorWhenRemoving [ self should: [ client removeBook: 1 ] diff --git a/source/Teapot-Library-Example/package.st b/source/Teapot-Library-Example/package.st index dea8d89..951816a 100644 --- a/source/Teapot-Library-Example/package.st +++ b/source/Teapot-Library-Example/package.st @@ -1 +1 @@ -Package { #name : #'Teapot-Library-Example' } +Package { #name : 'Teapot-Library-Example' } diff --git a/source/Teapot-Tests/TeaTestClient.class.st b/source/Teapot-Tests/TeaTestClient.class.st index 3b1210d..09ffd4a 100644 --- a/source/Teapot-Tests/TeaTestClient.class.st +++ b/source/Teapot-Tests/TeaTestClient.class.st @@ -2,19 +2,20 @@ Http client for testing. " Class { - #name : #TeaTestClient, - #superclass : #Object, - #category : #'Teapot-Tests' + #name : 'TeaTestClient', + #superclass : 'Object', + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpDelete: aString [ ^ ZnEasy delete: 'http://localhost:1701', aString ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpDeleteString: aString [ ^ ZnClient new url: 'http://localhost:1701', aString; @@ -23,14 +24,14 @@ TeaTestClient class >> httpDeleteString: aString [ ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpGet: aString [ ^ ZnEasy get: 'http://localhost:1701', aString ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpGetNoRedirect: aString [ ^ ZnClient new followRedirects: false; @@ -40,35 +41,35 @@ TeaTestClient class >> httpGetNoRedirect: aString [ ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpGetString: aString [ ^ (self httpGet: aString) entity string ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpPost: aString [ ^ ZnEasy post: 'http://localhost:1701', aString data: (ZnEntity text: 'any') ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpPostString: aString [ ^ (self httpPost: aString) entity string ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpPut: aString [ ^ ZnEasy put: 'http://localhost:1701', aString data: (ZnEntity text: 'any') ] -{ #category : #private } +{ #category : 'private' } TeaTestClient class >> httpPutString: aString [ ^ (self httpPut: aString) entity string diff --git a/source/Teapot-Tests/TeaUrlPatternTest.class.st b/source/Teapot-Tests/TeaUrlPatternTest.class.st index d754898..8113ead 100644 --- a/source/Teapot-Tests/TeaUrlPatternTest.class.st +++ b/source/Teapot-Tests/TeaUrlPatternTest.class.st @@ -1,10 +1,11 @@ Class { - #name : #TeaUrlPatternTest, - #superclass : #TestCase, - #category : #'Teapot-Tests' + #name : 'TeaUrlPatternTest', + #superclass : 'TestCase', + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeaUrlPatternTest >> pattern: patternString matches: urlString [ | placeholders | placeholders := Dictionary new. @@ -12,7 +13,7 @@ TeaUrlPatternTest >> pattern: patternString matches: urlString [ ^ placeholders ] -{ #category : #private } +{ #category : 'private' } TeaUrlPatternTest >> pattern: patternString noMatch: urlString [ | placeholders | placeholders := Dictionary new. @@ -20,13 +21,13 @@ TeaUrlPatternTest >> pattern: patternString noMatch: urlString [ ^ placeholders ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testLongerPatternEndedPlaceholder [ self pattern: '/a/b/' noMatch: '/a/b'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testLongerPatternEndedWildcard [ self pattern: '/a/b/c/*' matches: '/a/b/c'. self pattern: '/1/2/3/*/*' matches: '/1/2/3'. @@ -34,13 +35,13 @@ TeaUrlPatternTest >> testLongerPatternEndedWildcard [ self pattern: '/a/b/c/*' noMatch: '/a/b'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testNoWildcard [ self pattern: '/aa' matches: '/aa'. self pattern: '/aa' noMatch: '/bb'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testPlaceholderSubstitute [ | placeholders | @@ -55,7 +56,7 @@ TeaUrlPatternTest >> testPlaceholderSubstitute [ ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testPlaceholderTypeMatch [ | placeholders | placeholders := self pattern: '/' matches: '/12'. @@ -69,7 +70,7 @@ TeaUrlPatternTest >> testPlaceholderTypeMatch [ self assert: (placeholders at: #int) equals: 3. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testPlaceholderTypeNoMatch [ self pattern: '/' noMatch: '/foobar'. self pattern: '/' noMatch: '/foobar'. @@ -79,7 +80,7 @@ TeaUrlPatternTest >> testPlaceholderTypeNoMatch [ ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testPlaceholders [ self pattern: '//a/b' matches: '/1/a/b'. self pattern: '/a//b' matches: '/a/2/b'. @@ -90,7 +91,7 @@ TeaUrlPatternTest >> testPlaceholders [ self pattern: '/a/b/' noMatch: '/a/c/1'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testRoot [ self pattern: '/' matches: '/'. self pattern: '/' noMatch: '/a'. @@ -98,13 +99,13 @@ TeaUrlPatternTest >> testRoot [ self pattern: '/a/b' noMatch: '/'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testShorterPatternEndedPlaceholder [ self pattern: '/a/b/' noMatch: '/a/b/1/2'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testShorterPatternEndedWildcard [ self pattern: '/a/*' matches: '/a/b/c'. self pattern: '/*' matches: '/1/2/3'. @@ -113,13 +114,13 @@ TeaUrlPatternTest >> testShorterPatternEndedWildcard [ self pattern: '/a/b' noMatch: '/a/b/c'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testTralingSlash [ self pattern: '/a/b' matches: '/a/b/'. ] -{ #category : #tests } +{ #category : 'tests' } TeaUrlPatternTest >> testWildcards [ self pattern: '/*/1/2' matches: '/0/1/2'. self pattern: '/a/b/*' matches: '/a/b/c'. diff --git a/source/Teapot-Tests/TeapotAbortTest.class.st b/source/Teapot-Tests/TeapotAbortTest.class.st index 024204b..f2a02bc 100644 --- a/source/Teapot-Tests/TeapotAbortTest.class.st +++ b/source/Teapot-Tests/TeapotAbortTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotAbortTest, - #superclass : #TestCase, + #name : 'TeapotAbortTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotAbortTest >> setUp [ server := Teapot on GET: 'badrequest' -> [ :req | req abort: (ZnResponse badRequest: req) ]; @@ -16,17 +17,17 @@ TeapotAbortTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotAbortTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotAbortTest >> testAbortSupportsAnyObject [ self assert: (TeaTestClient httpGetString: '/abortstring') equals: 'abort test'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotAbortTest >> testErrorCodes [ self assert: (TeaTestClient httpGet: '/badrequest') code equals: 400. self assert: (TeaTestClient httpGet: '/unauthorized') code equals: 401. diff --git a/source/Teapot-Tests/TeapotAfterTest.class.st b/source/Teapot-Tests/TeapotAfterTest.class.st index b149e46..4fa9c76 100644 --- a/source/Teapot-Tests/TeapotAfterTest.class.st +++ b/source/Teapot-Tests/TeapotAfterTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotAfterTest, - #superclass : #TestCase, + #name : 'TeapotAfterTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotAfterTest >> setUp [ server := Teapot on after: '/after/' -> [ :req :resp | resp headers at: 'header-key' put: (req at: #param) ]; @@ -15,12 +16,12 @@ TeapotAfterTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotAfterTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotAfterTest >> testAfterFilterCanModifyResponse [ | response | diff --git a/source/Teapot-Tests/TeapotBeforeTest.class.st b/source/Teapot-Tests/TeapotBeforeTest.class.st index 9fbe591..296b814 100644 --- a/source/Teapot-Tests/TeapotBeforeTest.class.st +++ b/source/Teapot-Tests/TeapotBeforeTest.class.st @@ -1,14 +1,15 @@ Class { - #name : #TeapotBeforeTest, - #superclass : #TestCase, + #name : 'TeapotBeforeTest', + #superclass : 'TestCase', #instVars : [ 'server', 'log' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeapotBeforeTest >> forbidden [ ^ ZnResponse new statusLine: ZnStatusLine forbidden; @@ -16,12 +17,12 @@ TeapotBeforeTest >> forbidden [ yourself ] -{ #category : #private } +{ #category : 'private' } TeapotBeforeTest >> logRequest: aTeaRequest [ log add: (aTeaRequest at: #user) ] -{ #category : #running } +{ #category : 'running' } TeapotBeforeTest >> setUp [ log := OrderedCollection new. server := Teapot on @@ -35,12 +36,12 @@ TeapotBeforeTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotBeforeTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotBeforeTest >> testAuthentication [ self assert: (TeaTestClient httpGetString: '/secure?user=admin&pass=****') equals: 'protected'. self assert: (TeaTestClient httpGetString: '/secure/1/2/3?user=admin&pass=****') equals: 'protected'. @@ -51,7 +52,7 @@ TeapotBeforeTest >> testAuthentication [ self assert: (TeaTestClient httpPostString: '/public?user=any') equals: 'public'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotBeforeTest >> testMultipleBeforeHandlers [ TeaTestClient httpGet: '/secure?user=admin&pass=****'. TeaTestClient httpGet: '/secure/1/2/3?user=admin&pass=****'. diff --git a/source/Teapot-Tests/TeapotDefaultFormatTest.class.st b/source/Teapot-Tests/TeapotDefaultFormatTest.class.st index c64b7da..dd5dc3b 100644 --- a/source/Teapot-Tests/TeapotDefaultFormatTest.class.st +++ b/source/Teapot-Tests/TeapotDefaultFormatTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotDefaultFormatTest, - #superclass : #TestCase, + #name : 'TeapotDefaultFormatTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotDefaultFormatTest >> setUp [ server := (Teapot configure: { #defaultOutput -> #text }) GET: 'default' -> 'any'; @@ -15,19 +16,19 @@ TeapotDefaultFormatTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotDefaultFormatTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotDefaultFormatTest >> testDefault [ self assert: (TeaTestClient httpGet: '/default') contentType equals: ZnMimeType textPlain ] -{ #category : #tests } +{ #category : 'tests' } TeapotDefaultFormatTest >> testOverride [ self assert: (TeaTestClient httpGet: '/html') contentType diff --git a/source/Teapot-Tests/TeapotEncodingTest.class.st b/source/Teapot-Tests/TeapotEncodingTest.class.st index 8c2cfa4..d979c76 100644 --- a/source/Teapot-Tests/TeapotEncodingTest.class.st +++ b/source/Teapot-Tests/TeapotEncodingTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotEncodingTest, - #superclass : #TestCase, + #name : 'TeapotEncodingTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotEncodingTest >> setUp [ server := Teapot on GET: 'enc' -> (TeaResponse ok @@ -16,12 +17,12 @@ TeapotEncodingTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotEncodingTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotEncodingTest >> testUserSpecifiedEncoding [ | response | response := TeaTestClient httpGet: '/enc'. diff --git a/source/Teapot-Tests/TeapotErrorHandlingTest.class.st b/source/Teapot-Tests/TeapotErrorHandlingTest.class.st index 77c283a..27a3501 100644 --- a/source/Teapot-Tests/TeapotErrorHandlingTest.class.st +++ b/source/Teapot-Tests/TeapotErrorHandlingTest.class.st @@ -1,20 +1,21 @@ Class { - #name : #TeapotErrorHandlingTest, - #superclass : #TestCase, + #name : 'TeapotErrorHandlingTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeapotErrorHandlingTest >> handleError: ex request: req [ self assert: (ex isKindOf: Exception). self assert: (req isKindOf: TeaRequest). ^ ZnResponse ok: (ZnStringEntity text: 'outofbounds/domainerror handled') ] -{ #category : #running } +{ #category : 'running' } TeapotErrorHandlingTest >> setUp [ server := Teapot on GET: '/zerodiv' -> [ 1 / 0 ]; @@ -30,28 +31,28 @@ TeapotErrorHandlingTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotErrorHandlingTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotErrorHandlingTest >> testHandlesExceptionSet [ self assert: (TeaTestClient httpGetString: '/sub') equals: 'outofbounds/domainerror handled'. self assert: (TeaTestClient httpGetString: '/domain') equals: 'outofbounds/domainerror handled'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotErrorHandlingTest >> testHandlesOneException [ self assert: (TeaTestClient httpGetString: '/zerodiv') equals: 'zerodiv handled'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotErrorHandlingTest >> testTransformingErroHandlerResponse [ self assert: (TeaTestClient httpGetString: '/keynotfound') equals: 'XLII'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotErrorHandlingTest >> testValueAsExceptionHandler [ self assert: (TeaTestClient httpGetString: '/nonbool') equals: 'nonbool handled'. ] diff --git a/source/Teapot-Tests/TeapotFormParamsTest.class.st b/source/Teapot-Tests/TeapotFormParamsTest.class.st index d14bad3..2e5c8c3 100644 --- a/source/Teapot-Tests/TeapotFormParamsTest.class.st +++ b/source/Teapot-Tests/TeapotFormParamsTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotFormParamsTest, - #superclass : #TestCase, + #name : 'TeapotFormParamsTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotFormParamsTest >> setUp [ server := Teapot on POST: '/form' -> [ :req | (req at: #foo), '-', (req at: #bar) ]; @@ -15,12 +16,12 @@ TeapotFormParamsTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotFormParamsTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotFormParamsTest >> testFormParams [ | result | result := ZnEasy post: 'http://localhost:1701/form' data: (ZnApplicationFormUrlEncodedEntity new @@ -31,7 +32,7 @@ TeapotFormParamsTest >> testFormParams [ self assert: result entity string equals: 'abc-123'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotFormParamsTest >> testFormParamsNotFound [ | result | result := ZnEasy post: 'http://localhost:1701/form' data: (ZnApplicationFormUrlEncodedEntity new diff --git a/source/Teapot-Tests/TeapotFormatTest.class.st b/source/Teapot-Tests/TeapotFormatTest.class.st index 09632e1..e05d66a 100644 --- a/source/Teapot-Tests/TeapotFormatTest.class.st +++ b/source/Teapot-Tests/TeapotFormatTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotFormatTest, - #superclass : #TestCase, + #name : 'TeapotFormatTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotFormatTest >> setUp [ server := Teapot on GET: '/a' -> [ 4 ]; output: [ :resp :req | ZnResponse ok: (ZnStringEntity text: resp body printStringRoman) ]; @@ -17,31 +18,31 @@ TeapotFormatTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotFormatTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotFormatTest >> testArbitraryContentType [ self assert: (TeaTestClient httpGet: '/xml') contentType equals: (ZnMimeType applicationXml charSet: 'utf-8'; yourself) ] -{ #category : #tests } +{ #category : 'tests' } TeapotFormatTest >> testConverting [ self assert: (TeaTestClient httpGetString: '/a') equals: 'IV'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotFormatTest >> testDefaultContentTypeIsHtml [ self assert: (TeaTestClient httpGet: '/default') contentType equals: ZnMimeType textHtml ] -{ #category : #tests } +{ #category : 'tests' } TeapotFormatTest >> testSetsContentType [ self assert: (TeaTestClient httpGet: '/plain') contentType diff --git a/source/Teapot-Tests/TeapotMessageSendTest.class.st b/source/Teapot-Tests/TeapotMessageSendTest.class.st index 89da4f1..058f416 100644 --- a/source/Teapot-Tests/TeapotMessageSendTest.class.st +++ b/source/Teapot-Tests/TeapotMessageSendTest.class.st @@ -1,29 +1,30 @@ Class { - #name : #TeapotMessageSendTest, - #superclass : #TestCase, + #name : 'TeapotMessageSendTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #'web controller' } +{ #category : 'web controller' } TeapotMessageSendTest >> msg1 [ ^ 'msg1 result' ] -{ #category : #'web controller' } +{ #category : 'web controller' } TeapotMessageSendTest >> msg2Req: req nil: resp [ self assert: resp isNil. ^ 'msg2 ', (req at: #param) ] -{ #category : #'web controller' } +{ #category : 'web controller' } TeapotMessageSendTest >> msg3Req: req [ ^ 'msg3 ', (req at: #param) ] -{ #category : #running } +{ #category : 'running' } TeapotMessageSendTest >> setUp [ server := Teapot on GET: '/msg1' -> (Send message: #msg1 to: self); @@ -32,22 +33,22 @@ TeapotMessageSendTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotMessageSendTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotMessageSendTest >> testReceivingOneArgKeywordMessage [ self assert: (TeaTestClient httpGetString: '/msg3/bar') equals: 'msg3 bar'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotMessageSendTest >> testReceivingTwoArgsKeywordMessage [ self assert: (TeaTestClient httpGetString: '/msg2/foo') equals: 'msg2 foo'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotMessageSendTest >> testReceivingUnaryMessage [ self assert: (TeaTestClient httpGetString: '/msg1') equals: 'msg1 result'. ] diff --git a/source/Teapot-Tests/TeapotPathParamTest.class.st b/source/Teapot-Tests/TeapotPathParamTest.class.st index 7181fac..a5fcce7 100644 --- a/source/Teapot-Tests/TeapotPathParamTest.class.st +++ b/source/Teapot-Tests/TeapotPathParamTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotPathParamTest, - #superclass : #TestCase, + #name : 'TeapotPathParamTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotPathParamTest >> setUp [ server := Teapot on GET: '/user/' -> [ :req | '1-', (req at: #id) ]; @@ -17,31 +18,31 @@ TeapotPathParamTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotPathParamTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotPathParamTest >> testPlaceholderAtLast [ self assert: (TeaTestClient httpGetString: '/user/12') equals: '1-12' ] -{ #category : #tests } +{ #category : 'tests' } TeapotPathParamTest >> testPlaceholderFirst [ self assert: (TeaTestClient httpGetString: '/54/user') equals: '3-54'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotPathParamTest >> testPlaceholderInside [ self assert: (TeaTestClient httpGetString: '/user/34/create') equals: '2-34'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotPathParamTest >> testPlaceholderPost [ self assert: (TeaTestClient httpPostString: '/user/789/create') equals: '4-789'. diff --git a/source/Teapot-Tests/TeapotQueryParamsTest.class.st b/source/Teapot-Tests/TeapotQueryParamsTest.class.st index 2908f14..106e73c 100644 --- a/source/Teapot-Tests/TeapotQueryParamsTest.class.st +++ b/source/Teapot-Tests/TeapotQueryParamsTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotQueryParamsTest, - #superclass : #TestCase, + #name : 'TeapotQueryParamsTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotQueryParamsTest >> setUp [ server := Teapot on GET: '/query' -> [ :req | req at: #foo ]; @@ -15,17 +16,17 @@ TeapotQueryParamsTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotQueryParamsTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotQueryParamsTest >> testDefaultQueryParam [ self assert: (TeaTestClient httpGetString: '/queryopt') equals: 'default'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotQueryParamsTest >> testQueryParam [ self assert: (TeaTestClient httpGetString: '/query?foo=bar') equals: 'bar'. self assert: (TeaTestClient httpGetString: '/queryopt?foo=baz') equals: 'baz'. diff --git a/source/Teapot-Tests/TeapotRegexpTest.class.st b/source/Teapot-Tests/TeapotRegexpTest.class.st index 8b27428..3e225fa 100644 --- a/source/Teapot-Tests/TeapotRegexpTest.class.st +++ b/source/Teapot-Tests/TeapotRegexpTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotRegexpTest, - #superclass : #TestCase, + #name : 'TeapotRegexpTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotRegexpTest >> setUp [ server := Teapot on GET: '/./' asRegex -> [ 'regexp' ]; @@ -16,23 +17,23 @@ TeapotRegexpTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotRegexpTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotRegexpTest >> testCollectingSubexpressions [ self assert: (TeaTestClient httpGetString: '/abc3/4/xxx') equals: '3'. self assert: (TeaTestClient httpGetString: '/1/aabbcc/2/foobar') equals: '1aabbccfoobar'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRegexpTest >> testIgnoresQueryParam [ self assert: (TeaTestClient httpGetString: '/k/?param=value') equals: 'regexp'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRegexpTest >> testRegexpMatch [ self assert: (TeaTestClient httpGetString: '/k/') equals: 'regexp'. ] diff --git a/source/Teapot-Tests/TeapotResponseTest.class.st b/source/Teapot-Tests/TeapotResponseTest.class.st index 48c84b2..046e261 100644 --- a/source/Teapot-Tests/TeapotResponseTest.class.st +++ b/source/Teapot-Tests/TeapotResponseTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotResponseTest, - #superclass : #TestCase, + #name : 'TeapotResponseTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotResponseTest >> setUp [ server := Teapot on GET: '/test400' -> [ @@ -17,12 +18,12 @@ TeapotResponseTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotResponseTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotResponseTest >> testReturnsCustomCodeBodyAndHeaders [ | response | response := TeaTestClient httpGet: '/test400'. diff --git a/source/Teapot-Tests/TeapotReturnResponseTest.class.st b/source/Teapot-Tests/TeapotReturnResponseTest.class.st index 05396d7..eced655 100644 --- a/source/Teapot-Tests/TeapotReturnResponseTest.class.st +++ b/source/Teapot-Tests/TeapotReturnResponseTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotReturnResponseTest, - #superclass : #TestCase, + #name : 'TeapotReturnResponseTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotReturnResponseTest >> setUp [ | stream | stream := ZnStreamingEntity @@ -23,22 +24,22 @@ TeapotReturnResponseTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotReturnResponseTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotReturnResponseTest >> testDirectStreamResponse [ self assert: (TeaTestClient httpGetString: '/resp2') equals: 'direct stream'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotReturnResponseTest >> testDirectStringResponse [ self assert: (TeaTestClient httpGetString: '/resp1') equals: 'direct response'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotReturnResponseTest >> testRedirect [ self assert: (TeaTestClient httpGetString: '/redirect') equals: 'redirected here'. diff --git a/source/Teapot-Tests/TeapotRouteSetTest.class.st b/source/Teapot-Tests/TeapotRouteSetTest.class.st index fc4ae05..3fdfc37 100644 --- a/source/Teapot-Tests/TeapotRouteSetTest.class.st +++ b/source/Teapot-Tests/TeapotRouteSetTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotRouteSetTest, - #superclass : #TestCase, + #name : 'TeapotRouteSetTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotRouteSetTest >> setUp [ server := Teapot on before: { '/secure/*' . '/protected/*' } -> [ :req | req abort: TeaResponse unauthorized ]; @@ -17,12 +18,12 @@ TeapotRouteSetTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotRouteSetTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotRouteSetTest >> testMatchesAnyRouteInAfterFilter [ | response | response := TeaTestClient httpGet: '/a'. @@ -36,7 +37,7 @@ TeapotRouteSetTest >> testMatchesAnyRouteInAfterFilter [ ] -{ #category : #tests } +{ #category : 'tests' } TeapotRouteSetTest >> testMatchesAnyRouteInBeforeFilter [ | response | response := TeaTestClient httpGet: '/secure/123'. @@ -47,14 +48,14 @@ TeapotRouteSetTest >> testMatchesAnyRouteInBeforeFilter [ ] -{ #category : #tests } +{ #category : 'tests' } TeapotRouteSetTest >> testMatchesAnyRouteInSet [ self assert: (TeaTestClient httpGetString: '/a') equals: 'abc'. self assert: (TeaTestClient httpGetString: '/b') equals: 'abc'. self assert: (TeaTestClient httpGetString: '/c') equals: 'abc'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRouteSetTest >> testMatchesAnyRouteInSetWithParams [ self assert: (TeaTestClient httpPostString: '/x/value1') equals: 'value1'. self assert: (TeaTestClient httpPostString: '/y/value2') equals: 'value2'. diff --git a/source/Teapot-Tests/TeapotRoutingTest.class.st b/source/Teapot-Tests/TeapotRoutingTest.class.st index 6668788..d6f0d09 100644 --- a/source/Teapot-Tests/TeapotRoutingTest.class.st +++ b/source/Teapot-Tests/TeapotRoutingTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotRoutingTest, - #superclass : #TestCase, + #name : 'TeapotRoutingTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotRoutingTest >> setUp [ | teapot | teapot := Teapot configure: { #notFoundHandlerClass -> Tea405AwareNotFoundHandler }. @@ -24,17 +25,17 @@ TeapotRoutingTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotRoutingTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> test404 [ self assert: (TeaTestClient httpGet: '/1/2/3/4') code equals: 404 ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> test405 [ | response | response := TeaTestClient httpDelete: '/a'. @@ -44,7 +45,7 @@ TeapotRoutingTest >> test405 [ equals: #(GET POST) asSet. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testAnyMatchesToAnyHttpMethod [ self assert: (TeaTestClient httpGetString: '/any') equals: 'any'. self assert: (TeaTestClient httpPostString: '/any') equals: 'any'. @@ -52,38 +53,38 @@ TeapotRoutingTest >> testAnyMatchesToAnyHttpMethod [ self assert: (TeaTestClient httpDeleteString: '/any') equals: 'any'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testCustom404 [ self assert: (TeaTestClient httpGetString: '/404') equals: 'Not Found /custom', String crlf ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testMultipleWildcard [ self assert: (TeaTestClient httpGetString: '/x/foo/bar/z/baz') equals: '6'. self assert: (TeaTestClient httpGetString: '/x/foo/bar/z/baz/123') equals: '6'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testNoWildcard [ self assert: (TeaTestClient httpGetString: '') equals: '1'. self assert: (TeaTestClient httpGetString: '/a') equals: '2'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testWildcardEnd [ self assert: (TeaTestClient httpGetString: '/x/y/foo') equals: '5'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testWildcardFirst [ self assert: (TeaTestClient httpGetString: '/foo/c') equals: '4' ] -{ #category : #tests } +{ #category : 'tests' } TeapotRoutingTest >> testWildcardInside [ self assert: (TeaTestClient httpGetString: '/a/bar/b') equals: '3' diff --git a/source/Teapot-Tests/TeapotSslTest.class.st b/source/Teapot-Tests/TeapotSslTest.class.st index 0f1bc6e..e7fdbb2 100644 --- a/source/Teapot-Tests/TeapotSslTest.class.st +++ b/source/Teapot-Tests/TeapotSslTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotSslTest, - #superclass : #TestCase, + #name : 'TeapotSslTest', + #superclass : 'TestCase', #instVars : [ 'teapot' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeapotSslTest >> pemContent [ ^ String streamContents: [ :stream | { @@ -43,12 +44,12 @@ TeapotSslTest >> pemContent [ ] ] -{ #category : #private } +{ #category : 'private' } TeapotSslTest >> pemFile [ ^ FileLocator temp asFileReference / 'test-teapot-ssl.pem' ] -{ #category : #initialization } +{ #category : 'initialization' } TeapotSslTest >> setUp [ self writeOutPemTo: self pemFile. teapot := Teapot configure: { @@ -62,13 +63,13 @@ TeapotSslTest >> setUp [ start. ] -{ #category : #running } +{ #category : 'running' } TeapotSslTest >> tearDown [ teapot stop. self pemFile delete. ] -{ #category : #tests } +{ #category : 'tests' } TeapotSslTest >> testHttpsGet [ self skip. "| result | @@ -76,7 +77,7 @@ TeapotSslTest >> testHttpsGet [ self assert: result equals: 'secure'." ] -{ #category : #private } +{ #category : 'private' } TeapotSslTest >> writeOutPemTo: aFileReference [ aFileReference writeStreamDo: [ :stream | stream nextPutAll: self pemContent ] ] diff --git a/source/Teapot-Tests/TeapotStaticFilesTest.class.st b/source/Teapot-Tests/TeapotStaticFilesTest.class.st index 5cbcea8..4f7d5bb 100644 --- a/source/Teapot-Tests/TeapotStaticFilesTest.class.st +++ b/source/Teapot-Tests/TeapotStaticFilesTest.class.st @@ -1,14 +1,15 @@ Class { - #name : #TeapotStaticFilesTest, - #superclass : #TestCase, + #name : 'TeapotStaticFilesTest', + #superclass : 'TestCase', #instVars : [ 'server', 'htdocs' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeapotStaticFilesTest >> createTempHtdocs [ | tmpHtdocs | tmpHtdocs := FileLocator temp asFileReference / 'test_htdocs'. @@ -19,7 +20,7 @@ TeapotStaticFilesTest >> createTempHtdocs [ ^ tmpHtdocs ] -{ #category : #running } +{ #category : 'running' } TeapotStaticFilesTest >> setUp [ htdocs := self createTempHtdocs. server := Teapot on @@ -28,31 +29,31 @@ TeapotStaticFilesTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotStaticFilesTest >> tearDown [ htdocs deleteAll. server stop. ] -{ #category : #tests } +{ #category : 'tests' } TeapotStaticFilesTest >> testDynamicContentServedBeforeStatic [ self assert: (TeaTestClient httpGetString: '/here/are/statics/b.txt') equals: 'dynamic'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotStaticFilesTest >> testStaticFile [ self assert: (TeaTestClient httpGetString: '/here/are/statics/a.txt') equals: 'a'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotStaticFilesTest >> testStaticIndexHtml [ self assert: (TeaTestClient httpGetString: '/here/are/statics') equals: 'static index'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotStaticFilesTest >> testStaticNotFound [ self assert: (TeaTestClient httpGet: '/here/are/statics/notfound.txt') code equals: 404. diff --git a/source/Teapot-Tests/TeapotStreamingTest.class.st b/source/Teapot-Tests/TeapotStreamingTest.class.st index a5af3cf..ad209d4 100644 --- a/source/Teapot-Tests/TeapotStreamingTest.class.st +++ b/source/Teapot-Tests/TeapotStreamingTest.class.st @@ -1,19 +1,20 @@ Class { - #name : #TeapotStreamingTest, - #superclass : #TestCase, + #name : 'TeapotStreamingTest', + #superclass : 'TestCase', #instVars : [ 'server', 'downloadFile' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #private } +{ #category : 'private' } TeapotStreamingTest >> content [ ^ (ByteArray new: 4096 withAll: 65) asString ] -{ #category : #private } +{ #category : 'private' } TeapotStreamingTest >> createDownloadableFile [ | file | file := FileLocator temp asFileReference / 'download.file'. @@ -22,12 +23,12 @@ TeapotStreamingTest >> createDownloadableFile [ ] -{ #category : #private } +{ #category : 'private' } TeapotStreamingTest >> deleteDownloadableFile [ downloadFile delete ] -{ #category : #running } +{ #category : 'running' } TeapotStreamingTest >> setUp [ downloadFile := self createDownloadableFile. server := Teapot on @@ -36,13 +37,13 @@ TeapotStreamingTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotStreamingTest >> tearDown [ self deleteDownloadableFile. server stop. ] -{ #category : #tests } +{ #category : 'tests' } TeapotStreamingTest >> testStreamingContent [ self assert: (TeaTestClient httpGet: '/stream') contents asString diff --git a/source/Teapot-Tests/TeapotTeaResponseTest.class.st b/source/Teapot-Tests/TeapotTeaResponseTest.class.st index 5e155b5..f22403a 100644 --- a/source/Teapot-Tests/TeapotTeaResponseTest.class.st +++ b/source/Teapot-Tests/TeapotTeaResponseTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotTeaResponseTest, - #superclass : #TestCase, + #name : 'TeapotTeaResponseTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotTeaResponseTest >> setUp [ server := Teapot on GET: '/ok' -> (TeaResponse ok body: 'tested ok'); @@ -22,12 +23,12 @@ TeapotTeaResponseTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotTeaResponseTest >> tearDown [ server stop. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testBadRequest [ | response | response := TeaTestClient httpGet: '/badrequest'. @@ -35,7 +36,7 @@ TeapotTeaResponseTest >> testBadRequest [ self assert: response entity string equals: 'Bad Request' ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testCreated [ | response | response := TeaTestClient httpGet: '/created'. @@ -44,28 +45,28 @@ TeapotTeaResponseTest >> testCreated [ self assert: (response headers at: 'Location') equals: '/created'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testMethodNotAllowed [ | response | response := TeaTestClient httpGet: '/notallowed'. self assert: response code equals: 405. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testNotFound [ | response | response := TeaTestClient httpGet: '/notfound'. self assert: response code equals: 404. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testNotModified [ | response | response := TeaTestClient httpGet: '/notmodified'. self assert: response code equals: 304. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testOk [ | response | response := TeaTestClient httpGet: '/ok'. @@ -73,7 +74,7 @@ TeapotTeaResponseTest >> testOk [ self assert: response entity string equals: 'tested ok'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testRedirect [ | response | response := TeaTestClient httpGetNoRedirect: '/redirect'. @@ -81,7 +82,7 @@ TeapotTeaResponseTest >> testRedirect [ self assert: (response headers at: 'Location') equals: '/target'. ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testServerError [ | response | response := TeaTestClient httpGet: '/servererror'. @@ -89,7 +90,7 @@ TeapotTeaResponseTest >> testServerError [ self assert: response entity string equals: 'tested server error' ] -{ #category : #tests } +{ #category : 'tests' } TeapotTeaResponseTest >> testUnauthorized [ | response | response := TeaTestClient httpGet: '/unauthorized'. diff --git a/source/Teapot-Tests/TeapotWhenClauseTest.class.st b/source/Teapot-Tests/TeapotWhenClauseTest.class.st index 6af3e2f..8292555 100644 --- a/source/Teapot-Tests/TeapotWhenClauseTest.class.st +++ b/source/Teapot-Tests/TeapotWhenClauseTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotWhenClauseTest, - #superclass : #TestCase, + #name : 'TeapotWhenClauseTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotWhenClauseTest >> setUp [ server := Teapot on any: '/when' -> 'get'; when: [:req | req method = 'GET']; @@ -25,12 +26,12 @@ TeapotWhenClauseTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotWhenClauseTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotWhenClauseTest >> testDispatchesOnMethodInWhenFilter [ self assert: (TeaTestClient httpGetString: '/when') @@ -48,7 +49,7 @@ TeapotWhenClauseTest >> testDispatchesOnMethodInWhenFilter [ self assert: (TeaTestClient httpGet: '/never') isNotFound. ] -{ #category : #tests } +{ #category : 'tests' } TeapotWhenClauseTest >> testWhenClauseWithBeforeAfterFilter [ self assert: (TeaTestClient httpGetString: '/beforeurl') diff --git a/source/Teapot-Tests/TeapotWithTypeConstraintTest.class.st b/source/Teapot-Tests/TeapotWithTypeConstraintTest.class.st index 89b34d4..1b54300 100644 --- a/source/Teapot-Tests/TeapotWithTypeConstraintTest.class.st +++ b/source/Teapot-Tests/TeapotWithTypeConstraintTest.class.st @@ -1,13 +1,14 @@ Class { - #name : #TeapotWithTypeConstraintTest, - #superclass : #TestCase, + #name : 'TeapotWithTypeConstraintTest', + #superclass : 'TestCase', #instVars : [ 'server' ], - #category : #'Teapot-Tests' + #category : 'Teapot-Tests', + #package : 'Teapot-Tests' } -{ #category : #running } +{ #category : 'running' } TeapotWithTypeConstraintTest >> setUp [ server := Teapot on GET: '/u//more' -> [ :req | (req at: #identifier) asString ]; @@ -16,12 +17,12 @@ TeapotWithTypeConstraintTest >> setUp [ start ] -{ #category : #running } +{ #category : 'running' } TeapotWithTypeConstraintTest >> tearDown [ server stop ] -{ #category : #tests } +{ #category : 'tests' } TeapotWithTypeConstraintTest >> testNoParams [ self assert: (TeaTestClient httpGetString: '/u') @@ -29,7 +30,7 @@ TeapotWithTypeConstraintTest >> testNoParams [ ] -{ #category : #tests } +{ #category : 'tests' } TeapotWithTypeConstraintTest >> testParseTypeConstraint [ self assert: (TeaTestClient httpGetString: '/u/964d5d07-1834-0d00-a106-47ae08909eb2') @@ -37,7 +38,7 @@ TeapotWithTypeConstraintTest >> testParseTypeConstraint [ ] -{ #category : #tests } +{ #category : 'tests' } TeapotWithTypeConstraintTest >> testParseTypeConstraint2 [ self assert: (TeaTestClient httpGetString: '/u/964d5d07-1834-0d00-a106-47ae08909eb2/more') diff --git a/source/Teapot-Tests/package.st b/source/Teapot-Tests/package.st index 9dfd39b..552365e 100644 --- a/source/Teapot-Tests/package.st +++ b/source/Teapot-Tests/package.st @@ -1 +1 @@ -Package { #name : #'Teapot-Tests' } +Package { #name : 'Teapot-Tests' } diff --git a/source/Teapot-Tools/Cupboard.class.st b/source/Teapot-Tools/Cupboard.class.st index ebfda57..69eff08 100644 --- a/source/Teapot-Tools/Cupboard.class.st +++ b/source/Teapot-Tools/Cupboard.class.st @@ -7,8 +7,8 @@ You can open me with: self soleInstance open " Class { - #name : #Cupboard, - #superclass : #SpPresenter, + #name : 'Cupboard', + #superclass : 'SpPresenter', #instVars : [ 'teapots', 'toolbar' @@ -17,16 +17,18 @@ Class { 'soleInstance', 'icons' ], - #category : #'Teapot-Tools-UI' + #category : 'Teapot-Tools-UI', + #package : 'Teapot-Tools', + #tag : 'UI' } -{ #category : #accessing } +{ #category : 'accessing' } Cupboard class >> iconProvider [ ^TeaIconProvider ] -{ #category : #'world menu' } +{ #category : 'world menu' } Cupboard class >> menuCommandOn: aBuilder [ @@ -38,13 +40,13 @@ Cupboard class >> menuCommandOn: aBuilder [ aBuilder withSeparatorAfter ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } Cupboard class >> new [ self error: 'Do not create new instances - access using #soleInstance' ] -{ #category : #private } +{ #category : 'private' } Cupboard class >> reset [