Skip to content

Commit

Permalink
Scala 3: replace 'with' with comma
Browse files Browse the repository at this point in the history
  • Loading branch information
Zschimmer committed Oct 18, 2023
1 parent 152a03c commit 4fb8b54
Show file tree
Hide file tree
Showing 340 changed files with 694 additions and 611 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ import scala.concurrent.duration.FiniteDuration
* @author Joacim Zschimmer
*/
trait AgentClient
extends HttpSessionApi with PekkoHttpClient
with SessionApi.HasUserAndPassword
with HttpClusterNodeApi:
extends HttpSessionApi, PekkoHttpClient, SessionApi.HasUserAndPassword, HttpClusterNodeApi:

def httpClient = this

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ private[agent] final class PekkoHttpAgentTextApi(
protected val userAndPassword: Option[UserAndPassword],
protected val print: String => Unit,
configDirectory: Option[Path] = None)
extends HasCloser with ProvideActorSystem with TextApi with HttpSessionApi with PekkoHttpClient
with SessionApi.HasUserAndPassword:
extends HasCloser,
ProvideActorSystem, TextApi, HttpSessionApi, PekkoHttpClient, SessionApi.HasUserAndPassword:

protected val name = "PekkoHttpAgentTextApi"
protected val config = config"pekko.log-dead-letters = 0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class SimpleAgentClient(
val baseUri: Uri,
protected val userAndPassword: Option[UserAndPassword],
protected val httpsConfig: HttpsConfig = HttpsConfig.empty)
extends HasCloser with AgentClient:
extends HasCloser, AgentClient:

protected val name = "SimpleAgentClient"
protected val actorSystem =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ final case class AgentState(
idToWorkflow: Map[WorkflowId, Workflow/*reduced for this Agent!!!*/],
pathToJobResource: Map[JobResourcePath, JobResource],
keyToSignedItem : Map[SignableItemKey, Signed[SignableItem]])
extends SignedItemContainer
with EventDrivenStateView[AgentState, Event]
with SubagentDirectorState[AgentState]
with FileWatchStateHandler[AgentState]
with ClusterableState[AgentState]:
extends SignedItemContainer,
EventDrivenStateView[AgentState, Event],
SubagentDirectorState[AgentState],
FileWatchStateHandler[AgentState],
ClusterableState[AgentState]:

override def isAgent = true

Expand Down Expand Up @@ -330,8 +330,7 @@ with ClusterableState[AgentState]:


object AgentState
extends ClusterableState.Companion[AgentState]
with ItemContainer.Companion[AgentState]:
extends ClusterableState.Companion[AgentState], ItemContainer.Companion[AgentState]:

val empty = AgentState(EventId.BeforeFirst, SnapshotableState.Standards.empty,
AgentMetaState.empty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ object AgentCommand extends CommonCommand.Companion:
implicit val jsonCodec: Codec[Accepted] = singletonCodec(Accepted)

final case class Batch(commands: Seq[CorrelIdWrapped[AgentCommand]])
extends AgentCommand with CommonBatch with Big:
extends AgentCommand, CommonBatch, Big:
type Response = Batch.Response
object Batch:
final case class Response(responses: Seq[Checked[AgentCommand.Response]])
extends AgentCommand.Response with Big:
extends AgentCommand.Response, Big:
override def toString =
val succeeded = responses count (_.isRight)
s"Batch($succeeded succeeded and ${responses.size - succeeded} failed)"
Expand Down Expand Up @@ -115,7 +115,7 @@ object AgentCommand extends CommonCommand.Companion:
type Response = CoupleController.Response
object CoupleController:
final case class Response(orderIds: Set[OrderId])
extends AgentCommand.Response with Big:
extends AgentCommand.Response, Big:
override def toString = s"Response(${orderIds.size} Orders attached)"

final case class Reset(agentRunId: Option[AgentRunId])
Expand Down Expand Up @@ -190,7 +190,7 @@ object AgentCommand extends CommonCommand.Companion:
sealed trait AttachOrDetachOrder extends OrderCommand

final case class AttachOrder(order: Order[Order.IsFreshOrReady])
extends AttachOrDetachOrder with Big:
extends AttachOrDetachOrder, Big:
order.workflowId.requireNonAnonymous()
order.attached.orThrow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class RestartableDirector private(
conf: AgentConfiguration,
testWiring: TestWiring = TestWiring.empty)
(implicit scheduler: Scheduler)
extends MainService with Service.StoppableByRequest:
extends MainService, Service.StoppableByRequest:

protected type Termination = DirectorTermination

Expand Down
2 changes: 1 addition & 1 deletion js7-agent/src/main/scala/js7/agent/RunningAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class RunningAgent private(
val actorSystem: ActorSystem,
val conf: AgentConfiguration)
(implicit val scheduler: Scheduler)
extends MainService with Service.StoppableByRequest:
extends MainService, Service.StoppableByRequest:

protected type Termination = DirectorTermination

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private[agent] final class AgentActor(
clock: AlarmClock,
agentConf: AgentConfiguration)
(implicit protected val scheduler: Scheduler)
extends Actor with Stash with SimpleStateActor:
extends Actor, Stash, SimpleStateActor:

import agentConf.{implicitPekkoAskTimeout, journalLocation}
import context.{actorOf, watch}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ final class AgentOrderKeeper(
private implicit val clock: AlarmClock,
conf: AgentConfiguration)
(implicit protected val scheduler: Scheduler)
extends MainJournalingActor[AgentState, Event]
with Stash:
extends MainJournalingActor[AgentState, Event], Stash:
import conf.implicitPekkoAskTimeout
import context.{actorOf, watch}
import forDirector.{iox, subagent as localSubagent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private[order] object OrderActor:
extends Input

final case class Terminate(processSignal: Option[ProcessSignal] = None)
extends Input with DeadLetterSuppression
extends Input, DeadLetterSuppression

object Output:
case object RecoveryFinished
Expand Down
4 changes: 1 addition & 3 deletions js7-agent/src/main/scala/js7/agent/web/AgentRoute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ final class AgentRoute(
(implicit
protected val actorSystem: ActorSystem,
protected val scheduler: Scheduler)
extends WebLogDirectives
with ApiRoute
with ClusterNodeRouteBindings[AgentState]:
extends WebLogDirectives, ApiRoute, ClusterNodeRouteBindings[AgentState]:

import routeBinding.webServerBinding

Expand Down
13 changes: 7 additions & 6 deletions js7-agent/src/main/scala/js7/agent/web/ApiRoute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import org.apache.pekko.http.scaladsl.server.Route
* @author Joacim Zschimmer
*/
trait ApiRoute
extends RootWebService
with CommandWebService
with EventRoute
with SessionRoute
with JournalRoute
with ClusterRoute:
extends
RootWebService,
CommandWebService,
EventRoute,
SessionRoute,
JournalRoute,
ClusterRoute:

protected final val apiRoute: Route =
pathPrefix(Segment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.apache.pekko.http.scaladsl.server.Route
* @author Joacim Zschimmer
*/
trait CommandWebService
extends AgentRouteProvider with EntitySizeLimitProvider:
extends AgentRouteProvider, EntitySizeLimitProvider:

protected val executeCommand: (AgentCommand, CommandMeta) => Task[Checked[AgentCommand.Response]]

Expand Down
2 changes: 1 addition & 1 deletion js7-agent/src/main/scala/js7/agent/web/EventRoute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.apache.pekko.util.Timeout
/**
* @author Joacim Zschimmer
*/
trait EventRoute extends AgentRouteProvider with GenericEventRoute:
trait EventRoute extends AgentRouteProvider, GenericEventRoute:

implicit protected def pekkoAskTimeout: Timeout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.scalatest.concurrent.ScalaFutures
* @author Joacim Zschimmer
*/
final class AgentClientCommandMarshallingTest
extends OurTestSuite with ScalaFutures with AgentTester:
extends OurTestSuite, ScalaFutures, AgentTester:

//override protected val agentTestWiring = RunningAgent.TestWiring(
// commandHandler = Some(new CommandHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import scala.collection.mutable
/**
* @author Joacim Zschimmer
*/
final class AgentClientMainTest extends OurTestSuite with BeforeAndAfterAll with TestAgentProvider:
final class AgentClientMainTest extends OurTestSuite, BeforeAndAfterAll, TestAgentProvider:

override def afterAll() = closer closeThen super.afterAll()

//override protected def agentTestWiring = RunningAgent.TestWiring(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.scalatest.concurrent.ScalaFutures
/**
* @author Joacim Zschimmer
*/
final class AgentClientTest extends OurTestSuite with ScalaFutures with AgentTester:
final class AgentClientTest extends OurTestSuite, ScalaFutures, AgentTester:

override implicit val patienceConfig = PatienceConfig(timeout = 10.s)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import js7.base.time.ScalaTime.*
/**
* @author Joacim Zschimmer
*/
final class AgentPekkoNoStackoverflowTest extends OurTestSuite with AgentTester:
final class AgentPekkoNoStackoverflowTest extends OurTestSuite, AgentTester:

"Job working directory" in:
val exception = intercept[RuntimeException]:
provideAgentDirectory { directory =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import js7.data.workflow.test.TestSetting.*
import monix.execution.Scheduler.Implicits.traced
import org.scalatest.BeforeAndAfterAll

final class AgentShutDownTest extends OurTestSuite with BeforeAndAfterAll with TestAgentDirectoryProvider:
final class AgentShutDownTest extends OurTestSuite, BeforeAndAfterAll, TestAgentDirectoryProvider:

override def beforeAll() =
(agentDirectory / "config" / "private" / "private.conf") ++= """
|js7.auth.users.TEST-USER = "plain:TEST-PASSWORD"
Expand Down
3 changes: 2 additions & 1 deletion js7-agent/src/test/scala/js7/agent/tests/AgentTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import monix.execution.Scheduler.Implicits.traced
/**
* @author Joacim Zschimmer
*/
final class AgentTest extends OurTestSuite with AgentTester:
final class AgentTest extends OurTestSuite, AgentTester:

"work/http-uri" in:
assert((agentConfiguration.workDirectory / "http-uri").contentString ==
s"${agent.localUri}/subagent")
Expand Down
2 changes: 1 addition & 1 deletion js7-agent/src/test/scala/js7/agent/tests/AgentTester.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.scalatest.{BeforeAndAfterAll, Suite}
/**
* @author Joacim Zschimmer
*/
trait AgentTester extends BeforeAndAfterAll with TestAgentProvider:
trait AgentTester extends BeforeAndAfterAll, TestAgentProvider:
this: Suite =>

override protected def beforeAll() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import scala.collection.mutable
* @author Joacim Zschimmer
*/
final class PekkoHttpAgentTextApiTest
extends OurTestSuite with BeforeAndAfterAll with HasCloser with TestAgentProvider:
extends OurTestSuite, BeforeAndAfterAll, HasCloser, TestAgentProvider:

override protected lazy val agentConfiguration = AgentConfiguration.forTest(
configAndData = agentDirectory,
name = "PekkoHttpAgentTextApiTest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.scalatest.BeforeAndAfterAll
/**
* @author Joacim Zschimmer
*/
final class ProcessDriverTest extends OurTestSuite with BeforeAndAfterAll with TestAgentDirectoryProvider:
final class ProcessDriverTest extends OurTestSuite, BeforeAndAfterAll, TestAgentDirectoryProvider:
private lazy val ioxAllocated = IOExecutor.resource[Task](SubagentConf.DefaultConfig, "ProcessDriverTest")
.toAllocated.await(99.s)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.scalatest.{BeforeAndAfterAll, Suite}
/**
* @author Joacim Zschimmer
*/
trait TestAgentProvider extends TestAgentDirectoryProvider with BeforeAndAfterAll:
trait TestAgentProvider extends TestAgentDirectoryProvider, BeforeAndAfterAll:
this: Suite =>

protected def agentTestWiring: RunningAgent.TestWiring =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import scala.concurrent.Future
/**
* @author Joacim Zschimmer
*/
final class CommandWebServiceTest extends OurTestSuite with WebServiceTest with CommandWebService:
final class CommandWebServiceTest extends OurTestSuite, WebServiceTest, CommandWebService:

protected def whenShuttingDown = Future.never
protected def scheduler = Scheduler.traced
override protected val uriPathPrefix = "test"
Expand Down
3 changes: 2 additions & 1 deletion js7-agent/src/test/scala/js7/agent/web/EventRouteTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import org.apache.pekko.actor.ActorSystem
/**
* @author Joacim Zschimmer
*/
final class EventRouteTest extends OurTestSuite with AgentTester:
final class EventRouteTest extends OurTestSuite, AgentTester:

protected val pekkoAskTimeout = 99.s

implicit private lazy val actorSystem: ActorSystem = agent.actorSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.scalatest.{BeforeAndAfterAll, Suite}
/**
* @author Joacim Zschimmer
*/
trait WebServiceTest extends HasCloser with BeforeAndAfterAll with ScalatestRouteTest:
trait WebServiceTest extends HasCloser, BeforeAndAfterAll, ScalatestRouteTest:
this: AgentRouteProvider & Suite =>

ProblemCodeMessages.initialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import scala.concurrent.Future
/**
* @author Joacim Zschimmer
*/
final class RootWebServiceTest extends OurTestSuite with WebServiceTest with RootWebService:
final class RootWebServiceTest extends OurTestSuite, WebServiceTest, RootWebService:

protected def whenShuttingDown = Future.never
protected def scheduler = Scheduler.traced
protected def agentOverview = Task.pure(AgentOverview(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class DirectoryWatchingSignatureVerifier private(
settings: DirectoryWatchSettings,
onUpdated: () => Unit)
(implicit iox: IOExecutor)
extends SignatureVerifier with Service.StoppableByRequest:
extends SignatureVerifier, Service.StoppableByRequest:

@volatile private var state = State(Map.empty)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import javax.net.ssl.{SSLEngine, X509ExtendedKeyManager}
final class OneAliasX509ExtendedX509KeyManager(
protected val keyManager: X509ExtendedKeyManager,
protected val alias: String)
extends X509ExtendedKeyManager with OneAliasX509KeyManager:
extends X509ExtendedKeyManager, OneAliasX509KeyManager:

override def chooseEngineClientAlias(keyType: Array[String], issuers: Array[Principal],
engine: SSLEngine) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import org.apache.logging.log4j.spi.{CopyOnWrite, ReadOnlyThreadContextMap, Thre
import org.apache.logging.log4j.util.StringMap

final class CorrelIdLog4JThreadContextMap
extends ThreadContextMap
with ReadOnlyThreadContextMap
// CopyOnWrite seems to mean that getReadOnlyContextData returns an immutable map.
// Then Log4j do not make a copy.
with CopyOnWrite:
extends ThreadContextMap, ReadOnlyThreadContextMap, CopyOnWrite:
// CopyOnWrite seems to mean that getReadOnlyContextData returns an immutable map.
// Then Log4j do not make a copy.

private var lastCorrelIdLog4jStringMap = new CorrelIdLog4jStringMap(CorrelId.empty)

def clear() = {}
Expand Down
2 changes: 1 addition & 1 deletion js7-base/jvm/src/main/scala/js7/base/service/Service.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object Service:
resource(Task(
new RestartAfterFailureService(startDelays, runDelays)(serviceResource)))

trait StoppableByRequest extends Service with js7.base.service.StoppableByRequest
trait StoppableByRequest extends Service, js7.base.service.StoppableByRequest

/** Marker type to ensure call of `startFiber`. */
final class Started private[Service]:
Expand Down
8 changes: 4 additions & 4 deletions js7-base/jvm/src/main/scala/js7/base/time/JavaTime.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object JavaTime:
}

implicit final class RichDuration(private val delegate: Duration)
extends AnyVal with Ordered[RichDuration]:
extends AnyVal, Ordered[RichDuration]:
def unary_- = Duration.ZERO minus delegate
def +(o: Duration): Duration = delegate plus o
def -(o: Duration): Duration = delegate minus o
Expand All @@ -55,7 +55,7 @@ object JavaTime:

def compare(o: RichDuration) = delegate compareTo o.delegate

implicit final class RichInstant(private val delegate: Instant) extends AnyVal with Ordered[RichInstant]:
implicit final class RichInstant(private val delegate: Instant) extends AnyVal, Ordered[RichInstant]:
def +(o: Duration) = delegate plus o
def -(o: Duration) = delegate minus o
def -(o: Instant) = Duration.between(o, delegate)
Expand All @@ -71,11 +71,11 @@ object JavaTime:

override def toString = delegate.toString // For ScalaTest

implicit final class RichLocalTime(private val delegate: LocalTime) extends AnyVal with Ordered[RichLocalTime]:
implicit final class RichLocalTime(private val delegate: LocalTime) extends AnyVal, Ordered[RichLocalTime]:
def compare(o: RichLocalTime) = delegate compareTo o.delegate

implicit final class RichLocalDateTime(private val localDateTime: LocalDateTime)
extends AnyVal with Ordered[RichLocalDateTime]:
extends AnyVal, Ordered[RichLocalDateTime]:
def +(o: Duration): LocalDateTime = localDateTime plus o
def +(o: FiniteDuration): LocalDateTime = localDateTime.plusNanos(o.toNanos)
def -(o: Duration): LocalDateTime = localDateTime minus o
Expand Down
Loading

0 comments on commit 4fb8b54

Please sign in to comment.