online-auction-java icon indicating copy to clipboard operation
online-auction-java copied to clipboard

Pre-load a few users and items

Open rstento opened this issue 7 years ago • 4 comments

It is cumbersome to create multiple users and at least one item before you can actually exercise the app and bid on something. It would be nice to add a script that loads a few users and items so that someone who downloads and runs online auction could observe the main functionality right away. They could still add other users and items if they wish.

rstento avatar Jun 26 '17 15:06 rstento

@rstento @TimMoore So should we pull it depending on if it is in development env then run that script on base of env var?

lakhina avatar Jun 29 '17 02:06 lakhina

We can check if it's dev mode using this Play API: https://playframework.com/documentation/2.5.7/api/java/play/Environment.html#mode--

Here's an example in the Lagom framework: https://github.com/lagom/lagom/blob/7956d9b3532ff79c9247182de92fe43d94270cc9/logback/src/main/scala/com/lightbend/lagom/internal/logback/LogbackLoggerConfigurator.scala#L58

The Environment can be injected into a class constructor. The only question is what would be the best place to put all of the setup code? Maybe in the web-gateway app? I'm not sure.

TimMoore avatar Jun 29 '17 09:06 TimMoore

@rstento I will work on it soon

lakhina avatar Jul 13 '17 09:07 lakhina

This library might be helpful https://github.com/DiUS/java-faker

TimMoore avatar Jul 14 '17 00:07 TimMoore