aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-09-28 18:26:36 +0700
committerAleksandr <ognelisar@gmail.com>2017-09-28 18:26:36 +0700
commitf8902d43cb189b408210ae7c80e2112346bdc037 (patch)
tree4eb5d3c83f20bc4d8423561d1475dc9a9a4561f7 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
parent1f569ac1a31f88334c25976d94e7c495a7bbde80 (diff)
downloadrest-query-f8902d43cb189b408210ae7c80e2112346bdc037.tar.gz
rest-query-f8902d43cb189b408210ae7c80e2112346bdc037.tar.bz2
rest-query-f8902d43cb189b408210ae7c80e2112346bdc037.zip
Fixed generators of entities for ReP; Implemented json examples for swagger for ReP
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
index 2f07f1d..0d32495 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/DocumentGen.scala
@@ -18,43 +18,47 @@ object DocumentGen {
}
}
- private def nextDates =
+ private def nextDates() =
Common.genBoundedRangeOption[LocalDate](nextLocalDate, nextLocalDate)
- private def nextStartAndEndPagesOption =
+ private def nextStartAndEndPagesOption() =
Common.nextStartAndEndPages
- private def nextStartAndEndPage =
+ private def nextStartAndEndPage() =
Common.genBoundedRange(nextDouble(),nextDouble())
- def nextDocumentStatus: Document.Status =
- generators.oneOf[Document.Status](Document.Status.All)
+ def nextDocumentStatus(): Document.Status =
+ Document.Status.New
- def nextDocumentRequiredType: Document.RequiredType =
+ def nextDocumentRequiredType(): Document.RequiredType =
generators.oneOf[Document.RequiredType](Document.RequiredType.All)
- def nextDocumentHistoryState: DocumentHistory.State =
+ def nextDocumentHistoryState(): DocumentHistory.State =
generators.oneOf[DocumentHistory.State](DocumentHistory.State.All)
- def nextDocumentHistoryAction: DocumentHistory.Action =
+ def nextDocumentHistoryAction(): DocumentHistory.Action =
generators.oneOf[DocumentHistory.Action](DocumentHistory.Action.All)
- def nextDocumentMeta: Document.Meta = {
- val (startPage, endPage) = nextStartAndEndPage
+ def nextDocumentMeta(): Document.Meta = {
+ val (startPage, endPage) = nextStartAndEndPage()
Document.Meta(
nextOption(nextBoolean()), startPage, endPage
)
}
- def nextDocument: Document = {
- val dates = nextDates
+ def nextDocumentMetaJson(): TextJson[Document.Meta] = {
+ TextJson(nextDocumentMeta())
+ }
+
+ def nextDocument(): Document = {
+ val dates = nextDates()
Document(
id = nextLongId[Document],
- status = nextDocumentStatus,
- previousStatus = nextOption(nextDocumentStatus),
+ status = nextDocumentStatus(),
+ previousStatus = None,
assignee = nextOption(nextStringId[User]),
previousAssignee = nextOption(nextStringId[User]),
lastActiveUserId = nextOption(nextStringId[User]),
@@ -63,23 +67,23 @@ object DocumentGen {
typeId = nextOption(nextLongId[DocumentType]),
providerName = nextOption(nextString()),
providerTypeId = nextOption(nextLongId[ProviderType]),
- requiredType = nextOption(nextDocumentRequiredType),
- meta = nextOption(TextJson(nextDocumentMeta)),
+ requiredType = nextOption(nextDocumentRequiredType()),
+ meta = nextOption(nextDocumentMetaJson()),
startDate = dates._1,
endDate = dates._2,
lastUpdate = nextLocalDateTime
)
}
- def nextDocumentType: DocumentType = {
+ def nextDocumentType(): DocumentType = {
DocumentType(
id = nextLongId[DocumentType],
name = nextString()
)
}
- def nextDocumentIssue(documentId: LongId[Document]): DocumentIssue = {
- val pages = nextStartAndEndPagesOption
+ def nextDocumentIssue(documentId: LongId[Document] = nextLongId): DocumentIssue = {
+ val pages = nextStartAndEndPagesOption()
DocumentIssue(
id = nextLongId[DocumentIssue],
@@ -95,13 +99,13 @@ object DocumentGen {
}
- def nextDocumentHistory(documentId: LongId[Document]): DocumentHistory = {
+ def nextDocumentHistory(documentId: LongId[Document] = nextLongId): DocumentHistory = {
DocumentHistory(
id = nextLongId[DocumentHistory],
executor = nextStringId[User],
documentId = documentId,
- state = nextDocumentHistoryState,
- action = nextDocumentHistoryAction,
+ state = nextDocumentHistoryState(),
+ action = nextDocumentHistoryAction(),
created = nextLocalDateTime
)
}