aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-10-17 12:59:45 +0700
committerAleksandr <ognelisar@gmail.com>2017-10-17 12:59:45 +0700
commit55756e6206822ca1784f91e3266c48adc084905f (patch)
tree8095ef7157edbbb7e0997840eb654eb23278abb6 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
parentcf68e1eb3b352d8c5045dea703d4ae3fe9c46543 (diff)
parentc5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0 (diff)
downloadrest-query-55756e6206822ca1784f91e3266c48adc084905f.tar.gz
rest-query-55756e6206822ca1784f91e3266c48adc084905f.tar.bz2
rest-query-55756e6206822ca1784f91e3266c48adc084905f.zip
Merge branch 'master' into PDSUI-rep-spray
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.scala46
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)
+
}