• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala FeatureTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: QwebmonControllerTest

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

import com.criteo.qwebmon.drivers.FakeDbDriver
import com.twitter.finagle.http.Status._
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class QwebmonControllerTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(new FinatraServer {
    override def dbDrivers: Map[String, DbDriver] = Map("fake-db" -> new FakeDbDriver("fake-db"))
  })

  "Qwebmon" should {
    "Provide a refresh for fake-db" in {
      val response = server.httpGet(
        path = "/refresh/fake-db",
        andExpect = Ok
      ).contentString

      response should startWith(
        """{"running_queries":[{"user":"johndoe","run_seconds":350,"query":"select distinct 1","hostname":"127.0.0.1"},"""
      )

      response should include(""""running_query_count":5""")
    }
  }

} 
开发者ID:jqcoffey,项目名称:qwebmon,代码行数:30,代码来源:QwebmonControllerTest.scala


示例2: ExampleFeatureTest

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

import com.twitter.finagle.http.Status.Ok
import com.twitter.finatra.http.test.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class ExampleFeatureTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(new ExampleServer)

  "Server" should {
    "ping" in {
      server.httpGet(
        path = "/ping",
        andExpect = Ok,
        withBody = "pong")
    }
  }
} 
开发者ID:divanvisagie,项目名称:finatra-website-example,代码行数:20,代码来源:ExampleFeatureTest.scala


示例3: MainControllerFeatureTest

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

import com.twitter.finagle.http.Status.Ok
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import $package$.Server

class MainControllerFeatureTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(new Server)

  "Server" should {
    "respond" in {
      server.httpGet(
        path = "/",
        andExpect = Ok,
        withBody = "{\"message\":\"success\"}")
    }
  }
} 
开发者ID:jimschubert,项目名称:finatra.g8,代码行数:21,代码来源:MainControllerFeatureTest.scala


示例4:

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

import com.twitter.finagle.http.Status.Ok
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import $package$.Server

class $className$ControllerFeatureTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(new Server)

  "/$className$" should {
    "respond" in {
      server.httpGet(
        path = "/$className$",
        andExpect = Ok,
        withBody = "{\"message\":\"success\"}")
    }
  }
} 
开发者ID:jimschubert,项目名称:finatra.g8,代码行数:21,代码来源:$className$FeatureTest.scala


示例5: FinatraFeatureTest

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

import com.github.ikhoon.FinatraServer
import com.twitter.finagle.http.Status.Ok
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class FinatraFeatureTest extends FeatureTest {

  override val server = new EmbeddedHttpServer(new FinatraServer)

  test("Server#ping") {
    server.httpGet(
      path = "/ping",
      andExpect = Ok,
      withBody = """{"pong":"pong"}"""
    )
  }
} 
开发者ID:ikhoon,项目名称:finatra-mysql-seed,代码行数:20,代码来源:FinatraFeatureTest.scala


示例6: WishListsFeatureTest

//设置package包名称以及导入依赖的类
package me.kamkor.wishlists

import com.twitter.finagle.http.Status
import com.twitter.finatra.http.test.{EmbeddedHttpServer, HttpTest}
import com.twitter.inject.Mockito
import com.twitter.inject.server.FeatureTest

object WishListsFeatureTest {

  val TestTenant = "TestTenant"
  val Headers = Map("hybris-tenant" -> TestTenant)

}

class WishListsFeatureTest extends FeatureTest with Mockito with HttpTest {

  import WishListsFeatureTest._

  override val server = new EmbeddedHttpServer(new WishListsServer)

  "A WishLists endpoint" should {

    "GET wishlist" in {
      //mock document repository client
      //server.httpGet(path = s"/$TestTenant/wishlists/1", headers = Headers, andExpect = Status.Ok)
    }

    "GET NotFound" in {

    }

    "PUT wishlist" in {
      server.httpPut(
        path = s"/$TestTenant/wishlists/1",
        headers = Headers,
        putBody =
          """
            |{
            |  "owner":"kamil",
            |  "title":"food list",
            |  "description":"Food for the weekend"
            |}
          """.stripMargin,
        andExpect = Status.NoContent
      )
    }

    "DELETE wishlist" in {
      server.httpDelete(path = s"/$TestTenant/wishlists/1", headers = Headers, andExpect = Status.NoContent)
    }
  }


} 
开发者ID:kamkor,项目名称:yaas-wishlist-service,代码行数:55,代码来源:WishListsFeatureTest.scala


示例7: LoginFeatureTest

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

import com.swissguard.SwissGuardThriftServer
import com.swissguard.authentication.thriftscala.{AuthenticationService, LoginRequest}
import com.twitter.finatra.thrift.EmbeddedThriftServer
import com.twitter.inject.Mockito
import com.twitter.inject.server.FeatureTest
import com.twitter.util.{Await, Future}

class LoginFeatureTest extends FeatureTest with Mockito {

  override val server = new EmbeddedThriftServer(new SwissGuardThriftServer)

  val client = server.thriftClient[AuthenticationService[Future]](clientId = "login")


  "login with correct password" should {
    "respond with token" in {
      client.login(
        LoginRequest("bob","bobby123")
      ).value.length should be > 20
    }
  }

  "login with incorrect password" should {
    "throw Invalid password exception" in {

      val thrown = the [Exception] thrownBy {
        Await.result(client.login(
          LoginRequest("bob", "sarah123")
        ))
      }
      thrown.toString should include ("Invalid password")
    }
  }

  "login with incorrect username" should {
    "throw invalid Username exception" in {
      val thrown = the [Exception] thrownBy {
        Await.result(client.login(
          LoginRequest("alan-nowhere", "wont-matter")
        ))
      }
      thrown.toString should include ("User not found")
    }
  }
} 
开发者ID:divanvisagie,项目名称:swiss-guard,代码行数:48,代码来源:LoginFeatureTest.scala


示例8: CreateUserFeatureTest

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

import com.swissguard.SwissGuardThriftServer
import com.swissguard.authentication.thriftscala.{AuthenticationService, RegistrationRequest}
import com.twitter.finatra.thrift.EmbeddedThriftServer
import com.twitter.inject.Mockito
import com.twitter.inject.server.FeatureTest
import com.twitter.util.{Await, Future}

class CreateUserFeatureTest extends FeatureTest with Mockito {

  override val server = new EmbeddedThriftServer(new SwissGuardThriftServer)

  val client = server.thriftClient[AuthenticationService[Future]](clientId = "register")

  "register user bob " should {
    "throw user exists" in {

      val thrown = the[Exception] thrownBy {
        Await.result(client.register(
          RegistrationRequest(
            username = "bob",
            password = "bob",
            email = "[email protected]"
          )
        ))
      }
      thrown.toString should include("User exists")
    }
  }
} 
开发者ID:divanvisagie,项目名称:swiss-guard,代码行数:32,代码来源:CreateUserFeatureTest.scala


示例9: AuthenticationFeatureTest

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

import com.swissguard.SwissGuardThriftServer
import com.swissguard.authentication.thriftscala.AuthenticationService
import com.twitter.finatra.thrift.EmbeddedThriftServer
import com.twitter.inject.server.FeatureTest
import com.twitter.util.Future

class AuthenticationFeatureTest extends FeatureTest {

  override val server = new EmbeddedThriftServer(new SwissGuardThriftServer)

  val client = server.thriftClient[AuthenticationService[Future]](clientId = "loginClient")

  "user service" should {
    "respond to validation with true" in {
      client.validateToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImJvYmEifQ.fQ2PO8HbCgGzmVoyM6RBrzXjYseUgv1VgpwWx9FCBxY")
        .value should be (true)
    }
  }

  "user service" should {
    "respond to validation with false" in {
      client.validateToken("bad-token")
        .value should be (false)
    }
  }
} 
开发者ID:divanvisagie,项目名称:swiss-guard,代码行数:29,代码来源:AuthenticationFeatureTest.scala


示例10: 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


示例11: HelloControllerFeatureTest

//设置package包名称以及导入依赖的类
import com.twitter.finagle.http.Status
import com.twitter.finatra.http.test.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class HelloControllerFeatureTest extends FeatureTest {
  override val server: EmbeddedHttpServer = new EmbeddedHttpServer(
    twitterServer = new FitmanServer)

  "Say Hello" in {
    server.httpGet(
      path = "/hello",
      andExpect = Status.Ok,
      withBody = "Fitman says hello"
    )
  }
} 
开发者ID:simoncyl,项目名称:Fitman,代码行数:17,代码来源:FeatureTest.scala


示例12: PingControllerFeatureTest

//设置package包名称以及导入依赖的类
package net.songpon.controller

import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.{EmbeddedTwitterServer, FeatureTest}
import net.songpon.QuoteAPIServer


class PingControllerFeatureTest extends FeatureTest {
  override val server: EmbeddedHttpServer = new EmbeddedHttpServer( twitterServer = new QuoteAPIServer)

  "Tests - ping" in {
    server.httpGet(
      path = "/scalaquote/ping",
      andExpect = Status.Ok,
      withBody = "pong"
    )
  }
} 
开发者ID:tsongpon,项目名称:scala-quote,代码行数:20,代码来源:PingControllerFeatureTest.scala


示例13: FeederApiIndexFeatureTest

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

import com.twitter.finagle.http.Status
import com.twitter.finatra.http.test.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class FeederApiIndexFeatureTest extends FeatureTest {
  override val server = new EmbeddedHttpServer(
    new FeederApiServer,
    verbose = false,
    disableTestLogging = true
  )

  "Server" should {
    "return an index page" in {
      server.httpGet(
        path = "/",
        andExpect = Status.Ok,
        withBody = "Hello")
    }
  }
} 
开发者ID:jensraaby,项目名称:feeder,代码行数:23,代码来源:FeederApiIndexFeatureTest.scala


示例14: GameControllerFeatureTest

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

import com.buysomegames.kernel.BuysomegamesServer
import com.buysomegames.test.FreshDatabase
import com.buysomegames.test.TestUtilities.readResource
import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class GameControllerFeatureTest extends FeatureTest with FreshDatabase {
  override protected def server: EmbeddedHttpServer = new EmbeddedHttpServer(new BuysomegamesServer)

  "/games endpoint" should {
    "respond with information about all games" in {
      server.httpGet(
        path = "/games",
        andExpect = Status.Ok,
        withJsonBody = readResource("/controller/games/games.json")
      )
    }
  }
} 
开发者ID:kaliy,项目名称:buysomegames,代码行数:23,代码来源:GameControllerFeatureTest.scala


示例15: PlatformControllerFeatureTest

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

import com.buysomegames.kernel.BuysomegamesServer
import com.buysomegames.test.FreshDatabase
import com.buysomegames.test.TestUtilities.readResource
import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class PlatformControllerFeatureTest extends FeatureTest with FreshDatabase {
  override protected def server: EmbeddedHttpServer = new EmbeddedHttpServer(new BuysomegamesServer)
  "/platforms endpoint" should {
    "respond with information about all platforms" in {
      server.httpGet(
        path = "/platforms",
        andExpect = Status.Ok,
        withJsonBody = readResource("/controller/platforms/platforms-response.json")
      )
    }
  }
} 
开发者ID:kaliy,项目名称:buysomegames,代码行数:22,代码来源:PlatformControllerFeatureTest.scala


示例16: GameEditionControllerFeatureTest

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

import com.buysomegames.kernel.BuysomegamesServer
import com.buysomegames.test.FreshDatabase
import com.buysomegames.test.TestUtilities.readResource
import com.twitter.finagle.http.Status
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest

class GameEditionControllerFeatureTest extends FeatureTest with FreshDatabase {
  override protected def server: EmbeddedHttpServer = new EmbeddedHttpServer(new BuysomegamesServer)

  "/game_editions endpoint" should {
    "respond with information about all available game editions" in {
      server.httpGet(
        path = "/game_editions",
        andExpect = Status.Ok,
        withJsonBody = readResource("/controller/game_editions/game_editions.json")
      )
    }
  }
} 
开发者ID:kaliy,项目名称:buysomegames,代码行数:23,代码来源:GameEditionControllerFeatureTest.scala


示例17: ServerTest

//设置package包名称以及导入依赖的类
package uk.ac.wellcome.platform.idminter
import com.twitter.finagle.http.Status._
import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import uk.ac.wellcome.platform.idminter.utils.{
  IdentifiersTableInfo,
  MysqlLocal
}
import uk.ac.wellcome.test.utils.{AmazonCloudWatchFlag, SNSLocal, SQSLocal}

class ServerTest
    extends FeatureTest
    with SNSLocal
    with MysqlLocal
    with IdentifiersTableInfo
    with AmazonCloudWatchFlag
    with SQSLocal {

  val server = new EmbeddedHttpServer(
    new Server(),
    flags = snsLocalEndpointFlags ++
      sqsLocalFlags ++
      identifiersMySqlLocalFlags ++
      cloudWatchLocalEndpointFlag
  )

  test("it should show the healthcheck message") {
    server.httpGet(path = "/management/healthcheck",
                   andExpect = Ok,
                   withJsonBody = """{"message": "ok"}""")
  }
} 
开发者ID:wellcometrust,项目名称:platform-api,代码行数:33,代码来源:ServerTest.scala


示例18: StartupTest

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

import com.twitter.finatra.http.EmbeddedHttpServer
import com.twitter.inject.server.FeatureTest
import uk.ac.wellcome.platform.idminter.utils.{
  IdentifiersTableInfo,
  MysqlLocal
}
import uk.ac.wellcome.test.utils._

class StartupTest
    extends FeatureTest
    with StartupLogbackOverride
    with SNSLocal
    with MysqlLocal
    with IdentifiersTableInfo
    with AmazonCloudWatchFlag
    with SQSLocal {
  val server = new EmbeddedHttpServer(
    new Server(),
    flags = snsLocalEndpointFlags ++
      sqsLocalFlags ++
      identifiersMySqlLocalFlags ++
      cloudWatchLocalEndpointFlag
  )

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


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala TransportClient类代码示例发布时间:2022-05-23
下一篇:
Scala PrivateKey类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap