diff options
author | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 11:22:11 -0700 |
---|---|---|
committer | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 11:22:11 -0700 |
commit | 05aa114cfd22228f0457b6457ce441af5eabfc60 (patch) | |
tree | 62acecf547f01ca4d69fcd4c7c911e0899e9d96c /src/main/scala/xyz/driver/pdsuidomain/services/fake | |
parent | 0be360064e7b46eb0ebeac3bfde09d5e80c21d81 (diff) | |
parent | 6751966577c0f005858f372458ccdb72be7d879f (diff) | |
download | rest-query-05aa114cfd22228f0457b6457ce441af5eabfc60.tar.gz rest-query-05aa114cfd22228f0457b6457ce441af5eabfc60.tar.bz2 rest-query-05aa114cfd22228f0457b6457ce441af5eabfc60.zip |
Merge branch 'master' into trial-46-disease-entity
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/fake')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala index 9253f88..59f300b 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/services/fake/FakeTrialService.scala @@ -57,19 +57,27 @@ class FakeTrialService extends TrialService { Future.successful(GetListReply.EntityList(Seq(trial), 1, None)) override def getTrialWithLabels(trialId: StringId[Trial], condition: String)( - implicit requestContext: AuthenticatedRequestContext): Future[GetTrialWithLabelsReply] = { - Future.successful( - GetTrialWithLabelsReply.Entity(ExportTrialWithLabels( - StringId[Trial]("NCT" + generators.nextInt(999999).toString), - UuidId[Trial](generators.nextUuid()), - generators.oneOf("adenocarcinoma", "breast", "prostate"), - LocalDateTime.now(), - labelVersion = 1L, - generators.listOf(new ExportTrialArm( + implicit requestContext: AuthenticatedRequestContext): Future[GetTrialWithLabelsReply] = + Future.successful(GetTrialWithLabelsReply.Entity(nextExportTrialWithLabels())) + + override def getTrialsWithLabels(condition: String)( + implicit requestContext: AuthenticatedRequestContext): Future[GetTrialsWithLabelsReply] = + Future.successful(GetTrialsWithLabelsReply.EntityList(generators.seqOf(nextExportTrialWithLabels()))) + + private def nextExportTrialWithLabels() = + ExportTrialWithLabels( + StringId[Trial]("NCT" + generators.nextInt(999999).toString), + UuidId[Trial](generators.nextUuid()), + generators.oneOf("adenocarcinoma", "breast", "prostate"), + LocalDateTime.now(), + labelVersion = 1L, + generators.listOf( + new ExportTrialArm( LongId[Arm](generators.nextInt(999999).toLong), generators.nextName().value )), - generators.listOf(new ExportTrialLabelCriterion( + generators.listOf( + new ExportTrialLabelCriterion( LongId[Criterion](generators.nextInt(999999).toLong), generators.nextOption(generators.nextBoolean()), LongId[Label](generators.nextInt(999999).toLong), @@ -78,8 +86,7 @@ class FakeTrialService extends TrialService { generators.nextBoolean(), generators.nextBoolean() )) - ))) - } + ) def update(origTrial: Trial, draftTrial: Trial)( implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] = |