Class RangeStoreContract

java.lang.Object
me.ahoo.cosid.store.tck.RangeStoreContract

public abstract class RangeStoreContract extends Object
The RangeStore contract (04-segment.md §1, 06-stores.md §3). A backend test extends it and implements newStore(). Every case uses keys of its own, so the cases share one backend safely.
  • Constructor Details

    • RangeStoreContract

      public RangeStoreContract()
  • Method Details

    • newStore

      protected abstract me.ahoo.cosid.segment.RangeStore newStore()
      A store on the backend under test. Each call opens a new instance on the same data, so tests can run several instances against one key; tests close what they open.
      Returns:
      a new store instance
    • threads

      protected int threads()
      How many threads the concurrency cases run.
      Returns:
      the thread count, 8 by default
    • storeInstances

      protected int storeInstances()
      How many store instances the concurrency cases spread the threads over.
      Returns:
      the instance count, 4 by default
    • reservesPerThread

      protected int reservesPerThread()
      Returns:
      the count, 100 by default
    • firstReserveStartsAtInitialOffset

      @Test public void firstReserveStartsAtInitialOffset()
      Range: the first range of a new key starts at initialOffset (S2).
    • concurrentFirstReservesCreateTheKeyOnce

      @Test public void concurrentFirstReservesCreateTheKeyOnce()
      Range: concurrent first reserves of one key create it once: one range starts at initialOffset, none overlap (S2).
    • concurrentReservesAcrossStoresNeverOverlapAndStrictlyIncrease

      @Test public void concurrentReservesAcrossStoresNeverOverlapAndStrictlyIncrease()
      Range: N threads on M store instances reserve one key: ranges are disjoint and strictly increase in completion order (S1, S4).
    • valuesBeyond2Pow53StayExact

      @Test public void valuesBeyond2Pow53StayExact()
      Range: ranges starting beyond 2^53 come back exact, with no floating point loss.
    • overflowThrowsRangeExhausted

      @Test public void overflowThrowsRangeExhausted()
      Range: a reservation passing Long.MAX_VALUE throws RangeExhaustedException and never wraps (S5).
    • sealedKeyRejectsReserveAndKeepsItsValue

      @Test @OptionalCapability public void sealedKeyRejectsReserveAndKeepsItsValue()
      Range: after seal, reserve throws RangeSealedException and the next value is unchanged; skipped when seal returns false (S6).
    • reservesOfDifferentKeysOnOneConnectionStayIndependent

      @Test public void reservesOfDifferentKeysOnOneConnectionStayIndependent()
      Range: reserving key A then key B on the same connection gives B its own range (no stale last_insert_id).
    • storesTheLongestPortableKey

      @Test public void storesTheLongestPortableKey()
      Keys: the longest portable range key (StoreKeys, R1-spi-02) is a key of its own, every allowed punctuation and non-ASCII letters included; keys that differ in the last character stay apart.
    • storesTheKeysOfDottedGeneratorNames

      @Test public void storesTheKeysOfDottedGeneratorNames()
      Keys: the range keys of a generator named with a dot, as Wow names one per aggregate (<context>.<aggregate>): <namespace>/eshop-ordering.order for a segment and <namespace>/eshop-ordering.order/<period> for a periodic segment, each a key of its own, apart from the keys of eshop-ordering and eshop-ordering/order.