package uk.ac.wellcome.platform.reindex.reindex_worker.config

import com.typesafe.config.Config
import grizzled.slf4j.Logging
import uk.ac.wellcome.config.core.builders.EnrichConfig._
import uk.ac.wellcome.json.JsonUtil._
import uk.ac.wellcome.platform.reindex.reindex_worker.models.ReindexJobConfig

object ReindexJobConfigBuilder extends Logging {
  def buildReindexJobConfigMap(config: Config): Map[String, ReindexJobConfig] = {
    val jsonString = config.required("reindexer.jobConfig")
    val configMap = fromJson[Map[String, ReindexJobConfig]](jsonString).getOrElse(
      throw new RuntimeException(s"Unable to parse reindexer.jobConfig: <<$jsonString>>")
    )

    info(s"Read config map $configMap")
    configMap
  }
}

package uk.ac.wellcome.platform.reindex.reindex_worker.config

import com.typesafe.config.Config
import grizzled.slf4j.Logging
import uk.ac.wellcome.config.core.builders.EnrichConfig._
import uk.ac.wellcome.json.JsonUtil._
import uk.ac.wellcome.platform.reindex.reindex_worker.models.ReindexJobConfig

object ReindexJobConfigBuilder extends Logging {
  def buildReindexJobConfigMap(config: Config): Map[String, ReindexJobConfig] = {
    val jsonString = config.required[String]("reindexer.jobConfig")
    val configMap = fromJson[Map[String, ReindexJobConfig]](jsonString).getOrElse(
      throw new RuntimeException(s"Unable to parse reindexer.jobConfig: <<$jsonString>>")
    )

    info(s"Read config map $configMap")
    configMap
  }
}

Make sure to type this `config.required` call


name := "geocss"

libraryDependencies <++= gtVersion { v =>
  Seq(
    "org.geotools" % "gt-main" % v,
    "org.geotools" % "gt-cql" % v
  )
}

libraryDependencies +=
  "org.specs2" %% "specs2" % "1.7.1" % "test"

initialCommands += """
import org.geoscript.geocss._
import collection.JavaConversions._
val kb = dwins.logic.Knowledge.Oblivion(SelectorsAreSentential)
def in(path: String) = new java.io.FileReader(new java.io.File(path))
def load(path: String) = CssParser.parseAll(CssParser.styleSheet, in(path)).get
val tx = new Translator()
"""

name := "geocss"

libraryDependencies <++= gtVersion { v =>
  Seq(
    "org.geotools" % "gt-main" % v,
    "org.geotools" % "gt-cql" % v
  )
}

libraryDependencies +=
  "org.specs2" %% "specs2" % "1.7.1" % "test"

initialCommands += """
import org.{ geotools => gt }
import org.opengis.{ filter => ogc }
import org.geoscript._
import gt.filter.text.ecql.ECQL.{ toFilter => cql }
import geocss.filter.FiltersAreSentential
import support.logic.Sentential, support.logic.Knowledge.Oblivion
def reduce[P : Sentential](p: P) = Oblivion[P].reduce(p)
def in(path: String) = new java.io.FileReader(new java.io.File(path))
def load(path: String) =
  geocss.CssParser.parseAll(
    geocss.CssParser.styleSheet, in(path)
  ).get
val tx = new geocss.Translator()
"""

Fix up console preamble for geocss module


package ch.usi.inf.l3.sana.ooj.ast.augmenters

import ch.usi.inf.l3.sana
import sana.tiny.ast.SimpleUseTree
import sana.tiny.symbols.Symbol

trait AugmentedSimpleUseTree {

  def tree: SimpleUseTree

  def enclosing: Option[Symbol] =
    tree.attributes.get('enclosing).map(_.asInstanceOf[Symbol])

  def enclosing_=(enclosing: Symbol): Unit =
    tree.attributes = tree.attributes + ('enclosing -> enclosing)

}

package ch.usi.inf.l3.sana.ooj.ast.augmenters

import ch.usi.inf.l3.sana
import sana.tiny.ast.SimpleUseTree
import sana.tiny.symbols.Symbol

trait AugmentedSimpleUseTree {

  def tree: SimpleUseTree

  def enclosing: Option[Symbol] =
    tree.attributes.get('enclosing).map(_.asInstanceOf[Symbol])

  def enclosing_=(enclosing: Symbol): Unit =
    tree.attributes = tree.attributes + ('enclosing -> enclosing)

  def shouldBeStatic: Boolean =
    tree.attributes.get('shouldBeStatic)
      .map(_.asInstanceOf[Boolean]).getOrElse(false)

  def shouldBeStatic_=(shouldBeStatic: Boolean): Unit =
    tree.attributes = tree.attributes + ('shouldBeStatic -> shouldBeStatic)

}

Add shouldBeStatic field for SimpleUseAugmenters


package se.marcuslonnberg.scaladocker.remote.api

import java.io.File

import akka.actor.ActorSystem
import akka.stream.MaterializerSettings
import akka.stream.scaladsl2.{FutureSink, FlowFrom, FlowMaterializer}
import akka.testkit.TestKit
import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
import org.scalatest.{BeforeAndAfterAll, Matchers, FlatSpecLike}
import se.marcuslonnberg.scaladocker.remote.models.{BuildMessages, ImageName}

class BuildImageApiSpec extends TestKit(ActorSystem("image-api")) with FlatSpecLike with Matchers with ScalaFutures with BeforeAndAfterAll with IntegrationPatience {
  implicit val mat = FlowMaterializer(MaterializerSettings(system))

  val client = DockerClient()

  val imageName = ImageName("scaladocker/image-build")

  "Build image API" should "run commands from the Dockerfile in the root of the tar archive" in {
    val tarArchive = TarArchive(
      inDir = new File(getClass.getResource("simple-build-image").getFile),
      out = File.createTempFile("simple-build-image", ".tar"))

    val buildOutput = client.images.build(imageName, tarArchive)

    val future = FutureSink[Boolean]
    val matFlow = FlowFrom(buildOutput).collect {
      case BuildMessages.Output(out) if out.contains("yippee ki yay") => true
    }.withSink(future).run()

    future.future(matFlow).futureValue shouldEqual true
  }
}

package se.marcuslonnberg.scaladocker.remote.api

import java.io.File

import akka.actor.ActorSystem
import akka.stream.MaterializerSettings
import akka.stream.scaladsl2.{FutureSink, FlowFrom, FlowMaterializer}
import akka.testkit.TestKit
import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
import org.scalatest.{BeforeAndAfterAll, Matchers, FlatSpecLike}
import se.marcuslonnberg.scaladocker.remote.models.{BuildMessages, ImageName}

class BuildImageApiSpec extends TestKit(ActorSystem("build-image-api")) with FlatSpecLike with Matchers with ScalaFutures with BeforeAndAfterAll with IntegrationPatience {
  implicit val mat = FlowMaterializer(MaterializerSettings(system))

  val client = DockerClient()

  val imageName = ImageName("scaladocker/image-build")

  "Build image API" should "run commands from the Dockerfile in the root of the tar archive" in {
    val tarArchive = TarArchive(
      inDir = new File(getClass.getResource("simple-build-image").getFile),
      out = File.createTempFile("simple-build-image", ".tar"))

    val buildOutput = client.images.build(imageName, tarArchive)

    val future = FutureSink[Boolean]
    val matFlow = FlowFrom(buildOutput).collect {
      case BuildMessages.Output(out) if out.contains("yippee ki yay") => true
    }.withSink(future).run()

    future.future(matFlow).futureValue shouldEqual true
  }
}

Change actor system name in test

Change actor system name in test


/*
 * Copyright 2017 Mediative
 *
 * 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 com.mediative.sangria.codegen

import scala.annotation.compileTimeOnly
import scala.annotation.StaticAnnotation
import scala.meta._

@compileTimeOnly("@GraphQLDomain not expanded")
class GraphQLDomain(operations: String, schema: String) extends StaticAnnotation {
  inline def apply(defn: Any): Any = meta {
    val (schemaPath, operationsPath) = this match {
      case q"new $_(${Lit.String(schemaPath)}, ${Lit.String(operationsPath)})" =>
        (schemaPath, operationsPath)
      case _ =>
        abort("@GraphQLDomain requires a schema path and operations path")
    }

    defn match {
      case q"object $tname { ..$stats }" =>
        val client = SangriaCodegen(schemaPath, operationsPath).generate()
        val out  = q"""
          object $tname {
            ..$client
            ..$stats
          }
        """
        println("==============================================")
        println(out)
        println("==============================================")
        out

      case _ =>
        abort("@GraphQLDomain must annotate an object.")
    }
  }
}

/*
 * Copyright 2017 Mediative
 *
 * 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 com.mediative.sangria.codegen

import scala.annotation.compileTimeOnly
import scala.annotation.StaticAnnotation
import scala.meta._

@compileTimeOnly("@GraphQLDomain not expanded")
class GraphQLDomain(operations: String, schema: String) extends StaticAnnotation {
  inline def apply(defn: Any): Any = meta {
    val (schemaPath, operationsPath) = this match {
      case q"new $_(${Lit.String(schemaPath)}, ${Lit.String(operationsPath)})" =>
        (schemaPath, operationsPath)
      case _ =>
        abort("@GraphQLDomain requires a schema path and operations path")
    }

    defn match {
      case q"object $tname { ..$stats }" =>
        val client = SangriaCodegen(schemaPath, operationsPath).generate()
        q"""
          object $tname {
            ..$client
            ..$stats
          }
        """

      case _ =>
        abort("@GraphQLDomain must annotate an object.")
    }
  }
}

Remove debug printing from the macro annotation


package com.microsoft.partnercatalyst.fortis.spark

object Constants {
  val SparkAppName = "project-fortis-spark"
  val SparkMasterDefault = "local[*]"
  val SparkStreamingBatchSizeDefault = 1

  val EventHubProgressDir = "eventhubProgress"

  object Env {
    val HighlyAvailableProgressDir = "HA_PROGRESS_DIR"
    val AppInsightsKey = "FORTIS_APPINSIGHTS_IKEY"
    val LanguageModelDir = "FORTIS_MODELS_DIRECTORY"
    val FeatureServiceUrlBase = "FORTIS_FEATURE_SERVICE_HOST"
    val OxfordVisionToken= "OXFORD_VISION_TOKEN"
    val OxfordLanguageToken = "OXFORD_LANGUAGE_TOKEN"
    val BlobUrlBase = "FORTIS_BLOB_HOST"
  }
}

package com.microsoft.partnercatalyst.fortis.spark

object Constants {
  val SparkAppName = "project-fortis-spark"
  val SparkMasterDefault = "local[*]"
  val SparkStreamingBatchSizeDefault = 1

  val EventHubProgressDir = "eventhubProgress"

  object Env {
    val HighlyAvailableProgressDir = "HA_PROGRESS_DIR"
    val AppInsightsKey = "FORTIS_APPINSIGHTS_IKEY"
    val LanguageModelDir = "FORTIS_MODELS_DIRECTORY"
    val FeatureServiceUrlBase = "FORTIS_FEATURE_SERVICE_HOST"
    val OxfordVisionToken= "OXFORD_VISION_TOKEN"
    val OxfordLanguageToken = "OXFORD_LANGUAGE_TOKEN"
    val BlobUrlBase = "FORTIS_CENTRAL_ASSETS_HOST"
  }
}

Update to correct environment variable name

See
https://github.com/CatalystCode/fortisdeploy/blob/3a2ee0c2fdf28c6a404b4af1f4b876ebf2bfe0df/ops/setup-environment.sh#L35


latestVersion in ThisBuild := "0.9.0"
latestBinaryCompatibleVersion in ThisBuild := Some("0.9.0")
unreleasedModuleNames in ThisBuild := Set()

latestVersion in ThisBuild := "0.9.1"
latestBinaryCompatibleVersion in ThisBuild := Some("0.9.1")
unreleasedModuleNames in ThisBuild := Set()

Set latest version to 0.9.1

Set latest version to 0.9.1


package hmda.geo.client.api.model.census

case class HMDAGeoTractResult(
  statefp: String,
  countyfp: String,
  tractce: String,
  geoid: String,
  namelsad: String,
  mtfcc: String,
  funcstat: String,
  aland: Double,
  awater: Double,
  intptlat: String,
  intptlon: String)

package hmda.geo.client.api.model.census

object HMDAGeoTractResult {
  def empty: HMDAGeoTractResult = HMDAGeoTractResult("", "", "", "", "", "", "", 0.0, 0.0, "", "")
}

case class HMDAGeoTractResult(
  statefp: String,
  countyfp: String,
  tractce: String,
  geoid: String,
  namelsad: String,
  mtfcc: String,
  funcstat: String,
  aland: Double,
  awater: Double,
  intptlat: String,
  intptlon: String)

Add empty result for client

Add empty result for client


import sbt._
import Keys._

object DottyInjectedPlugin extends AutoPlugin {
  override def requires = plugins.JvmPlugin
  override def trigger = allRequirements

  override val projectSettings = Seq(
    scalaVersion := sys.props("plugin.scalaVersion"),
    scalacOptions += "-source:3.0-migration
  )
}

import sbt._
import Keys._

object DottyInjectedPlugin extends AutoPlugin {
  override def requires = plugins.JvmPlugin
  override def trigger = allRequirements

  override val projectSettings = Seq(
    scalaVersion := sys.props("plugin.scalaVersion"),
    scalacOptions += "-source:3.0-migration"
  )
}

Fix typo breaking sbt scripted tests

Fix typo breaking sbt scripted tests


package org.scalaide.refactoring.internal

import org.scalaide.core.internal.formatter.FormatterPreferences
import scala.tools.refactoring.Refactoring

import scalariform.formatter.preferences.SpaceInsideParentheses

/**
 * Enables passing the user's source formatting preferences to the refactoring library's
 * source code generation.
 */
trait UserPreferencesFormatting {
  this: ScalaIdeRefactoring =>

  /**
   * Refactoring actions should mix in this trait when creating a refactoring instance to
   * automatically pass the user's formatting preferences to the refactoring implementation.
   */
  trait FormattingOverrides {
    this: Refactoring =>

    override val spacingAroundMultipleImports: String = {
      for {
        javaProject <- Option(file.getJavaProject)
        prefs = FormatterPreferences.getPreferences(javaProject)
        if  prefs(SpaceInsideParentheses)
      } yield " "
    } getOrElse ""

    // TODO: Create more overrides here and in the refactoring library.
  }
}

package org.scalaide.refactoring.internal

import org.scalaide.core.internal.formatter.FormatterPreferences
import scala.tools.refactoring.Refactoring

import scalariform.formatter.preferences.SpaceInsideParentheses

/**
 * Enables passing the user's source formatting preferences to the refactoring library's
 * source code generation.
 */
trait UserPreferencesFormatting {
  this: ScalaIdeRefactoring =>

  /**
   * Refactoring actions should mix in this trait when creating a refactoring instance to
   * automatically pass the user's formatting preferences to the refactoring implementation.
   */
  trait FormattingOverrides {
    this: Refactoring =>

    override val spacingAroundMultipleImports: String = " "

    // TODO: Create more overrides here and in the refactoring library.
  }
}

Make organize imports format consistent with scalariform

We used to pass the IDE's SpaceInsideParentheses setting to scala-refactoring to control the spaces inside the braces of multiple imports, like this:

import a.b.{ c, d }

Unfortunately, in scalariform SpaceInsideParentheses only affects the space around regular parenthesis, and there is no setting for the spaces in imports. So to make the code generated by scala-refactoring consistent with the formatting of scalariform, we always print a space inside multiple imports.

Fixes scala-ide/scala-refactoring#81.


package org.scalatra
package scalate

import java.io.PrintWriter
import javax.servlet.{ServletContext, ServletConfig, FilterConfig}
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.fusesource.scalate.TemplateEngine
import org.fusesource.scalate.servlet.{ServletRenderContext, ServletTemplateEngine}

trait ScalateSupport extends Initializable {
  self: {
    def servletContext: ServletContext
    def request: HttpServletRequest
    def response: HttpServletResponse
  } =>

  protected var templateEngine: TemplateEngine = _

  abstract override def initialize(config: Config) {
    super.initialize(config)
    templateEngine = createTemplateEngine(config)
  }

  protected def createTemplateEngine(config: Config) =
    config match {
      case servletConfig: ServletConfig =>
        new ServletTemplateEngine(servletConfig) with CreatesServletRenderContext
      case filterConfig: FilterConfig =>
        new ServletTemplateEngine(filterConfig) with CreatesServletRenderContext
      case _ =>
        // Don't know how to convert your Config to something that
        // ServletTemplateEngine can accept, so fall back to a TemplateEngine
        new TemplateEngine with CreatesServletRenderContext
    }

  trait CreatesServletRenderContext {
    this: TemplateEngine =>

    override def createRenderContext(uri: String, out: PrintWriter) =
      ScalateSupport.this.createRenderContext
  }

  def createRenderContext: ServletRenderContext =
    new ServletRenderContext(templateEngine, request, response, servletContext)

  def renderTemplate(path: String, attributes: (String, Any)*) =
    createRenderContext.render(path, Map(attributes : _*))
}

package org.scalatra
package scalate

import java.io.PrintWriter
import javax.servlet.{ServletContext, ServletConfig, FilterConfig}
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.fusesource.scalate.TemplateEngine
import org.fusesource.scalate.servlet.{ServletRenderContext, ServletTemplateEngine}

trait ScalateSupport extends ScalatraKernel {
  self: {
    def servletContext: ServletContext
  } =>

  protected var templateEngine: TemplateEngine = _

  abstract override def initialize(config: Config) {
    super.initialize(config)
    templateEngine = createTemplateEngine(config)
  }

  protected def createTemplateEngine(config: Config) =
    config match {
      case servletConfig: ServletConfig =>
        new ServletTemplateEngine(servletConfig) with ScalatraTemplateEngine
      case filterConfig: FilterConfig =>
        new ServletTemplateEngine(filterConfig) with ScalatraTemplateEngine
      case _ =>
        // Don't know how to convert your Config to something that
        // ServletTemplateEngine can accept, so fall back to a TemplateEngine
        new TemplateEngine with ScalatraTemplateEngine
    }

  trait ScalatraTemplateEngine {
    this: TemplateEngine =>

    override def createRenderContext(uri: String, out: PrintWriter) =
      ScalateSupport.this.createRenderContext

    override def isDevelopmentMode = ScalateSupport.this.isDevelopmentMode
  }

  def createRenderContext: ServletRenderContext =
    new ServletRenderContext(templateEngine, request, response, servletContext)

  def renderTemplate(path: String, attributes: (String, Any)*) =
    createRenderContext.render(path, Map(attributes : _*))
}

Synchronize development mode flag on template engine with kernel's.


/* Copyright (C) 2015 University of Massachusetts Amherst.
   This file is part of “author_coref”
   http://github.com/iesl/author_coref
   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 edu.umass.cs.iesl.author_coref.data_structures

trait PersonName extends CubbieWithHTMLFormatting{

  val firstName = new StringSlot("firstName")
  val middleNames = new StringListSlot("middleNames")
  val lastName = new StringSlot("lastName")
  val suffixes = new StringSlot("suffixes")

}

/* Copyright (C) 2015 University of Massachusetts Amherst.
   This file is part of “author_coref”
   http://github.com/iesl/author_coref
   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 edu.umass.cs.iesl.author_coref.data_structures

trait PersonName extends CubbieWithHTMLFormatting{

  val firstName = new StringSlot("firstName")
  val middleNames = new StringListSlot("middleNames")
  val lastName = new StringSlot("lastName")
  val suffixes = new StringListSlot("suffixes")

}

Make suffixes be a list slot

Make suffixes be a list slot


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.24"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.1",
      "com.ning" % "async-http-client" % "1.9.36",
      "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.25"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.1",
      "com.ning" % "async-http-client" % "1.9.36",
      "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.25


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6", "2.11.12", "2.10.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % 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.1.78"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6", "2.11.12", "2.10.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % 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.1.79"

autocommit: Update configuration to record version 0.1.79


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.10"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.4.6",
      "com.ning" % "async-http-client" % "1.9.32",
      "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.7"

version := "0.0.11"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.4.6",
      "com.ning" % "async-http-client" % "1.9.32",
      "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")
  }
}

Increment version from 0.0.10 => 0.0.11

Increment version from 0.0.10 => 0.0.11


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.1"

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.3.2"

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.3.2


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

crossScalaVersions := Seq("2.11.7")

version := "0.0.9"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      "org.scalatest" %% "scalatest" % "2.2.5" % "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 play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

crossScalaVersions := Seq("2.11.7")

version := "0.0.10"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      "org.scalatest" %% "scalatest" % "2.2.5" % "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")
  }
}

Increment version from 0.0.9 => 0.0.10

Increment version from 0.0.9 => 0.0.10


name := "logback-journal"

organization := "org.gnieh"

version := "0.0.1-SNAPSHOT"

libraryDependencies += "net.java.dev.jna" % "jna" % "4.1.0"

libraryDependencies += "ch.qos.logback"  % "logback-classic" % "1.1.1"

name := "logback-journal"

organization := "org.gnieh"

version := "0.0.1-SNAPSHOT"

javaOptions += "-Djna.nosys=true"

libraryDependencies += "net.java.dev.jna" % "jna" % "4.1.0"

libraryDependencies += "ch.qos.logback"  % "logback-classic" % "1.1.1"

Make sure to use local jna

Make sure to use local jna


organization := "com.github.nilsga"

name := "akka-persistence-elasticsearch"

version := "1.0.1"

scalaVersion := "2.11.6"

val akkaVersion = "2.4.0-RC3"

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))

parallelExecution in Test := false

credentials += Credentials(
  "Artifactory Realm",
  "oss.jfrog.org",
  sys.env.getOrElse("OSS_JFROG_USER", ""),
  sys.env.getOrElse("OSS_JFROG_PASS", "")
)

publishTo := {
  val jfrog = "https://oss.jfrog.org/artifactory/"
  if (isSnapshot.value)
    Some("OJO Snapshots" at jfrog + "oss-snapshot-local")
  else
    Some("OJO Releases" at jfrog + "oss-release-local")
}

libraryDependencies ++= Seq(
  "org.elasticsearch"  % "elasticsearch"             % "1.7.1",
  "com.sksamuel.elastic4s" %% "elastic4s-streams" % "1.7.4",
  "com.typesafe.akka"      %% "akka-persistence"                  % akkaVersion,
  "com.typesafe.akka"      %% "akka-slf4j"                        % akkaVersion % "test",
  "com.typesafe.akka"      %% "akka-persistence-tck"              % akkaVersion  % "test",
  "ch.qos.logback"         % "logback-classic" % "1.1.3" % "test"
)

organization := "com.github.nilsga"

name := "akka-persistence-elasticsearch"

version := "1.0.2-SNAPSHOT"

scalaVersion := "2.11.6"

val akkaVersion = "2.4.0-RC3"

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))

parallelExecution in Test := false

credentials += Credentials(
  "Artifactory Realm",
  "oss.jfrog.org",
  sys.env.getOrElse("OSS_JFROG_USER", ""),
  sys.env.getOrElse("OSS_JFROG_PASS", "")
)

publishTo := {
  val jfrog = "https://oss.jfrog.org/artifactory/"
  if (isSnapshot.value)
    Some("OJO Snapshots" at jfrog + "oss-snapshot-local")
  else
    Some("OJO Releases" at jfrog + "oss-release-local")
}

libraryDependencies ++= Seq(
  "org.elasticsearch"  % "elasticsearch"             % "1.7.1",
  "com.sksamuel.elastic4s" %% "elastic4s-streams" % "1.7.4",
  "com.typesafe.akka"      %% "akka-persistence"                  % akkaVersion,
  "com.typesafe.akka"      %% "akka-slf4j"                        % akkaVersion % "test",
  "com.typesafe.akka"      %% "akka-persistence-tck"              % akkaVersion  % "test",
  "ch.qos.logback"         % "logback-classic" % "1.1.3" % "test"
)

Prepare version number for 1.0.2

Prepare version number for 1.0.2


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.12"

crossScalaVersions := Seq("2.11.12")

version := "0.4.24"

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.12"

crossScalaVersions := Seq("2.11.12")

version := "0.4.25"

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.4.25


package io.taig.akka.http.phoenix

class TopicTest extends Suite {
    it should "parse regular topics" in {
        Topic.parse( "foo:bar" ) shouldBe Some( Topic( "foo", "bar" ) )
    }

    it should "parse broadcasts" in {
        Topic.parse( "foo" ) shouldBe Some( Topic( "foo" ) )
    }

    it should "fail to parse invalid topics" in {
        Topic.parse( "foo:bar:baz" ) shouldBe None
        Topic.parse( "foo:" ) shouldBe None
        Topic.parse( "" ) shouldBe None
        Topic.parse( " " ) shouldBe None
    }
}

package io.taig.akka.http.phoenix

class TopicTest extends Suite {
    "parse" should "handle regular topics" in {
        Topic.parse( "foo:bar" ) shouldBe Some( Topic( "foo", "bar" ) )
    }

    it should "handle broadcasts" in {
        Topic.parse( "foo" ) shouldBe Some( Topic( "foo" ) )
    }

    it should "fail to handle invalid topics" in {
        Topic.parse( "foo:bar:baz" ) shouldBe None
        Topic.parse( "foo:" ) shouldBe None
        Topic.parse( "" ) shouldBe None
        Topic.parse( " " ) shouldBe None
    }

    "isSubscribedTo" should "accept equal topics" in {
        val topic = Topic( "foo", "bar" )
        topic isSubscribedTo topic shouldBe true
    }

    it should "accept specific topics with broadcasts" in {
        Topic( "foo", "bar" ) isSubscribedTo Topic( "foo" ) shouldBe true
    }

    it should "deny invalid topics" in {
        Topic( "foo", "bar" ) isSubscribedTo Topic( "bar", "baz" ) shouldBe false
        Topic( "foo", "bar" ) isSubscribedTo Topic( "bar" ) shouldBe false
    }
}

Add tests for isSubscribedTo method

Add tests for isSubscribedTo method


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.14.2",
  "org.http4s" %% "http4s-ember-client" % "0.23.11",
  "org.http4s" %% "http4s-circe" % "0.23.11",
)

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.14.2",
  "org.http4s" %% "http4s-ember-client" % "0.23.12",
  "org.http4s" %% "http4s-circe" % "0.23.12",
)

Update http4s-circe, http4s-ember-client to 0.23.12 in series/0.23


import com.github.retronym.SbtOneJar._
import sbt.Credentials

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.96"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.flow" %% "lib-util" % "0.1.0",
      "io.flow" %% "apibuilder-validation" % "0.2.1",
      "com.typesafe.play" %% "play-json" % "2.6.10",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/"

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")
  }
}

import com.github.retronym.SbtOneJar._
import sbt.Credentials

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.97"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.flow" %% "lib-util" % "0.1.0",
      "io.flow" %% "apibuilder-validation" % "0.2.1",
      "com.typesafe.play" %% "play-json" % "2.6.10",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/"

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")
  }
}

autocommit: Update configuration to record version 0.1.97


import ScalaModulePlugin._

scalaModuleSettings

name               := "scala-swing"

version            := "2.0.1-SNAPSHOT"

scalaVersion       := crossScalaVersions.value.head

crossScalaVersions := Seq("2.11.8", "2.12.1")

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

// Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]]
scalaVersionsByJvm in ThisBuild := Map(
  8 -> List("2.11.11", "2.12.2", "2.13.0-M1").map(_ -> true)
)

OsgiKeys.exportPackage := Seq(s"scala.swing.*;version=${version.value}")

mimaPreviousVersion := None

// set the prompt (for this build) to include the project id.
shellPrompt in ThisBuild := { state => Project.extract(state).currentRef.project + "> " }

lazy val swing = project.in( file(".") )

lazy val examples = project.in( file("examples") )
  .dependsOn(swing)
  .settings(
    scalaVersion := (scalaVersion in swing).value,
    fork in run := true,
    fork := true
  )

lazy val uitest = project.in( file("uitest") )
  .dependsOn(swing)
  .settings(
    scalaVersion := (scalaVersion in swing).value,
    fork in run := true,
    fork := true
  )

import ScalaModulePlugin._

scalaModuleSettings

name               := "scala-swing"

version            := "2.0.1-SNAPSHOT"

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

// Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]]
scalaVersionsByJvm in ThisBuild := Map(
  8 -> List("2.11.11", "2.12.2", "2.13.0-M1").map(_ -> true)
)

OsgiKeys.exportPackage := Seq(s"scala.swing.*;version=${version.value}")

mimaPreviousVersion := None

// set the prompt (for this build) to include the project id.
shellPrompt in ThisBuild := { state => Project.extract(state).currentRef.project + "> " }

lazy val swing = project.in( file(".") )

lazy val examples = project.in( file("examples") )
  .dependsOn(swing)
  .settings(
    scalaVersion := (scalaVersion in swing).value,
    fork in run := true,
    fork := true
  )

lazy val uitest = project.in( file("uitest") )
  .dependsOn(swing)
  .settings(
    scalaVersion := (scalaVersion in swing).value,
    fork in run := true,
    fork := true
  )

Remove scala version settings, as now covered by scala module

Mistakenly added when merging with @lrytz changes


lazy val commonSettings = Seq(
  version := "1.0.0-beta9",
  scalaVersion := "2.12.2"
)

val guava = "com.google.guava" % "guava" % "21.0"
val scalaTest = "org.scalatest" % "scalatest_2.12" % "3.0.1" % "test"
val sprayJson = "io.spray" %% "spray-json" % "1.3.2"
val snakeYaml = "org.yaml" % "snakeyaml" % "1.17"

lazy val intellijHaskell = (project in file(".")).
  enablePlugins(SbtIdeaPlugin).
  settings(commonSettings: _*).
  settings(
    name := "IntelliJ Haskell",
    javacOptions in Global ++= Seq("-source", "1.8", "-target", "1.8"),
    scalacOptions in Global ++= Seq("-target:jvm-1.8", "-deprecation"),
    libraryDependencies += guava,
    libraryDependencies += scalaTest,
    libraryDependencies += sprayJson,
    libraryDependencies += snakeYaml,
    unmanagedSourceDirectories in Compile += baseDirectory.value / "gen",
    unmanagedJars in Compile += baseDirectory.value / "idea"
  )

ideaBuild in ThisBuild := "172.3317.76"

lazy val commonSettings = Seq(
  version := "1.0.0-beta9",
  scalaVersion := "2.12.3"
)

val guava = "com.google.guava" % "guava" % "21.0"
val scalaTest = "org.scalatest" % "scalatest_2.12" % "3.0.1" % "test"
val sprayJson = "io.spray" %% "spray-json" % "1.3.2"
val snakeYaml = "org.yaml" % "snakeyaml" % "1.18"

lazy val intellijHaskell = (project in file(".")).
  enablePlugins(SbtIdeaPlugin).
  settings(commonSettings: _*).
  settings(
    name := "IntelliJ Haskell",
    javacOptions in Global ++= Seq("-source", "1.8", "-target", "1.8"),
    scalacOptions in Global ++= Seq("-target:jvm-1.8", "-deprecation"),
    libraryDependencies += guava,
    libraryDependencies += scalaTest,
    libraryDependencies += sprayJson,
    libraryDependencies += snakeYaml,
    unmanagedSourceDirectories in Compile += baseDirectory.value / "gen",
    unmanagedJars in Compile += baseDirectory.value / "idea"
  )

ideaBuild in ThisBuild := "172.3544.18"

Upgrade to Scala 2.12.3. Upgrade of snakeyaml library.


/**
 * Copyright 2011-2014 eBusiness Information, Groupe Excilys (www.ebusinessinformation.fr)
 *
 * 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.app

/**
 * List of status codes returned by Gatling
 */
private[app] object GatlingStatusCodes {
  val Success = 0
  val InvalidArguments = 1
  val AssertionsFailed = 2
}

/**
 * Copyright 2011-2014 eBusiness Information, Groupe Excilys (www.ebusinessinformation.fr)
 *
 * 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.app

/**
 * List of status codes returned by Gatling
 */
object GatlingStatusCodes {
  val Success = 0
  val InvalidArguments = 1
  val AssertionsFailed = 2
}

Make exit codes constants public again

App: Make exit codes constants public again


package model

import com.amazonaws.services.autoscaling.model.{Instance => AwsAsgInstance, _}
import play.api.libs.json.Json

case class ASGMember(id: String, description: Option[String], uptime: String, version: Option[String],
                     state: Option[String], lifecycleState: Option[String], goodorbad: String, instance: Instance)

object ASGMember {
  implicit val memberWrites = Json.writes[ASGMember]

  def from(instance: Instance, asgInfo: Option[AwsAsgInstance], elbInfo: Option[ELBMember]): ASGMember = {
    def healthStatus = asgInfo.map(_.getHealthStatus)
    def lifecycleState = asgInfo.map(_.getLifecycleState)

    def lbState = elbInfo.map(_.state)
    def description = elbInfo.flatMap(_.description)

    def instanteState = instance.state

    def goodorbad = (healthStatus, lifecycleState, lbState, instanteState) match {
      case (_, Some("Pending"), _, _) | (_, Some("Terminating"), _, _) => "pending"
      case (Some("Healthy"), Some("InService"), Some("InService"), _) => "success"
      case (Some("Healthy"), Some("InService"), None, _) => "success"
      case (None, None, None, "running") => "success"
      case _ => "danger"
    }

    ASGMember(instance.id, description, instance.uptime, instance.version, lbState, lifecycleState, goodorbad, instance)
  }

}

package model

import com.amazonaws.services.autoscaling.model.{Instance => AwsAsgInstance, _}
import play.api.libs.json.Json

case class ASGMember(id: String, description: Option[String], uptime: String, version: Option[String],
                     state: Option[String], lifecycleState: Option[String], goodorbad: String, instance: Instance)

object ASGMember {
  implicit val memberWrites = Json.writes[ASGMember]

  def from(instance: Instance, asgInfo: Option[AwsAsgInstance], elbInfo: Option[ELBMember]): ASGMember = {
    def healthStatus = asgInfo.map(_.getHealthStatus)
    def lifecycleState = asgInfo.map(_.getLifecycleState)

    def lbState = elbInfo.map(_.state)
    def description = elbInfo.flatMap(_.description)

    def instanteState = instance.state

    def goodorbad = (healthStatus, lifecycleState, lbState, instanteState) match {
      case (_, Some("Pending"), _, _) | (_, Some("Terminating"), _, _) => "pending"
      case (Some("Healthy"), Some("InService"), Some("InService"), _) => "success"
      case (Some("Healthy"), Some("InService"), None, _) => "success"
      case (None, None, None, "running") => "success"
      case _ => "danger"
    }

    val truncatedId = {
      if(instance.id.length > 10) {
        s"${instance.id.take(8)}..."
      } else instance.id
    }

    ASGMember(truncatedId, description, instance.uptime, instance.version, lbState, lifecycleState, goodorbad, instance)
  }

}

Truncate the new instance ids if they are too long.


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.21"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.0",
      "com.ning" % "async-http-client" % "1.9.33",
      "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.22"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.0",
      "com.ning" % "async-http-client" % "1.9.33",
      "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.22


name := "Glint"

version := "0.1"

scalaVersion := "2.11.7"

// Akka

libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.4.0"

libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.4.0"

// Breeze native BLAS support

libraryDependencies += "org.scalanlp" %% "breeze" % "0.11.2"

libraryDependencies += "org.scalanlp" %% "breeze-natives" % "0.11.2"

// Unit tests

libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"

// Scala option parser

libraryDependencies += "com.github.scopt" %% "scopt" % "3.3.0"

// Logging

libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.1.0"

libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.1"

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.0.3"

// Resolvers

resolvers += Resolver.sonatypeRepo("public")

name := "Glint"

version := "0.1-SNAPSHOT"

organization := "ch.ethz.inf.da"

scalaVersion := "2.11.7"

crossScalaVersions := Seq("2.10.5", "2.11.7")

// Akka

libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.4.0"

libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.4.0"

// Breeze native BLAS support

libraryDependencies += "org.scalanlp" %% "breeze" % "0.11.2"

libraryDependencies += "org.scalanlp" %% "breeze-natives" % "0.11.2"

// Unit tests

libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test"

// Scala option parser

libraryDependencies += "com.github.scopt" %% "scopt" % "3.3.0"

// Logging

libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.1.0"

libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.1"

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.0.3"

// Resolvers

resolvers += Resolver.sonatypeRepo("public")

Add cross scala versions and organization


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

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.35"

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.36"

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.36


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.22"

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.3.23"

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.3.23


/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.spark.ml.h2o.models

object H2OMOJOProps {
  val serializedFileName = "mojo_model"
}

[SW-1187][Pre-step] Use H2OMojoModel to load mojo & mojo pipelines as well


package sttp.client.testing.websocket

import java.nio.channels.ClosedChannelException

import org.scalatest.Suite
import org.scalatest.flatspec.AsyncFlatSpecLike
import sttp.capabilities.WebSockets
import sttp.client.testing.HttpTest.wsEndpoint
import sttp.client._
import sttp.monad.MonadError
import sttp.client.testing.ConvertToFuture

import scala.concurrent.duration._
import scala.concurrent.duration.FiniteDuration
import sttp.monad.syntax._
import sttp.ws.WebSocket

trait WebSocketBufferOverflowTest[F[_]] { outer: Suite with AsyncFlatSpecLike with WebSocketTest[F] =>
  val backend: SttpBackend[F, WebSockets]
  implicit val monad: MonadError[F]
  implicit val convertToFuture: ConvertToFuture[F]
  def bufferCapacity: Int

  it should "error if incoming messages overflow the buffer" in {
    basicRequest
      .get(uri"$wsEndpoint/ws/echo")
      .response(asWebSocketAlways { (ws: WebSocket[F]) =>
        send(ws, bufferCapacity * 2).flatMap { _ =>
          eventually(10.millis, 500) {
            ws.isOpen().map(_ shouldBe false)
          }
        }
      })
      .send(backend)
      .map(_.body)
      .handleError {
        case _: ClosedChannelException => succeed.unit
      }
      .toFuture()
  }

  def eventually[T](interval: FiniteDuration, attempts: Int)(f: => F[T]): F[T]
}

package sttp.client.testing.websocket

import java.nio.channels.ClosedChannelException

import org.scalatest.Suite
import org.scalatest.flatspec.AsyncFlatSpecLike
import sttp.capabilities.WebSockets
import sttp.client.testing.HttpTest.wsEndpoint
import sttp.client._
import sttp.monad.MonadError
import sttp.client.testing.ConvertToFuture

import scala.concurrent.duration._
import scala.concurrent.duration.FiniteDuration
import sttp.monad.syntax._
import sttp.ws.WebSocket

trait WebSocketBufferOverflowTest[F[_]] { outer: Suite with AsyncFlatSpecLike with WebSocketTest[F] =>
  val backend: SttpBackend[F, WebSockets]
  implicit val monad: MonadError[F]
  implicit val convertToFuture: ConvertToFuture[F]
  def bufferCapacity: Int

  it should "error if incoming messages overflow the buffer" in {
    basicRequest
      .get(uri"$wsEndpoint/ws/echo")
      .response(asWebSocketAlways { (ws: WebSocket[F]) =>
        send(ws, bufferCapacity + 1).flatMap { _ =>
          eventually(100.millis, 500) {
            ws.isOpen().map(_ shouldBe false)
          }
        }
      })
      .send(backend)
      .map(_.body)
      .handleError {
        case _: ClosedChannelException => succeed.unit
      }
      .toFuture()
  }

  def eventually[T](interval: FiniteDuration, attempts: Int)(f: => F[T]): F[T]
}

Make buffering test more resilient

Make buffering test more resilient


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.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.22.3",
  "org.http4s" %% "http4s-circe" % "0.22.3",
)

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.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.22.4",
  "org.http4s" %% "http4s-circe" % "0.22.4",
)

Update http4s-circe, http4s-ember-client to 0.22.4


package controllers

import play.api.test._
import play.api.test.Helpers._
import scala.concurrent.Promise
import nl.surfnet.nsi._
import nl.surfnet.nsi.NsiProviderOperation._
import nl.surfnet.nsi.NsiRequesterOperation._
import nl.surfnet.nsi.NsiResponseMessage._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import org.specs2.matcher.BeNull
import org.ogf.schemas.nsi._2013._04.connection.types.ReserveType

@org.junit.runner.RunWith(classOf[org.specs2.runner.JUnitRunner])
class ConnectionProviderSpec extends org.specs2.mutable.Specification {

  val CorrelationId = newCorrelationId

  "Reserve operation" should {
    "return the connection id and confirm the reservation" in new WithApplication {
      @volatile var requesterOperation: NsiRequesterOperation = null
      val response = Await.result(ConnectionProvider.handleRequest(Reserve(CorrelationId, new ReserveType)) { requesterOperation = _ }, Duration.Inf)

      response must beAnInstanceOf[ReserveResponse]
      response must beLike {
        case ReserveResponse(correlationId, connectionId) =>
          correlationId must beEqualTo(CorrelationId)
          connectionId must not(beEmpty)
      }

      requesterOperation must beAnInstanceOf[ReserveConfirmed]
      requesterOperation.correlationId must beEqualTo(CorrelationId)
    }
  }
}

package controllers

import play.api.test._
import play.api.test.Helpers._
import scala.concurrent.Promise
import nl.surfnet.nsi._
import nl.surfnet.nsi.NsiProviderOperation._
import nl.surfnet.nsi.NsiRequesterOperation._
import nl.surfnet.nsi.NsiResponseMessage._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import org.specs2.matcher.BeNull
import org.ogf.schemas.nsi._2013._04.connection.types.ReserveType

@org.junit.runner.RunWith(classOf[org.specs2.runner.JUnitRunner])
class ConnectionProviderSpec extends org.specs2.mutable.Specification {

  val CorrelationId = newCorrelationId

  "Reserve operation" should {
    "return the connection id and confirm the reservation" in new WithApplication {
      val requesterOperation: Promise[NsiRequesterOperation] = Promise()
      val response = await(ConnectionProvider.handleRequest(Reserve(CorrelationId, new ReserveType)) { requesterOperation.success(_) })

      response must beAnInstanceOf[ReserveResponse]
      response must beLike {
        case ReserveResponse(correlationId, connectionId) =>
          correlationId must beEqualTo(CorrelationId)
          connectionId must not(beEmpty)
      }

      await(requesterOperation.future) must beLike {
        case op: ReserveConfirmed => op.correlationId must beEqualTo(CorrelationId)
      }
    }
  }
}

Use a promise to communicate between threads instead.


/*
 * Copyright (C) 28/11/12 Romain Reuillon
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.openmole.core.model.transition

trait Filter[T] extends (T ⇒ Boolean)

object Filter {

  def apply[T](ts: T*) = new Filter[T] {
    @transient lazy val tsSet = ts.toSet
    def apply(t: T) = ts.contains(t)
  }

  def empty[T] = new Filter[T] {
    def apply(t: T) = false
  }

}

object Keep {
  def apply[T](ts: T*) = new Filter[T] {
    @transient lazy val tsSet = ts.toSet
    def apply(t: T) = !ts.contains(t)
  }
}

/*
 * Copyright (C) 28/11/12 Romain Reuillon
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.openmole.core.model.transition

trait IFilter[T] extends (T ⇒ Boolean)

trait Filter[T] extends IFilter[T] {
  def filtered: Set[T]
  def apply(t: T) = filtered.contains(t)
}

trait Keep[T] extends IFilter[T] {
  def kept: Set[T]
  def apply(t: T) = !kept.contains(t)
}

class EmptyFilter[T] extends IFilter[T] {
  def apply(t: T) = false
}

object Filter {

  def apply[T](ts: T*) = new Filter[T] {
    lazy val filtered = ts.toSet
  }

  def empty[T] = new EmptyFilter[T]

}

object Keep {

  def apply[T](ts: T*) = new Keep[T] {
    @transient lazy val kept = ts.toSet
  }

}

Use named classes for filters.

Use named classes for filters.


package org.allenai.common.guice

import akka.actor.ActorSystem
import net.codingwell.scalaguice.ScalaModule

import scala.concurrent.ExecutionContext

/** Module that binds an ActorSystem and its associated ExecutionContext.
  * @param bindingName optional name to create the bindings under
  * @param actorSystem the actor system to bind
  */
class ActorSystemModule(bindingName: Option[String] = None)(implicit actorSystem: ActorSystem)
    extends ScalaModule {
  override def configure(): Unit = {
    bindingName match {
      case Some(name) => {
        bind[ActorSystem].annotatedWithName(name).toInstance(actorSystem)
        bind[ExecutionContext].annotatedWithName(name).toInstance(actorSystem.dispatcher)
      }
      case None => {
        bind[ActorSystem].toInstance(actorSystem)
        bind[ExecutionContext].toInstance(actorSystem.dispatcher)
      }
    }
  }
}

package org.allenai.common.guice

import akka.actor.{ ActorRefFactory, ActorSystem }
import net.codingwell.scalaguice.ScalaModule

import scala.concurrent.ExecutionContext

/** Module that binds ActorSystem and its associated ExecutionContext. The ActorSystem will also be
  * bound to ActorRefFactory.
  * @param bindingName optional name to create the bindings under
  * @param actorSystem the actor system to bind
  */
class ActorSystemModule(bindingName: Option[String] = None)(implicit actorSystem: ActorSystem)
    extends ScalaModule {
  override def configure(): Unit = {
    bindingName match {
      case Some(name) => {
        bind[ActorRefFactory].annotatedWithName(name).toInstance(actorSystem)
        bind[ActorSystem].annotatedWithName(name).toInstance(actorSystem)
        bind[ExecutionContext].annotatedWithName(name).toInstance(actorSystem.dispatcher)
      }
      case None => {
        bind[ActorRefFactory].toInstance(actorSystem)
        bind[ActorSystem].toInstance(actorSystem)
        bind[ExecutionContext].toInstance(actorSystem.dispatcher)
      }
    }
  }
}

Add a binding for ActorRefFactory.

Add a binding for ActorRefFactory.


package com.microsoft.partnercatalyst.fortis.spark.transforms.locations.client

import com.microsoft.partnercatalyst.fortis.spark.transforms.locations.Geofence
import com.microsoft.partnercatalyst.fortis.spark.transforms.locations.dto.{FeatureServiceFeature, FeatureServiceResponse}
import net.liftweb.json

import scala.io.Source

@SerialVersionUID(100L)
class FeatureServiceClient(host: String) extends Serializable {
  def bbox(geofence: Geofence): Iterable[FeatureServiceFeature] = {
    parseResponse(fetchBboxResponse(geofence))
  }

  def point(latitude: Double, longitude: Double): Iterable[FeatureServiceFeature] = {
    parseResponse(fetchPointResponse(latitude = latitude, longitude = longitude))
  }

  private def parseResponse(response: String): Iterable[FeatureServiceFeature] = {
    implicit val formats = json.DefaultFormats

    json.parse(response).extract[FeatureServiceResponse].features
  }

  protected def fetchBboxResponse(geofence: Geofence): String = {
    val fetch = s"http://$host/features/bbox/${geofence.north}/${geofence.west}/${geofence.south}/${geofence.east}"
    Source.fromURL(fetch).mkString
  }

  protected def fetchPointResponse(latitude: Double, longitude: Double): String = {
    val fetch = s"http://$host/features/point/$latitude/$longitude"
    Source.fromURL(fetch).mkString
  }
}

package com.microsoft.partnercatalyst.fortis.spark.transforms.locations.client

import com.microsoft.partnercatalyst.fortis.spark.transforms.locations.Geofence
import com.microsoft.partnercatalyst.fortis.spark.transforms.locations.dto.{FeatureServiceFeature, FeatureServiceResponse}
import net.liftweb.json

import scala.io.Source

@SerialVersionUID(100L)
class FeatureServiceClient(host: String) extends Serializable {
  def bbox(geofence: Geofence): Iterable[FeatureServiceFeature] = {
    parseResponse(fetchBboxResponse(geofence))
  }

  def point(latitude: Double, longitude: Double): Iterable[FeatureServiceFeature] = {
    parseResponse(fetchPointResponse(latitude = latitude, longitude = longitude))
  }

  private def parseResponse(response: String): Iterable[FeatureServiceFeature] = {
    implicit val formats = json.DefaultFormats

    json.parse(response).extract[FeatureServiceResponse].features
  }

  protected def fetchBboxResponse(geofence: Geofence): String = {
    val fetch = s"http://$host/features/bbox/${geofence.north}/${geofence.west}/${geofence.south}/${geofence.east}"
    Source.fromURL(fetch)("UTF-8").mkString
  }

  protected def fetchPointResponse(latitude: Double, longitude: Double): String = {
    val fetch = s"http://$host/features/point/$latitude/$longitude"
    Source.fromURL(fetch)("UTF-8").mkString
  }
}

Fix potential crash with non-ascii response


package uk.ac.wellcome.platform.transformer.transformers.miro

import org.scalatest.{FunSpec, Matchers}

class MiroContributorCodesTest extends FunSpec with Matchers {
  it("looks up a contributor code in the general map") {
    transformer.lookupContributorCode(miroId = "B0000001", code = "CSP") shouldBe Some(
      "Wellcome Collection")
  }

  it(
    "looks up a contributor code in the per-record map if it's absent from the general map") {
    transformer.lookupContributorCode(miroId = "B0006507", code = "CSC") shouldBe Some(
      "Jenny Nichols, Wellcome Trust Centre for Stem Cell Research")
  }

  it("uses the uppercased version of a contributor code") {
    transformer.lookupContributorCode(miroId = "B0000001", code = "csp") shouldBe Some(
      "Wellcome Collection")
  }

  it("returns None if it cannot find a contributor code") {
    transformer.lookupContributorCode(miroId = "XXX", code = "XXX") shouldBe None
  }

  val transformer = new MiroContributorCodes {}
}

package uk.ac.wellcome.platform.transformer.transformers.miro

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.platform.transformer.transformers.ShouldNotTransformException

class MiroContributorCodesTest extends FunSpec with Matchers {
  it("looks up a contributor code in the general map") {
    transformer.lookupContributorCode(miroId = "B0000001", code = "CSP") shouldBe Some(
      "Wellcome Collection")
  }

  it(
    "looks up a contributor code in the per-record map if it's absent from the general map") {
    transformer.lookupContributorCode(miroId = "B0006507", code = "CSC") shouldBe Some(
      "Jenny Nichols, Wellcome Trust Centre for Stem Cell Research")
  }

  it("uses the uppercased version of a contributor code") {
    transformer.lookupContributorCode(miroId = "B0000001", code = "csp") shouldBe Some(
      "Wellcome Collection")
  }

  it("returns None if it cannot find a contributor code") {
    transformer.lookupContributorCode(miroId = "XXX", code = "XXX") shouldBe None
  }

  it("rejects some images from contributor code GUS") {
    val caught = intercept[ShouldNotTransformException] {
      transformer.lookupContributorCode(miroId = "B0009891", code = "GUS")
    }
    caught.getMessage shouldBe s"Image B0009891 from contributor GUS should not be sent to the pipeline"
  }

  it("allows images from contributor code GUS which aren't on the ban list") {
    transformer.lookupContributorCode(miroId = "B0009889", code = "GUS") shouldBe Some(
      "Karen Gustafson")
  }

  val transformer: MiroContributorCodes = new MiroContributorCodes {}
}

Add tests for the GUS contributor code

Add tests for the GUS contributor code


import gitbucket.core.controller.Context
import gitbucket.core.plugin.PluginRegistry
import gitbucket.core.plugin._
import gitbucket.core.service.SystemSettingsService.SystemSettings
import gitbucket.monitoring.controllers.MonitoringController
import io.github.gitbucket.solidbase.model.Version
import javax.servlet.ServletContext

class Plugin extends gitbucket.core.plugin.Plugin {
  override val pluginId: String = "monitoring"
  override val pluginName: String = "Monitoring Plugin"
  override val description: String = "Monitoring resources"
  override val versions: List[Version] = List(new Version("1.0.0"))

  override val systemSettingMenus: Seq[(Context) => Option[Link]] = Seq(
    (context: Context) => Some(Link("monitoring", "Monitoring", "admin/monitoring"))
  )

  override val controllers = Seq(
    "/admin/monitoring" -> new MonitoringController
  )
}

import gitbucket.core.controller.Context
import gitbucket.core.plugin.PluginRegistry
import gitbucket.core.plugin._
import gitbucket.core.service.SystemSettingsService.SystemSettings
import gitbucket.monitoring.controllers.MonitoringController
import io.github.gitbucket.solidbase.model.Version
import javax.servlet.ServletContext

class Plugin extends gitbucket.core.plugin.Plugin {
  override val pluginId: String = "monitoring"
  override val pluginName: String = "Monitoring Plugin"
  override val description: String = "Monitoring resources"
  override val versions: List[Version] = List(new Version("1.0.0"))

  override val systemSettingMenus: Seq[(Context) => Option[Link]] = Seq(
    (context: Context) => Some(Link("monitoring", "Monitoring", "admin/monitoring"))
  )

  override val controllers = Seq(
    "/*" -> new MonitoringController
  )
}

Update path for plugin's controller

Update path for plugin's controller


package lila.security

import lila.common.IpAddress

final class IpTrust(intelApi: IpIntel, geoApi: GeoIP, torApi: Tor, firewallApi: Firewall) {

  def isSuspicious(ip: IpAddress): Fu[Boolean] =
    if (IpIntel isBlacklisted ip) fuTrue
    else if (firewallApi blocksIp ip) fuTrue
    else if (torApi isExitNode ip) fuTrue
    else {
      val location = geoApi orUnknown ip
      if (location == Location.unknown || location == Location.tor) fuTrue
      else if (isUndetectedProxy(location)) fuTrue
      else intelApi(ip).map { 75 < _ }
    }

  def isSuspicious(ipData: UserSpy.IPData): Fu[Boolean] = isSuspicious(ipData.ip.value)

  /* lichess blacklist of proxies that ipintel doesn't know about */
  private def isUndetectedProxy(location: Location): Boolean =
    location.shortCountry == "Iran" ||
      location.shortCountry == "United Arab Emirates" ||
      location == Location("Poland", "Subcarpathian Voivodeship".some, "Stalowa Wola".some) ||
      location == Location("Poland", "Lesser Poland Voivodeship".some, "Krakow".some)
}

package lila.security

import lila.common.IpAddress

final class IpTrust(intelApi: IpIntel, geoApi: GeoIP, torApi: Tor, firewallApi: Firewall) {

  def isSuspicious(ip: IpAddress): Fu[Boolean] =
    if (IpIntel isBlacklisted ip) fuTrue
    else if (firewallApi blocksIp ip) fuTrue
    else if (torApi isExitNode ip) fuTrue
    else {
      val location = geoApi orUnknown ip
      if (location == Location.unknown || location == Location.tor) fuTrue
      else if (isUndetectedProxy(location)) fuTrue
      else intelApi(ip).map { 75 < _ }
    }

  def isSuspicious(ipData: UserSpy.IPData): Fu[Boolean] = isSuspicious(ipData.ip.value)

  /* lichess blacklist of proxies that ipintel doesn't know about */
  private def isUndetectedProxy(location: Location): Boolean =
    location.shortCountry == "Iran" ||
      location.shortCountry == "United Arab Emirates" ||
      location == Location("Poland", "Subcarpathian Voivodeship".some, "Stalowa Wola".some) ||
      location == Location("Poland", "Lesser Poland Voivodeship".some, "Krakow".some) ||
      location == Location("Russia", "Bashkortostan".some, "Ufa".some)
}

Update IPTrust rule for GC

Update IPTrust rule for GC

https://lichess.slack.com/archives/G0HL9GBHU/p1529435635000274


/* ------------------- 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) yield {
      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 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 => }
    }
  }
}

Remove unneeded yield in for expression.


latestVersion in ThisBuild := "0.7.0"

latestVersionInSeries in ThisBuild := Some("0.7.0")

unreleasedModules in ThisBuild := Set(
// Example:
// "refined-eval"
)

latestVersion in ThisBuild := "0.7.0"

latestVersionInSeries in ThisBuild := Some("0.7.0")

unreleasedModules in ThisBuild := Set(
// Example:
  "refined-eval"
)

Add refined-eval to unreleasedModules until it is on Maven Central


package io.finch.circe

import com.twitter.util.{Return, Throw, Try}
import io.circe.Decoder
import io.circe.jawn.decode
import io.finch.{Decode, Error}

trait Decoders {

  /**
   * Maps a Circe's [[Decoder]] to Finch's [[Decode]].
   */
  implicit def decodeCirce[A](implicit d: Decoder[A]): Decode[A] = Decode.instance(s =>
    decode[A](s).fold[Try[A]](
      error => Throw[A](Error(error.getMessage)),
      value => Return(value)
    )
  )
}

package io.finch.circe

import cats.syntax.show._
import com.twitter.util.{Return, Throw, Try}
import io.circe.Decoder
import io.circe.jawn.decode
import io.finch.{Decode, Error}

trait Decoders {

  /**
   * Maps a Circe's [[Decoder]] to Finch's [[Decode]].
   */
  implicit def decodeCirce[A](implicit d: Decoder[A]): Decode[A] = Decode.instance(s =>
    decode[A](s).fold[Try[A]](
      error => Throw[A](Error(error.show)),
      value => Return(value)
    )
  )
}

Improve decoding errors from finch-circe


package com.softwaremill.codebrag.service.updater

import akka.actor._
import com.typesafe.scalalogging.slf4j.Logging
import com.softwaremill.codebrag.service.commits.CommitImportService
import RepoUpdateActor._
import com.softwaremill.codebrag.repository.Repository

class RepoUpdateActor(importService: CommitImportService, repository: Repository) extends Actor with Logging {

  def receive = {
    case Update(scheduleNext) => {
      try {
        importService.importRepoCommits(repository)
        importService.cleanupStaleBranches()
      } finally {
        if (scheduleNext) {
          import context.dispatcher
          logger.debug("Scheduling next update delay to " + NextUpdatesInterval.toString)
          context.system.scheduler.scheduleOnce(NextUpdatesInterval, self, Update(scheduleNext = true))
        }
      }
    }
  }
}

object RepoUpdateActor {

  import scala.concurrent.duration._

  val InitialDelay = 3.seconds
  val NextUpdatesInterval = 45.seconds

  case class Update(scheduleNext: Boolean)
}

package com.softwaremill.codebrag.service.updater

import akka.actor._
import com.typesafe.scalalogging.slf4j.Logging
import com.softwaremill.codebrag.service.commits.CommitImportService
import RepoUpdateActor._
import com.softwaremill.codebrag.repository.Repository

class RepoUpdateActor(importService: CommitImportService, repository: Repository) extends Actor with Logging {

  def receive = {
    case Update(scheduleNext) => {    // TODO: get rid of this scheduleNext
      try {
        importService.importRepoCommits(repository)
        importService.cleanupStaleBranches(repository)
      } finally {
        if (scheduleNext) {
          import context.dispatcher
          logger.debug(s"Scheduling next update of ${repository.repoName} in ${NextUpdatesInterval.toString}")
          context.system.scheduler.scheduleOnce(NextUpdatesInterval, self, Update(scheduleNext = true))
        }
      }
    }
  }
}

object RepoUpdateActor {

  import scala.concurrent.duration._

  val InitialDelay = 3.seconds
  val NextUpdatesInterval = 45.seconds

  case class Update(scheduleNext: Boolean)
}

Clean stale branches for repo specified after loading repo update


import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.{Controller, HttpServer}
import com.twitter.finatra.http.routing.HttpRouter

class CustomController() extends Controller {
  get("/healthcheck") { request: Request =>
    response.ok.json(Map("status" -> "ok"))
  }

  get("/:*") { request: Request =>
    response.notFound.json(Map(
      "status" -> 404,
      "description" -> s"Page not found for URL ${request.uri}"
    ))
  }
}

class Server extends HttpServer {
  override def configureHttp(router: HttpRouter) {
    router.add[CustomController]
  }
}

object ServerMain extends Server

import com.twitter.finagle.http.{Request, Response}
import com.twitter.finatra.http.{Controller, HttpServer}
import com.twitter.finatra.http.routing.HttpRouter

class CustomController() extends Controller {
  get("/greeting") { request: Request =>
    response.ok.json(Map("hello" -> "world"))
  }

  get("/:*") { request: Request =>
    response.notFound.json(Map(
      "error" -> s"page not found: ${request.uri}"
    ))
  }
}

class Server extends HttpServer {
  override def configureHttp(router: HttpRouter) {
    router.add[CustomController]
  }
}

object ServerMain extends Server

Tweak the example app to be more friendly


scalaVersion in ThisBuild := "2.12.3"

enablePlugins(JooqCodegen)

jooqCodegen <<= jooqCodegen.dependsOn(flywayMigrate in migration)

jooqCodegenConfigFile := Some(file("jooq-codegen.xml"))

jooqCodegenStrategy := CodegenStrategy.Always

libraryDependencies ++= Seq("runtime", "jooq").map { conf =>
  "com.h2database" % "h2" % "1.4.196" % conf
}

lazy val migration = project.settings(
  flywayUrl := "jdbc:h2:./test",
  flywaySchemas := Seq("PUBLIC"),
  flywayLocations := Seq("classpath:db/migration"),
  libraryDependencies += "com.h2database" % "h2" % "1.4.196" % "runtime"
)

scalaVersion in ThisBuild := "2.12.3"

enablePlugins(JooqCodegen)

jooqCodegen := jooqCodegen.dependsOn(flywayMigrate in migration).value

jooqCodegenConfigFile := Some(file("jooq-codegen.xml"))

jooqCodegenStrategy := CodegenStrategy.Always

libraryDependencies ++= Seq("runtime", "jooq").map { conf =>
  "com.h2database" % "h2" % "1.4.196" % conf
}

lazy val migration = project.settings(
  flywayUrl := "jdbc:h2:./test",
  flywaySchemas := Seq("PUBLIC"),
  flywayLocations := Seq("classpath:db/migration"),
  libraryDependencies += "com.h2database" % "h2" % "1.4.196" % "runtime"
)

Fix sbt warning in scripted test

Fix sbt warning in scripted test


package com.github.dkanellis.skyspark.scala.api.algorithms.bnl

import javax.annotation.concurrent.ThreadSafe

import com.github.dkanellis.skyspark.scala.api.algorithms.{Point, SkylineAlgorithm}
import org.apache.spark.rdd.RDD

/**
  * A MapReduce based, block-nested loop algorithm (MR-BNL).
  *

  * First we do the division job of the points to <Flag, Point> and then we merge the local skylines together and
  * calculate the total skyline set.
  *

  * For more information read Adapting Skyline Computation to the MapReduce Framework: Algorithms and Experiments
  * by Boliang Zhang, Shuigeng Zhou, Jihong Guan
  *
  * @param divider The Division part of the algorithm
  * @param merger  The Merging part of the algorithm
  */
@ThreadSafe
class BlockNestedLoop private[bnl](private val divider: Divider, private val merger: Merger) extends SkylineAlgorithm {

  def this() = this(new BnlAlgorithm)

  override def computeSkylinePoints(points: RDD[Point]): RDD[Point] = {
    require(!points.isEmpty)

    val localSkylinesWithFlags = divider.divide(points)

    merger.merge(localSkylinesWithFlags)
  }

  private def this(bnlAlgorithm: BnlAlgorithm) = this(new Divider(bnlAlgorithm), new Merger(bnlAlgorithm))
}

package com.github.dkanellis.skyspark.scala.api.algorithms.bnl

import javax.annotation.concurrent.ThreadSafe

import com.github.dkanellis.skyspark.scala.api.algorithms.{Point, SkylineAlgorithm}
import org.apache.spark.rdd.RDD

/**
  * A MapReduce based, block-nested loop algorithm (MR-BNL).
  *

  * First we do the division job of the points to <Flag, Point> and then we merge the local skylines together and
  * calculate the total skyline set.
  *

  * For more information read Adapting Skyline Computation to the MapReduce Framework: Algorithms and Experiments
  * by Boliang Zhang, Shuigeng Zhou, Jihong Guan
  *
  * @param divider The Division part of the algorithm
  * @param merger  The Merging part of the algorithm
  */
@ThreadSafe
class BlockNestedLoop private[bnl](private val divider: Divider, private val merger: Merger) extends SkylineAlgorithm {

  private def this(bnlAlgorithm: BnlAlgorithm) = this(new Divider(bnlAlgorithm), new Merger(bnlAlgorithm))

  def this() = this(new BnlAlgorithm)

  override def computeSkylinePoints(points: RDD[Point]): RDD[Point] = {
    require(!points.isEmpty)

    val localSkylinesWithFlags = divider.divide(points)

    merger.merge(localSkylinesWithFlags)
  }
}

Fix wrong placement of constructor due to IntelliJ's code rearranging


import app._
import org.scalatra._
import javax.servlet._

class ScalatraBootstrap extends LifeCycle {
  override def init(context: ServletContext) {
    context.mount(new IndexController, "/")
    context.mount(new SignInController, "/*")
    context.mount(new UsersController, "/*")
    context.mount(new CreateRepositoryController, "/*")
    context.mount(new AccountController, "/*")
    context.mount(new RepositoryViewerController, "/*")
    context.mount(new WikiController, "/*")
    context.mount(new IssuesController, "/*")
    context.mount(new LabelsController, "/*")
    context.mount(new MilestonesController, "/*")
    context.mount(new SettingsController, "/*")

    context.addListener(new ServletContextListener(){
      def contextInitialized(e: ServletContextEvent): Unit = {
        val dir = new java.io.File(_root_.util.Directory.GitBucketHome)
        if(!dir.exists){
          dir.mkdirs()
        }
      }

      def contextDestroyed(e: ServletContextEvent): Unit = {}
    })
  }
}

import app._
import org.scalatra._
import javax.servlet._

class ScalatraBootstrap extends LifeCycle {
  override def init(context: ServletContext) {
    context.mount(new IndexController, "/")
    context.mount(new SignInController, "/*")
    context.mount(new UsersController, "/*")
    context.mount(new CreateRepositoryController, "/*")
    context.mount(new AccountController, "/*")
    context.mount(new RepositoryViewerController, "/*")
    context.mount(new WikiController, "/*")
    context.mount(new LabelsController, "/*")
    context.mount(new MilestonesController, "/*")
    context.mount(new IssuesController, "/*")
    context.mount(new SettingsController, "/*")

    context.addListener(new ServletContextListener(){
      def contextInitialized(e: ServletContextEvent): Unit = {
        val dir = new java.io.File(_root_.util.Directory.GitBucketHome)
        if(!dir.exists){
          dir.mkdirs()
        }
      }

      def contextDestroyed(e: ServletContextEvent): Unit = {}
    })
  }
}

Change order of MilestonesController, LabelsController and IssuesController.


pgpPassphrase := Some(sys.prop("PGP_PASSPHRASE").toArray)

pgpPublicRing := file("admin/pubring.asc")

pgpSecretRing := file("admin/secring.asc")

credentials   += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", sys.prop("SONA_USER"), sys.prop("SONA_PASS"))

pgpPassphrase := Some(sys.props("PGP_PASSPHRASE").toArray)

pgpPublicRing := file("admin/pubring.asc")

pgpSecretRing := file("admin/secring.asc")

credentials   += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", sys.props("SONA_USER"), sys.props("SONA_PASS"))

Fix type in system property access

Fix type in system property access


package org.jetbrains.plugins.scala.packagesearch

import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.jetbrains.packagesearch.intellij.plugin.extensibility.{AbstractProjectModuleOperationProvider, ProjectModuleType}
import org.jetbrains.plugins.scala.packagesearch.utils.SbtProjectModuleType

class SbtProjectModuleOperationProvider extends AbstractProjectModuleOperationProvider {
  override def hasSupportFor(project: Project, psiFile: PsiFile): Boolean = {
    val file = psiFile.getVirtualFile
    if (file == null) return false
    if (file.getExtension.toLowerCase() == "sbt" || file.getExtension.toLowerCase() == "scala") return true
    false
  }

  override def hasSupportFor(projectModuleType: ProjectModuleType): Boolean = projectModuleType match {
    case SbtProjectModuleType => true
    case _ => false
  }

}

package org.jetbrains.plugins.scala.packagesearch

import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.jetbrains.packagesearch.intellij.plugin.extensibility.{AbstractProjectModuleOperationProvider, ProjectModuleType}
import org.jetbrains.plugins.scala.packagesearch.utils.SbtProjectModuleType

class SbtProjectModuleOperationProvider extends AbstractProjectModuleOperationProvider {
  override def hasSupportFor(project: Project, psiFile: PsiFile): Boolean = {
    val file = psiFile.getVirtualFile
    if (file == null || file.getExtension == null) return false
    if (file.getExtension.toLowerCase() == "sbt" || file.getExtension.toLowerCase() == "scala") return true
    false
  }

  override def hasSupportFor(projectModuleType: ProjectModuleType): Boolean = projectModuleType match {
    case SbtProjectModuleType => true
    case _ => false
  }

}

Fix the bug of null exception in the case getExtension returns null (SCL-19184)


package org.jetbrains.plugins.scala.performance.highlighting.projectHighlighting

import com.intellij.openapi.editor.LogicalPosition
import org.jetbrains.plugins.scala.SlowTests
import org.jetbrains.plugins.scala.performance.ScalaCommunityDownloadingAndImportingTestCase
import org.junit.experimental.categories.Category

/**
  * Author: Svyatoslav Ilinskiy
  * Date: 11/18/2015
  */
@Category(Array(classOf[SlowTests]))
class ScalaCommunityPerformanceRehighlightingTest extends RehighlightingPerformanceTypingTestBase
  with ScalaCommunityDownloadingAndImportingTestCase {

  def testTypingInScalaPsiUtil(): Unit = {
    doTest("ScalaPsiUtil.scala", 40.seconds, Seq("val i = Some(10)\n"), new LogicalPosition(80, 1), Some("def foo() = {\n"))
  }

  def testTypingInsideFunctionWithDefinedReturnType(): Unit = {
    doTest("ScalaPsiUtil.scala", 3.seconds, Seq("val i = Some(10)\n"), new LogicalPosition(80, 1), Some("def foo(): Unit = {\n"))
  }
}

package org.jetbrains.plugins.scala.performance.highlighting.projectHighlighting

import com.intellij.openapi.editor.LogicalPosition
import org.jetbrains.plugins.scala.SlowTests
import org.jetbrains.plugins.scala.performance.ScalaCommunityDownloadingAndImportingTestCase
import org.junit.experimental.categories.Category

/**
  * Author: Svyatoslav Ilinskiy
  * Date: 11/18/2015
  */
@Category(Array(classOf[SlowTests]))
class ScalaCommunityPerformanceRehighlightingTest extends RehighlightingPerformanceTypingTestBase
  with ScalaCommunityDownloadingAndImportingTestCase {

  def testTypingInScalaPsiUtil(): Unit = {
    doTest("ScalaPsiUtil.scala", 4.seconds, Seq("val i = Some(10)\n"), new LogicalPosition(80, 1), Some("def foo() = {\n"))
  }

  def testTypingInScalaPsiUtilInClassBody(): Unit = {
    doTest("ScalaPsiUtil.scala", 40.seconds, Seq("val i = Some(10)\n"), new LogicalPosition(80, 1), None)
  }

  def testTypingInsideFunctionWithDefinedReturnType(): Unit = {
    doTest("ScalaPsiUtil.scala", 3.seconds, Seq("val i = Some(10)\n"), new LogicalPosition(80, 1), Some("def foo(): Unit = {\n"))
  }
}

Update test timeout after performance improvement and add new test


/*
 * Copyright 2013 http4s.org
 *
 * 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 org.http4s
package syntax

import org.typelevel.ci.CIString

trait StringSyntax {
  @deprecated("Use CIString.apply instead", "1.0.0-M1")
  implicit def http4sStringSyntax(s: String): StringOps =
    new StringOps(s)
}

@deprecated("Use CIString.apply instead", "1.0.0-M1")
final class StringOps(val self: String) extends AnyVal {
  def ci: CIString = CIString(self)
}

/*
 * Copyright 2013 http4s.org
 *
 * 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 org.http4s
package syntax

import org.typelevel.ci.CIString

trait StringSyntax {
  @deprecated(
    "Use org.typelevel.ci.CIString.apply instead, " +
      """or for literals import org.typelevel.ci._ and replace "foo".ci with ci"foo"""",
    "0.22.0")
  implicit def http4sStringSyntax(s: String): StringOps =
    new StringOps(s)
}

@deprecated(
  "Use org.typelevel.ci.CIString.apply instead, " +
    """or for literals import org.typelevel.ci._ and replace "foo".ci with ci"foo"""",
  "0.22.0")
final class StringOps(val self: String) extends AnyVal {
  def ci: CIString = CIString(self)
}

Update string syntax deprecation warning


package uk.ac.wellcome.platform.transformer.sierra.transformers.sierra

import org.scalatest.{FunSpec, Matchers}

/** All of these test cases are based on real examples from the Sierra data. */
class WellcomeImagesURLParserTest extends FunSpec with Matchers {

  val miroIDexamples = List(
    "L0046161",
    "V0033167F1",
    "V0032544ECL"
  )

  it("indexplus/image URLs with a single '.html'") {
    miroIDexamples.foreach { miroID =>
      val url = s"http://wellcomeimages.org/indexplus/image/$miroID.html"
      assertURLParsedCorrectly(url, miroID = miroID)
    }
  }

  val transformer = new WellcomeImagesURLParser {}

  private def assertURLParsedCorrectly(url: String, miroID: String) = {
    val result = transformer.maybeGetMiroID(url)
    if (result.isEmpty) {
      println(s"$url did not return a Miro ID")
    }
    result shouldBe Some(miroID)
  }
}

package uk.ac.wellcome.platform.transformer.sierra.transformers.sierra

import org.scalatest.{FunSpec, Matchers}

/** All of these test cases are based on real examples from the Sierra data. */
class WellcomeImagesURLParserTest extends FunSpec with Matchers {

  val miroIDexamples = List(
    "L0046161",
    "V0033167F1",
    "V0032544ECL"
  )

  it("indexplus/image URLs with a single '.html'") {
    assertURLTemplateParsedCorrectly { miroID =>
      s"http://wellcomeimages.org/indexplus/image/$miroID.html"
    }
  }

  it("indexplus/image URLs with a double '.html'") {
    assertURLTemplateParsedCorrectly { miroID =>
      s"http://wellcomeimages.org/indexplus/image/$miroID.html.html"
    }
  }

  val transformer = new WellcomeImagesURLParser {}

  private def assertURLTemplateParsedCorrectly(createURL: (String) => String) = {
    miroIDexamples.foreach { miroID =>
      val url = createURL(miroID)
      assertURLParsedCorrectly(url, miroID = miroID)
    }
  }

  private def assertURLParsedCorrectly(url: String, miroID: String) = {
    val result = transformer.maybeGetMiroID(url)
    if (result.isEmpty) {
      println(s"$url did not return a Miro ID")
    }
    result shouldBe Some(miroID)
  }
}

Make it easier to write test cases

Make it easier to write test cases


package de.uni_potsdam.hpi.coheel.programs

import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._

class LargeFileTestProgram extends CoheelProgram with ProgramDescription {

	override def getDescription = "Large file test"

	override def buildProgram(env: ExecutionEnvironment): Unit = {
		val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")

		val result = input.mapPartition { linesIt =>
			println(s"READHERE: Reading ${linesIt.size} files.")
			List((1, 1))
		}.sum(0)
		result.print()
	}
}

package de.uni_potsdam.hpi.coheel.programs

import org.apache.flink.api.common.ProgramDescription
import org.apache.flink.api.scala._

class LargeFileTestProgram extends CoheelProgram with ProgramDescription {

	override def getDescription = "Large file test"

	override def buildProgram(env: ExecutionEnvironment): Unit = {
		val input = env.readTextFile("hdfs://tenemhead2/home/stefan.bunk/large_file")

		val result = input.mapPartition { linesIt =>
			println(s"READHERE: Reading ${linesIt.size} files.")
			List((1, 1))
		}.sum(0)
		result.writeAsText("hdfs://tenemhead2/home/stefan.bunk/large_file_result")
	}
}

Write large file result to disk.

Write large file result to disk.

Former-commit-id: bc0604f1be9c1c256852a2998b01507c83c96219