当前位置: 首页>>代码示例>>Scala>>正文


Scala Stage类代码示例

本文整理汇总了Scala中com.google.inject.Stage的典型用法代码示例。如果您正苦于以下问题:Scala Stage类的具体用法?Scala Stage怎么用?Scala Stage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Stage类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: ExampleServerStartupTest

//设置package包名称以及导入依赖的类
package com.example

import com.google.inject.Stage
import com.twitter.finatra.thrift.EmbeddedThriftServer
import com.twitter.inject.server.FeatureTest
import com.swissguard.SwissGuardThriftServer

class ExampleServerStartupTest extends FeatureTest {

  val server = new EmbeddedThriftServer(
    twitterServer = new SwissGuardThriftServer,
    stage = Stage.PRODUCTION)

  "server" should {
    "startup" in {
      server.assertHealthy()
    }
  }
} 
开发者ID:divanvisagie,项目名称:swiss-guard,代码行数:20,代码来源:ExampleServerStartupTest.scala

示例2: StartupTest

//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.reindexer

import com.google.inject.Stage
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import uk.ac.wellcome.test.utils.{
  AmazonCloudWatchFlag,
  DynamoDBLocal,
  StartupLogbackOverride
}

class StartupTest
    extends FeatureTest
    with StartupLogbackOverride
    with DynamoDBLocal
    with AmazonCloudWatchFlag {

  val server = new EmbeddedHttpServer(
    stage = Stage.PRODUCTION,
    twitterServer = new Server,
    flags = Map(
      "aws.dynamo.reindexTracker.tableName" -> "ReindexTracker",
      "aws.dynamo.miroData.tableName" -> "MiroData",
      "reindex.target.tableName" -> "MiroData"
    ) ++ dynamoDbLocalEndpointFlags ++ cloudWatchLocalEndpointFlag
  )

  test("server starts up correctly") {
    server.assertHealthy()
  }
} 
开发者ID:wellcometrust,项目名称:platform-api,代码行数:32,代码来源:StartupTest.scala

示例3: StartupTest

//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.ingestor

import com.google.inject.Stage
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import uk.ac.wellcome.test.utils.{
  AmazonCloudWatchFlag,
  SQSLocal,
  StartupLogbackOverride
}

class StartupTest
    extends FeatureTest
    with StartupLogbackOverride
    with SQSLocal
    with AmazonCloudWatchFlag {

  val server = new EmbeddedHttpServer(
    stage = Stage.PRODUCTION,
    twitterServer = new Server,
    flags = sqsLocalFlags ++ cloudWatchLocalEndpointFlag)

  test("server starts up correctly") {
    server.assertHealthy()
  }
} 
开发者ID:wellcometrust,项目名称:platform-api,代码行数:27,代码来源:StartupTest.scala

示例4: StartupTest

//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.transformer

import com.google.inject.Stage
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import uk.ac.wellcome.test.utils._

class StartupTest
    extends FeatureTest
    with StartupLogbackOverride
    with AmazonCloudWatchFlag
    with SQSLocal
    with SNSLocal {

  val server = new EmbeddedHttpServer(
    stage = Stage.PRODUCTION,
    twitterServer = new Server,
    flags = Map(
      "transformer.source" -> "MiroData"
    ) ++ cloudWatchLocalEndpointFlag ++ sqsLocalFlags ++ snsLocalEndpointFlags
  )

  test("server starts up correctly") {
    server.assertHealthy()
  }
} 
开发者ID:wellcometrust,项目名称:platform-api,代码行数:27,代码来源:StartupTest.scala

示例5: StartupFeatureTest

//设置package包名称以及导入依赖的类
package com.twitter.diffy

import com.google.inject.Stage
import com.twitter.finatra.http.test.EmbeddedHttpServer
import com.twitter.inject.Test

class StartupFeatureTest extends Test {

  val server = new EmbeddedHttpServer(
    stage = Stage.PRODUCTION,
    twitterServer = new MainService {
    },
    extraArgs = Seq(
      "-proxy.port=:0",
      "-candidate=localhost:80",
      "-master.primary=localhost:80",
      "-master.secondary=localhost:80",
      "-service.protocol=http"))

  "verify startup" in {
    server.assertHealthy()
  }
} 
开发者ID:sachinmanchanda,项目名称:diffy_unicast,代码行数:24,代码来源:StartupFeatureTest.scala

示例6: ExampleStartupTest

//设置package包名称以及导入依赖的类
package com.example

import com.google.inject.Stage
import com.twitter.finatra.http.EmbeddedHttpServer
import org.scalatest.FunSuite

class ExampleStartupTest extends FunSuite {

  lazy val server = new EmbeddedHttpServer(
    stage = Stage.PRODUCTION,
    twitterServer = new HelloServer)

  test("Server#startup") {
    try {
      server.assertHealthy()
    } catch {
      case e: Exception => e.printStackTrace()
    }
  }
} 
开发者ID:yafengli,项目名称:finatra-freemarker-seed.g8,代码行数:21,代码来源:ExampleStartupTest.scala

示例7: UserLoginControllerTest

//设置package包名称以及导入依赖的类
package cronus.auth

import com.google.inject.Stage
import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.finatra.json.FinatraObjectMapper
import com.twitter.inject.server.FeatureTest
import cronus.FrontServer

class UserLoginControllerTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(
    twitterServer = new FrontServer,
    stage = Stage.PRODUCTION,
    verbose = true,
    maxStartupTimeSeconds = 60)

  val url = "/user/authenticate"

  val objectMapper = FinatraObjectMapper.create(injector.underlying)

  "UserLoginController" should {

    "Get a token when sending the right access credentials" in {
      val shuttle = AuthShuttle("test", "test", "")
      val sendJson = objectMapper.writePrettyString(shuttle)
      val response = server.httpPostJson[AuthShuttle](path = url, postBody = sendJson, andExpect = Status.Ok)
      assert(response.uid == response.uid)
      assert(response.password == "")
      assert(response.token == "TESTTOKEN")
      //objectMapper.writePrettyString()
    }

    "Get Unauthorized when sending wrong user" in {
      val shuttle = AuthShuttle("wrong", "test", "")
      val sendJson = objectMapper.writePrettyString(shuttle)
      server.httpPost(path = url, postBody = sendJson, andExpect = Status.Unauthorized)
    }

    "Get Unauthorized when sending wrong password" in {
      val shuttle = AuthShuttle("test", "wrong",  "")
      val sendJson = objectMapper.writePrettyString(shuttle)
      server.httpPost(path = url, postBody = sendJson, andExpect = Status.Unauthorized)
    }

    "Get BadRequest when sending non json" in {
      server.httpPost(path = url, postBody = "wrong", andExpect = Status.BadRequest)
    }

    "Get BadRequest when sending empty string" in {
      server.httpPost(path = url, postBody = "", andExpect = Status.BadRequest)
    }

  }

} 
开发者ID:codeape,项目名称:cronus,代码行数:57,代码来源:UserLoginControllerTest.scala

示例8: FrontServerStartupTest

//设置package包名称以及导入依赖的类
package cronus

import com.google.inject.Stage
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class FrontServerStartupTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(
    twitterServer = new FrontServer,
    stage = Stage.PRODUCTION,
    verbose = false)

  "Server" should {
    "startup" in {
      server.assertHealthy()
    }
  }

} 
开发者ID:codeape,项目名称:cronus,代码行数:21,代码来源:FrontServerStartupTest.scala

示例9: AssetControllerFeatureTest

//设置package包名称以及导入依赖的类
package cronus.controllers

import com.google.common.net.MediaType
import com.google.inject.Stage
import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import cronus.FrontServer
import org.webjars.WebJarAssetLocator

import scala.io.Source


class AssetControllerFeatureTest extends FeatureTest
{

  override val server = new EmbeddedHttpServer(
    twitterServer = new FrontServer,
    stage = Stage.PRODUCTION,
    verbose = true,
    maxStartupTimeSeconds = 60)

  "AssetController" should  {

    "return -ok- for an existing WebJar resource" in {
      val locator: WebJarAssetLocator = new WebJarAssetLocator()
      val fullPath = locator.getFullPath("bootstrap", "js/npm.js")
      val is = locator.getClass.getClassLoader.getResourceAsStream(fullPath)
      val response = server.httpGet(path="/assets/bootstrap/js/npm.js", andExpect = Status.Ok,
        withBody = Source.fromInputStream(is).mkString)
      response.contentType should equal(Some(MediaType.JAVASCRIPT_UTF_8.toString))

      val fullPath2 = locator.getFullPath("backbonejs", "backbone-min.js")
      val is2 = locator.getClass.getClassLoader.getResourceAsStream(fullPath2)
      val response2 = server.httpGet(path="/assets/backbonejs/backbone-min.js", andExpect = Status.Ok,
        withBody = Source.fromInputStream(is2).mkString)
      response2.contentType should equal(Some(MediaType.JAVASCRIPT_UTF_8.toString))
    }

    "return -not found- for an path containing only a webjar name" in {
      server.httpGet(path="/assets/bootstrap/", andExpect = Status.NotFound)
      server.httpGet(path="/assets/bootstrap", andExpect = Status.NotFound)
    }

    "return -not found- for an path containing /assets" in {
      server.httpGet(path="/assets/", andExpect = Status.NotFound)
      server.httpGet(path="/assets", andExpect = Status.NotFound)
    }

    "return -not found- for an non existing WebJar resource" in {
      server.httpGet(path="/assets/bootstrap/css/.fail", andExpect = Status.NotFound)
    }
  }
} 
开发者ID:codeape,项目名称:cronus,代码行数:55,代码来源:AssetControllerFeatureTest.scala


注:本文中的com.google.inject.Stage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。