-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
2 changed files
with
46 additions
and
3 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
43 changes: 43 additions & 0 deletions
43
src/main/scala/com/ing/wbaa/rokku/proxy/api/TestService.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,43 @@ | ||
package com.ing.wbaa.rokku.proxy.api | ||
|
||
import akka.http.scaladsl.model.StatusCodes | ||
import akka.http.scaladsl.server.Directives._ | ||
import akka.http.scaladsl.server.Route | ||
import com.ing.wbaa.rokku.proxy.data.RequestId | ||
import com.ing.wbaa.rokku.proxy.handler.LoggerHandlerWithId | ||
|
||
trait TestService { | ||
|
||
private val logger = new LoggerHandlerWithId | ||
|
||
final val testRoute: Route = | ||
path("test200") { | ||
get { | ||
parameters("timeout".as[Long]) { (timeout) => | ||
logger.debug("start test200")(RequestId("test200")) | ||
Thread.sleep(timeout) | ||
logger.debug("stop test200")(RequestId("test200")) | ||
complete(StatusCodes.OK -> "test") | ||
} | ||
} | ||
} ~ path("test502") { | ||
get { | ||
parameters("timeout".as[Long]) { (timeout) => | ||
logger.debug("start test502")(RequestId("test200")) | ||
Thread.sleep(timeout) | ||
logger.debug("stop test502")(RequestId("test200")) | ||
complete(StatusCodes.BadGateway -> "502") | ||
} | ||
} | ||
} ~ path("test503") { | ||
get { | ||
parameters("timeout".as[Long]) { (timeout) => | ||
logger.debug("start test503")(RequestId("test503")) | ||
Thread.sleep(timeout) | ||
logger.debug("stop test503")(RequestId("test503")) | ||
complete(StatusCodes.ServiceUnavailable -> "503") | ||
} | ||
} | ||
} | ||
|
||
} |