Skip to content

Instantly share code, notes, and snippets.

describe "planets|player_index" do
before(:each) do
@action = "planets|player_index"
@params = {}
end
it_behaves_like "only push"
it_should_behave_like "having controller action scope"
it "should return players planets" do
private[this] def badParams(msg: String) = BadRequest(
Json.toJson(Map("error" -> ("Be sure to have these params defined: "+msg)))
)
def create = Action(parse.json) { request =>
(for (
modeStr <- (request.body \ "mode").asOpt[String];
mode <- Graph.ConnectionsMode.withNameOpt(modeStr);
time <- (request.body \ "travel_time").asOpt[Int];
lat <- (request.body \ "origin" \ "lat").asOpt[Double];
import sbt._
import sbt.Keys._
object PluginDef extends Build {
override lazy val projects = Seq(root)
lazy val igeoliseLib = RootProject(file("../../lib"))
lazy val root = Project(
"plugins", file("."),
settings = Defaults.defaultSettings ++ Seq(
inputTask[Unit] { argTask =>
(argTask, scalaVersion) map { case(args, sv) => Map.empty[String, String] }
}
class TimeFilterTest extends ProjectSpec {
lazy val time = 200
lazy val mode = Graph.ConnectionsMode.Driving
lazy val origin = Node.DegreeCoords(1.4, 7.8)
lazy val threshold = 500000
describe("instance") {
lazy val isochroneMock = mock[Isochrone]
lazy val instance = new TimeFilter(
time, mode, origin, threshold = threshold
<configuration>
<conversionRule conversionWord="coloredLevel"
converterClass="play.api.Logger$ColoredLevel"/>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${application.home}/logs/application.log</file>
<encoder>
<pattern>%date - [%level] - from %logger in %thread
%n%message%n%xException%n</pattern>
</encoder>
private[this] def ignored(prefix: String) =
log(prefix)("Ignored: " + prefix) ~ any(80 - prefix.length)
/** Header **/
def header = ignored("HD") ~ nl
/** Ignored record types - these have no meaning for us **/
def tiplocInsert = ignored("TI") ~ nl
$ head -n 50 ../api/data/sources/atoc.mca
HDTPS.UCFCATE.PD1210050510122309DFTTISD FA051012180513
TIAACHEN 00081601LAACHEN 00005 0
TIABCWM 00385964VABERCWMBOI 78128 0
TIABDAPEN00398202VPENYWAUN BUS 00000 0XPZ
TIABDARE 00398200TABERDARE 78100 0ABAABERDARE
TIABDATRE00398203ATRECYNON BUS 00000 0XTO
TIABDO 00909000ZABERDOUR 03295 0AURABERDOUR
TIABDVY 00443500EABERDOVEY 64409 0AVYABERDOVEY
TIABER 08381300LABER 78371 0ABEABER
def parse(file: File): ListBuffer[Schedule] = {
val reader = new BufferedReader(new FileReader(file))
try {
val schedules = ListBuffer.empty[Schedule]
var basicSchedule: BasicSchedule = null
var origin: OriginLocation = null
var intermediateLocations = ListBuffer.empty[IntermediateLocation]
var line: String = reader.readLine()
intermediateLocations match {
case Nil =>
f(oDeparture, tArrival)
case intermediate :: Nil =>
f(oDeparture, iArrival(intermediate))
f(iDeparture(intermediate), tArrival)
case _ =>
f(oDeparture, iArrival(intermediateLocations.head))
val last = intermediateLocations.sliding(2).
foldLeft(intermediateLocations.head) {