Skip to content

Commit

Permalink
Fixes #57 - reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Weber committed Apr 14, 2016
1 parent c7d0ed4 commit b6d10b9
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mesosphere.chaos.examples.trains.impl.loading
package mesosphere.chaos.examples.trains

import com.softwaremill.macwire._

import mesosphere.chaos.examples.trains.impl.loading.{CraneController, TrainLoader}
import mesosphere.chaos.examples.trains.impl.shunting.PointSwitcher

@Module
Expand All @@ -12,7 +12,3 @@ trait LoadingModule {
// dependency of the module
def pointSwitcher: PointSwitcher
}

class CraneController()
class TrainLoader(craneController: CraneController,
pointSwitcher: PointSwitcher)
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
package mesosphere.chaos.examples.trains.impl.shunting
package mesosphere.chaos.examples.trains

import com.softwaremill.macwire._

class PointSwitcher() {
def switch() = println("switch")
}
class TrainCarCoupler()

trait TrainShunter { def shunt() = println("shunt")}

class TraditionalTrainShunter(pointSwitcher: PointSwitcher,
trainCarCoupler: TrainCarCoupler) extends TrainShunter

class TeleportingTrainShunter() extends TrainShunter
import mesosphere.chaos.examples.trains.impl.shunting._

@Module
trait ShuntingModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package mesosphere.chaos.examples.trains

import com.softwaremill.macwire._
import mesosphere.chaos.examples.trains.impl.station.{TrainDispatch, TrainStation}

@Module
trait StationModule extends ShuntingModule with LoadingModule {
lazy val trainDispatch = wire[TrainDispatch]
lazy val trainStation = wire[TrainStation]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package mesosphere.chaos.examples.trains

import com.softwaremill.macwire._
import mesosphere.chaos.examples.trains.impl.stats.{LoadingStats, ShuntingStats}

class StatsModule(shuntingModule: ShuntingModule, loadingModule: LoadingModule) {
lazy val loadingStats = wire[LoadingStats]
lazy val shuntingStats = wire[ShuntingStats]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package mesosphere.chaos.examples.trains

object TrainStation extends App {
val traditionalModules = new TraditionalShuntingModule
with LoadingModule
with StationModule

val modernModules = new ModernShuntingModule
with LoadingModule
with StationModule

println(traditionalModules.trainStation.prepareAndDispatchNextTrain())
println(modernModules.trainStation.prepareAndDispatchNextTrain())
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package mesosphere.chaos.examples.trains.impl.loading

class CraneController()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package mesosphere.chaos.examples.trains.impl.loading

import mesosphere.chaos.examples.trains.impl.shunting.PointSwitcher

class TrainLoader(craneController: CraneController,
pointSwitcher: PointSwitcher)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package mesosphere.chaos.examples.trains.impl.shunting

class PointSwitcher() {
def switch() = println("switch")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package mesosphere.chaos.examples.trains.impl.shunting

class TrainCarCoupler()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package mesosphere.chaos.examples.trains.impl.shunting

trait TrainShunter { def shunt() = println("shunt")}
class TraditionalTrainShunter(pointSwitcher: PointSwitcher,
trainCarCoupler: TrainCarCoupler) extends TrainShunter
class TeleportingTrainShunter() extends TrainShunter

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package mesosphere.chaos.examples.trains.impl.station

class TrainDispatch()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package mesosphere.chaos.examples.trains.impl.station

import mesosphere.chaos.examples.trains.impl.loading.TrainLoader
import mesosphere.chaos.examples.trains.impl.shunting.TrainShunter

class TrainStation(trainShunter: TrainShunter,
trainLoader: TrainLoader,
trainDispatch: TrainDispatch) {

def prepareAndDispatchNextTrain() = "Choo choo"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package mesosphere.chaos.examples.trains.impl.stats

import com.softwaremill.macwire._

import mesosphere.chaos.examples.trains.impl.loading.{LoadingModule, TrainLoader}
import mesosphere.chaos.examples.trains.impl.shunting.{ShuntingModule, TrainShunter}
import mesosphere.chaos.examples.trains.impl.loading.TrainLoader
import mesosphere.chaos.examples.trains.impl.shunting.TrainShunter

class LoadingStats(trainLoader: TrainLoader)
class ShuntingStats(trainShunter: TrainShunter)

class StatsModule(shuntingModule: ShuntingModule, loadingModule: LoadingModule) {
lazy val loadingStats = wire[LoadingStats]
lazy val shuntingStats = wire[ShuntingStats]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package mesosphere.chaos.examples.trains.impl.shunting

import org.scalatest.FlatSpec
package mesosphere.chaos.examples.trains

import mesosphere.chaos.examples.trains.impl.shunting.PointSwitcher
import org.mockito.Mockito._
import org.scalatest.FlatSpec

class ShuntingModuleTest extends FlatSpec {
it should "work" in {
Expand Down

0 comments on commit b6d10b9

Please sign in to comment.