diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-17 11:15:54 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-17 11:15:54 +0700 |
commit | c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0 (patch) | |
tree | 485fc8a1c7ac8e7a9dd8fc8ed5308dba185fb6ca /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala | |
parent | f3b809659969ee29ab7f0a62ec1cff25a3e263dc (diff) | |
parent | a0599ae4d12acafb934b40f52d4a771709b3e583 (diff) | |
download | rest-query-c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0.tar.gz rest-query-c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0.tar.bz2 rest-query-c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0.zip |
Merge pull request #47 from drivergroup/PDSUI-2318v0.8.8
PDSUI-2318 Created custom swagger format for TM
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala index f77c2e0..0ac2be5 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala @@ -2,9 +2,12 @@ package xyz.driver.pdsuidomain.fakes.entities import java.time.{LocalDate, LocalDateTime, LocalTime} -import xyz.driver.core.generators.{nextDouble, nextOption} -import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} -import xyz.driver.pdsuidomain.entities.{Trial, TrialHistory} +import xyz.driver.core.generators._ +import xyz.driver.entities.common.FullName +import xyz.driver.entities.patient.CancerType +import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue +import xyz.driver.pdsuicommon.domain.{LongId, StringId, TextJson, UuidId} +import xyz.driver.pdsuidomain.entities._ import scala.util.Random @@ -50,7 +53,42 @@ object common { ranges.map(_._1) -> ranges.flatMap(_._2) } - def nextStartAndEndPages: (Option[Double], Option[Double]) = + def nextStartAndEndPagesOption: (Option[Double], Option[Double]) = genBoundedRangeOption[Double](nextDouble(), nextDouble()) + def nextStartAndEndPages: (Double, Double) = + genBoundedRange(nextDouble(), nextDouble()) + + def nextPatientStatus: Patient.Status = generators.oneOf[Patient.Status](Patient.Status.All) + + def nextFullName[T]: FullName[T] = FullName( + firstName = generators.nextName[T](10), + middleName = generators.nextName[T](10), + lastName = generators.nextName[T](10) + ) + + def nextCancerType: CancerType = + generators.oneOf[CancerType](CancerType.Breast, CancerType.Lung, CancerType.Prostate) + + private val maxAttemptsNumber = 100 + + def nextBridgeUploadQueueItem(): BridgeUploadQueue.Item = { + BridgeUploadQueue.Item( + kind = nextString(), + tag = nextString(), + created = nextLocalDateTime, + attempts = nextInt(maxAttemptsNumber, minValue = 0), + nextAttempt = nextLocalDateTime, + completed = nextBoolean(), + dependencyKind = nextOption(nextString()), + dependencyTag = nextOption(nextString()) + ) + } + + def nextDocumentType(): DocumentType = generators.oneOf[DocumentType](DocumentType.All: _*) + + def nextProviderType(): ProviderType = generators.oneOf[ProviderType](ProviderType.All: _*) + + def nextTextJson[T](obj: T): TextJson[T] = TextJson(obj) + } |