-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Weber
committed
Apr 14, 2016
1 parent
b6d10b9
commit 5cfc1e8
Showing
24 changed files
with
113 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
...amples/src/main/scala/mesosphere/chaos/examples/trains/impl/loading/CraneController.scala
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
...s-examples/src/main/scala/mesosphere/chaos/examples/trains/impl/loading/TrainLoader.scala
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...xamples/src/main/scala/mesosphere/chaos/examples/trains/impl/shunting/PointSwitcher.scala
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
...mples/src/main/scala/mesosphere/chaos/examples/trains/impl/shunting/TrainCarCoupler.scala
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
...examples/src/main/scala/mesosphere/chaos/examples/trains/impl/shunting/TrainShunter.scala
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
...examples/src/main/scala/mesosphere/chaos/examples/trains/impl/station/TrainDispatch.scala
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...-examples/src/main/scala/mesosphere/chaos/examples/trains/impl/station/TrainStation.scala
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
chaos-examples/src/main/scala/mesosphere/chaos/examples/trains/impl/stats/StaatsModule.scala
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...chaos/examples/trains/LoadingModule.scala → ...amples/trains/modules/LoadingModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...haos/examples/trains/ShuntingModule.scala → ...mples/trains/modules/ShuntingModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...chaos/examples/trains/StationModule.scala → ...amples/trains/modules/StationModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...e/chaos/examples/trains/StatsModule.scala → ...examples/trains/modules/StatsModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...rc/main/scala/mesosphere/chaos/examples/trains/modules/impl/loading/CraneController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.loading | ||
|
||
class CraneController() { | ||
def controll() = println("crane moved") | ||
} |
11 changes: 11 additions & 0 deletions
11
...es/src/main/scala/mesosphere/chaos/examples/trains/modules/impl/loading/TrainLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.loading | ||
|
||
import mesosphere.chaos.examples.trains.modules.impl.shunting.PointSwitcher | ||
|
||
class TrainLoader(craneController: CraneController, | ||
pointSwitcher: PointSwitcher) { | ||
def load() = { | ||
println("loaded") | ||
pointSwitcher.switch() | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...src/main/scala/mesosphere/chaos/examples/trains/modules/impl/shunting/PointSwitcher.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.shunting | ||
|
||
class PointSwitcher() { | ||
def switch() = println("switched") | ||
} |
3 changes: 3 additions & 0 deletions
3
...c/main/scala/mesosphere/chaos/examples/trains/modules/impl/shunting/TrainCarCoupler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.shunting | ||
|
||
class TrainCarCoupler() { def couple() = println("coupled") } |
18 changes: 18 additions & 0 deletions
18
.../src/main/scala/mesosphere/chaos/examples/trains/modules/impl/shunting/TrainShunter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.shunting | ||
|
||
trait TrainShunter { def shunt() = println("shunted") } | ||
class TraditionalTrainShunter(pointSwitcher: PointSwitcher, | ||
trainCarCoupler: TrainCarCoupler) extends TrainShunter { | ||
override def shunt() = { | ||
println("# Traditional shunter:") | ||
pointSwitcher.switch() | ||
trainCarCoupler.couple() | ||
super.shunt() | ||
} | ||
} | ||
class TeleportingTrainShunter() extends TrainShunter { | ||
override def shunt() = { | ||
println("# Modern shunter:") | ||
println("teleported") | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
.../src/main/scala/mesosphere/chaos/examples/trains/modules/impl/station/TrainDispatch.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.station | ||
|
||
class TrainDispatch() { def dispatch() = "dispatched" } |
18 changes: 18 additions & 0 deletions
18
...s/src/main/scala/mesosphere/chaos/examples/trains/modules/impl/station/TrainStation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.station | ||
|
||
import mesosphere.chaos.examples.trains.modules.impl.loading.TrainLoader | ||
import mesosphere.chaos.examples.trains.modules.impl.shunting.TrainShunter | ||
|
||
class TrainStation(trainShunter: TrainShunter, | ||
trainLoader: TrainLoader, | ||
trainDispatch: TrainDispatch) { | ||
|
||
def prepareAndDispatchNextTrain() = { | ||
println("## Shunter:") | ||
trainShunter.shunt() | ||
println("## Loader:") | ||
trainLoader.load() | ||
println("## Dispatcher:") | ||
trainDispatch.dispatch() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...les/src/main/scala/mesosphere/chaos/examples/trains/modules/impl/stats/StaatsModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package mesosphere.chaos.examples.trains.modules.impl.stats | ||
|
||
import mesosphere.chaos.examples.trains.modules.impl.loading.TrainLoader | ||
import mesosphere.chaos.examples.trains.modules.impl.shunting.TrainShunter | ||
|
||
class LoadingStats(trainLoader: TrainLoader) | ||
class ShuntingStats(trainShunter: TrainShunter) |
22 changes: 0 additions & 22 deletions
22
chaos-examples/src/test/scala/mesosphere/chaos/examples/trains/ShuntingModuleTest.scala
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...examples/src/test/scala/mesosphere/chaos/examples/trains/modules/ShuntingModuleTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package mesosphere.chaos.examples.trains.modules | ||
|
||
import mesosphere.chaos.examples.trains.modules.impl.shunting.PointSwitcher | ||
import org.scalamock.scalatest.MockFactory | ||
import org.scalatest.FlatSpec | ||
|
||
class ShuntingModuleTest extends FlatSpec with MockFactory { | ||
it should "work" in { | ||
// given | ||
val mockPointSwitcher = mock[PointSwitcher] | ||
|
||
// when | ||
val moduleToTest = new ShuntingModule2 { | ||
// the mock implementation will be used to wire the graph | ||
override lazy val pointSwitcher = mockPointSwitcher | ||
} | ||
|
||
moduleToTest.trainShunter.shunt() | ||
|
||
// then | ||
|
||
// verify(mockPointSwitcher).switch() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters