Class MachineLeaseStoreSpec

java.lang.Object
me.ahoo.cosid.test.machine.lease.MachineLeaseStoreSpec

public abstract class MachineLeaseStoreSpec extends Object
Compatibility kit of MachineLeaseStore: every implementation must pass it unchanged.
  • Constructor Details

    • MachineLeaseStoreSpec

      public MachineLeaseStoreSpec()
  • Method Details

    • getStore

      protected abstract MachineLeaseStore 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, return false: 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

      protected static String newNamespace(String prefix)
      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

      @Test public void concurrentClaimNewHandsOutDistinctMachineIds() throws Exception
      Throws:
      Exception
    • concurrentClaimExpiredHasOneWinner

      @Test public void concurrentClaimExpiredHasOneWinner() throws Exception
      Throws:
      Exception
    • concurrentClaimReleasedHasOneWinner

      @Test public void concurrentClaimReleasedHasOneWinner() throws Exception
      Throws:
      Exception
    • concurrentClaimersOfAsManyReleasedIdsAllSucceed

      @Test public void concurrentClaimersOfAsManyReleasedIdsAllSucceed() throws Exception
      Throws:
      Exception
    • concurrentClaimersOfAsManyExpiredIdsAllSucceed

      @Test public void concurrentClaimersOfAsManyExpiredIdsAllSucceed() throws Exception
      Throws:
      Exception
    • concurrentRenewOfOneVersionHasOneWinner

      @Test public void concurrentRenewOfOneVersionHasOneWinner() throws Exception
      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

      @Test public void claimSelfRacingClaimExpiredHasOneWinner() throws Exception
      Throws:
      Exception
    • serverTimeIsWallClockTime

      @Test public void serverTimeIsWallClockTime()