Class PetstoreSeed
java.lang.Object
org.apache.juneau.petstore.console.data.PetstoreSeed
Deterministic demo data for the petstore console: about 500 pets, 2,000 orders, 50 users and 300 audit rows,
generated from a fixed
Random seed and a fixed Clock so tests and screenshots are repeatable.
The classic rows a new PetStore() loads (pets 1-9, orders 101-103, three users) stay first with their ids;
generated rows follow. Both runners seed this way on startup.
Example:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAudit rows written bypopulate(PetStore).static final ClockDefault clock: fixed at 2026-10-01T12:00:00Z, UTC.static final longDefault random seed.static final StringEnvironment variable that pins the petstore's "now"; seefixedNowClock().static final intTotal orders afterpopulate(PetStore).static final intTotal pets afterpopulate(PetStore).static final intTotal users afterpopulate(PetStore). -
Method Summary
Modifier and TypeMethodDescriptionstatic PetstoreSeedcreate()static ClockThe clock the "PETSTORE_FIXED_NOW" environment variable pins "now" to, so screenshots of the day-relative store and jobs pages repeat from run to run.static Instantnow()Adds the generated rows to a store that holds only the classic rows.randomSeed(long value)
-
Field Details
-
DEFAULT_SEED
Default random seed.- See Also:
-
DEFAULT_CLOCK
Default clock: fixed at 2026-10-01T12:00:00Z, UTC. -
FIXED_NOW_ENV
Environment variable that pins the petstore's "now"; seefixedNowClock().- See Also:
-
PETS
Total pets afterpopulate(PetStore).- See Also:
-
ORDERS
Total orders afterpopulate(PetStore).- See Also:
-
USERS
Total users afterpopulate(PetStore).- See Also:
-
AUDIT
Audit rows written bypopulate(PetStore).- See Also:
-
-
Method Details
-
create
- Returns:
- A new seed builder with the default seed and clock.
-
randomSeed
- Parameters:
value- TheRandomseed.- Returns:
- This object.
-
fixedNowClock
The clock the "PETSTORE_FIXED_NOW" environment variable pins "now" to, so screenshots of the day-relative store and jobs pages repeat from run to run.- Returns:
- The clock, or
null when the variable is unset, meaning the system clock.
-
now
- Returns:
- The pinned "now" when "PETSTORE_FIXED_NOW" is set, else the current instant.
-
clock
- Parameters:
value- The clock that dates orders and audit rows. Must not benull .- Returns:
- This object.
-
populate
Adds the generated rows to a store that holds only the classic rows.- Parameters:
store- A freshly constructed store.- Returns:
- The same store, for chaining.
- Throws:
IllegalArgumentException- If the store already holds more than the classic rows.
-