package monocle.function

import monocle.MonocleSuite
import monocle.function.all.{ala, unwrapped, wrapped}

import scalaz.{@@, Tags}
import scalaz.std.anyVal._
import scalaz.std.list._
import scalaz.std.function._
import scalaz.syntax.foldable._

class WrappedExample extends MonocleSuite {

  test("wrapped is an Iso") {
    (Tags.Max(100) applyIso wrapped[Int @@ Tags.Max, Int] get) shouldEqual 100
  }

  test("unwrapped is an Iso") {
    ("Hello" applyIso unwrapped[String @@ Tags.Dual, String] get) shouldEqual Tags.Dual("Hello")
  }

  test("ala wraps and unwraps inside of a functor") {
    ala[Boolean @@ Tags.Disjunction, Boolean, ({type λ[α] = List[Boolean] => α})#λ](f => xs => xs.foldMap(f)).apply(List(true, false, true)) shouldEqual true
  }

}

package monocle.function

import monocle.MonocleSuite
import monocle.function.all.{ala, unwrapped, wrapped}

import scalaz.{@@, Tags}
import scalaz.std.anyVal._
import scalaz.std.list._
import scalaz.std.function._
import scalaz.syntax.foldable._

class WrappedExample extends MonocleSuite {

  test("wrapped is an Iso") {
    (Tags.Max(100) applyIso wrapped get) shouldEqual 100
  }

  test("unwrapped is an Iso") {
    ("Hello" applyIso unwrapped get) shouldEqual Tags.Dual("Hello")
  }

  test("ala wraps and unwraps inside of a functor") {
    ala[Boolean @@ Tags.Disjunction, Boolean, ({type λ[α] = List[Boolean] => α})#λ](f => xs => xs.foldMap(f)).apply(List(true, false, true)) shouldEqual true
  }

}

Remove explicit types for wrapped in examples

I thought they were needed there, but they are not!


package ml.combust.mleap.springboot

import TypeConverters._
import javax.annotation.PostConstruct
import org.slf4j.LoggerFactory
import ml.combust.mleap.pb
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component

import scala.io.Source
import scalapb.json4s.Parser

@Component
class ModelLoader {
  @Value("${mleap.model.config:#{null}}")
  private val modelConfigPath: String = null

  private val logger = LoggerFactory.getLogger(classOf[ModelLoader])
  private val jsonParser = new Parser()
  private val timeout = 60000

  @PostConstruct
  def loadModel(): Unit = {
    if (modelConfigPath == null) {
      logger.info("Skipping loading model on startup")
    } else {
      logger.info(s"Loading model from $modelConfigPath")

      val fileSource = Source.fromFile(modelConfigPath)

      val request = try {
        fileSource.getLines.mkString
      } finally {
        fileSource.close()
      }

      StarterConfiguration.getMleapExecutor
        .loadModel(jsonParser.fromJsonString[pb.LoadModelRequest](request))(timeout)
    }
  }
}

package ml.combust.mleap.springboot

import TypeConverters._
import javax.annotation.PostConstruct
import org.slf4j.LoggerFactory
import ml.combust.mleap.pb
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component

import java.nio.file.{Paths, Files}
import scalapb.json4s.Parser

@Component
class ModelLoader {
  @Value("${mleap.model.config:#{null}}")
  private val modelConfigPath: String = null

  private val logger = LoggerFactory.getLogger(classOf[ModelLoader])
  private val jsonParser = new Parser()
  private val timeout = 60000

  @PostConstruct
  def loadModel(): Unit = {
    if (modelConfigPath == null) {
      logger.info("Skipping loading model on startup")
      return
    }

    val configPath = Paths.get(modelConfigPath)

    if (!Files.exists(configPath)) {
      logger.warn(s"Model path does not exist: $modelConfigPath")
      return
    }

    logger.info(s"Loading model from $modelConfigPath")

    val request = new String(Files.readAllBytes(configPath))

    StarterConfiguration.getMleapExecutor
      .loadModel(jsonParser.fromJsonString[pb.LoadModelRequest](request))(timeout)
  }
}

Use java.nio.file to work with files and paths


import org.scalajs.sbtplugin.ScalaJSPlugin.AutoImport._
import sbt._

object Dependencies
{
  object apache {
    val commonsLang3="com.hynnet" % "commons-lang3" % "3.4"
  }

  object scalaJs
  {
    def stubs = "org.scala-js" %% "scalajs-stubs" % scalaJSVersion

    def angular = "com.greencatsoft" %%%! "scalajs-angular" % "0.8-SNAPSHOT"

    def jquery = "be.doeraene" %%%! "scalajs-jquery" % "0.9.0"
  }

  object js
  {
    def angular = "org.webjars.bower" % "angular" % "1.5.7"

    def jquery = "org.webjars.bower" % "jquery" % "2.2.4" force()
  }

  object prickle
  {
    val version = "1.1.11"

    def js = "com.github.benhutchison" %%%! "prickle" % version

    def jvm = "com.github.benhutchison" %% "prickle" % version
  }

  object db
  {
    val elastic4s = Seq(
      "com.sksamuel.elastic4s" %% "elastic4s-core" % "1.7.5",
      "com.sksamuel.elastic4s" %% "elastic4s-streams" % "1.7.5"
    )

//    val elasticsearch = "org.elasticsearch" % "elasticsearch" % "1.7.5"

  }

}

import org.scalajs.sbtplugin.ScalaJSPlugin.AutoImport._
import sbt._

object Dependencies
{
  object apache {
    val commonsLang3="com.hynnet" % "commons-lang3" % "3.4"
  }

  object scalaJs
  {
    def stubs = "org.scala-js" %% "scalajs-stubs" % scalaJSVersion

    def angular = "com.greencatsoft" %%%! "scalajs-angular" % "0.7"

    def jquery = "be.doeraene" %%%! "scalajs-jquery" % "0.9.0"
  }

  object js
  {
    def angular = "org.webjars.bower" % "angular" % "1.5.7"

    def jquery = "org.webjars.bower" % "jquery" % "2.2.4" force()
  }

  object prickle
  {
    val version = "1.1.11"

    def js = "com.github.benhutchison" %%%! "prickle" % version

    def jvm = "com.github.benhutchison" %% "prickle" % version
  }

  object db
  {
    val elastic4s = Seq(
      "com.sksamuel.elastic4s" %% "elastic4s-core" % "1.7.5",
      "com.sksamuel.elastic4s" %% "elastic4s-streams" % "1.7.5"
    )

//    val elasticsearch = "org.elasticsearch" % "elasticsearch" % "1.7.5"

  }

}

Use release version of scalajs-angular

Use release version of scalajs-angular


name := "lib-reference"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}
version := "0.0.1"

autocommit: Update configuration to record version 0.0.1


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.2.18"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.2.19"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.2.19


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.1.4"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.9",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.0" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.1.5"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.9",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.0" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.1.5


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.5"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.9" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

scalacOptions ++= allScalacOptions

version := "0.2.82"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.5"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.9" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

scalacOptions ++= allScalacOptions

version := "0.2.83"

autocommit: Update configuration to record version 0.2.83


package akka.viz.serialization.serializers

import akka.actor.ActorRef
import akka.viz.serialization.AkkaVizSerializer
import upickle.Js

case object ActorRefSerializer extends AkkaVizSerializer {
  override def serialize(obj: Any): Js.Value = {
    obj match {
      case a: ActorRef =>
        Js.Obj("path" -> Js.Str(a.path.toSerializationFormat))
    }
  }

  override def canSerialize(obj: Any): Boolean = obj match {
    case t: ActorRef => true
    case _ => false
  }
}

package akka.viz.serialization.serializers

import akka.actor.ActorRef
import akka.viz.serialization.AkkaVizSerializer
import upickle.Js

case object ActorRefSerializer extends AkkaVizSerializer {
  override def serialize(obj: Any): Js.Value = {
    obj match {
      case a: ActorRef =>
        Js.Obj(
          "$type" -> Js.Str(classOf[ActorRef].getName),
          "path" -> Js.Str(a.path.toSerializationFormat)
        )
    }
  }

  override def canSerialize(obj: Any): Boolean = obj match {
    case t: ActorRef => true
    case _ => false
  }
}

Store infor about ActorRef type in serialized form


package mesosphere.marathon.state

import mesosphere.marathon.MarathonSpec

class TimestampTest extends MarathonSpec {

  test("Ordering") {
    val t1 = Timestamp(1024)
    val t2 = Timestamp(2048)
    assert(t1.compare(t2) < 0)
  }
}

package mesosphere.marathon.state

import mesosphere.marathon.MarathonSpec
import org.joda.time.{ DateTime, DateTimeZone }

class TimestampTest extends MarathonSpec {

  test("Ordering") {
    val t1 = Timestamp(1024)
    val t2 = Timestamp(2048)
    assert(t1.compare(t2) < 0)
  }

  test("Independent of timezone") {
    val t1 = Timestamp(1024)
    val t2 = Timestamp(new DateTime(1024).toDateTime(DateTimeZone.forOffsetHours(2)))

    assert(t1 == t2)
    assert(t1.hashCode == t2.hashCode)
  }
}

Add test for timezone independence of Timestamps


/**
 * Copyright 2011-2016 GatlingCorp (http://gatling.io)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gatling.core.stats.message

import com.typesafe.scalalogging.LazyLogging

case class ResponseTimings(startTimestamp: Long, endTimestamp: Long) extends LazyLogging {

  val responseTime = {
    val rt = (endTimestamp - startTimestamp).toInt
    if (rt >= 0) {
      rt
    } else {
      logger.error(s"Got a negative response time startTimestamp=$startTimestamp endTimestamp=$endTimestamp")
      1
    }
  }
}

/**
 * Copyright 2011-2016 GatlingCorp (http://gatling.io)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gatling.core.stats.message

import com.typesafe.scalalogging.LazyLogging

case class ResponseTimings(startTimestamp: Long, endTimestamp: Long) extends LazyLogging {

  val responseTime =
    if (endTimestamp < 0) {
      Int.MinValue
    } else {
      val rt = (endTimestamp - startTimestamp).toInt
      if (rt >= 0) {
        rt
      } else {
        logger.error(s"Got a negative response time startTimestamp=$startTimestamp endTimestamp=$endTimestamp")
        1
      }
    }
}

Use negative endTimestamp as workaround for non transactional events (count, no duration)


package uk.ac.wellcome.finatra.modules

import javax.inject.Singleton

import com.google.inject.Provides
import com.twitter.inject.TwitterModule
import uk.ac.wellcome.models.aws.SQSConfig

import scala.concurrent.duration._

object SQSConfigModule extends TwitterModule {
  private val queueUrl =
    flag[String]("aws.sqs.queue.url", "", "URL of the SQS Queue")
  val waitTime = flag(
    "aws.sqs.waitTime",
    20,
    "Time to wait (in seconds) for a message to arrive on the queue before returning")
  val maxMessages =
    flag("aws.sqs.maxMessages", 1, "Maximum number of SQS messages to return")

  @Singleton
  @Provides
  def providesSQSConfig(): SQSConfig =
    SQSConfig(queueUrl(), waitTime() seconds, maxMessages())
}

package uk.ac.wellcome.finatra.modules

import javax.inject.Singleton

import com.google.inject.Provides
import com.twitter.inject.TwitterModule
import uk.ac.wellcome.models.aws.SQSConfig

import scala.concurrent.duration._

object SQSConfigModule extends TwitterModule {
  private val queueUrl =
    flag[String]("aws.sqs.queue.url", "", "URL of the SQS Queue")
  val waitTime = flag(
    "aws.sqs.waitTime",
    20,
    "Time to wait (in seconds) for a message to arrive on the queue before returning")
  val maxMessages =
    flag("aws.sqs.maxMessages", 10, "Maximum number of SQS messages to return")

  @Singleton
  @Provides
  def providesSQSConfig(): SQSConfig =
    SQSConfig(queueUrl(), waitTime() seconds, maxMessages())
}

Increase the default number of messages read for all applications


package rescala.reactives

import rescala.core.{ReSource}
import rescala.extra.simpleprop.invariant.SimpleStruct

class InvariantViolationException(t: Throwable, reactive: ReSource[SimpleStruct], causalErrorChains: Seq[Seq[ReSource[SimpleStruct]]])
  extends RuntimeException {

  override def getMessage: String = {
    val chainErrorMessage = if (causalErrorChains.nonEmpty)
      "The error was caused by these update chains:\n\n" ++ causalErrorChains.map(_.map(_.name.str).mkString("\n↓\n")).mkString("\n---\n")
    else "The error was not triggered by a change."

    s"${t.getMessage} in reactive ${reactive.name.str}\n$chainErrorMessage\n"
  }

  override def fillInStackTrace() = this
}

package rescala.reactives

import rescala.core.{ReSource}
import rescala.extra.simpleprop.invariant.SimpleStruct

class InvariantViolationException(t: Throwable, reactive: ReSource[SimpleStruct], causalErrorChains: Seq[Seq[ReSource[SimpleStruct]]])
  extends RuntimeException {

  override def getMessage: String = {
    val chainErrorMessage = if (causalErrorChains.nonEmpty)
      "The error was caused by these update chains:\n\n" ++ causalErrorChains.map(_.map(r => s"${r.name.str} with value: ${r.state.value}").mkString("\n↓\n")).mkString("\n---\n")
    else "The error was not triggered by a change."

    s"${t.getMessage} in reactive ${reactive.name.str}\n$chainErrorMessage\n"
  }

  override def fillInStackTrace() = this
}

Print value for elements in error chain

Print value for elements in error chain


import java.io.{ByteArrayOutputStream, NotSerializableException, ObjectOutputStream}

object Test {
  def plus(x: Int): Int = x + 1
  def serialize(name: String, fn: Int => Int): Unit = {
    try {
      val oos = new ObjectOutputStream(new ByteArrayOutputStream)
      oos.writeObject(fn)
    } catch {
      case e: NotSerializableException =>
        println(s"NotSerializableException: $name")
        e.printStackTrace()
    }
  }
  object Inner {
    def minus(x: Int): Int = x - 1
    def testInner(): Unit = {
      serialize("plus", plus)
      serialize("this.plus", Test.this.plus)
      serialize("Test.plus", Test.plus)

      serialize("minus", minus)
      serialize("this.minus", this.minus)
      serialize("Inner.minus", Inner.minus)
    }
  }
  def main(args: Array[String]): Unit = {
    serialize("plus", plus)
    serialize("this.plus", this.plus)
    serialize("Test.plus", Test.plus)

    Inner.testInner()
  }
}

import java.io.{ByteArrayOutputStream, NotSerializableException, ObjectOutputStream}

object Test {
  def plus(x: Int): Int = x + 1
  def notSerialize(name: String, fn: Int => Int): Unit = try {
    val oos = new ObjectOutputStream(new ByteArrayOutputStream)
    oos.writeObject(fn)
    assert(false)
  } catch {
    case e: NotSerializableException =>
      // expected
  }
  def serialize(name: String, fn: Int => Int): Unit = {
    try {
      val oos = new ObjectOutputStream(new ByteArrayOutputStream)
      oos.writeObject(fn)
    } catch {
      case e: NotSerializableException =>
        println(s"NotSerializableException: $name")
        e.printStackTrace()
    }
  }
  object Inner {
    def minus(x: Int): Int = x - 1
    def testInner(): Unit = {
      serialize("plus", plus)
      serialize("this.plus", Test.this.plus)
      serialize("Test.plus", Test.plus)

      serialize("minus", minus)
      serialize("this.minus", this.minus)
      serialize("Inner.minus", Inner.minus)
    }
    def testLocal(): Unit = {
     object Local {
        def zero(x: Int) = 0
        def apply(): Unit = {
          serialize("plus", plus)
          serialize("this.plus", Test.this.plus)
          serialize("Test.plus", Test.plus)

          serialize("minus", minus)
          serialize("Inner.minus", Inner.minus)

          notSerialize("zero", zero)
          notSerialize("this.zero", this.zero)
          notSerialize("Local.zero", Local.zero)
        }
      }
      Local()
    }
  }
  def main(args: Array[String]): Unit = {
    serialize("plus", plus)
    serialize("this.plus", this.plus)
    serialize("Test.plus", Test.plus)

    Inner.testInner()

    Inner.testLocal()
  }
}

Expand test case to consider local modules


addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")

// cross-compiling
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject"      % "1.0.0")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"                   % "1.5.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")

// cross-compiling
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject"      % "1.0.0")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"                   % "1.5.1")

Update sbt-scalajs, scalajs-compiler, ... to 1.5.1


// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.1")

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.3")

Update to play framework v2.1.3

Update to play framework v2.1.3


/* Copyright 2009-2018 EPFL, Lausanne */

package stainless
package extraction
package imperative

trait TransformerWithPC extends innerfuns.TransformerWithPC {
  val s: Trees
  val t: Trees

  override def transform(e: s.Expr, env: Env): t.Expr = e match {
    case s.LetVar(vd, v, b) =>
      t.LetVar(transform(vd, env), transform(v, env), transform(b, env withBinding (vd -> v))).copiedFrom(e)

    case _ => super.transform(e, env)
  }
}

/* Copyright 2009-2018 EPFL, Lausanne */

package stainless
package extraction
package imperative

trait TransformerWithPC extends innerfuns.TransformerWithPC {
  val s: Trees
  val t: Trees

  override def transform(e: s.Expr, env: Env): t.Expr = e match {
    case s.LetVar(vd, v, b) =>
      t.LetVar(transform(vd, env), transform(v, env), transform(b, env withBinding (vd -> v))).copiedFrom(e)

    case s.While(cond, body, optInv) =>
      val bodyEnv = env withCond optInv.map(inv => s.And(inv, cond).copiedFrom(e)).getOrElse(cond)
      t.While(transform(cond, env), transform(body, bodyEnv), optInv.map(transform(_, env))).copiedFrom(e)

    case _ => super.transform(e, env)
  }
}

Add while-loop condition and invariant to path condition


package almond

import almond.logger.{Level, LoggerContext}

object TestLogging {
  val logCtx = LoggerContext.stderr(
    sys.env.get("ALMOND_TEST_LOGGING")
      .orElse(sys.props.get("almond.test.logging"))
      .map { s =>
        Level.fromString(s) match {
          case Left(e) =>
            sys.error(s"Parsing log level '$s': $e")
          case Right(l) => l
        }
      }
      .getOrElse(
        Level.Info
      )
  )
}

package almond

import almond.logger.{Level, LoggerContext}

object TestLogging {
  val logCtx = LoggerContext.stderr(
    sys.env.get("ALMOND_TEST_LOGGING")
      .orElse(sys.props.get("almond.test.logging"))
      .map { s =>
        Level.fromString(s) match {
          case Left(e) =>
            sys.error(s"Parsing log level '$s': $e")
          case Right(l) => l
        }
      }
      .getOrElse(
        Level.Debug
      )
  )
}

Print debug log in tests

Print debug log in tests


import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( androidBuildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"com.android.support" % "appcompat-v7" % "21.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6",
				"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
				"org.scala-lang" % "scala-reflect" % scalaVersion.value
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			publishArtifact in ( Compile, packageDoc ) := false,
			scalaVersion := "2.11.4",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:existentials",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			// @see https://github.com/pfn/android-sdk-plugin/issues/88
			sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
			version := "0.3.10-BETA",
			minSdkVersion in Android := "10",
			platformTarget in Android := "android-21",
			targetSdkVersion in Android := "21"
		)
}

import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( androidBuildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"com.android.support" % "appcompat-v7" % "21.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6",
				"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
				"org.scala-lang" % "scala-reflect" % scalaVersion.value
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			publishArtifact in ( Compile, packageDoc ) := false,
			scalaVersion := "2.11.4",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:existentials",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			// @see https://github.com/pfn/android-sdk-plugin/issues/88
			sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
			version := "0.3.11-BETA",
			minSdkVersion in Android := "10",
			platformTarget in Android := "android-21",
			targetSdkVersion in Android := "21"
		)
}

Set project version to 0.3.11-BETA

Set project version to 0.3.11-BETA


resolvers += Resolver.bintrayIvyRepo("gatling", "sbt-plugins")
resolvers += Resolver.jcenterRepo

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "2.5.4")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.7.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.3.7")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.4.0")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.9")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.18")

resolvers += Resolver.bintrayIvyRepo("gatling", "sbt-plugins")
resolvers += Resolver.jcenterRepo

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "2.5.4")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.7.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.3.7")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.4.0")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.9")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.18-1")

Upgrade scalafix 0.9.18-1 and fix random RejectedExecutionException


// These are needed even before build.scala

resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += "Spray Repository" at "http://repo.spray.cc/"

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.2")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

//addSbtPlugin("io.spray" %% "sbt-twirl" % "0.6.1")

// For Sonatype publishing
//resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

//addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")

// These are needed even before build.scala

resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += "Spray Repository" at "http://repo.spray.cc/"

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.2")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.7.0")

resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"

//addSbtPlugin("io.spray" %% "sbt-twirl" % "0.6.1")

// For Sonatype publishing
//resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

//addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")

Add scalastyle plugin to sbt

Add scalastyle plugin to sbt


package cromwell.backend.impl.tes

import com.azure.identity.DefaultAzureCredentialBuilder
import com.azure.security.keyvault.secrets.{SecretClient, SecretClientBuilder}
import common.validation.ErrorOr
import common.validation.ErrorOr._

class AzureKeyVaultClient(client: SecretClient) {
  def getSecret(secretName: String): ErrorOr[String] = {
    ErrorOr(client.getSecret(secretName)).map(_.getValue)
  }
}

object AzureKeyVaultClient {
  def apply(vaultName: String, identityClientId: Option[String]): ErrorOr[AzureKeyVaultClient] = ErrorOr {
    val defaultCreds = identityClientId.map(identityId =>
      new DefaultAzureCredentialBuilder().managedIdentityClientId(identityId)
    ).getOrElse(
      new DefaultAzureCredentialBuilder()
    ).build()

    val client = new SecretClientBuilder()
      .vaultUrl(s"https://${vaultName}.vault.azure.net")
      .credential(defaultCreds)
      .buildClient()

    new AzureKeyVaultClient(client)
  }
}

Add newline at end of file

Add newline at end of file


package info.mukel.telegram.bots.v2.examples

import info.mukel.telegram.bots.v2.TelegramBot

import scala.io.Source

/**
  * Created by mukel on 5/9/16.
  */
trait TestBot extends TelegramBot {
  override def token: String =
    Source.fromFile("./tokens/flunkey_bot.token").getLines().next
}

package info.mukel.telegram.bots.v2.examples

import info.mukel.telegram.bots.v2.TelegramBot

import scala.io.Source

/**
  * Created by mukel on 5/9/16.
  */
trait TestBot extends TelegramBot {
  override def token: String =
    Source.fromFile("./tokens/menial_bot.token").getLines().next
}

Change token for test bot harness

Change token for test bot harness


package uk.ac.wellcome.platform.api.works

import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import uk.ac.wellcome.display.models.ApiVersions
import uk.ac.wellcome.test.fixtures.TestWith

class ApiErrorsTest extends ApiWorksTestBase {

  it("returns a Not Found error if you try to get an API version") {
    withServer(indexNameV1 = "not-important", indexNameV2 = "not-important") {
      server =>
        server.httpGet(
          path = "/catalogue/v567/works",
          andExpect = Status.NotFound,
          withJsonBody = badRequest(
            s"catalogue/${ApiVersions.default.toString}",
            "v567 is not a valid API version")
        )
    }
  }

  private def withServer[R](testWith: TestWith[EmbeddedHttpServer, R]): R =
    withServer(indexNameV1 = "index-v1", indexNameV2 = "index-v2") { server =>
      testWith(server)
    }
}

package uk.ac.wellcome.platform.api.works

import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import uk.ac.wellcome.display.models.ApiVersions
import uk.ac.wellcome.test.fixtures.TestWith

class ApiErrorsTest extends ApiWorksTestBase {

  it("returns a Not Found error if you try to get an API version") {
    withServer { server =>
      server.httpGet(
        path = "/catalogue/v567/works",
        andExpect = Status.NotFound,
        withJsonBody = badRequest(
          s"catalogue/${ApiVersions.default.toString}",
          "v567 is not a valid API version")
      )
    }
  }

  it("returns a Not Found error if you try to get an unrecognised path") {
    withServer { server =>
      server.httpGet(
        path = "/foo/bar",
        andExpect = Status.NotFound,
        withJsonBody = badRequest(
          s"catalogue/${ApiVersions.default.toString}",
          "v567 is not a valid API version")
      )
    }
  }

  private def withServer[R](testWith: TestWith[EmbeddedHttpServer, R]): R =
    withServer(indexNameV1 = "index-v1", indexNameV2 = "index-v2") { server =>
      testWith(server)
    }
}

Improve the quality of these tests

Improve the quality of these tests


name := "qdb-spark-connector"
version := "1.0.0-SNAPSHOT"

resolvers += Resolver.mavenLocal
resolvers += "QuasarDB Maven Repository" at "https://maven.quasardb.net/"
resolvers += "softprops-maven" at "http://dl.bintray.com/content/softprops/maven"

spName := "quasardb/spark-connector"
scalaVersion := "2.11.7"
crossScalaVersions := Seq("2.10.5", "2.11.7")

sparkVersion := "2.2.0"
sparkComponents ++= Seq("streaming", "sql")

organization := "net.quasardb"
organizationName := "QuasarDB"
organizationHomepage := Some(url("https://www.quasardb.net"))

libraryDependencies ++= Seq(
  "net.quasardb" % "qdb" % "2.1.0-SNAPSHOT",
  "net.quasardb" % "jni" % "2.1.0-SNAPSHOT",
  "org.scalatest" %% "scalatest" % "3.0.4" % "test",
  "com.novocode" % "junit-interface" % "0.9" % "test"
)

parallelExecution in Test := false

name := "qdb-spark-connector"
version := "1.0.0-SNAPSHOT"

resolvers += Resolver.mavenLocal
resolvers += "QuasarDB Maven Repository" at "https://maven.quasardb.net/"
resolvers += "softprops-maven" at "http://dl.bintray.com/content/softprops/maven"

spName := "quasardb/spark-connector"
scalaVersion := "2.11.7"
crossScalaVersions := Seq("2.10.5", "2.11.7")

sparkVersion := "2.2.0"
sparkComponents ++= Seq("streaming", "sql")

organization := "net.quasardb"
organizationName := "QuasarDB"
organizationHomepage := Some(url("https://www.quasardb.net"))

libraryDependencies ++= Seq(
  "net.quasardb" % "qdb" % "2.1.0-SNAPSHOT",
  "net.quasardb" % "jni" % "2.1.0-SNAPSHOT",
  "me.lessis" %% "retry" % "0.2.0",
  "org.scalatest" %% "scalatest" % "3.0.4" % "test",
  "com.novocode" % "junit-interface" % "0.9" % "test"
)

parallelExecution in Test := false

Use retry library for backoff mechanism

Use retry library for backoff mechanism


name := "debiki-core"

organization := "com.debiki"

version := "0.0.2-SNAPSHOT"

scalaVersion := "2.9.1"

resolvers += "Scala-Tools Maven2 Repository" at "http://scala-tools.org/repo-releases"

libraryDependencies ++= Seq(
  "org.scala-lang" % "scala-library" % "2.9.1",
  "org.yaml" % "snakeyaml" % "1.6",
  "com.google.guava" % "guava" % "r09",
  "commons-codec" % "commons-codec" % "1.5",
  "net.liftweb" %% "lift-util" % "2.4-M5",
  "junit" % "junit" % "4.7" % "test",
  "org.scala-tools.testing" %% "specs" % "1.6.9" % "test"
)

scalacOptions += "-deprecation"

name := "debiki-core"

organization := "com.debiki"

version := "0.0.2-SNAPSHOT"

scalaVersion := "2.9.1"

resolvers += "Scala-Tools Maven2 Repository" at "http://scala-tools.org/repo-releases"

libraryDependencies ++= Seq(
  "org.scala-lang" % "scala-library" % "2.9.1",
  "org.yaml" % "snakeyaml" % "1.6",
  "com.google.guava" % "guava" % "r09",
  "commons-codec" % "commons-codec" % "1.5",
  "nu.validator.htmlparser" % "htmlparser" % "1.2.1",
  "junit" % "junit" % "4.7" % "test",
  "org.scala-tools.testing" %% "specs" % "1.6.9" % "test"
)

scalacOptions += "-deprecation"

Remove Lift-Web dependency, add Validator.nu HTML Parser dep.


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.3" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.7.2" cross CrossVersion.full),
      "com.github.ghik" %% "silencer-lib" % "1.7.2" % Provided cross CrossVersion.full,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.76"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.3" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.7.2" cross CrossVersion.full),
      "com.github.ghik" %% "silencer-lib" % "1.7.2" % Provided cross CrossVersion.full,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.77"

autocommit: Update configuration to record version 0.2.77


package com.softwaremill.react.kafka

import kafka.consumer.KafkaConsumer
import org.reactivestreams.{Subscription, Subscriber}

import scala.util.control.NonFatal

private[kafka] class KafkaTopicSubscription(consumer: KafkaConsumer,
                                            subscriber: Subscriber[_ >: String]) extends Subscription {

  override def request(n: Long): Unit = {
    require(n > 0, "n <= 0")

    for (i <- 0 to n.toInt)
      consumer.read(bytes => {
        val msgAsStr = new String(bytes)
        subscriber.onNext(msgAsStr)
      })
  }

  override def cancel() = try {
    consumer.close()
  } catch {
    case NonFatal(exception) =>
      subscriber.onError(new IllegalStateException("onComplete threw an exception", exception))
  }
}

package com.softwaremill.react.kafka

import kafka.consumer.KafkaConsumer
import org.reactivestreams.{Subscription, Subscriber}

import scala.util.control.NonFatal

private[kafka] class KafkaTopicSubscription(consumer: KafkaConsumer,
                                            subscriber: Subscriber[_ >: String]) extends Subscription {

  override def request(n: Long): Unit = {
    require(n > 0, "n <= 0")

    (1L to n.toInt) foreach { _ =>
      consumer.read(bytes => {
        val msgAsStr = new String(bytes)
        subscriber.onNext(msgAsStr)
      })
    }
  }

  override def cancel() = try {
    consumer.close()
  } catch {
    case NonFatal(exception) =>
      subscriber.onError(new IllegalStateException("onComplete threw an exception", exception))
  }
}

Fix loop counter and style

Fix loop counter and style


package net.liftmodules.mongoauth
package field

import net.liftweb._
import common._
import mongodb.record.field.MongoListField
import mongodb.record.BsonRecord

import com.mongodb._

class PermissionListField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)
  extends MongoListField[OwnerType, Permission](rec)
{
  import scala.collection.JavaConversions._

  override def asDBObject: DBObject = {
    val dbl = new BasicDBList
    value.foreach { v => dbl.add(v.toString) }
    dbl
  }

  override def setFromDBObject(dbo: DBObject): Box[List[Permission]] =
    setBox(Full(dbo.keySet.toList.map(k => {
      Permission.fromString(dbo.get(k.toString).asInstanceOf[String])
    })))
}

package net.liftmodules.mongoauth
package field

import scala.collection.JavaConverters._

import net.liftweb._
import common._
import mongodb.record.field.MongoListField
import mongodb.record.BsonRecord

import com.mongodb._

class PermissionListField[OwnerType <: BsonRecord[OwnerType]](rec: OwnerType)
  extends MongoListField[OwnerType, Permission](rec)
{

  override def asDBObject: DBObject = {
    val dbl = new BasicDBList
    value.foreach { v => dbl.add(v.toString) }
    dbl
  }

  override def setFromDBObject(dbo: DBObject): Box[List[Permission]] =
    setBox(Full(dbo.keySet.asScala.toList.map { k =>
      Permission.fromString(dbo.get(k.toString).asInstanceOf[String])
    }))
}

Use JavaConverters instead of JavaConversions


package hmda.validation.engine.ts

import hmda.parser.fi.ts.TsGenerators
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.prop.PropertyChecks
import org.scalatest.{ MustMatchers, PropSpec }

import scala.concurrent.ExecutionContext

//TODO: fails if JSExecutionContext.Implicits.queue is used (runNow is deprecated, but works)
//TODO: fails in Travis CI with org.scalajs.jsenv.ComJSEnv$ComClosedException: JSCom has been closed
//class TsValidationEngineSpec extends PropSpec with PropertyChecks with MustMatchers with TsGenerators with CommonTsValidationEngine with ScalaFutures with CommonTsValidationSpec {
//
//  override implicit val ec: ExecutionContext = scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow

//}

package hmda.validation.engine.ts

import hmda.parser.fi.ts.TsGenerators
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.prop.PropertyChecks
import org.scalatest.{ MustMatchers, PropSpec }

import scala.concurrent.ExecutionContext

//TODO: fails if JSExecutionContext.Implicits.queue is used (runNow is deprecated, but works)
class TsValidationEngineSpec extends PropSpec with PropertyChecks with MustMatchers with TsGenerators with TsValidationEngine with ScalaFutures with CommonTsValidationSpec {

  override implicit val ec: ExecutionContext = scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow

}

Add JS Validation Engine test

Add JS Validation Engine test


package uk.ac.wellcome.platform.idminter.steps

import com.google.inject.Inject
import com.twitter.inject.Logging
import uk.ac.wellcome.metrics.MetricsSender
import uk.ac.wellcome.models.Work

import scala.concurrent.Future

class IdEmbedder @Inject()(metricsSender: MetricsSender,
                           identifierGenerator: IdentifierGenerator)
    extends Logging {
  def embedId(work: Work): Future[Work] = {
    metricsSender.timeAndCount(
      "generate-id",
      () =>
        Future {
          val canonicalId = identifierGenerator
            .retrieveOrGenerateCanonicalId(
              work.identifiers,
              ontologyType = work.ontologyType
            )
            .get
          work.copy(canonicalId = Some(canonicalId))
      }
    )
  }
}

package uk.ac.wellcome.platform.idminter.steps

import com.google.inject.Inject
import com.twitter.inject.Logging
import uk.ac.wellcome.metrics.MetricsSender
import uk.ac.wellcome.models.Work
import uk.ac.wellcome.utils.GlobalExecutionContext.context

import scala.concurrent.Future

class IdEmbedder @Inject()(metricsSender: MetricsSender,
                           identifierGenerator: IdentifierGenerator)
    extends Logging {
  def embedId(work: Work): Future[Work] = {
    metricsSender.timeAndCount(
      "generate-id",
      () =>
        Future {
          val canonicalId = identifierGenerator
            .retrieveOrGenerateCanonicalId(
              work.identifiers,
              ontologyType = work.ontologyType
            )
            .get
          work.copy(canonicalId = Some(canonicalId))
      }
    )
  }
}

Add an execution context for the ID minter


package com.themillhousegroup.witchhunt

import org.specs2.mutable.Specification
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import java.net.URL

class StyleguideScraperSpec extends Specification {

  // These pages are hosted on Github pages
  // Checkout gh-pages to add/edit content, and push to make it live.

  val basicStyleguide = new URL("http://themillhousegroup.github.io/witchhunt/index.html  ")
  val styleguideWithLink = new URL("http://themillhousegroup.github.io/witchhunt/page-with-local-links.html")
  val styleguideWithCircularLink = new URL("http://themillhousegroup.github.io/witchhunt/page-with-multiple-local-links.html")

  def visit(target: URL) = Await.result(
    StyleguideScraper.visit(target), Duration(5, "seconds")
  )

  "Styleguide Scraper" should {

    "be able to extract a single document from a plain styleguide" in {

      val result = visit(basicStyleguide)

      result must haveLength(1)

      result.head.select("title").text mustEqual ("Witchhunt by themillhousegroup")
    }

    "be able to follow links from the starting document" in {

      val result = visit(styleguideWithLink)

      result must haveLength(2)

      result.map(_.select("title").text) must contain("Page with local link", "Witchhunt by themillhousegroup")
    }

    "not follow circular links" in {

      val result = visit(styleguideWithCircularLink)

      result must haveLength(3)

      result.map(_.select("title").text) must contain("Page with multiple local links", "Page with local link", "Witchhunt by themillhousegroup")
    }
  }
}

package com.themillhousegroup.witchhunt

import org.specs2.mutable.Specification
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import java.net.URL

import com.themillhousegroup.witchhunt.test.GithubPagesHelper._

class StyleguideScraperSpec extends Specification {

  def visit(target: URL) = Await.result(
    StyleguideScraper.visit(target), Duration(5, "seconds")
  )

  "Styleguide Scraper" should {

    "be able to extract a single document from a plain styleguide" in {

      val result = visit(basicStyleguide)

      result must haveLength(1)

      result.head.title mustEqual ("Witchhunt by themillhousegroup")
    }

    "be able to follow links from the starting document" in {

      val result = visit(styleguideWithLink)

      result must haveLength(2)

      result.map(_.title) must contain("Page with local link", "Witchhunt by themillhousegroup")
    }

    "not follow circular links" in {

      val result = visit(styleguideWithCircularLink)

      result must haveLength(3)

      result.map(_.title) must contain("Page with multiple local links", "Page with local link", "Witchhunt by themillhousegroup")
    }
  }
}

Use the .title method instead of CSS selectors


package k2b6s9j.boatcraft.api.registry

import java.util.{HashMap, List, Map}

import scala.collection.JavaConversions.asScalaBuffer

import k2b6s9j.boatcraft.api.traits.Modifier
import net.minecraft.item.ItemStack

/** Contains the methods needed to register Materials with BoatCraft:Core. */
object ModifierRegistry
{
	var modifiers: Map[String, Modifier] = new HashMap[String, Modifier]

  /** Adds a single Modifier to the Map used by BoatCraft:Core for boat creation.
    *
    * @param newModifier the Modifier being registered
    */
  def addModifier(newModifier: Modifier)
	{
		modifiers put(newModifier toString, newModifier)
	}

  /** Adds a List of Modifiers to the Map used by BoatCraft:Core for boat creation.
    *
    * @param newModifiers list of Modifiers being registered
    */
	def addModifiers(newModifiers: List[Modifier])
	{
		for (modifier <- newModifiers)
			modifiers put(modifier toString, modifier)
	}

	def getModifier(name: String) =
		modifiers get name

	def getModifier(stack: ItemStack) =
		modifiers get (stack.stackTagCompound getString "modifier")
}

package k2b6s9j.boatcraft.api.registry

import java.util.{HashMap, List, Map}

import scala.collection.JavaConversions.asScalaBuffer

import k2b6s9j.boatcraft.api.traits.Modifier
import net.minecraft.item.ItemStack

/** Contains the methods needed to register Materials with BoatCraft:Core. */
object ModifierRegistry
{
	var modifiers: Map[String, Modifier] = new HashMap[String, Modifier]

  /** Adds a single Modifier to the Map used by BoatCraft:Core for boat creation.
    *
    * @param newModifier the Modifier being registered
    */
  def addModifier(newModifier: Modifier)
	{
		modifiers put(newModifier toString, newModifier)
	}

  /** Adds a List of Modifiers to the Map used by BoatCraft:Core for boat creation.
    *
    * @param newModifiers list of Modifiers being registered
    */
	def addModifiers(newModifiers: List[Modifier])
	{
		for (modifier <- newModifiers)
			modifiers put(modifier toString, modifier)
	}

  /** Returns a registered Modifier associated with a certain name.
    *
    * @param name name of registered Modifier
    * @return registered Modifier
    */
	def getModifier(name: String) =
		modifiers get name

  /** Returns a registered Modifier associated with a certain ItemStack.
   *
   * @param stack ItemStack of registered Modifier
   * @return registered Modifier
   */
	def getModifier(stack: ItemStack) =
		modifiers get (stack.stackTagCompound getString "modifier")
}

Add documentation comments for getModifier()


/* ------------------- sse-jmx ------------------- *\
 * Licensed under the Apache License, Version 2.0. *
 * Author: Spiros Tzavellas                        *
\* ----------------------------------------------- */
package com.tzavellas.sse.jmx

import scala.collection.mutable.{HashSet, SynchronizedSet}
import javax.management.{ObjectName, InstanceNotFoundException}

/**
 * Tracks MBean registrations.
 *
 * @see [[unregisterAll]]
 */
trait MBeanRegistrationTracker extends MBeanRegistrationSupport {

  private val registered = new HashSet[ObjectName] with SynchronizedSet[ObjectName]

  abstract override def registerMBean(mbean: AnyRef, name: ObjectName, behavior: IfAlreadyExists.Enum = IfAlreadyExists.Fail) {
    super.registerMBean(mbean, name, behavior)
    registered += name
  }

  abstract override def unregisterMBean(name: ObjectName, ignore: Boolean = false) {
    super.unregisterMBean(name)
    registered -= name
  }

  /**
   * Unregister all the MBeans that have been registered using this instance.
   *
   * @see [[registerMBean]]
   */
  def unregisterAll() {
    for (name <- registered) {
      try { unregisterMBean(name) }
      catch { case e: InstanceNotFoundException => }
    }
  }
}

/* ------------------- sse-jmx ------------------- *\
 * Licensed under the Apache License, Version 2.0. *
 * Author: Spiros Tzavellas                        *
\* ----------------------------------------------- */
package com.tzavellas.sse.jmx

import scala.collection.mutable.{HashSet, SynchronizedSet}
import java.util.concurrent.ConcurrentHashMap
import javax.management.{ObjectName, InstanceNotFoundException}

/**
 * Tracks MBean registrations.
 *
 * @see [[unregisterAll]]
 */
trait MBeanRegistrationTracker extends MBeanRegistrationSupport {

  private val registered = new ConcurrentHashMap[ObjectName, Unit]

  abstract override def registerMBean(mbean: AnyRef, name: ObjectName, behavior: IfAlreadyExists.Enum = IfAlreadyExists.Fail) {
    super.registerMBean(mbean, name, behavior)
    registered.putIfAbsent(name, ())
  }

  abstract override def unregisterMBean(name: ObjectName, ignore: Boolean = false) {
    super.unregisterMBean(name)
    registered.remove(name)
  }

  /**
   * Unregister all the MBeans that have been registered using this instance.
   *
   * @see [[registerMBean]]
   */
  def unregisterAll() {
    val names = registered.keySet.iterator
    while(names.hasNext) {
      try {
        unregisterMBean(names.next)
      } catch {
        case e: InstanceNotFoundException =>
      }
      names.remove()
    }
  }
}

Remove deprecation warning for synchronized collection.


package pkg

object Test {
  def main(args: Array[String]): Unit = {
    val world = Hello("World")
    println(s"Hello $world")
  }
}

case class Hello(name: String)

package pkg

object Test {
  def main(args: Array[String]): Unit = {
    val world = Hello("World")
    println(s"Hello ${world.name}")
  }
}

case class Hello(name: String)

Print name of object instead of whole object


//
// StandardOrcRuntime.scala -- Scala class StandardOrcRuntime
// Project OrcScala
//
// $Id$
//
// Created by dkitchin on Jun 24, 2010.
//
// Copyright (c) 2010 The University of Texas at Austin. All rights reserved.
//
// Use and redistribution of this file is governed by the license terms in
// the LICENSE file found in the project's top-level directory and also found at
// URL: http://orc.csres.utexas.edu/license.shtml .
//

package orc.run

import orc.OrcRuntime
import orc.run.extensions._

class StandardOrcRuntime extends OrcRuntime
with Orc
with StandardInvocationBehavior
with ActorBasedScheduler
with SupportForCapsules
with SupportForSynchronousExecution
with SupportForRtimer
with SupportForStdout
with ExceptionReportingOnConsole

/* The first behavior in the trait list will be tried last */
trait StandardInvocationBehavior extends InvocationBehavior
with ErrorOnUndefinedInvocation
with SupportForSiteInvocation
with SupportForJavaObjectInvocation

Add missing file header comment

Add missing file header comment


addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.8")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")

libraryDependencies ++= Seq(
  "org.testcontainers" % "postgresql" % "1.16.3",
  "org.testcontainers" % "elasticsearch" % "1.16.3",
  "org.tpolecat" %% "doobie-postgres" % "0.13.4"
)

addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.8")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")

libraryDependencies ++= Seq(
  "org.testcontainers" % "postgresql" % "1.16.3",
  "org.testcontainers" % "elasticsearch" % "1.16.3",
  "org.tpolecat" %% "doobie-postgres" % "0.13.4"
)

Update sbt-scalajs, scalajs-compiler, ... to 1.9.0


// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.1")

Change play version to 2.1.1

Change play version to 2.1.1


addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")

addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.4.31")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1")

addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.5")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")

addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.1")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9")

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")

addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.4.31")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1")

addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.5")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")

addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.1")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.31")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9")

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7")

Update sbt-scalajs, scalajs-compiler to 0.6.31


addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.5")
addSbtPlugin("org.scalameta"     % "sbt-scalafmt" % "2.4.2")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.6")
addSbtPlugin("org.scalameta"     % "sbt-scalafmt" % "2.4.2")

Update play-ahc-ws, play-akka-http-server, ... to 2.8.6


package com.blinkbox.books.catalogue.browser

import java.net.URL

import com.blinkbox.books.catalogue.browser.v1.{SearchApi, EsV1SearchService}
import com.blinkbox.books.catalogue.common.e2e.E2ESpec
import com.blinkbox.books.config.ApiConfig
import com.blinkbox.books.json.DefaultFormats
import org.json4s.Formats
import org.scalatest.Suite
import org.scalatest.time.{Millis, Span}
import spray.httpx.Json4sJacksonSupport
import spray.testkit.ScalatestRouteTest
import scala.concurrent.duration._

trait ApiSpecBase extends E2ESpec with ScalatestRouteTest with Json4sJacksonSupport {
  this: Suite =>

  override implicit def patienceConfig = PatienceConfig(timeout = Span(3000, Millis), interval = Span(100, Millis))
  override def e2eExecutionContext = executor
  override implicit def json4sJacksonFormats: Formats = DefaultFormats

  implicit val routeTestTimeout = RouteTestTimeout(5.seconds)

  lazy val searchService = new EsV1SearchService(searchConfig, esClient)
  lazy val apiUrl = new URL("http://localhost:9595")
  lazy val apiConfig = ApiConfig(apiUrl, apiUrl, 2.seconds)
  lazy val apiService = new SearchApi(apiConfig, searchService)
  lazy val routes = apiService.routes
}

package com.blinkbox.books.catalogue.browser

import java.net.URL

import com.blinkbox.books.catalogue.browser.v1.{SearchApi, EsV1SearchService}
import com.blinkbox.books.catalogue.common.e2e.E2ESpec
import com.blinkbox.books.config.ApiConfig
import com.blinkbox.books.json.DefaultFormats
import org.json4s.Formats
import org.scalatest.Suite
import org.scalatest.time.{Millis, Span}
import spray.httpx.Json4sJacksonSupport
import spray.testkit.ScalatestRouteTest
import scala.concurrent.duration._

trait ApiSpecBase extends E2ESpec with ScalatestRouteTest with Json4sJacksonSupport {
  this: Suite =>

  override implicit def patienceConfig = PatienceConfig(timeout = Span(5000, Millis), interval = Span(100, Millis))
  override def e2eExecutionContext = executor
  override implicit def json4sJacksonFormats: Formats = DefaultFormats

  implicit val routeTestTimeout = RouteTestTimeout(5.seconds)

  lazy val searchService = new EsV1SearchService(searchConfig, esClient)
  lazy val apiUrl = new URL("http://localhost:9595")
  lazy val apiConfig = ApiConfig(apiUrl, apiUrl, 2.seconds)
  lazy val apiService = new SearchApi(apiConfig, searchService)
  lazy val routes = apiService.routes
}

Increase the patience config timeout.

Increase the patience config timeout.


package org.opencommercesearch.api.controllers

import play.api.mvc.{AnyContent, Request, Controller}
import org.apache.solr.client.solrj.SolrQuery

import org.opencommercesearch.api.Global.MaxPaginationLimit

trait Pagination {
  self: Controller =>

  def withPagination(query: SolrQuery)(implicit request: Request[AnyContent]) : SolrQuery = {
    val offset = request.getQueryString("offset")
    val limit = request.getQueryString("limit")

    if (offset.isDefined) {
      try {
        query.setStart(offset.get.toInt)
      } catch {
        case e => // do nothing
      }
    }

    if (limit.isDefined) {
      try {
        val l = limit.get.toInt
        query.setRows(Math.min(MaxPaginationLimit, l))
      } catch {
        case e => // do nothing
      }
    }

    query
  }
}

package org.opencommercesearch.api.controllers

import play.api.mvc.{AnyContent, Request, Controller}
import org.apache.solr.client.solrj.SolrQuery

import org.opencommercesearch.api.Global.MaxPaginationLimit

trait Pagination {
  self: Controller =>

  def withPagination(query: SolrQuery)(implicit request: Request[AnyContent]) : SolrQuery = {
    val offset = request.getQueryString("offset")
    val limit = request.getQueryString("limit")

    if (offset.isDefined) {
      try {
        query.setStart(offset.get.toInt)
      } catch {
        case e: Throwable => // do nothing
      }
    }

    if (limit.isDefined) {
      try {
        val l = limit.get.toInt
        query.setRows(Math.min(MaxPaginationLimit, l))
      } catch {
        case e: Throwable => // do nothing
      }
    }

    query
  }
}

Remove warnings in pagination trait

Remove warnings in pagination trait


package org.continuumio.bokeh

abstract class Renderer

class Glyph extends Renderer {
    object data_source extends Field[this.type, DataSource](this)
    object xdata_range extends Field[this.type, Range](this)
    object ydata_range extends Field[this.type, Range](this)

    object units extends Field[this.type, Units](this)

    // XXX: has_ref = False
    object glyph extends Field[this.type, BaseGlyph](this)
    object selection_glyph extends Field[this.type, BaseGlyph](this)
    object nonselection_glyph extends Field[this.type, BaseGlyph](this)
}

package org.continuumio.bokeh

abstract class Renderer extends PlotObject

class Glyph extends Renderer {
    object data_source extends Field[this.type, DataSource](this)
    object xdata_range extends Field[this.type, Range](this)
    object ydata_range extends Field[this.type, Range](this)

    object units extends Field[this.type, Units](this)

    // XXX: has_ref = False
    object glyph extends Field[this.type, BaseGlyph](this)
    object selection_glyph extends Field[this.type, BaseGlyph](this)
    object nonselection_glyph extends Field[this.type, BaseGlyph](this)
}

Fix Renderer to inherit from PlotObject

Fix Renderer to inherit from PlotObject


package io.github.bamos

object Whitelist {
  val users = Seq(
    "adius",
    "adobe-research",
    "ajn123",
    "amplab",
    "bamos",
    "bigdatagenomics",
    "bryangarza",
    "cc-archive",
    "cimpress-mcp",
    "cjwelborn",
    "cmusatyalab",
    "coreos",
    "creativecommons",
    "darksigma",
    "davewood",
    "docker",
    "ecomfe",
    "etsy",
    "facebook",
    "fnothaft",
    "geotrellis",
    "github",
    "google",
    "HackathonHackers",
    "hamiltont",
    "haskell",
    "homebrew",
    "humblesoftware",
    "jebes",
    "jez",
    "mozilla",
    "ObeliskIsHuge",
    "okfn",
    "OpenRA",
    "puppetlabs",
    "rails",
    "rhema",
    "scotty-web",
    "snowplow",
    "spine",
    "square",
    "tejasmanohar",
    "themattman",
    "twitter",
    "vishnuravi",
    "VT-Magnum-Research",
    "WalnutiQ",
    "welbornprod",
    "zmughal",
    "LightTable"
  ).map(_.toLowerCase)
}

package io.github.bamos

object Whitelist {
  val users = Seq(
    "adius",
    "adobe-research",
    "ajn123",
    "amplab",
    "AndlyticsProject",
    "AndyScherzinger",
    "bamos",
    "bigdatagenomics",
    "bryangarza",
    "cc-archive",
    "cimpress-mcp",
    "cjwelborn",
    "cmusatyalab",
    "coreos",
    "creativecommons",
    "darksigma",
    "davewood",
    "docker",
    "ecomfe",
    "etsy",
    "facebook",
    "fnothaft",
    "geotrellis",
    "github",
    "google",
    "HackathonHackers",
    "hamiltont",
    "haskell",
    "homebrew",
    "humblesoftware",
    "jebes",
    "jez",
    "mozilla",
    "ObeliskIsHuge",
    "okfn",
    "OpenRA",
    "puppetlabs",
    "rails",
    "rhema",
    "scotty-web",
    "snowplow",
    "spine",
    "square",
    "tejasmanohar",
    "themattman",
    "twitter",
    "vishnuravi",
    "VT-Magnum-Research",
    "WalnutiQ",
    "welbornprod",
    "zmughal",
    "LightTable"
  ).map(_.toLowerCase)
}

Update whitelist add personal & Org Account


package com.microsoft.partnercatalyst.fortis.spark.logging

import com.microsoft.applicationinsights.{TelemetryClient, TelemetryConfiguration}
import java.util.HashMap

class AppInsightsTelemetry extends FortisTelemetry {
  private val client: TelemetryClient = new TelemetryClient(TelemetryConfiguration.createDefault())

  def logIncomingEventBatch(streamId: String, connectorName: String, batchSize: Long): Unit = {
    val properties = new HashMap[String, String](2)
    properties.put("streamId", streamId)
    properties.put("connectorName", connectorName)

    val metrics = new HashMap[String, java.lang.Double](1)
    metrics.put("batchSize", batchSize.toDouble)

    client.trackEvent("batch.receive", properties, metrics)
  }

  def logCassandraEventsSink(duration: Long, batchSize: Long): Unit = {
    val properties = new HashMap[String, String](0)

    val metrics = new HashMap[String, java.lang.Double](2)
    metrics.put("batchSize", batchSize.toDouble)
    metrics.put("duration", duration.toDouble)

    client.trackEvent("sink.cassandra", properties, metrics)
  }
}

package com.microsoft.partnercatalyst.fortis.spark.logging

import com.microsoft.applicationinsights.{TelemetryClient, TelemetryConfiguration}
import java.util.HashMap

class AppInsightsTelemetry extends FortisTelemetry {
  private val client: TelemetryClient = new TelemetryClient(TelemetryConfiguration.createDefault())

  def logIncomingEventBatch(streamId: String, connectorName: String, batchSize: Long): Unit = {
    val properties = new HashMap[String, String](2)
    properties.put("streamId", streamId)
    properties.put("connectorName", connectorName)

    val metrics = new HashMap[String, java.lang.Double](1)
    metrics.put("batchSize", batchSize.toDouble)

    client.trackEvent("batch.receive", properties, metrics)
  }

  def logCassandraEventsSink(duration: Long, batchSize: Long): Unit = {
    val properties = new HashMap[String, String](0)

    val metrics = new HashMap[String, java.lang.Double](2)
    metrics.put("batchSize", batchSize.toDouble)
    metrics.put("duration", duration.toDouble)

    client.trackEvent("batch.sink", properties, metrics)
  }
}

Rename event for logCassandraEventsSink to batch.sink


package org.jetbrains.plugins.scala
package debugger

import com.intellij.debugger.NameMapper
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.util.Computable
import com.intellij.psi.PsiClass
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTemplateDefinition, ScTrait}

/**
*@author ilyas
*/
class ScalaJVMNameMapper extends NameMapper {
  def getQualifiedName(@NotNull clazz: PsiClass): String = {
    ApplicationManager.getApplication.runReadAction(new Computable[String] {
      def compute: String = {
        clazz match {
          case obj: ScObject => obj.qualifiedName + "$"
          case tr: ScTrait => tr.qualifiedName
          case templDef: ScTemplateDefinition => templDef.qualifiedName
          case psiClass => psiClass.getQualifiedName
        }
      }
    })
  }
}

package org.jetbrains.plugins.scala
package debugger

import com.intellij.debugger.NameMapper
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.util.Computable
import com.intellij.psi.PsiClass
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTemplateDefinition, ScTrait}

/**
*@author ilyas
*/
class ScalaJVMNameMapper extends NameMapper {
  def getQualifiedName(@NotNull clazz: PsiClass): String = {
    ApplicationManager.getApplication.runReadAction(new Computable[String] {
      def compute: String = {
        clazz match {
          case obj: ScObject => obj.qualifiedName + "$"
          case tr: ScTrait => tr.qualifiedName
          case templDef: ScTemplateDefinition => templDef.qualifiedName
          case psiClass => null
        }
      }
    })
  }
}

Fix compatible problem with other NameMapper

IDEA's com.intellij.debugger.impl.DebuggerManagerImpl#getVMClassQualifiedName will iterate all registered NameMapper and return the first not null result from NameMapper.

When install Scala plugin with another plugin which also register a NameMapper to DebugManager, Scala's ScalaJVMNameMapper will return a not null value when the class is not a Scala object. This cause the follow NameMappers dit not got any chance to execute.

Return a null when it is not a Scala object will fix this bug.


package org.continuumio

package object bokeh {
    case class Percent(value: Double) {
        require(0.0 <= value && value <= 1.0)
    }

    implicit class IntPercent(value: Int) {
        def %% : Percent = Percent(value.toDouble/100)
    }

    def uuid4(): String = java.util.UUID.randomUUID.toString

    def snakify(name: String): String =
        name.replaceAll("([A-Z]+)([A-Z][a-z])", "$1_$2")
            .replaceAll("([a-z\\d])([A-Z])", "$1_$2")
            .toLowerCase
}

package org.continuumio

package object bokeh {
    case class Percent(value: Double) {
        require(0.0 <= value && value <= 1.0)
    }

    implicit class IntPercent(value: Int) {
        def %% : Percent = Percent(value.toDouble/100)
    }

    implicit def DoublePercent(value: Double): Percent = Percent(value)

    def uuid4(): String = java.util.UUID.randomUUID.toString

    def snakify(name: String): String =
        name.replaceAll("([A-Z]+)([A-Z][a-z])", "$1_$2")
            .replaceAll("([a-z\\d])([A-Z])", "$1_$2")
            .toLowerCase
}

Add implicit conversion from Double to Percent


package com.davebsoft.sctw.ui

import java.awt.{Component, Color}
import javax.swing.table.{DefaultTableCellRenderer, TableCellRenderer}
import javax.swing.{JTextArea, JTable}

/**
 * Word wrapping renderer.
 * @author Dave Briccetti
 */

class WordWrappingCellRenderer extends JTextArea with TableCellRenderer {
  setLineWrap(true)
  setWrapStyleWord(true)
  val renderer = new DefaultTableCellRenderer

  override def getTableCellRendererComponent(table: JTable, value: Any,
      isSelected: Boolean, hasFocus: Boolean, row: Int, column: Int): Component = {

    renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column)
    setForeground(renderer.getForeground)
    setBackground(renderer.getBackground)
    setBorder(renderer.getBorder)
    setText(renderer.getText)
    setSize(table.getColumnModel.getColumn(2).getWidth, 0)
    return this
  }

}

package com.davebsoft.sctw.ui

import java.awt.{Component, Color}
import javax.swing.table.{DefaultTableCellRenderer, TableCellRenderer}
import javax.swing.{JTextArea, JTable}

/**
 * Word wrapping renderer.
 * @author Dave Briccetti
 */

class WordWrappingCellRenderer extends TableCellRenderer {

  private val renderer = new DefaultTableCellRenderer

  override def getTableCellRendererComponent(table: JTable, value: Any,
          isSelected: Boolean, hasFocus: Boolean, row: Int, column: Int): Component = {

    /*
    Normally, this class would extend JTextArea, but I found that certain text (Hebrew, I believe)
    “breaks” the JTextArea and causes all further rendering to appear in an ugly font (despite
    attempts to reset the font). To work around, I’m creating a new JTextArea for every cell.
     */
    renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column)
    val ta = new JTextArea {
      setLineWrap(true)
      setWrapStyleWord(true)
      setForeground(renderer.getForeground)
      setBackground(renderer.getBackground)
      setBorder(renderer.getBorder)
      setText(renderer.getText)
    }
    return ta
  }

}

Work around problem with Hebrew text “breaking” a JTextArea.


package com.sageserpent.plutonium

/**
 * Created by Gerard on 09/07/2015.
 */
trait Bitemporal[Raw] {
  def filter(predicate: Raw => Boolean): Bitemporal[Raw]

  def map[Raw2](transform: Raw => Raw2): Bitemporal[Raw2]

  def flatMap[Raw2](stage: Raw => Bitemporal[Raw2]): Bitemporal[Raw2]
}

// This companion object can produce a bitemporal instance that refers to zero, one or many raw instances depending
// how many of those raw instances match the id or wildcard.
object Bitemporal{
  def apply[Raw](raw: Raw) = new BitemporalReferenceImplementation[Raw](raw)

  def withId[Raw <: Identified](id: Raw#Id): Bitemporal[Raw] = ??? // TODO - don't we need a manifest type for 'Raw'?

  def wildcard[Raw <: Identified](): Bitemporal[Raw] = new BitemporalReferenceImplementation[Raw]

  def none[Raw]: Bitemporal[Raw] = new BitemporalReferenceImplementation[Raw]

  // TODO - something that makes Bitemporal[Instant] to provide a way of snooping into the scope's 'when' from within the monad.
}

package com.sageserpent.plutonium

/**
 * Created by Gerard on 09/07/2015.
 */
trait Bitemporal[Raw] {
  def filter(predicate: Raw => Boolean): Bitemporal[Raw]

  def map[Raw2](transform: Raw => Raw2): Bitemporal[Raw2]

  def flatMap[Raw2](stage: Raw => Bitemporal[Raw2]): Bitemporal[Raw2]
}

// This companion object can produce a bitemporal instance that refers to zero, one or many raw instances depending
// how many of those raw instances match the id or wildcard.
object Bitemporal{
  def apply[Raw](raw: Raw) = new BitemporalReferenceImplementation[Raw](raw)

  def withId[Raw <: Identified](id: Raw#Id): Bitemporal[Raw] = ??? // TODO - don't we need a manifest type for 'Raw'?

  def wildcard[Raw <: Identified](): Bitemporal[Raw] = new BitemporalReferenceImplementation[Raw]

  def none[Raw]: Bitemporal[Raw] = new BitemporalReferenceImplementation[Raw]

  // TODO - something that makes Bitemporal[Instant] to provide a way of snooping into the scope's 'when' from within the monad.

  // TODO - something that takes a bitemporal and then makes a time-shifted bitemporal from within the monad - for PnL.
}

Add in 'RichRandom.splitIntoNonEmptyPieces' and its tests - using a deliberately incorrect implementation which does indeed fail a single test.


package pl.touk.nussknacker.engine.lite

import cats.data.Validated.Valid
import cats.data.{Validated, ValidatedNel}
import cats.~>
import pl.touk.nussknacker.engine.api.context.ProcessCompilationError
import pl.touk.nussknacker.engine.api.context.ProcessCompilationError.CannotCreateObjectError
import pl.touk.nussknacker.engine.lite.api.customComponentTypes.CapabilityTransformer

import scala.language.higherKinds
import scala.reflect.runtime.universe.TypeTag

object capabilities {

  class FixedCapabilityTransformer[Target[_]](implicit targetTag: TypeTag[Target[Any]]) extends CapabilityTransformer[Target] {
    override def transform[From[_]](implicit tag: TypeTag[From[Any]]): ValidatedNel[ProcessCompilationError, From ~> Target] = {
      if (targetTag == tag) {
        Valid(new ~>[From, Target] {
          override def apply[A](fa: From[A]): Target[A] = fa.asInstanceOf[Target[A]]
        })
      } else {
        Validated.invalidNel(new CannotCreateObjectError(s"Cannot convert capability: $tag", ""))
      }
    }
  }

}

package pl.touk.nussknacker.engine.lite

import cats.data.Validated.Valid
import cats.data.{Validated, ValidatedNel}
import cats.~>
import pl.touk.nussknacker.engine.api.context.ProcessCompilationError
import pl.touk.nussknacker.engine.api.context.ProcessCompilationError.CannotCreateObjectError
import pl.touk.nussknacker.engine.lite.api.customComponentTypes.CapabilityTransformer

import scala.language.higherKinds
import scala.reflect.runtime.universe.TypeTag

object capabilities {

  //We are not using here TypeTag.equals since type prefix (tpe.pre) there is computed like this: targetTag.tpe == tag.tpe
  //It is a problem when FixedCapabilityTransformer[T] and T type are defined in the same object
  //In such a case in FixedCapabilityTransformer prefix of type T in TypeTag[T] is defined as UniqueThisType
  //but implicitly added tag: TypeTag[F] in transform method has prefix of type F defined as UniqueSingleType (despite that it is same type)
  def equalTags(targetTag: TypeTag[_], tag: TypeTag[_]): Boolean = {
    targetTag.mirror == tag.mirror && targetTag.tpe =:= tag.tpe
  }

  class FixedCapabilityTransformer[Target[_]](implicit targetTag: TypeTag[Target[Any]]) extends CapabilityTransformer[Target] {
    override def transform[From[_]](implicit tag: TypeTag[From[Any]]): ValidatedNel[ProcessCompilationError, From ~> Target] = {
      if (equalTags(targetTag, tag)) {
        Valid(new ~>[From, Target] {
          override def apply[A](fa: From[A]): Target[A] = fa.asInstanceOf[Target[A]]
        })
      } else {
        Validated.invalidNel(new CannotCreateObjectError(s"Cannot convert capability: $tag", ""))
      }
    }
  }

}

Fix issue with comparing typeTags in FixedCapabilityTransformer


scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.12.3",
  "org.http4s" %% "http4s-blaze-client" % "0.20.14",
  "org.http4s" %% "http4s-circe" % "0.20.14",
)

// Hack around a binary conflict in scalameta's dependency on
// fastparse as specified by sbt-doctest-0.9.5.
libraryDependencies += "org.scalameta" %% "scalameta" % "4.3.0"

scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.12.3",
  "org.http4s" %% "http4s-blaze-client" % "0.20.15",
  "org.http4s" %% "http4s-circe" % "0.20.15",
)

// Hack around a binary conflict in scalameta's dependency on
// fastparse as specified by sbt-doctest-0.9.5.
libraryDependencies += "org.scalameta" %% "scalameta" % "4.3.0"

Update http4s-blaze-client, http4s-circe to 0.20.15


package uk.gov.dvla.vehicles.presentation.common.controllers

import play.api.Play.current
import play.api.i18n.Lang
import play.api.mvc.{Action, Controller}

object AlternateLanguages extends Controller {
  final val CyId = "cy"
  final val EnId = "en"
  val langCy = Lang(CyId)
  val langEn = Lang(EnId)

  def withLanguage(chosenLanguage: String) = Action { implicit request =>
    val refererOpt = request.headers.get(REFERER)
    val safeReferer = refererOpt.filter { _.stripPrefix("https://").stripPrefix("http://") startsWith request.host }

    safeReferer.map { ref =>
      Redirect(ref).withLang(Lang(chosenLanguage))
    } getOrElse NotFound("The link is invalid")
  }
}

package uk.gov.dvla.vehicles.presentation.common.controllers

import play.api.i18n.Lang
import play.api.Logger
import play.api.mvc.{Action, Controller}
import play.api.Play.current

object AlternateLanguages extends Controller {
  final val CyId = "cy"
  final val EnId = "en"
  val langCy = Lang(CyId)
  val langEn = Lang(EnId)

  def withLanguage(chosenLanguage: String) = Action { implicit request =>
    val refererOpt = request.headers.get(REFERER)
    val safeReferer = refererOpt.filter { _.stripPrefix("https://").stripPrefix("http://") startsWith request.host }

    Logger.debug(s"referrer $refererOpt host ${request.host}")

    safeReferer.map { ref =>
      Redirect(ref).withLang(Lang(chosenLanguage))
    } getOrElse NotFound("The link is invalid")
  }
}

Add logging for the referer issue

Add logging for the referer issue


package org.jetbrains.plugins.scala.packagesearch.configuration

import com.intellij.openapi.components.{BaseState, PersistentStateComponent, State, Storage}
import com.intellij.openapi.project.Project
import com.intellij.util.xmlb.annotations.OptionTag
import com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchGeneralConfiguration
import org.jetbrains.plugins.scala.packagesearch.utils.SbtCommon

@State(
  name = "PackageSearchMavenConfiguration",
  storages = Array(new Storage(PackageSearchGeneralConfiguration.StorageFileName))
)
class PackageSearchSbtConfiguration extends BaseState with PersistentStateComponent[PackageSearchSbtConfiguration] {
  override def getState: PackageSearchSbtConfiguration = this

  override def loadState(state: PackageSearchSbtConfiguration): Unit = this.copyFrom(state)

  @OptionTag("SBT_SCOPES_DEFAULT")
  var defaultSbtScope: String = SbtCommon.defaultLibScope

  def determineDefaultSbtConfiguration: String = {
    if (defaultSbtScope != null && defaultSbtScope.nonEmpty) defaultSbtScope
    else SbtCommon.defaultLibScope
  }

  def getSbtConfigurations: Array[String] = SbtCommon.libScopes.split(',').map(_.trim).filter(_.nonEmpty)
}

object packageSearchSbtConfigurationForProject {
  def getService(project: Project): PackageSearchSbtConfiguration = project.getService(classOf[PackageSearchSbtConfiguration])
}

package org.jetbrains.plugins.scala.packagesearch.configuration

import com.intellij.openapi.components.{BaseState, PersistentStateComponent, State, Storage}
import com.intellij.openapi.project.Project
import com.intellij.util.xmlb.annotations.OptionTag
import com.jetbrains.packagesearch.intellij.plugin.configuration.PackageSearchGeneralConfiguration
import org.jetbrains.plugins.scala.packagesearch.utils.SbtCommon

@State(
  name = "PackageSearchSbtConfiguration",
  storages = Array(new Storage(PackageSearchGeneralConfiguration.StorageFileName))
)
class PackageSearchSbtConfiguration extends BaseState with PersistentStateComponent[PackageSearchSbtConfiguration] {
  override def getState: PackageSearchSbtConfiguration = this

  override def loadState(state: PackageSearchSbtConfiguration): Unit = this.copyFrom(state)

  @OptionTag("SBT_SCOPES_DEFAULT")
  var defaultSbtScope: String = SbtCommon.defaultLibScope

  def determineDefaultSbtConfiguration: String = {
    if (defaultSbtScope != null && defaultSbtScope.nonEmpty) defaultSbtScope
    else SbtCommon.defaultLibScope
  }

  def getSbtConfigurations: Array[String] = SbtCommon.libScopes.split(',').map(_.trim).filter(_.nonEmpty)
}

object packageSearchSbtConfigurationForProject {
  def getService(project: Project): PackageSearchSbtConfiguration = project.getService(classOf[PackageSearchSbtConfiguration])
}

Fix the issue SCL-19097 (Conflicting component name 'PackageSearchMavenConfiguration' exception thrown when opening sbt settings)


package org.programmiersportgruppe.redis

import org.scalatest.FunSuite
import akka.util.ByteString

class ByteStringReaderTest extends FunSuite {

  test("Can extract prefix of a given length") {
    val byteString = ByteString("This is a string")
    val reader = new ByteStringReader(byteString, 0)

    val (extracted, remainder) = reader.extract(10)

    assertResult(Some(ByteString("This is a ")))(extracted)
    assertResult(new ByteStringReader(byteString, 10))(remainder)
  }

  test("Gives none when trying to extract more bytes than available") {
    val byteString = ByteString("This is a string")
    val reader = new ByteStringReader(byteString, 0)

    val (extracted, remainder) = reader.extract(20)

    assertResult(None)(extracted)
    assertResult(reader)(remainder)
  }

}

package org.programmiersportgruppe.redis

import akka.util.ByteString
import org.programmiersportgruppe.redis.test.Test

class ByteStringReaderTest extends Test {

  behavior of "a byte string reader"

  it can "extract prefix of a given length" in {
    val byteString = ByteString("This is a string")
    val reader = new ByteStringReader(byteString, 0)

    val (extracted, remainder) = reader.extract(10)

    assertResult(Some(ByteString("This is a ")))(extracted)
    assertResult(new ByteStringReader(byteString, 10))(remainder)
  }

  it should "give None when trying to extract more bytes than available" in {
    val byteString = ByteString("This is a string")
    val reader = new ByteStringReader(byteString, 0)

    val (extracted, remainder) = reader.extract(20)

    assertResult(None)(extracted)
    assertResult(reader)(remainder)
  }

}

Use common base Test class

Use common base Test class


package coursier.cli.options.shared

import caseapp.{ExtraName => Short, HelpMessage => Help, _}
import coursier.cli.options.ResolveOptions

final case class SharedLaunchOptions(

  @Short("M")
  @Short("main")
    mainClass: String = "",

  @Short("J")
  @Help("Extra JARs to be added to the classpath of the launched application. Directories accepted too.")
    extraJars: List[String] = Nil,

  @Recurse
    sharedLoaderOptions: SharedLoaderOptions = SharedLoaderOptions(),

  @Recurse
    resolveOptions: ResolveOptions = ResolveOptions(),

  @Recurse
    artifactOptions: ArtifactOptions = ArtifactOptions()
)

object SharedLaunchOptions {
  implicit val parser = Parser[SharedLaunchOptions]
  implicit val help = caseapp.core.help.Help[SharedLaunchOptions]
}

package coursier.cli.options.shared

import caseapp.{ExtraName => Short, HelpMessage => Help, _}
import coursier.cli.options.ResolveOptions

final case class SharedLaunchOptions(

  @Short("M")
  @Short("main")
    mainClass: String = "",

  @Help("Extra JARs to be added to the classpath of the launched application. Directories accepted too.")
    extraJars: List[String] = Nil,

  @Recurse
    sharedLoaderOptions: SharedLoaderOptions = SharedLoaderOptions(),

  @Recurse
    resolveOptions: ResolveOptions = ResolveOptions(),

  @Recurse
    artifactOptions: ArtifactOptions = ArtifactOptions()
)

object SharedLaunchOptions {
  implicit val parser = Parser[SharedLaunchOptions]
  implicit val help = caseapp.core.help.Help[SharedLaunchOptions]
}

Remove -J option from launch command

Remove -J option from launch command

Just use `--extra-jars` instead. Conflict with -J in the bootstrap
command in subsequent commits else.


import sbt._, Keys._

object Dependencies {
  val servletApiDep = "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.10.5"
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.0" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "1.3.0"
  val commonsIoVersion = "2.8.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "9.4.34.v20201102"
  val nettyVersion = "4.1.53.Final"
  val scalatestVersion = "3.2.2"
  val scalatestScalacheckVersion = "3.2.2.0"
  val json4sVersion = "3.6.10"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

import sbt._, Keys._

object Dependencies {
  val servletApiDep = "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.10.5"
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.0" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "1.3.0"
  val commonsIoVersion = "2.8.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "9.4.34.v20201102"
  val nettyVersion = "4.1.53.Final"
  val scalatestVersion = "3.2.3"
  val scalatestScalacheckVersion = "3.2.2.0"
  val json4sVersion = "3.6.10"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

Update scalatest, scalatest-core to 3.2.3


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.35"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.2",
      "com.ning" % "async-http-client" % "1.9.38",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.36"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.2",
      "com.ning" % "async-http-client" % "1.9.38",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.36


name := """akka-pusher-play-app"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  //"io.spray"             %%  "spray-json"    % "1.3.2",
  "com.github.dtaniwaki" %%  "akka-pusher"   % "0.1.4",
  //"com.typesafe.akka"    %%  "akka-slf4j"    % "2.3.14",
  specs2 % Test
)

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator

// For sbt-native-packager
javaOptions in Universal ++= Seq(
  // JVM memory tuning
  "-J-Xmx1024m",
  "-J-Xms512m",

  // Since play uses separate pidfile we have to provide it with a proper path
  s"-Dpidfile.path=/var/run/${packageName.value}/play.pid",

  // Use separate configuration file for production environment
  s"-Dconfig.file=/usr/share/${packageName.value}/conf/application.conf",

  // Use separate logger configuration file for production environment
  s"-Dlogger.file=/usr/share/${packageName.value}/conf/logback.xml"
)

Remove native packager options for now

Remove native packager options for now


name := "constraints"

organization := "fr.laas.fape"

version := "0.8-SNAPSHOT"

scalacOptions ++= Seq("-deprecation", "-feature")

libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.5" % "test"

libraryDependencies ++= Seq(
  "fr.laas.fape" %% "graphs" % "0.8-SNAPSHOT",
  "fr.laas.fape" %% "anml-parser" % "0.8-SNAPSHOT",
  "net.openhft" % "koloboke-api-jdk6-7" % "0.6.7",
  "net.openhft" % "koloboke-impl-jdk6-7" % "0.6.7" % "runtime"
//  "com.github.scala-blitz" %% "scala-blitz" % "1.1"
)

crossPaths := true

name := "constraints"

organization := "fr.laas.fape"

version := "0.8-SNAPSHOT"

resolvers += "FAPE Nightly Maven Repo" at "http://www.laas.fr/~abitmonn/maven/"

scalacOptions ++= Seq("-deprecation", "-feature")

libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.5" % "test"

libraryDependencies ++= Seq(
  "fr.laas.fape" %% "graphs" % "0.8-SNAPSHOT",
  "fr.laas.fape" %% "anml-parser" % "0.8-SNAPSHOT",
  "net.openhft" % "koloboke-api-jdk6-7" % "0.6.7",
  "net.openhft" % "koloboke-impl-jdk6-7" % "0.6.7" % "runtime"
//  "com.github.scala-blitz" %% "scala-blitz" % "1.1"
)

crossPaths := true

Add fape nightly repository as dependency resolver


name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.33"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.13",
      "org.scalatest" %% "scalatest" % "3.0.1" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.34"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.13",
      "org.scalatest" %% "scalatest" % "3.0.1" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.0.34


package generator

import com.gilt.apidocspec.models.Service
import models.TestHelper
import org.scalatest.{ ShouldMatchers, FunSpec }

class ScalaEnumsSpec extends FunSpec with ShouldMatchers {

  describe("for a model with 2 enum fields") {

    val json = """
    {
      "base_url": "http://localhost:9000",
      "name": "Api Doc",
      "enums": {
        "age_group": {
          "values": [
            { "name": "twenties" },
            { "name": "thirties" }
          ]
        },
        "genre": {
          "values": [
            { "name": "Classical" },
            { "name": "Jazz" }
          ]
        }
      },

      "models": {
        "user": {
          "fields": [
            { "name": "age_group", "type": "age_group" },
            { "name": "music", "type": "genre" }
          ]
        }
      }
    }
    """

    lazy val ssd = TestHelper.scalaService(json)

    it("generates valid models") {
      val enums = ssd.enums.map { ScalaEnums(_).build() }.mkString("\n\n")
      TestHelper.assertEqualsFile("test/resources/play2enums-example.txt", enums)
    }

    it("generates valid json conversions") {
      val jsonConversions = ssd.enums.map { ScalaEnums(_).buildJson("Test") }.mkString("\n\n")
      TestHelper.assertEqualsFile("test/resources/play2enums-json-example.txt", jsonConversions)
    }
  }

}

package generator

import com.gilt.apidocspec.models.Service
import models.TestHelper
import org.scalatest.{ ShouldMatchers, FunSpec }

class ScalaEnumsSpec extends FunSpec with ShouldMatchers {

  describe("for a model with 2 enum fields") {

    val json = TestHelper.buildJson("""
      "enums": [
        {
          "name": "age_group",
          "values": [
            { "name": "twenties" },
            { "name": "thirties" }
          ]
        },
        {
          "name": "genre",
          "values": [
            { "name": "Classical" },
            { "name": "Jazz" }
          ]
        }
      ],

      "models": [
        {
          "name": "user",
          "plural": "users",
          "fields": [
            { "name": "age_group", "type": "age_group", "required": true },
            { "name": "music", "type": "genre", "required": true }
          ]
        }
      ]
    """)

    lazy val ssd = TestHelper.scalaService(json)

    it("generates valid models") {
      val enums = ssd.enums.map { ScalaEnums(_).build() }.mkString("\n\n")
      TestHelper.assertEqualsFile("test/resources/play2enums-example.txt", enums)
    }

    it("generates valid json conversions") {
      val jsonConversions = ssd.enums.map { ScalaEnums(_).buildJson("Test") }.mkString("\n\n")
      TestHelper.assertEqualsFile("test/resources/play2enums-json-example.txt", jsonConversions)
    }
  }

}

Update JSON to latest service version

Update JSON to latest service version