1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.technical.job
21 
22 import java.time.ZonedDateTime
23 
24 import org.make.core.MakeSerializable
25 import org.make.core.SprayJsonFormatters._
26 import org.make.core.job.Job._
27 import spray.json.DefaultJsonProtocol._
28 import spray.json.{DefaultJsonProtocol, RootJsonFormat}
29 
30 sealed abstract class JobEvent extends MakeSerializable {
31   def id: JobId
32   def date: ZonedDateTime
33 }
34 
35 object JobEvent {
36 
37   final case class Started(id: JobId, date: ZonedDateTime) extends JobEvent
38 
39   object Started {
40     implicit val formatter: RootJsonFormat[Started] = DefaultJsonProtocol.jsonFormat2(Started.apply)
41   }
42 
43   final case class HeartbeatReceived(id: JobId, date: ZonedDateTime) extends JobEvent
44 
45   object HeartbeatReceived {
46     implicit val formatter: RootJsonFormat[HeartbeatReceived] = DefaultJsonProtocol.jsonFormat2(HeartbeatReceived.apply)
47   }
48 
49   final case class Progressed(id: JobId, date: ZonedDateTime, progress: Progress) extends JobEvent
50 
51   object Progressed {
52     implicit val formatter: RootJsonFormat[Progressed] = DefaultJsonProtocol.jsonFormat3(Progressed.apply)
53   }
54 
55   final case class Finished(id: JobId, date: ZonedDateTime, outcome: Option[String]) extends JobEvent
56 
57   object Finished {
58     implicit val formatter: RootJsonFormat[Finished] = DefaultJsonProtocol.jsonFormat3(Finished.apply)
59   }
60 }
Line Stmt Id Pos Tree Symbol Tests Code
40 14546 1294 - 1340 ApplyToImplicitArgs spray.json.ProductFormatsInstances.jsonFormat2 org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest spray.json.DefaultJsonProtocol.jsonFormat2[org.make.core.job.Job.JobId, java.time.ZonedDateTime, org.make.api.technical.job.JobEvent.Started](((id: org.make.core.job.Job.JobId, date: java.time.ZonedDateTime) => JobEvent.this.Started.apply(id, date)))(Job.this.JobId.jobIdFormatter, org.make.core.SprayJsonFormatters.zonedDateTimeFormatter, (ClassTag.apply[org.make.api.technical.job.JobEvent.Started](classOf[org.make.api.technical.job.JobEvent$$Started]): scala.reflect.ClassTag[org.make.api.technical.job.JobEvent.Started]))
40 18027 1325 - 1325 Select org.make.core.SprayJsonFormatters.zonedDateTimeFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest org.make.core.SprayJsonFormatters.zonedDateTimeFormatter
40 10342 1325 - 1325 Select org.make.core.job.Job.JobId.jobIdFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest Job.this.JobId.jobIdFormatter
40 13787 1326 - 1339 Apply org.make.api.technical.job.JobEvent.Started.apply org.scalatest.testsuite JobEvent.this.Started.apply(id, date)
46 13076 1557 - 1557 Select org.make.core.SprayJsonFormatters.zonedDateTimeFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest org.make.core.SprayJsonFormatters.zonedDateTimeFormatter
46 16769 1557 - 1557 Select org.make.core.job.Job.JobId.jobIdFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest Job.this.JobId.jobIdFormatter
46 11472 1526 - 1582 ApplyToImplicitArgs spray.json.ProductFormatsInstances.jsonFormat2 org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest spray.json.DefaultJsonProtocol.jsonFormat2[org.make.core.job.Job.JobId, java.time.ZonedDateTime, org.make.api.technical.job.JobEvent.HeartbeatReceived](((id: org.make.core.job.Job.JobId, date: java.time.ZonedDateTime) => JobEvent.this.HeartbeatReceived.apply(id, date)))(Job.this.JobId.jobIdFormatter, org.make.core.SprayJsonFormatters.zonedDateTimeFormatter, (ClassTag.apply[org.make.api.technical.job.JobEvent.HeartbeatReceived](classOf[org.make.api.technical.job.JobEvent$$HeartbeatReceived]): scala.reflect.ClassTag[org.make.api.technical.job.JobEvent.HeartbeatReceived]))
46 10793 1558 - 1581 Apply org.make.api.technical.job.JobEvent.HeartbeatReceived.apply org.scalatest.testsuite JobEvent.this.HeartbeatReceived.apply(id, date)
52 16053 1798 - 1798 Select org.make.core.job.Job.progressJsonFormat org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest org.make.core.job.Job.progressJsonFormat
52 13798 1798 - 1798 Select org.make.core.job.Job.JobId.jobIdFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest Job.this.JobId.jobIdFormatter
52 17487 1799 - 1815 Apply org.make.api.technical.job.JobEvent.Progressed.apply org.scalatest.testsuite JobEvent.this.Progressed.apply(id, date, progress)
52 10219 1798 - 1798 Select org.make.core.SprayJsonFormatters.zonedDateTimeFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest org.make.core.SprayJsonFormatters.zonedDateTimeFormatter
52 14561 1767 - 1816 ApplyToImplicitArgs spray.json.ProductFormatsInstances.jsonFormat3 org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest spray.json.DefaultJsonProtocol.jsonFormat3[org.make.core.job.Job.JobId, java.time.ZonedDateTime, org.make.core.job.Job.Progress, org.make.api.technical.job.JobEvent.Progressed](((id: org.make.core.job.Job.JobId, date: java.time.ZonedDateTime, progress: org.make.core.job.Job.Progress) => JobEvent.this.Progressed.apply(id, date, progress)))(Job.this.JobId.jobIdFormatter, org.make.core.SprayJsonFormatters.zonedDateTimeFormatter, org.make.core.job.Job.progressJsonFormat, (ClassTag.apply[org.make.api.technical.job.JobEvent.Progressed](classOf[org.make.api.technical.job.JobEvent$$Progressed]): scala.reflect.ClassTag[org.make.api.technical.job.JobEvent.Progressed]))
58 13711 2000 - 2047 ApplyToImplicitArgs spray.json.ProductFormatsInstances.jsonFormat3 org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest spray.json.DefaultJsonProtocol.jsonFormat3[org.make.core.job.Job.JobId, java.time.ZonedDateTime, Option[String], org.make.api.technical.job.JobEvent.Finished](((id: org.make.core.job.Job.JobId, date: java.time.ZonedDateTime, outcome: Option[String]) => JobEvent.this.Finished.apply(id, date, outcome)))(Job.this.JobId.jobIdFormatter, org.make.core.SprayJsonFormatters.zonedDateTimeFormatter, spray.json.DefaultJsonProtocol.optionFormat[String](spray.json.DefaultJsonProtocol.StringJsonFormat), (ClassTag.apply[org.make.api.technical.job.JobEvent.Finished](classOf[org.make.api.technical.job.JobEvent$$Finished]): scala.reflect.ClassTag[org.make.api.technical.job.JobEvent.Finished]))
58 10705 2032 - 2046 Apply org.make.api.technical.job.JobEvent.Finished.apply org.scalatest.testsuite JobEvent.this.Finished.apply(id, date, outcome)
58 17286 2031 - 2031 ApplyToImplicitArgs spray.json.StandardFormats.optionFormat org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest spray.json.DefaultJsonProtocol.optionFormat[String](spray.json.DefaultJsonProtocol.StringJsonFormat)
58 16784 2031 - 2031 Select org.make.core.job.Job.JobId.jobIdFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest Job.this.JobId.jobIdFormatter
58 13563 2031 - 2031 Select org.make.core.SprayJsonFormatters.zonedDateTimeFormatter org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest org.make.core.SprayJsonFormatters.zonedDateTimeFormatter
58 11783 2031 - 2031 Select spray.json.BasicFormats.StringJsonFormat org.make.api.sessionhistory.sessionhistorycoordinatortest,org.make.api.technical.crm.crmservicecomponenttest spray.json.DefaultJsonProtocol.StringJsonFormat