From d1553df37361ea29807cbeaf627f966f265b4170 Mon Sep 17 00:00:00 2001
From: Richard Alam <ritzalam@gmail.com>
Date: Thu, 13 Sep 2018 14:44:40 -0700
Subject: [PATCH]  - fix akka-transcode build failing on scalariform

---
 akka-bbb-transcode/build.sbt                  | 29 +++++++++++++------
 akka-bbb-transcode/project/plugins.sbt        |  6 ++--
 .../redis/AppsRedisSubscriberActor.scala      | 10 ++++---
 .../transcode/core/MessageSenderActor.scala   | 10 +++----
 .../transcode/core/TranscodersModel.scala     |  6 ++--
 .../transcode/core/TranscodingActor.scala     | 24 +++++++--------
 6 files changed, 49 insertions(+), 36 deletions(-)

diff --git a/akka-bbb-transcode/build.sbt b/akka-bbb-transcode/build.sbt
index c628960904..49e0cefb57 100755
--- a/akka-bbb-transcode/build.sbt
+++ b/akka-bbb-transcode/build.sbt
@@ -6,7 +6,7 @@ organization := "org.bigbluebutton"
 
 version := "0.0.2"
 
-scalaVersion  := "2.12.2"
+scalaVersion  := "2.12.6"
 
 scalacOptions ++= Seq(
   "-unchecked",
@@ -37,24 +37,24 @@ testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "html", "console",
 
 testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-reports")
 
-val akkaVersion  = "2.5.1"
-val scalaTestV  = "2.2.6"
+val akkaVersion  = "2.5.14"
+val scalaTestV  = "3.0.5"
 
 libraryDependencies ++= {
   Seq(
-    "ch.qos.logback"            %  "logback-classic"   % "1.0.3",
+    "ch.qos.logback"            %  "logback-classic"   % "1.2.3"	% "runtime",
     "junit"                     %  "junit"             % "4.11",
-    "commons-codec"             %  "commons-codec"     % "1.10",
+    "commons-codec"             %  "commons-codec"     % "1.11",
     "joda-time"                 %  "joda-time"         % "2.3",
-    "org.apache.commons"        %  "commons-lang3"     % "3.2"
+    "org.apache.commons"        %  "commons-lang3"     % "3.7"
   )}
 
 libraryDependencies += "org.bigbluebutton" % "bbb-common-message_2.12" % "0.0.19-SNAPSHOT"
 
 // https://mvnrepository.com/artifact/org.scala-lang/scala-library
-libraryDependencies += "org.scala-lang" % "scala-library" % "2.12.2"
+libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value
 // https://mvnrepository.com/artifact/org.scala-lang/scala-compiler
-libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.2"
+libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
 
 // https://mvnrepository.com/artifact/com.typesafe.akka/akka-actor_2.12
 libraryDependencies += "com.typesafe.akka" % "akka-actor_2.12" % akkaVersion
@@ -80,7 +80,18 @@ libraryDependencies += "org.mockito" % "mockito-core" % "2.7.22" % "test"
 
 seq(Revolver.settings: _*)
 
-scalariformSettings
+import com.typesafe.sbt.SbtScalariform
+
+import scalariform.formatter.preferences._
+import com.typesafe.sbt.SbtScalariform.ScalariformKeys
+
+SbtScalariform.defaultScalariformSettings
+
+ScalariformKeys.preferences := ScalariformKeys.preferences.value
+  .setPreference(AlignSingleLineCaseStatements, true)
+  .setPreference(DoubleIndentClassDeclaration, true)
+  .setPreference(AlignParameters, true)
+
 
 //-----------
 // Packaging
diff --git a/akka-bbb-transcode/project/plugins.sbt b/akka-bbb-transcode/project/plugins.sbt
index 6fabc00590..ec155bbffc 100755
--- a/akka-bbb-transcode/project/plugins.sbt
+++ b/akka-bbb-transcode/project/plugins.sbt
@@ -1,10 +1,10 @@
-addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")
+addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
 
-addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")
+addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
 
 addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")
 
-addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0")
+addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.6")
 
 addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "0.2.7")
 
diff --git a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala
index 96cc6d77c6..d637944510 100755
--- a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala
+++ b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala
@@ -31,11 +31,13 @@ object AppsRedisSubscriberActor extends SystemConfiguration {
       channels, patterns).withDispatcher("akka.rediscala-subscriber-worker-dispatcher")
 }
 
-class AppsRedisSubscriberActor(val system: ActorSystem,
-  msgBus: InJsonMsgBus, redisHost: String,
+class AppsRedisSubscriberActor(
+  val system: ActorSystem,
+  msgBus:     InJsonMsgBus, redisHost: String,
   redisPort: Int,
-  channels: Seq[String] = Nil, patterns: Seq[String] = Nil)
-    extends RedisSubscriberActor(new InetSocketAddress(redisHost, redisPort),
+  channels:  Seq[String] = Nil, patterns: Seq[String] = Nil)
+    extends RedisSubscriberActor(
+      new InetSocketAddress(redisHost, redisPort),
       channels, patterns, onConnectStatus = connected => { println(s"connected: $connected") }) with SystemConfiguration {
 
   override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
diff --git a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/MessageSenderActor.scala b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/MessageSenderActor.scala
index 849d4f3320..953dfd2cc1 100644
--- a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/MessageSenderActor.scala
+++ b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/MessageSenderActor.scala
@@ -20,12 +20,12 @@ class MessageSenderActor(val msgSender: RedisPublisher)
   val routing = collection.immutable.HashMap("sender" -> "bbb-transcode")
 
   def receive = {
-    case msg: StartTranscoderReply => handleStartTranscoderReply(msg)
-    case msg: StopTranscoderReply => handleStopTranscoderReply(msg)
-    case msg: UpdateTranscoderReply => handleUpdateTranscoderReply(msg)
+    case msg: StartTranscoderReply   => handleStartTranscoderReply(msg)
+    case msg: StopTranscoderReply    => handleStopTranscoderReply(msg)
+    case msg: UpdateTranscoderReply  => handleUpdateTranscoderReply(msg)
     case msg: TranscoderStatusUpdate => handleTranscoderStatusUpdate(msg)
-    case msg: StartProbingReply => handleStartProbingReply(msg)
-    case _ => // do nothing
+    case msg: StartProbingReply      => handleStartProbingReply(msg)
+    case _                           => // do nothing
   }
 
   private def handleStartTranscoderReply(msg: StartTranscoderReply) {
diff --git a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodersModel.scala b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodersModel.scala
index efb7279638..4abc388133 100644
--- a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodersModel.scala
+++ b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodersModel.scala
@@ -21,21 +21,21 @@ class TranscodersModel {
   def removeTranscoder(meetingId: String, transcoderId: String) {
     meetings.get(meetingId) match {
       case Some(transcoders) => transcoders -= transcoderId
-      case _ =>
+      case _                 =>
     }
   }
 
   def getTranscoder(meetingId: String, transcoderId: String): Option[ActorRef] = {
     meetings.get(meetingId) match {
       case Some(transcoders) => transcoders.get(transcoderId)
-      case _ => None
+      case _                 => None
     }
   }
 
   def getTranscoders(meetingId: String): Array[ActorRef] = {
     meetings.get(meetingId) match {
       case Some(transcoders) => transcoders.values toArray
-      case _ => Array.empty
+      case _                 => Array.empty
     }
   }
 }
diff --git a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodingActor.scala b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodingActor.scala
index b4b1910149..aa6427a2c4 100644
--- a/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodingActor.scala
+++ b/akka-bbb-transcode/src/main/scala/org/bigbluebutton/transcode/core/TranscodingActor.scala
@@ -19,21 +19,21 @@ class TranscodingActor(val system: ActorSystem, messageSender: RedisPublisher)
   val messageSenderActor = context.actorOf(MessageSenderActor.props(messageSender), "bbb-sender-actor")
 
   def receive = {
-    case msg: StartTranscoderRequest => handleStartTranscoderRequest(msg)
-    case msg: UpdateTranscoderRequest => handleUpdateTranscoderRequest(msg)
-    case msg: StopTranscoderRequest => handleStopTranscoderRequest(msg)
-    case msg: StopMeetingTranscoders => handleStopMeetingTranscoders(msg)
-    case msg: StartProbingRequest => handleStartProbingRequest(msg)
+    case msg: StartTranscoderRequest            => handleStartTranscoderRequest(msg)
+    case msg: UpdateTranscoderRequest           => handleUpdateTranscoderRequest(msg)
+    case msg: StopTranscoderRequest             => handleStopTranscoderRequest(msg)
+    case msg: StopMeetingTranscoders            => handleStopMeetingTranscoders(msg)
+    case msg: StartProbingRequest               => handleStartProbingRequest(msg)
 
     //internal messages
-    case msg: StartVideoTranscoderReply => handleStartVideoTranscoderReply(msg)
-    case msg: UpdateVideoTranscoderReply => handleUpdateVideoTranscoderReply(msg)
-    case msg: DestroyVideoTranscoderReply => handleDestroyVideoTranscoderReply(msg)
+    case msg: StartVideoTranscoderReply         => handleStartVideoTranscoderReply(msg)
+    case msg: UpdateVideoTranscoderReply        => handleUpdateVideoTranscoderReply(msg)
+    case msg: DestroyVideoTranscoderReply       => handleDestroyVideoTranscoderReply(msg)
     case msg: TranscodingFinishedUnsuccessfully => handleTranscodingFinishedUnsuccessfully(msg)
-    case msg: TranscodingFinishedSuccessfully => handleTranscodingFinishedSuccessfully(msg)
-    case msg: RestartVideoTranscoderReply => handleRestartVideoTranscoderReply(msg)
-    case msg: StartVideoProbingReply => handleStartVideoProbingReply(msg)
-    case _ => // do nothing
+    case msg: TranscodingFinishedSuccessfully   => handleTranscodingFinishedSuccessfully(msg)
+    case msg: RestartVideoTranscoderReply       => handleRestartVideoTranscoderReply(msg)
+    case msg: StartVideoProbingReply            => handleStartVideoProbingReply(msg)
+    case _                                      => // do nothing
   }
 
   private def handleStartTranscoderRequest(msg: StartTranscoderRequest) {
-- 
GitLab