Package me.ahoo.cosid.test.machine.lease
Class MachineLeaseStoreSpec
java.lang.Object
me.ahoo.cosid.test.machine.lease.MachineLeaseStoreSpec
Compatibility kit of
MachineLeaseStore: every implementation must pass it unchanged.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidprotected abstract MachineLeaseStoregetStore()voidvoidprotected static StringnewNamespace(String prefix) A unique namespace.voidvoidvoidvoidvoidvoidprotected booleanWhether the store keeps the watermark apart from the renewal time.voidvoidvoidvoid
-
Constructor Details
-
MachineLeaseStoreSpec
public MachineLeaseStoreSpec()
-
-
Method Details
-
getStore
-
separatesWatermark
protected boolean separatesWatermark()Whether the store keeps the watermark apart from the renewal time. Stores still on the 3.4 format, with one last timestamp for both, returnfalse: the cases that need the separation then check that the store really keeps one timestamp, so the opt-out cannot outlive the store's new format. -
newNamespace
A unique namespace.MockIdGenerator.usePrefix(prefix)creates a new generator on every call, so two calls in the same millisecond return the same id: use the shared instance instead. -
claimNewTakesSequentialMachineIdsUntilFull
@Test public void claimNewTakesSequentialMachineIdsUntilFull() -
claimSelfTakesBackOwnLeaseRenewed
@Test public void claimSelfTakesBackOwnLeaseRenewed() -
renewRequiresTheCurrentVersion
@Test public void renewRequiresTheCurrentVersion() -
ownerFindsOutWhenItsLeaseIsStolenBetweenRenewals
@Test public void ownerFindsOutWhenItsLeaseIsStolenBetweenRenewals() -
claimExpiredSkipsFreshAndStableLeases
@Test public void claimExpiredSkipsFreshAndStableLeases() -
releasedMachineIdGoesToTheNextClaimer
@Test public void releasedMachineIdGoesToTheNextClaimer() -
stableInstanceKeepsItsMachineIdAfterRelease
@Test public void stableInstanceKeepsItsMachineIdAfterRelease() -
watermarkNeverMovesBackwards
@Test public void watermarkNeverMovesBackwards() -
concurrentClaimNewHandsOutDistinctMachineIds
- Throws:
Exception
-
concurrentClaimExpiredHasOneWinner
- Throws:
Exception
-
concurrentClaimReleasedHasOneWinner
- Throws:
Exception
-
concurrentClaimersOfAsManyReleasedIdsAllSucceed
- Throws:
Exception
-
concurrentClaimersOfAsManyExpiredIdsAllSucceed
- Throws:
Exception
-
concurrentRenewOfOneVersionHasOneWinner
- Throws:
Exception
-
leaseExpiresExactlyAtExpiredBefore
@Test public void leaseExpiresExactlyAtExpiredBefore() -
claimsRespectMaxMachineId
@Test public void claimsRespectMaxMachineId() -
stableFlagChangeIsPersisted
@Test public void stableFlagChangeIsPersisted() -
renewOfReleasedLeaseFails
@Test public void renewOfReleasedLeaseFails() -
namespacesAreIsolated
@Test public void namespacesAreIsolated() -
everyWriteChangesTheVersion
@Test public void everyWriteChangesTheVersion() -
renewDoesNotAdvanceTheWatermark
@Test public void renewDoesNotAdvanceTheWatermark() -
renewAfterTheStoreClockMovedBackKeepsTheLeaseAlive
@Test public void renewAfterTheStoreClockMovedBackKeepsTheLeaseAlive() -
claimSelfRacingClaimExpiredHasOneWinner
- Throws:
Exception
-
serverTimeIsWallClockTime
@Test public void serverTimeIsWallClockTime()
-