diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-10-23 14:49:40 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2017-10-23 14:49:40 +0700 |
commit | 7f8b3b9621ad31328dd135a67152f97e0419d5c9 (patch) | |
tree | 9deecc62f7cf2518effe4ed7568ee5fdc8e3b3f7 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala | |
parent | 133b4fe8487db9df80c1f39f64bbe7d6fc039952 (diff) | |
parent | d1537fa8bbf7c7097fe7ddb410e40c82381d79f2 (diff) | |
download | rest-query-7f8b3b9621ad31328dd135a67152f97e0419d5c9.tar.gz rest-query-7f8b3b9621ad31328dd135a67152f97e0419d5c9.tar.bz2 rest-query-7f8b3b9621ad31328dd135a67152f97e0419d5c9.zip |
Merge branch 'master' into PDSUI-2330
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 | 29 |
1 files changed, 29 insertions, 0 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 0ac2be5..2aaa251 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala @@ -7,6 +7,7 @@ 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.ListResponse import xyz.driver.pdsuidomain.entities._ import scala.util.Random @@ -85,10 +86,38 @@ object common { ) } + def nextBridgeUploadQueueItemListResponse(): ListResponse[BridgeUploadQueue.Item] = { + val xs: Seq[BridgeUploadQueue.Item] = Seq.fill(3)(nextBridgeUploadQueueItem()) + nextListResponse(xs) + } + def nextDocumentType(): DocumentType = generators.oneOf[DocumentType](DocumentType.All: _*) def nextProviderType(): ProviderType = generators.oneOf[ProviderType](ProviderType.All: _*) + def nextDocumentTypeListResponse(): ListResponse[DocumentType] = { + val xs: Seq[DocumentType] = Seq.fill(3)(nextDocumentType()) + nextListResponse(xs) + } + + def nextProviderTypeListResponse(): ListResponse[ProviderType] = { + val xs: Seq[ProviderType] = Seq.fill(3)(nextProviderType()) + nextListResponse(xs) + } + def nextTextJson[T](obj: T): TextJson[T] = TextJson(obj) + def nextListResponse[T](xs: Seq[T]): ListResponse[T] = { + val pageSize = generators.nextInt(xs.size, 1) + ListResponse( + items = xs, + meta = ListResponse.Meta( + itemsCount = xs.size, + pageNumber = generators.nextInt(xs.size / pageSize), + pageSize = pageSize, + lastUpdate = generators.nextOption(nextLocalDateTime) + ) + ) + } + } |