-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added testNextPutWithMessageId test case
- Loading branch information
Showing
9 changed files
with
55 additions
and
26 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
...ry/RediStick-Stream-Objects-Tests.package/RsRedisStreamTest.class/instance/testNextPut.st
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...Stream-Objects-Tests.package/RsRedisStreamTest.class/instance/testNextPutWithMessageId.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
tests | ||
testNextPutWithMessageId | ||
| strm one two three four five invalidId conts | | ||
strm := self newStreamNamed: 'testNextPutWithMessageId'. | ||
strm beEmptyAndReset. | ||
self assert: strm length equals: 0. | ||
one := 'one' -> '1'. | ||
two := 'two' -> '2'. | ||
three := 'three' -> '3'. | ||
four := 'four' -> '4'. | ||
five := 'five' -> '5'. | ||
invalidId := RsStreamMessageId epoch. | ||
self assert: (strm nextPut: one at: invalidId) equals: nil. | ||
self assert: strm length equals: 0. | ||
|
||
strm nextPut: one at: '0-1'. | ||
strm nextPut: two at: (RsStreamMessageId mainId: 0 subId: 2). | ||
conts := strm contents. | ||
self assert: strm length equals: 2. | ||
self assert: conts first content equals: one. | ||
self assert: conts second content equals: two. | ||
|
||
strm nextPut: three at: (RsStreamMessageId mainIdOnly: 1). | ||
strm nextPut: four at: (RsStreamMessageId mainIdSubIncremented: 1). | ||
self assert: (strm nextPut: five at: (RsStreamMessageId mainIdOnly: 1)) equals: nil. | ||
conts := strm contents. | ||
self assert: strm length equals: 4. | ||
self assert: conts first content equals: one. | ||
self assert: conts last content equals: four. | ||
self assert: (conts collect: [ :each | each id ]) asArray equals: #('0-1' '0-2' '1-0' '1-1'). | ||
self assert: strm info lastGeneratedId equals: '1-1'. | ||
|
||
strm trimLowerThan: (RsStreamMessageId mainId: 1 subId: 0). | ||
conts := strm contents. | ||
self assert: strm length equals: 2. | ||
self assert: conts first content equals: three. | ||
self assert: conts last content equals: four. | ||
|
||
strm trimTo: 0. | ||
self assert: strm length equals: 0 |
3 changes: 3 additions & 0 deletions
3
repository/RediStick-Stream-Objects.package/RsStream.class/instance/beEmpty.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
deleting | ||
beEmpty | ||
self trimTo: 0 |
4 changes: 4 additions & 0 deletions
4
repository/RediStick-Stream-Objects.package/RsStream.class/instance/beEmptyAndReset.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
deleting | ||
beEmptyAndReset | ||
self beEmpty. | ||
self setLastMessageId: RsStreamMessageId epoch |
3 changes: 3 additions & 0 deletions
3
repository/RediStick-Stream-Objects.package/RsStream.class/instance/trimLowerThan..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
trimming | ||
trimLowerThan: messageId | ||
^ self endpoint xTrim: self name minId: messageId |
1 change: 1 addition & 0 deletions
1
...sitory/RediStick-Stream.package/RsStreamInfo.class/instance/initFromOrderedCollection..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
initialization | ||
initFromOrderedCollection: rawValues | ||
rawValues ifNil: [ ^ self ]. | ||
rawValues pairsDo: [ :key :value | self initVariableAt: key value: value ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
repository/RediStick-Stream.package/RsStreamTrimOptions.class/instance/minId..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
minId: id | ||
self beMinId. | ||
self threshold: id. | ||
self threshold: id asString. |
2 changes: 1 addition & 1 deletion
2
repository/RediStick-Stream.package/RsStreamTrimOptions.class/instance/minIdAtLeast..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
minIdAtLeast: id | ||
self beMinId. | ||
self atLeast: id | ||
self atLeast: id asString |