From c8573c26bf9b1596a2ddc9a5e06ddf46a1741329 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 31 Aug 2023 14:42:15 -0300 Subject: [PATCH 01/11] Move extensions to its own packages --- .../BaselineOfHyperspace.class.st | 4 +++ .../ZnClient.extension.st | 14 ++++----- .../ZnEntity.extension.st | 2 +- .../ZnMimeType.extension.st | 8 ++--- .../ZnRequest.extension.st | 16 +++++----- .../ZnResponse.extension.st | 24 +++++++------- .../ZnSingleThreadedServer.extension.st | 4 +-- .../ZnUrl.extension.st | 10 +++--- source/Hyperspace-Extensions/package.st | 1 + .../CharacterCollection.extension.st | 31 +++++++++++++++++++ source/Hyperspace-GS64-Extensions/package.st | 1 + .../String.extension.st | 10 +++--- source/Hyperspace-Pharo-Extensions/package.st | 1 + 13 files changed, 82 insertions(+), 44 deletions(-) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnClient.extension.st (67%) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnEntity.extension.st (87%) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnMimeType.extension.st (74%) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnRequest.extension.st (71%) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnResponse.extension.st (77%) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnSingleThreadedServer.extension.st (70%) rename source/{Hyperspace-Model => Hyperspace-Extensions}/ZnUrl.extension.st (76%) create mode 100644 source/Hyperspace-Extensions/package.st create mode 100644 source/Hyperspace-GS64-Extensions/CharacterCollection.extension.st create mode 100644 source/Hyperspace-GS64-Extensions/package.st rename source/{Hyperspace-Model => Hyperspace-Pharo-Extensions}/String.extension.st (56%) create mode 100644 source/Hyperspace-Pharo-Extensions/package.st diff --git a/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st b/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st index 664c272..37d7cfb 100644 --- a/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st +++ b/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st @@ -52,6 +52,10 @@ BaselineOfHyperspace >> setUpPackages: spec [ spec package: 'Hyperspace-Model' with: [ spec requires: #('Buoy-Deployment' 'Zinc-Core')]; group: 'Deployment' with: 'Hyperspace-Model'; + package: 'Hyperspace-Extensions' with: [ spec requires: 'Hyperspace-Model']; + group: 'Deployment' with: 'Hyperspace-Extensions'; + package: 'Hyperspace-Pharo-Extensions' with: [ spec requires: 'Hyperspace-Model']; + group: 'Deployment' with: 'Hyperspace-Pharo-Extensions'; package: 'Hyperspace-Model-Tests' with: [ spec requires: #( 'Hyperspace-Model' 'Dependent-SUnit-Extensions' ) ]; group: 'Tests' with: 'Hyperspace-Model-Tests'. diff --git a/source/Hyperspace-Model/ZnClient.extension.st b/source/Hyperspace-Extensions/ZnClient.extension.st similarity index 67% rename from source/Hyperspace-Model/ZnClient.extension.st rename to source/Hyperspace-Extensions/ZnClient.extension.st index a5e945b..a955d1d 100644 --- a/source/Hyperspace-Model/ZnClient.extension.st +++ b/source/Hyperspace-Extensions/ZnClient.extension.st @@ -1,12 +1,12 @@ Extension { #name : #ZnClient } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> logLevel [ ^ logLevel ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> query [ "Execute an HTTP QUERY the request set up and return the response #contents." @@ -17,32 +17,32 @@ ZnClient >> query [ ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> resetRequest [ request := ZnRequest empty. response := nil ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> setAccept: object [ request setAccept: object ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> setIfMatchTo: etag [ request setIfMatchTo: etag ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> setIfNoneMatchTo: etag [ request setIfNoneMatchTo: etag ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnClient >> setLogLevelAtLeastTo: integer [ self logLevel: (integer max: logLevel) diff --git a/source/Hyperspace-Model/ZnEntity.extension.st b/source/Hyperspace-Extensions/ZnEntity.extension.st similarity index 87% rename from source/Hyperspace-Model/ZnEntity.extension.st rename to source/Hyperspace-Extensions/ZnEntity.extension.st index c61d474..264aeef 100644 --- a/source/Hyperspace-Model/ZnEntity.extension.st +++ b/source/Hyperspace-Extensions/ZnEntity.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ZnEntity } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnEntity class >> with: anObject ofType: aMimeType [ | entity | diff --git a/source/Hyperspace-Model/ZnMimeType.extension.st b/source/Hyperspace-Extensions/ZnMimeType.extension.st similarity index 74% rename from source/Hyperspace-Model/ZnMimeType.extension.st rename to source/Hyperspace-Extensions/ZnMimeType.extension.st index 7bb5d1b..c98a0bf 100644 --- a/source/Hyperspace-Model/ZnMimeType.extension.st +++ b/source/Hyperspace-Extensions/ZnMimeType.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ZnMimeType } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnMimeType >> accepts: aMimeType [ ^ (aMimeType main = '*' or: [ aMimeType main = self main ]) @@ -8,19 +8,19 @@ ZnMimeType >> accepts: aMimeType [ or: [ self sub = aMimeType sub or: [ (self sub splitOn: $+) includes: aMimeType sub ] ] ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnMimeType >> asMediaType [ ^ self ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnMimeType >> quality [ ^ Float readFrom: (self parameterAt: 'q' ifAbsent: [ ^1.0 ]) ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnMimeType >> version: aVersionString [ self parameters at: 'version' put: aVersionString diff --git a/source/Hyperspace-Model/ZnRequest.extension.st b/source/Hyperspace-Extensions/ZnRequest.extension.st similarity index 71% rename from source/Hyperspace-Model/ZnRequest.extension.st rename to source/Hyperspace-Extensions/ZnRequest.extension.st index ea896d8..4975632 100644 --- a/source/Hyperspace-Model/ZnRequest.extension.st +++ b/source/Hyperspace-Extensions/ZnRequest.extension.st @@ -1,48 +1,48 @@ Extension { #name : #ZnRequest } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest >> acceptLanguage [ ^ self headers at: 'Accept-Language' ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest >> hasLanguageProrityList [ ^ self headers includesKey: 'Accept-Language' ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest class >> query: urlObject [ ^ self supportQUERYDuring: [ self method: #QUERY url: urlObject ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest >> readFrom: stream [ ^ self class supportQUERYDuring: [ super readFrom: stream ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest >> setAcceptLanguage: acceptLanguageDirectives [ self headers at: 'Accept-Language' put: acceptLanguageDirectives asString ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest >> setIfMatchTo: etag [ self headers at: 'If-Match' put: etag asString ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest >> setIfNoneMatchTo: etag [ self headers at: 'If-None-Match' put: etag asString ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnRequest class >> supportQUERYDuring: aBlock [ ^ aBlock diff --git a/source/Hyperspace-Model/ZnResponse.extension.st b/source/Hyperspace-Extensions/ZnResponse.extension.st similarity index 77% rename from source/Hyperspace-Model/ZnResponse.extension.st rename to source/Hyperspace-Extensions/ZnResponse.extension.st index 76cfe6a..6918699 100644 --- a/source/Hyperspace-Model/ZnResponse.extension.st +++ b/source/Hyperspace-Extensions/ZnResponse.extension.st @@ -1,30 +1,30 @@ Extension { #name : #ZnResponse } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> addCachingDirective: aDirective [ self headers at: 'Cache-Control' add: aDirective ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> addContentLanguage: aLanguageTag [ self headers at: 'Content-Language' add: aLanguageTag ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> addLink: aLink [ self headers at: 'Link' add: aLink ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> addToVary: headerName [ self headers at: 'Vary' add: headerName ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> cachingDirectives [ | directives | @@ -35,7 +35,7 @@ ZnResponse >> cachingDirectives [ ifFalse: [ Array with: directives ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> contentLanguageTags [ | headerValue | @@ -46,19 +46,19 @@ ZnResponse >> contentLanguageTags [ ifFalse: [ Array with: headerValue asLanguageTag ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> entityTag [ ^ (self headers at: 'ETag') asEntityTag ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> hasLocation [ ^ self headers includesKey: 'Location' ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> links [ | headerValue | @@ -69,13 +69,13 @@ ZnResponse >> links [ ifFalse: [ Array with: headerValue asWebLink ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> setEntityTag: aStringOrEntityTag [ self headers at: 'ETag' put: aStringOrEntityTag asEntityTag asString ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> varyHeaderNames [ | headerValue | @@ -86,7 +86,7 @@ ZnResponse >> varyHeaderNames [ ifFalse: [ Array with: headerValue ] ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnResponse >> withEntityTagDo: foundBlock ifAbsent: absentBlock [ self headers at: 'ETag' ifPresent: [ :headerValue | ^ foundBlock cull: headerValue asEntityTag ]. diff --git a/source/Hyperspace-Model/ZnSingleThreadedServer.extension.st b/source/Hyperspace-Extensions/ZnSingleThreadedServer.extension.st similarity index 70% rename from source/Hyperspace-Model/ZnSingleThreadedServer.extension.st rename to source/Hyperspace-Extensions/ZnSingleThreadedServer.extension.st index cc05fe8..88c505d 100644 --- a/source/Hyperspace-Model/ZnSingleThreadedServer.extension.st +++ b/source/Hyperspace-Extensions/ZnSingleThreadedServer.extension.st @@ -1,12 +1,12 @@ Extension { #name : #ZnSingleThreadedServer } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnSingleThreadedServer >> logLevel [ ^ logLevel ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnSingleThreadedServer >> setLogLevelAtLeastTo: integer [ self logLevel: (integer max: logLevel) diff --git a/source/Hyperspace-Model/ZnUrl.extension.st b/source/Hyperspace-Extensions/ZnUrl.extension.st similarity index 76% rename from source/Hyperspace-Model/ZnUrl.extension.st rename to source/Hyperspace-Extensions/ZnUrl.extension.st index 1a5857e..6fb9e6d 100644 --- a/source/Hyperspace-Model/ZnUrl.extension.st +++ b/source/Hyperspace-Extensions/ZnUrl.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ZnUrl } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnUrl >> asAbsoluteUrl [ AssertionChecker @@ -11,7 +11,7 @@ ZnUrl >> asAbsoluteUrl [ ^ self ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnUrl >> asHostedAt: aBaseUrl [ ^ self copy @@ -21,13 +21,13 @@ ZnUrl >> asHostedAt: aBaseUrl [ yourself ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnUrl >> asWebLink [ ^ WebLink to: self ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnUrl >> queryAt: aKey putUrl: anUnencodedUrl [ | encodedUrl | @@ -36,7 +36,7 @@ ZnUrl >> queryAt: aKey putUrl: anUnencodedUrl [ ^ self queryAt: aKey put: encodedUrl ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Extensions' } ZnUrl >> start: startIndex limit: limitCount [ self diff --git a/source/Hyperspace-Extensions/package.st b/source/Hyperspace-Extensions/package.st new file mode 100644 index 0000000..28205ee --- /dev/null +++ b/source/Hyperspace-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Hyperspace-Extensions' } diff --git a/source/Hyperspace-GS64-Extensions/CharacterCollection.extension.st b/source/Hyperspace-GS64-Extensions/CharacterCollection.extension.st new file mode 100644 index 0000000..9d416b0 --- /dev/null +++ b/source/Hyperspace-GS64-Extensions/CharacterCollection.extension.st @@ -0,0 +1,31 @@ +Extension { #name : #CharacterCollection } + +{ #category : #'*Hyperspace-GS64-Extensions' } +CharacterCollection >> asAbsoluteUrl [ + + ^ self asUrl asAbsoluteUrl +] + +{ #category : #'*Hyperspace-GS64-Extensions' } +CharacterCollection >> asEntityTag [ + + ^ EntityTag fromString: self +] + +{ #category : #'*Hyperspace-GS64-Extensions' } +CharacterCollection >> asLanguageTag [ + + ^ LanguageTag fromString: self +] + +{ #category : #'*Hyperspace-GS64-Extensions' } +CharacterCollection >> asMediaType [ + + ^ self asZnMimeType +] + +{ #category : #'*Hyperspace-GS64-Extensions' } +CharacterCollection >> asWebLink [ + + ^ WebLink fromString: self +] diff --git a/source/Hyperspace-GS64-Extensions/package.st b/source/Hyperspace-GS64-Extensions/package.st new file mode 100644 index 0000000..02f9af5 --- /dev/null +++ b/source/Hyperspace-GS64-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Hyperspace-GS64-Extensions' } diff --git a/source/Hyperspace-Model/String.extension.st b/source/Hyperspace-Pharo-Extensions/String.extension.st similarity index 56% rename from source/Hyperspace-Model/String.extension.st rename to source/Hyperspace-Pharo-Extensions/String.extension.st index 92fa431..2b35ad4 100644 --- a/source/Hyperspace-Model/String.extension.st +++ b/source/Hyperspace-Pharo-Extensions/String.extension.st @@ -1,30 +1,30 @@ Extension { #name : #String } -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Pharo-Extensions' } String >> asAbsoluteUrl [ ^ self asUrl asAbsoluteUrl ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Pharo-Extensions' } String >> asEntityTag [ ^ EntityTag fromString: self ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Pharo-Extensions' } String >> asLanguageTag [ ^ LanguageTag fromString: self ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Pharo-Extensions' } String >> asMediaType [ ^ self asZnMimeType ] -{ #category : #'*Hyperspace-Model' } +{ #category : #'*Hyperspace-Pharo-Extensions' } String >> asWebLink [ ^ WebLink fromString: self diff --git a/source/Hyperspace-Pharo-Extensions/package.st b/source/Hyperspace-Pharo-Extensions/package.st new file mode 100644 index 0000000..8b280a4 --- /dev/null +++ b/source/Hyperspace-Pharo-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Hyperspace-Pharo-Extensions' } From a92ea94ec225336776b78444a4575608f19b9ff2 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 31 Aug 2023 15:01:54 -0300 Subject: [PATCH 02/11] Add rowan specs --- .github/workflows/loading-groups.yml | 2 +- .github/workflows/loading-gs64-components.yml | 19 +++++++++++++++ .github/workflows/notify.yml | 4 +--- .github/workflows/unit-tests-gs64.yml | 15 ++++++++++++ .github/workflows/unit-tests.yml | 2 +- README.md | 9 +++++--- docs/reference/Baseline-groups.md | 13 ++++++++++- .../Dependent-SUnit-Extensions.ston | 18 +++++++++++++++ rowan/components/Deployment.ston | 23 +++++++++++++++++++ rowan/components/Tests.ston | 23 +++++++++++++++++++ rowan/project.ston | 11 +++++++++ rowan/projects/Zinc.ston | 10 ++++++++ rowan/specs/Hyperspace-CI.ston | 14 +++++++++++ ...Hyperspace-Dependent-SUnit-Extensions.ston | 12 ++++++++++ rowan/specs/Hyperspace-Deployment.ston | 9 ++++++++ source/.properties | 3 ++- 16 files changed, 177 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/loading-gs64-components.yml create mode 100644 .github/workflows/unit-tests-gs64.yml create mode 100644 rowan/components/Dependent-SUnit-Extensions.ston create mode 100644 rowan/components/Deployment.ston create mode 100644 rowan/components/Tests.ston create mode 100644 rowan/project.ston create mode 100644 rowan/projects/Zinc.ston create mode 100644 rowan/specs/Hyperspace-CI.ston create mode 100644 rowan/specs/Hyperspace-Dependent-SUnit-Extensions.ston create mode 100644 rowan/specs/Hyperspace-Deployment.ston diff --git a/.github/workflows/loading-groups.yml b/.github/workflows/loading-groups.yml index db4f758..215ccfc 100644 --- a/.github/workflows/loading-groups.yml +++ b/.github/workflows/loading-groups.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0 ] + smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0 ] load-spec: [ deployment, dependent-sunit-extensions, tests, tools, development ] name: ${{ matrix.smalltalk }} + ${{ matrix.load-spec }} steps: diff --git a/.github/workflows/loading-gs64-components.yml b/.github/workflows/loading-gs64-components.yml new file mode 100644 index 0000000..97fcae4 --- /dev/null +++ b/.github/workflows/loading-gs64-components.yml @@ -0,0 +1,19 @@ +name: 'GS64 Components Loading' + +on: [push,pull_request,workflow_dispatch] + +jobs: + component-loading: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + load-spec: [ Deployment, Dependent-SUnit-Extensions ] + name: GS64 + ${{ matrix.load-spec }} + steps: + - uses: actions/checkout@v3 + - name: Load component in image + uses: ba-st-actions/gs64-ci@v1 + with: + project_name: 'Hyperspace' + load_spec: 'Hyperspace-${{ matrix.load-spec }}' diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index bfe0828..bc6862d 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -1,8 +1,6 @@ name: Release Notifications -on: - release: - types: [published] +on: workflow_dispatch jobs: notify: diff --git a/.github/workflows/unit-tests-gs64.yml b/.github/workflows/unit-tests-gs64.yml new file mode 100644 index 0000000..1ae449a --- /dev/null +++ b/.github/workflows/unit-tests-gs64.yml @@ -0,0 +1,15 @@ +name: 'GS64 Unit Tests' + +on: [push,pull_request,workflow_dispatch] + +jobs: + unit-tests: + runs-on: ubuntu-latest + name: GS64 Unit Tests + steps: + - uses: actions/checkout@v3 + - name: Load Image and Run Tests + uses: ba-st-actions/gs64-ci@v1 + with: + project_name: 'Hyperspace' + run_tests: 'true' diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index cc54e9c..14f66b0 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0, Pharo64-7.0 ] + smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0 ] name: ${{ matrix.smalltalk }} steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 714ab76..7499280 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,21 @@ Building blocks for Internet technologies on top of [Zinc HTTP Components](https://github.com/svenvc/zinc) -[![Unit Tests](https://github.com/ba-st/Hyperspace/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ba-st/Hyperspace/actions/workflows/unit-tests.yml) +[![Pharo - Unit Tests](https://github.com/ba-st/Hyperspace/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ba-st/Hyperspace/actions/workflows/unit-tests.yml) +[![GS64 - Unit Tests](https://github.com/ba-st/Hyperspace/actions/workflows/unit-tests-gs64.yml/badge.svg)](https://github.com/ba-st/Hyperspace/actions/workflows/unit-tests-gs64.yml) [![Coverage Status](https://codecov.io/github/ba-st/Hyperspace/coverage.svg?branch=release-candidate)](https://codecov.io/gh/ba-st/Hyperspace/branch/release-candidate) + [![Baseline Groups](https://github.com/ba-st/Hyperspace/actions/workflows/loading-groups.yml/badge.svg)](https://github.com/ba-st/Hyperspace/actions/workflows/loading-groups.yml) +[![GS64 Components](https://github.com/ba-st/Hyperspace/actions/workflows/loading-gs64-components.yml/badge.svg)](https://github.com/ba-st/Hyperspace/actions/workflows/loading-gs64-components.yml) [![Markdown Lint](https://github.com/ba-st/Hyperspace/actions/workflows/markdown-lint.yml/badge.svg)](https://github.com/ba-st/Hyperspace/actions/workflows/markdown-lint.yml) [![GitHub release](https://img.shields.io/github/release/ba-st/Hyperspace.svg)](https://github.com/ba-st/Hyperspace/releases/latest) -[![Pharo 7.0](https://img.shields.io/badge/Pharo-7.0-informational)](https://pharo.org) -[![Pharo 8.0](https://img.shields.io/badge/Pharo-8.0-informational)](https://pharo.org) [![Pharo 9.0](https://img.shields.io/badge/Pharo-9.0-informational)](https://pharo.org) [![Pharo 10](https://img.shields.io/badge/Pharo-10-informational)](https://pharo.org) [![Pharo 11](https://img.shields.io/badge/Pharo-11-informational)](https://pharo.org) +[![GS64 3.6.6](https://img.shields.io/badge/GS64-3.6.6-informational)](https://gemtalksystems.com/products/gs64/) + ## Quick links - [**Explore the docs**](docs/README.md) diff --git a/docs/reference/Baseline-groups.md b/docs/reference/Baseline-groups.md index b54e405..8eb49b7 100644 --- a/docs/reference/Baseline-groups.md +++ b/docs/reference/Baseline-groups.md @@ -1,4 +1,6 @@ -# Baseline Groups +# Baseline Groups & GS 64 Components + +## Pharo Baseline Groups Hyperspace includes the following groups in its Baseline that can be used as loading targets: @@ -11,3 +13,12 @@ loading targets: particular case it is the same as `Tests` - `Development` will load all the needed packages to develop and contribute to the project + +## GS64 Components + +Hyperspace includes the following components in its Rowan configuration that can be +used as loading targets: + +- `Deployment` will load all the packages needed in a deployed application +- `Tests` will load the test cases +- `Dependent-SUnit-Extensions` will load extensions to SUnit diff --git a/rowan/components/Dependent-SUnit-Extensions.ston b/rowan/components/Dependent-SUnit-Extensions.ston new file mode 100644 index 0000000..c7ad14f --- /dev/null +++ b/rowan/components/Dependent-SUnit-Extensions.ston @@ -0,0 +1,18 @@ +RwSimpleProjectLoadComponentV2 { + #name : 'Dependent-SUnit-Extensions', + #condition : 'sunit', + #projectNames : [ ], + #componentNames : [ ], + #packageNames : [ + 'Hyperspace-SUnit-Model' + ], + #conditionalPackageMapSpecs : { + 'gemstone' : { + 'allusers' : { + #packageNameToPlatformPropertiesMap : { + 'Hyperspace-SUnit-Model' : { 'symbolDictName' : 'Globals' } + } + } + } + } +} diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston new file mode 100644 index 0000000..d9dce62 --- /dev/null +++ b/rowan/components/Deployment.ston @@ -0,0 +1,23 @@ +RwSimpleProjectLoadComponentV2 { + #name : 'Deployment', + #projectNames : [ + 'Zinc' + ], + #componentNames : [ ], + #packageNames : [ + 'Hyperspace-Model', + 'Hyperspace-Extensions', + 'Hyperspace-GS64-Extensions', + ], + #conditionalPackageMapSpecs : { + 'gemstone' : { + 'allusers' : { + #packageNameToPlatformPropertiesMap : { + 'Hyperspace-Model' : { 'symbolDictName' : 'Hyperspace' }, + 'Hyperspace-Extensions' : { 'symbolDictName' : 'Zinc' }, + 'Hyperspace-GS64-Extensions' : { 'symbolDictName' : 'Globals' } + } + } + } + } +} diff --git a/rowan/components/Tests.ston b/rowan/components/Tests.ston new file mode 100644 index 0000000..4c568fe --- /dev/null +++ b/rowan/components/Tests.ston @@ -0,0 +1,23 @@ +RwSimpleProjectLoadComponentV2 { + #name : 'Tests', + #condition : 'tests', + #projectNames : [ ], + #componentNames : [ + 'Deployment', + 'Dependent-SUnit-Extensions' + ], + #packageNames : [ + 'Hyperspace-Model-Tests', + 'Hyperspace-SUnit-Model-Tests' + ], + #conditionalPackageMapSpecs : { + 'gemstone' : { + 'allusers' : { + #packageNameToPlatformPropertiesMap : { + 'Hyperspace-Model-Tests' : { 'symbolDictName' : 'Hyperspace' }, + 'Hyperspace-SUnit-Model-Tests' : { 'symbolDictName' : 'Hyperspace' } + } + } + } + } +} diff --git a/rowan/project.ston b/rowan/project.ston new file mode 100644 index 0000000..a644b14 --- /dev/null +++ b/rowan/project.ston @@ -0,0 +1,11 @@ +RwProjectSpecificationV2 { + #specName : 'project', + #projectSpecPath : 'rowan', + #componentsPath : 'rowan/components', + #packagesPath : 'source', + #projectsPath : 'rowan/projects', + #specsPath : 'rowan/specs', + #packageFormat : 'tonel', + #packageConvention : 'Rowan', + #comment : 'Hyperspace project specification' +} diff --git a/rowan/projects/Zinc.ston b/rowan/projects/Zinc.ston new file mode 100644 index 0000000..6e513ee --- /dev/null +++ b/rowan/projects/Zinc.ston @@ -0,0 +1,10 @@ +RwLoadSpecificationV2 { + #specName: 'Zinc', + #projectName : 'Zinc', + #gitUrl : 'https://github.com/ba-st-dependencies/Zinc.git', + #revision : 'v5', + #projectSpecFile : 'rowan/project.ston', + #componentNames : [ + 'Deployment' + ] +} diff --git a/rowan/specs/Hyperspace-CI.ston b/rowan/specs/Hyperspace-CI.ston new file mode 100644 index 0000000..7008b73 --- /dev/null +++ b/rowan/specs/Hyperspace-CI.ston @@ -0,0 +1,14 @@ +RwLoadSpecificationV2 { + #specName: 'Hyperspace-CI', + #projectName : 'Hyperspace', + #diskUrl : '/opt/gemstone/projects/Hyperspace', + #projectSpecFile : 'rowan/project.ston', + #componentNames : [ + 'Tests' + ], + #customConditionalAttributes : [ + 'tests', + 'sunit' + ], + #comment : 'Loading spec for the continuous integration setup' +} diff --git a/rowan/specs/Hyperspace-Dependent-SUnit-Extensions.ston b/rowan/specs/Hyperspace-Dependent-SUnit-Extensions.ston new file mode 100644 index 0000000..9ce7d68 --- /dev/null +++ b/rowan/specs/Hyperspace-Dependent-SUnit-Extensions.ston @@ -0,0 +1,12 @@ +RwLoadSpecificationV2 { + #specName: 'Hyperspace-CI', + #projectName : 'Hyperspace', + #diskUrl : '/opt/gemstone/projects/Hyperspace', + #projectSpecFile : 'rowan/project.ston', + #componentNames : [ + 'Dependent-SUnit-Extensions' + ], + #customConditionalAttributes : [ + 'sunit' + ] +} diff --git a/rowan/specs/Hyperspace-Deployment.ston b/rowan/specs/Hyperspace-Deployment.ston new file mode 100644 index 0000000..4fe49e0 --- /dev/null +++ b/rowan/specs/Hyperspace-Deployment.ston @@ -0,0 +1,9 @@ +RwLoadSpecificationV2 { + #specName: 'Hyperspace-CI', + #projectName : 'Hyperspace', + #diskUrl : '/opt/gemstone/projects/Hyperspace', + #projectSpecFile : 'rowan/project.ston', + #componentNames : [ + 'Deployment' + ] +} diff --git a/source/.properties b/source/.properties index 53a5454..f668380 100644 --- a/source/.properties +++ b/source/.properties @@ -1,3 +1,4 @@ { - #format : #tonel + #format : #tonel, + #convention : 'Rowan' } From e374de44bf935535f4448e947704cfddd283dc18 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 31 Aug 2023 16:09:54 -0300 Subject: [PATCH 03/11] Fix baseline and rowan spec --- docs/reference/Baseline-groups.md | 4 +-- rowan/components/Deployment.ston | 2 +- .../BaselineOfHyperspace.class.st | 25 +++++++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/reference/Baseline-groups.md b/docs/reference/Baseline-groups.md index 8eb49b7..d9b3e19 100644 --- a/docs/reference/Baseline-groups.md +++ b/docs/reference/Baseline-groups.md @@ -16,8 +16,8 @@ loading targets: ## GS64 Components -Hyperspace includes the following components in its Rowan configuration that can be -used as loading targets: +Hyperspace includes the following components in its Rowan configuration that +can be used as loading targets: - `Deployment` will load all the packages needed in a deployed application - `Tests` will load the test cases diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index d9dce62..dd583e4 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -7,7 +7,7 @@ RwSimpleProjectLoadComponentV2 { #packageNames : [ 'Hyperspace-Model', 'Hyperspace-Extensions', - 'Hyperspace-GS64-Extensions', + 'Hyperspace-GS64-Extensions' ], #conditionalPackageMapSpecs : { 'gemstone' : { diff --git a/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st b/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st index 37d7cfb..5f48680 100644 --- a/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st +++ b/source/BaselineOfHyperspace/BaselineOfHyperspace.class.st @@ -50,20 +50,29 @@ BaselineOfHyperspace >> setUpDependencies: spec [ BaselineOfHyperspace >> setUpPackages: spec [ spec - package: 'Hyperspace-Model' with: [ spec requires: #('Buoy-Deployment' 'Zinc-Core')]; + package: 'Hyperspace-Model' + with: [ spec requires: #( 'Buoy-Deployment' 'Zinc-Core' ) ]; group: 'Deployment' with: 'Hyperspace-Model'; - package: 'Hyperspace-Extensions' with: [ spec requires: 'Hyperspace-Model']; + package: 'Hyperspace-Extensions' + with: [ spec requires: 'Hyperspace-Model' ]; group: 'Deployment' with: 'Hyperspace-Extensions'; - package: 'Hyperspace-Pharo-Extensions' with: [ spec requires: 'Hyperspace-Model']; - group: 'Deployment' with: 'Hyperspace-Pharo-Extensions'; - package: 'Hyperspace-Model-Tests' - with: [ spec requires: #( 'Hyperspace-Model' 'Dependent-SUnit-Extensions' ) ]; + package: 'Hyperspace-Pharo-Extensions' + with: [ spec requires: 'Hyperspace-Model' ]; + group: 'Deployment' with: 'Hyperspace-Pharo-Extensions'. + + spec + package: 'Hyperspace-Model-Tests' with: [ + spec requires: + #( 'Hyperspace-Model' 'Hyperspace-Extensions' + 'Hyperspace-Pharo-Extensions' 'Dependent-SUnit-Extensions' ) ]; group: 'Tests' with: 'Hyperspace-Model-Tests'. spec - package: 'Hyperspace-SUnit-Model' with: [ spec requires: 'Buoy-SUnit' ]; + package: 'Hyperspace-SUnit-Model' + with: [ spec requires: 'Buoy-SUnit' ]; group: 'Dependent-SUnit-Extensions' with: 'Hyperspace-SUnit-Model'; - package: 'Hyperspace-SUnit-Model-Tests' with: [ spec requires: 'Hyperspace-SUnit-Model' ]; + package: 'Hyperspace-SUnit-Model-Tests' + with: [ spec requires: 'Hyperspace-SUnit-Model' ]; group: 'Tests' with: 'Hyperspace-SUnit-Model-Tests'. spec group: 'Tools' with: 'Buoy-Tools' From 61b08220230cfbb2c0ec71946b8a04a0fa3b379a Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 31 Aug 2023 17:08:57 -0300 Subject: [PATCH 04/11] Move HTTPError>>#- to Pharo extensions package --- source/Hyperspace-Model/HTTPError.class.st | 9 --------- .../Hyperspace-Pharo-Extensions/HTTPError.extension.st | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 source/Hyperspace-Pharo-Extensions/HTTPError.extension.st diff --git a/source/Hyperspace-Model/HTTPError.class.st b/source/Hyperspace-Model/HTTPError.class.st index 7369566..53a4628 100644 --- a/source/Hyperspace-Model/HTTPError.class.st +++ b/source/Hyperspace-Model/HTTPError.class.st @@ -20,15 +20,6 @@ HTTPError class >> code: aCode [ ^ instance ] -{ #category : #'error handling' } -HTTPError >> - anotherException [ - - ^ ExceptionSetWithExclusions new - add: self; - addExclusion: anotherException; - yourself -] - { #category : #accessing } HTTPError >> code [ diff --git a/source/Hyperspace-Pharo-Extensions/HTTPError.extension.st b/source/Hyperspace-Pharo-Extensions/HTTPError.extension.st new file mode 100644 index 0000000..5f86d66 --- /dev/null +++ b/source/Hyperspace-Pharo-Extensions/HTTPError.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #HTTPError } + +{ #category : #'*Hyperspace-Pharo-Extensions' } +HTTPError >> - anotherException [ + + ^ ExceptionSetWithExclusions new + add: self; + addExclusion: anotherException; + yourself +] From b32cf2626e4c814fb8c0ea66e0c6a406e9f871ef Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 31 Aug 2023 17:53:26 -0300 Subject: [PATCH 05/11] Improve portability --- source/Hyperspace-Extensions/ZnMimeType.extension.st | 7 ++++--- .../ZnRequestHyperspaceExtensionsTest.class.st | 2 +- source/Hyperspace-Model/PortAvailabilityChecker.class.st | 2 +- source/Hyperspace-Model/WebLink.class.st | 3 ++- .../ZnNetworkingUtils.extension.st | 7 +++++++ 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 source/Hyperspace-Pharo-Extensions/ZnNetworkingUtils.extension.st diff --git a/source/Hyperspace-Extensions/ZnMimeType.extension.st b/source/Hyperspace-Extensions/ZnMimeType.extension.st index c98a0bf..206b41e 100644 --- a/source/Hyperspace-Extensions/ZnMimeType.extension.st +++ b/source/Hyperspace-Extensions/ZnMimeType.extension.st @@ -3,9 +3,10 @@ Extension { #name : #ZnMimeType } { #category : #'*Hyperspace-Extensions' } ZnMimeType >> accepts: aMimeType [ - ^ (aMimeType main = '*' or: [ aMimeType main = self main ]) - and: [ aMimeType sub = '*' - or: [ self sub = aMimeType sub or: [ (self sub splitOn: $+) includes: aMimeType sub ] ] ] + ^ (aMimeType main = '*' or: [ aMimeType main = self main ]) and: [ + aMimeType sub = '*' or: [ + self sub = aMimeType sub or: [ + ($+ split: self sub) includes: aMimeType sub ] ] ] ] { #category : #'*Hyperspace-Extensions' } diff --git a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st index 17fa8d0..ec3a205 100644 --- a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st +++ b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st @@ -69,7 +69,7 @@ ZnRequestHyperspaceExtensionsTest >> testQuery [ request := ZnRequest query: self googleUrl / 'search'. - self assert: request method equals: #QUERY. + self assert: request method equals: 'QUERY'. output := String streamContents: [ :s | request writeOn: s ]. self diff --git a/source/Hyperspace-Model/PortAvailabilityChecker.class.st b/source/Hyperspace-Model/PortAvailabilityChecker.class.st index c20598e..53fa798 100644 --- a/source/Hyperspace-Model/PortAvailabilityChecker.class.st +++ b/source/Hyperspace-Model/PortAvailabilityChecker.class.st @@ -35,7 +35,7 @@ PortAvailabilityChecker >> isAvailableForTCP: portNumber [ ^ [ | socket | - socket := Socket newTCP. + socket := ZnNetworkingUtils default socketClass newTCP. ZnNetworkingUtils default setServerSocketOptions: socket. socket listenOn: portNumber. [ diff --git a/source/Hyperspace-Model/WebLink.class.st b/source/Hyperspace-Model/WebLink.class.st index a675e67..6cd9a45 100644 --- a/source/Hyperspace-Model/WebLink.class.st +++ b/source/Hyperspace-Model/WebLink.class.st @@ -258,7 +258,8 @@ WebLink >> quoteValueWhenNeeded: aString [ "Values including ; or , needs to be quoted" self assertNotEmpty: aString. - ^ ( aString includesAnyOf: ';,' ) then: [ '"<1s>"' expandMacrosWith: aString ] + ^ ((aString includes: $;) or: [ aString includes: $, ]) + then: [ '"<1s>"' expandMacrosWith: aString ] otherwise: [ aString ] ] diff --git a/source/Hyperspace-Pharo-Extensions/ZnNetworkingUtils.extension.st b/source/Hyperspace-Pharo-Extensions/ZnNetworkingUtils.extension.st new file mode 100644 index 0000000..0952402 --- /dev/null +++ b/source/Hyperspace-Pharo-Extensions/ZnNetworkingUtils.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #ZnNetworkingUtils } + +{ #category : #'*Hyperspace-Pharo-Extensions' } +ZnNetworkingUtils >> socketClass [ + + ^ Socket +] From 3504e9306e899480a18f86c032a280b5783a7334 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 31 Aug 2023 17:57:37 -0300 Subject: [PATCH 06/11] Improve test portability --- .../ZnClientHyperspaceExtensionsTest.class.st | 2 +- .../ZnRequestHyperspaceExtensionsTest.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st b/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st index 0142f87..925254b 100644 --- a/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st +++ b/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st @@ -8,7 +8,7 @@ Class { ZnClientHyperspaceExtensionsTest >> handleRequest: request [ self - assert: request method equals: #QUERY; + assert: request method equals: 'QUERY'; assertUrl: request url equals: 'hello'. ^ ZnResponse ok: (ZnEntity text: 'hello') ] diff --git a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st index ec3a205..433066e 100644 --- a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st +++ b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st @@ -86,7 +86,7 @@ ZnRequestHyperspaceExtensionsTest >> testReadQueryRequest [ 'QUERY /search HTTP/1.1Host: google.com' expandMacros readStream. self - assert: request method equals: #QUERY; + assert: request method equals: 'QUERY'; assertUrl: request url equals: 'search'; assertUrl: request host equals: 'http://google.com' ] From 8a59b284869ca6b8e70407c26af0f6b51ab9d41a Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Fri, 1 Sep 2023 09:32:11 -0300 Subject: [PATCH 07/11] Fix tests --- .../ZnClientHyperspaceExtensionsTest.class.st | 8 ++++---- .../ZnRequestHyperspaceExtensionsTest.class.st | 4 ++-- source/Hyperspace-Model/LanguageRange.class.st | 6 ++++++ source/Hyperspace-Model/LanguageTag.class.st | 6 ++++++ source/Hyperspace-Model/PortAvailabilityChecker.class.st | 3 --- source/Hyperspace-Model/WebLink.class.st | 6 ++++++ 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st b/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st index 925254b..4a41700 100644 --- a/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st +++ b/source/Hyperspace-Model-Tests/ZnClientHyperspaceExtensionsTest.class.st @@ -66,9 +66,9 @@ ZnClientHyperspaceExtensionsTest >> testSetIfMatchTo [ client := ZnClient new. - self should: [ client request headers at: #'If-Match' ] raise: KeyNotFound. + self should: [ client request headers at: 'If-Match' ] raise: KeyNotFound. client setIfMatchTo: ( EntityTag with: '12345' ). - self assert: ( client request headers at: #'If-Match' ) equals: '"12345"' + self assert: ( client request headers at: 'If-Match' ) equals: '"12345"' ] { #category : #tests } @@ -78,9 +78,9 @@ ZnClientHyperspaceExtensionsTest >> testSetIfNoneMatchTo [ client := ZnClient new. - self should: [ client request headers at: #'If-None-Match' ] raise: KeyNotFound. + self should: [ client request headers at: 'If-None-Match' ] raise: KeyNotFound. client setIfNoneMatchTo: ( EntityTag with: '12345' ). - self assert: ( client request headers at: #'If-None-Match' ) equals: '"12345"' + self assert: ( client request headers at: 'If-None-Match' ) equals: '"12345"' ] { #category : #tests } diff --git a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st index 433066e..a60bc70 100644 --- a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st +++ b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st @@ -47,7 +47,7 @@ ZnRequestHyperspaceExtensionsTest >> testIfMatch [ setIfMatchTo: ( EntityTag with: '12345' ); yourself. - self assert: ( request headers at: #'If-Match' ) equals: '"12345"' + self assert: ( request headers at: 'If-Match' ) equals: '"12345"' ] { #category : #tests } @@ -59,7 +59,7 @@ ZnRequestHyperspaceExtensionsTest >> testIfNoneMatch [ setIfNoneMatchTo: ( EntityTag with: '12345' ); yourself. - self assert: (request headers at: #'If-None-Match') equals: '"12345"' + self assert: (request headers at: 'If-None-Match') equals: '"12345"' ] { #category : #tests } diff --git a/source/Hyperspace-Model/LanguageRange.class.st b/source/Hyperspace-Model/LanguageRange.class.st index 42c633a..59dac00 100644 --- a/source/Hyperspace-Model/LanguageRange.class.st +++ b/source/Hyperspace-Model/LanguageRange.class.st @@ -58,6 +58,12 @@ LanguageRange >> = anObject [ checkAgainst: anObject ] +{ #category : #converting } +LanguageRange >> asString [ + + ^ self printString +] + { #category : #comparing } LanguageRange >> hash [ diff --git a/source/Hyperspace-Model/LanguageTag.class.st b/source/Hyperspace-Model/LanguageTag.class.st index e464735..d220a02 100644 --- a/source/Hyperspace-Model/LanguageTag.class.st +++ b/source/Hyperspace-Model/LanguageTag.class.st @@ -62,6 +62,12 @@ LanguageTag >> asLanguageTag [ ^ self ] +{ #category : #printing } +LanguageTag >> asString [ + + ^ self printString +] + { #category : #private } LanguageTag >> assertIsValid [ diff --git a/source/Hyperspace-Model/PortAvailabilityChecker.class.st b/source/Hyperspace-Model/PortAvailabilityChecker.class.st index 53fa798..48c2b7b 100644 --- a/source/Hyperspace-Model/PortAvailabilityChecker.class.st +++ b/source/Hyperspace-Model/PortAvailabilityChecker.class.st @@ -5,9 +5,6 @@ Whenever possible, it is best to let the OS provide us a free port. But if you n Class { #name : #PortAvailabilityChecker, #superclass : #Object, - #instVars : [ - 'portNumberA' - ], #classInstVars : [ 'uniqueInstance' ], diff --git a/source/Hyperspace-Model/WebLink.class.st b/source/Hyperspace-Model/WebLink.class.st index 6cd9a45..18518e1 100644 --- a/source/Hyperspace-Model/WebLink.class.st +++ b/source/Hyperspace-Model/WebLink.class.st @@ -105,6 +105,12 @@ WebLink >> asByteArray [ ^ self printString asByteArray ] +{ #category : #printing } +WebLink >> asString [ + + ^ self printString +] + { #category : #converting } WebLink >> asWebLink [ From bee60812688decf0760f7b2dfa56752a5de7baab Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Fri, 1 Sep 2023 09:47:13 -0300 Subject: [PATCH 08/11] Fix test --- .../ZnRequestHyperspaceExtensionsTest.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st index a60bc70..4e0c99b 100644 --- a/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st +++ b/source/Hyperspace-Model-Tests/ZnRequestHyperspaceExtensionsTest.class.st @@ -66,10 +66,9 @@ ZnRequestHyperspaceExtensionsTest >> testIfNoneMatch [ ZnRequestHyperspaceExtensionsTest >> testQuery [ | request output | - request := ZnRequest query: self googleUrl / 'search'. - self assert: request method equals: 'QUERY'. + self assert: request method equals: #QUERY. output := String streamContents: [ :s | request writeOn: s ]. self From c60b234008f78209fa85af8d2c4769c40360c69f Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Fri, 1 Sep 2023 10:29:31 -0300 Subject: [PATCH 09/11] Allow combination of HTTPError instances as exception selectors --- .../HTTPErrorTest.class.st | 17 +++++++++++ .../Hyperspace-Model-Tests/RetryTest.class.st | 4 +-- .../ExceptionSelectorSet.class.st | 29 +++++++++++++++++++ source/Hyperspace-Model/HTTPError.class.st | 8 ++++- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 source/Hyperspace-Model/ExceptionSelectorSet.class.st diff --git a/source/Hyperspace-Model-Tests/HTTPErrorTest.class.st b/source/Hyperspace-Model-Tests/HTTPErrorTest.class.st index dfbcced..d00c7f2 100644 --- a/source/Hyperspace-Model-Tests/HTTPErrorTest.class.st +++ b/source/Hyperspace-Model-Tests/HTTPErrorTest.class.st @@ -7,6 +7,23 @@ Class { #category : #'Hyperspace-Model-Tests-Exceptions' } +{ #category : #tests } +HTTPErrorTest >> testHandlingExceptionSelectorSets [ + + self + should: [ HTTPClientError notFound signal ] + raise: HTTPClientError notFound , HTTPServerError; + should: [ HTTPServerError serviceUnavailable signal ] + raise: HTTPClientError notFound , HTTPServerError. + + self + should: [ + [ HTTPServerError serviceUnavailable signal ] + on: HTTPClientError notFound , HTTPServerError internalServerError + do: [ :signal | self fail ] ] + raise: HTTPServerError serviceUnavailable +] + { #category : #tests } HTTPErrorTest >> testHandlingHTTPClientError [ diff --git a/source/Hyperspace-Model-Tests/RetryTest.class.st b/source/Hyperspace-Model-Tests/RetryTest.class.st index 8fc89b9..2c26337 100644 --- a/source/Hyperspace-Model-Tests/RetryTest.class.st +++ b/source/Hyperspace-Model-Tests/RetryTest.class.st @@ -347,7 +347,7 @@ RetryTest >> testOnWhenExpectedErrorIsRaisedAndSeveralErrorsHandled [ ] configuredBy: [ :retry | retry - on: AssertionFailed , self expectedError; + on: self expectedError , AssertionFailed; upTo: 1 ] ]. @@ -363,7 +363,7 @@ RetryTest >> testOnWhenExpectedErrorIsRaisedAndSeveralErrorsHandled [ ] configuredBy: [ :retry | retry - on: AssertionFailed , self expectedError; + on: self expectedError , AssertionFailed; upTo: 1 ] ] diff --git a/source/Hyperspace-Model/ExceptionSelectorSet.class.st b/source/Hyperspace-Model/ExceptionSelectorSet.class.st new file mode 100644 index 0000000..2252819 --- /dev/null +++ b/source/Hyperspace-Model/ExceptionSelectorSet.class.st @@ -0,0 +1,29 @@ +Class { + #name : #ExceptionSelectorSet, + #superclass : #Object, + #instVars : [ + 'value', + 'suffix', + 'selectors' + ], + #category : #'Hyperspace-Model-IETF' +} + +{ #category : #'exception selector' } +ExceptionSelectorSet >> , exceptionSelector [ + + selectors add: exceptionSelector +] + +{ #category : #'exception selector' } +ExceptionSelectorSet >> handles: anException [ + + ^ selectors anySatisfy: [ :selector | selector handles: anException ] +] + +{ #category : #initialization } +ExceptionSelectorSet >> initialize [ + + super initialize. + selectors := OrderedCollection new +] diff --git a/source/Hyperspace-Model/HTTPError.class.st b/source/Hyperspace-Model/HTTPError.class.st index 53a4628..ab05d06 100644 --- a/source/Hyperspace-Model/HTTPError.class.st +++ b/source/Hyperspace-Model/HTTPError.class.st @@ -20,6 +20,12 @@ HTTPError class >> code: aCode [ ^ instance ] +{ #category : #'exception selector' } +HTTPError >> , exceptionSelector [ + + ^ ExceptionSelectorSet new , self , exceptionSelector +] + { #category : #accessing } HTTPError >> code [ @@ -32,7 +38,7 @@ HTTPError >> code: anErrorCode [ code := anErrorCode ] -{ #category : #'error handling' } +{ #category : #'exception selector' } HTTPError >> handles: aSignal [ ^ ( self class handles: aSignal ) and: [ aSignal code = self code ] From e19160e1288d743824ac1b91b1c5b5f827e31785 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Fri, 1 Sep 2023 17:10:12 -0300 Subject: [PATCH 10/11] Add missing dependency on Dependent-SUnit-Extensions component --- rowan/components/Dependent-SUnit-Extensions.ston | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rowan/components/Dependent-SUnit-Extensions.ston b/rowan/components/Dependent-SUnit-Extensions.ston index c7ad14f..7e91872 100644 --- a/rowan/components/Dependent-SUnit-Extensions.ston +++ b/rowan/components/Dependent-SUnit-Extensions.ston @@ -2,7 +2,9 @@ RwSimpleProjectLoadComponentV2 { #name : 'Dependent-SUnit-Extensions', #condition : 'sunit', #projectNames : [ ], - #componentNames : [ ], + #componentNames : [ + 'Deployment' + ], #packageNames : [ 'Hyperspace-SUnit-Model' ], From b8f5652b72c13ec5ab84e9bfb581d9fd1cd8d28f Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Fri, 1 Sep 2023 17:13:04 -0300 Subject: [PATCH 11/11] Improve tests --- source/Hyperspace-Model-Tests/WebLinkTest.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Hyperspace-Model-Tests/WebLinkTest.class.st b/source/Hyperspace-Model-Tests/WebLinkTest.class.st index 28174cb..5493707 100644 --- a/source/Hyperspace-Model-Tests/WebLinkTest.class.st +++ b/source/Hyperspace-Model-Tests/WebLinkTest.class.st @@ -262,6 +262,7 @@ WebLinkTest >> testPrinting [ self assert: self googleUrl asWebLink printString equals: ''; + assert: self googleUrl asWebLink asString equals: ''; assert: ( self googleUrl asWebLink relationType: 'search' ) printString equals: ';rel=search' ]