Skip to content

Commit

Permalink
Merge pull request #101 from ba-st/100-Support-interval-queries-in-Ge…
Browse files Browse the repository at this point in the history
…mStone

100 support interval queries in gem stone
  • Loading branch information
gcotelli authored Apr 3, 2024
2 parents 1b6a558 + 20a8a42 commit 3246da7
Show file tree
Hide file tree
Showing 15 changed files with 366 additions and 47 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/PostgreSQL-Integration-Tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
name: PostgreSQL Integration Tests

on: [push,pull_request,workflow_dispatch]

on:
- push
- pull_request
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0 ]
rdbms: [ PostgreSQLv9.4, PostgreSQLv9.5, PostgreSQLv9.6, PostgreSQLv10, PostgreSQLv11, PostgreSQLv12 , PostgreSQLv13 , PostgreSQLv14, PostgreSQLv15]
smalltalk:
- Pharo64-9.0
- Pharo64-10
- Pharo64-11
rdbms:
- PostgreSQLv9.4
- PostgreSQLv9.5
- PostgreSQLv9.6
- PostgreSQLv10
- PostgreSQLv11
- PostgreSQLv12
- PostgreSQLv13
- PostgreSQLv14
- PostgreSQLv15
name: ${{ matrix.smalltalk }} + ${{ matrix.rdbms }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}
Expand All @@ -29,5 +42,5 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: ${{matrix.rdbms}}-${{matrix.smalltalk}}
name: Integration-Tests-${{matrix.rdbms}}-${{matrix.smalltalk}}
token: ${{ secrets.CODECOV_TOKEN }}
19 changes: 12 additions & 7 deletions .github/workflows/SQLite3-Integration-Tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: SQLite3 Integration Tests

on: [push,pull_request,workflow_dispatch]

on:
- push
- pull_request
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0 ]
rdbms: [ SQLite3 ]
smalltalk:
- Pharo64-9.0
- Pharo64-10
- Pharo64-11
rdbms:
- SQLite3
name: ${{ matrix.smalltalk }} + ${{ matrix.rdbms }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}
Expand All @@ -29,5 +34,5 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: ${{matrix.rdbms}}-${{matrix.smalltalk}}
name: Integration-Tests-${{matrix.rdbms}}-${{matrix.smalltalk}}
token: ${{ secrets.CODECOV_TOKEN }}
23 changes: 16 additions & 7 deletions .github/workflows/loading-groups.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
name: Baseline groups

on: [push,pull_request,workflow_dispatch]

on:
- push
- pull_request
- workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0 ]
rdbms: [ SQLite3 ]
load-spec: [ deployment, tests, tools, development]
smalltalk:
- Pharo64-9.0
- Pharo64-10
- Pharo64-11
rdbms:
- SQLite3
load-spec:
- deployment
- tests
- tools
- development
name: ${{ matrix.smalltalk }} + ${{ matrix.rdbms }} + ${{ matrix.load-spec }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/loading-gs64-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
- push
- pull_request
- workflow_dispatch

jobs:
component-loading:
runs-on: ubuntu-latest
Expand All @@ -15,7 +14,7 @@ jobs:
- Dependent-SUnit-Extensions
name: GS64 + ${{ matrix.load-spec }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Load component in image
uses: ba-st-actions/gs64-ci@v2
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Markdown Lint
on: [push,pull_request,workflow_dispatch]
on:
- push
- pull_request
- workflow_dispatch
jobs:
remark-lint:
name: runner / markdownlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: markdownlint
uses: reviewdog/action-markdownlint@v0
with:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Shellcheck

on: [push,pull_request]

on:
- push
- pull_request
- workflow_dispatch
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/unit-tests-gs64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ on:
- push
- pull_request
- workflow_dispatch

jobs:
unit-tests:
runs-on: ubuntu-latest
name: GS64 Unit Tests
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Load Image and Run Tests
uses: ba-st-actions/gs64-ci@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions source/BaselineOfSagan/BaselineOfSagan.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ BaselineOfSagan >> projectClass [
BaselineOfSagan >> setUpDependencies: spec [

spec
baseline: 'Kepler' with: [ spec repository: 'github://ba-st/Kepler:v6/source' ];
baseline: 'Kepler' with: [ spec repository: 'github://ba-st/Kepler:v6' ];
project: 'Kepler-Core' copyFrom: 'Kepler' with: [ spec loads: 'Core' ];
project: 'Kepler-SUnit' copyFrom: 'Kepler' with: [ spec loads: 'Dependent-SUnit-Extensions' ].

spec
baseline: 'ObjectPool' with: [ spec repository: 'github://pharo-ide/ObjectPool:v1.0.3' ];
baseline: 'ObjectPool' with: [ spec repository: 'github://ba-st-dependencies/ObjectPool:v2' ];
project: 'ObjectPool-Core' copyFrom: 'ObjectPool' with: [ spec loads: 'Core' ].

spec
baseline: 'Buoy' with: [ spec repository: 'github://ba-st/Buoy:v7/source' ];
baseline: 'Buoy' with: [ spec repository: 'github://ba-st/Buoy:v7' ];
project: 'Buoy-SUnit' copyFrom: 'Buoy' with: [ spec loads: 'Dependent-SUnit-Extensions' ];
project: 'Buoy-Tools' copyFrom: 'Buoy' with: [ spec loads: 'Tools' ].

Expand Down
50 changes: 50 additions & 0 deletions source/Sagan-Core-Tests/RepositoryBasedTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ RepositoryBasedTest >> sistineStallone [
^ self extraterrestrialNamedFirst: 'Sistine' last: 'Stallone' bornOn: (Date year: 1998 month: 6 day: 27)
]

{ #category : 'tests - querying' }
RepositoryBasedTest >> testCountAll [

self extraterrestrials
store: self silvesterStallone;
store: self sistineStallone.

self assert: self extraterrestrials countAll equals: 2
]

{ #category : 'tests - querying' }
RepositoryBasedTest >> testCountMatching [

Expand All @@ -153,6 +163,46 @@ RepositoryBasedTest >> testCountMatching [
assert: ( self extraterrestrials countMatching: [ :person | person birthDate = (Date year: 1998 month: 6 day: 27) ] ) equals: 1
]

{ #category : 'tests - querying' }
RepositoryBasedTest >> testFindAllFromUpToSortedByAscending [

| found |

self extraterrestrials
store: self johnTravolta;
store: self johnLock;
store: self silvesterStallone.

found := self extraterrestrials findAllFrom: 2 upTo: 2 sortedByAscending: #lastName.
self
withTheOnlyOneIn: found
do: [ :extraterrestrial | self assert: extraterrestrial lastName equals: 'Stallone' ].

found := self extraterrestrials findAllFrom: 1 upTo: 1 sortedByAscending: #lastName.
self
withTheOnlyOneIn: found
do: [ :extraterrestrial | self assert: extraterrestrial lastName equals: 'Lock' ].

found := self extraterrestrials findAllFrom: 1 upTo: 2 sortedByAscending: #firstName.
self assert: ( found allSatisfy: [ :extraterrestrial | extraterrestrial firstName = 'John' ] ).

found := self extraterrestrials findAllFrom: 8 upTo: 9 sortedByAscending: #lastName.
self assert: found isEmpty.

self
should: [ self extraterrestrials findAllFrom: 0 upTo: 0 sortedByAscending: #lastName ]
raise: PersistenceCommandFailed
withMessageText: 'Starting position must be strictly positive.'.
self
should: [ self extraterrestrials findAllFrom: -6 upTo: 1 sortedByAscending: #lastName ]
raise: PersistenceCommandFailed
withMessageText: 'Starting position must be strictly positive.'.
self
should: [ self extraterrestrials findAllFrom: 3 upTo: 1 sortedByAscending: #lastName ]
raise: PersistenceCommandFailed
withMessageText: 'Maximum position must be equal or greater than starting position.'
]

{ #category : 'tests - querying' }
RepositoryBasedTest >> testFindAllMatching [

Expand Down
28 changes: 28 additions & 0 deletions source/Sagan-Core/InMemoryRepository.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ InMemoryRepository >> conflictCheckingStrategy [
^ conflictCheckingStrategy
]

{ #category : 'querying' }
InMemoryRepository >> countAll [

^ contents size
]

{ #category : 'querying' }
InMemoryRepository >> countMatching: aCriteriaOrBlockClosure [

Expand Down Expand Up @@ -121,6 +127,28 @@ InMemoryRepository >> updateAfterCheckingConflicts: aDomainObject with: anUpdate
^ aDomainObject
]

{ #category : 'private - querying' }
InMemoryRepository >> validatedFindAllFrom: aStartingPosition upTo: aMaximumPosition sortedByAscending: aVariableName [

| from to |

( contents isEmpty or: [ aStartingPosition > contents size ] ) ifTrue: [ ^ Set new ].

from := aStartingPosition max: 1.
to := ( aMaximumPosition min: contents size ) max: 1.

^ ( contents sorted: [ :a :b |
( self valueOf: aVariableName in: a ) <= ( self valueOf: aVariableName in: b ) ] )
copyFrom: from
to: to
]

{ #category : 'private - accessing' }
InMemoryRepository >> valueOf: aVariableName in: anObject [

^ anObject instVarAt: ( anObject class instVarNames indexOf: aVariableName )
]

{ #category : 'querying' }
InMemoryRepository >> withOneMatching: aCriteriaOrBlock do: foundBlock else: noneBlock [

Expand Down
Loading

0 comments on commit 3246da7

Please sign in to comment.