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

Scala NoLogging类代码示例

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

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



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

示例1: log

//设置package包名称以及导入依赖的类
package me.snov.akka.sqs.shape

import akka.event.{LoggingAdapter, NoLogging}
import akka.stream.ActorMaterializer
import akka.stream.stage.GraphStageLogic

private[sqs] trait StageLogging { self: GraphStageLogic =>

  private var loggingAdapter: LoggingAdapter = _

  def log: LoggingAdapter = {
    if (loggingAdapter eq null) {
      materializer match {
        case actorMaterializer: ActorMaterializer =>
          loggingAdapter = akka.event.Logging(actorMaterializer.system, self.getClass)
        case _ =>
          loggingAdapter = NoLogging
      }
    }

    loggingAdapter
  }
} 
开发者ID:s12v,项目名称:akka-stream-sqs,代码行数:24,代码来源:StageLogging.scala


示例2: BaseHttpApiSpec

//设置package包名称以及导入依赖的类
package hmda.api.http

import akka.event.{ NoLogging, LoggingAdapter }
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.model.headers.{ HttpEncodings, `Accept-Encoding` }
import akka.http.scaladsl.model.headers.HttpEncodings._
import akka.http.scaladsl.testkit.ScalatestRouteTest
import hmda.api.model.Status
import org.scalatest.{ MustMatchers, WordSpec }

import scala.concurrent.ExecutionContext

class BaseHttpApiSpec extends WordSpec with MustMatchers with ScalatestRouteTest with BaseHttpApi {
  override val log: LoggingAdapter = NoLogging
  val ec: ExecutionContext = system.dispatcher

  "Http API service" must {

    "return OK for GET requests to the root path" in {
      Get() ~> routes("hmda-filing-api") ~> check {
        responseAs[Status].status mustBe "OK"
        responseAs[Status].service mustBe "hmda-filing-api"
      }
    }

    "use requested encoding for root path" in {
      Get().addHeader(`Accept-Encoding`(gzip)) ~> routes("hmda-filing-api") ~> check {
        response.encoding mustBe HttpEncodings.gzip
      }
    }

  }

} 
开发者ID:cfpb,项目名称:hmda-platform,代码行数:35,代码来源:BaseHttpApiSpec.scala


示例3:

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

import me.archdev.restapi.http.HttpService
import me.archdev.restapi.models.{ TokenEntity, UserEntity }
import me.archdev.restapi.utils.Migration
import org.scalatest._

import akka.event.{ NoLogging, LoggingAdapter }
import akka.http.scaladsl.testkit.ScalatestRouteTest

import scala.concurrent.Await
import scala.concurrent.duration._

trait BaseServiceTest extends WordSpec with Matchers with ScalatestRouteTest with HttpService with Migration {
  protected val log: LoggingAdapter = NoLogging

  import driver.api._

  val testUsers = Seq(
    UserEntity(Some(1), "Arhelmus", "test"),
    UserEntity(Some(2), "Arch", "test"),
    UserEntity(Some(3), "Hierarh", "test")
  )

  val testTokens = Seq(
    TokenEntity(userId = Some(1)),
    TokenEntity(userId = Some(2)),
    TokenEntity(userId = Some(3))
  )

  reloadSchema()
  Await.result(db.run(users ++= testUsers), 10.seconds)
  Await.result(db.run(tokens ++= testTokens), 10.seconds)
} 
开发者ID:samuelmartingc,项目名称:Akka-REST-service,代码行数:35,代码来源:BaseServiceTest.scala


示例4: ServiceSpec

//设置package包名称以及导入依赖的类
package org.stanoq.tests.crawler

import akka.event.NoLogging
import akka.http.scaladsl.model.ContentTypes._
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.testkit.ScalatestRouteTest
import org.scalatest._
import org.stanoq.crawler.CrawlerService
import org.stanoq.crawler.model.{ConfigProperties, CrawlerProtocols, CrawlerResponse}
import spray.json._

import scala.io.Source

class ServiceSpec extends FlatSpec with Matchers with ScalatestRouteTest with CrawlerProtocols {
  override def testConfigSource = "akka.loglevel = DEBUG"
  def config = testConfig
  val logger = NoLogging

  val crawlerService = new CrawlerService
  val configJson = Source.fromFile("config.json").mkString

  "CrawlerService" should "respond with >2 processed pages on crawling websocket.org with depth 1 (json)" in {
    Post(s"/crawler", configJson.parseJson.convertTo[ConfigProperties]) ~> crawlerService.route ~> check {
      status shouldBe OK
      contentType shouldBe `application/json`
      responseAs[CrawlerResponse].pages.size should be >2
    }
  }

  "CrawlerService" should "respond with >20 processed pages on crawling websocket.org with depth 4" in {
    Post(s"/crawler", ConfigProperties("https://www.websocket.org/index.html",4)) ~> crawlerService.route ~> check {
      status shouldBe OK
      contentType shouldBe `application/json`
      val res = responseAs[CrawlerResponse]
      res.pages.size should be >20
      res.pages.filter(_.statusCode!=200).size shouldBe 2
    }
  }
} 
开发者ID:olka,项目名称:stanoq,代码行数:40,代码来源:ServiceSpec.scala


示例5:

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

import synahive.restapi.http.HttpService
import synahive.restapi.models.{ TokenEntity, UserEntity }
import synahive.restapi.utils.Migration
import org.scalatest._

import akka.event.{ NoLogging, LoggingAdapter }
import akka.http.scaladsl.testkit.ScalatestRouteTest

import scala.concurrent.Await
import scala.concurrent.duration._

trait BaseServiceTest extends WordSpec with Matchers with ScalatestRouteTest with HttpService with Migration {
  protected val log: LoggingAdapter = NoLogging

  import driver.api._

  val testUsers = Seq(
    UserEntity(Some(1), "Synahive", "test"),
    UserEntity(Some(2), "Marius", "test"),
    UserEntity(Some(3), "Gerald", "test")
  )

  val testTokens = Seq(
    TokenEntity(userId = Some(1)),
    TokenEntity(userId = Some(2)),
    TokenEntity(userId = Some(3))
  )

  reloadSchema()
  Await.result(db.run(users ++= testUsers), 10.seconds)
  Await.result(db.run(tokens ++= testTokens), 10.seconds)
} 
开发者ID:synahive,项目名称:synahive-server,代码行数:35,代码来源:BaseServiceTest.scala


示例6: ServiceSpec

//设置package包名称以及导入依赖的类
import actors.EventManager
import akka.event.NoLogging
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.model.ContentTypes._
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.testkit.ScalatestRouteTest
import messages.{ClientEvent, RequestText}
import org.aj.ner.EmbeddedToken
import org.scalatest._
import akka.testkit.TestActorRef

class ServiceSpec extends FlatSpec with Matchers with ScalatestRouteTest with Service {

  override def testConfigSource = "akka.loglevel = WARNING"
  override def config = testConfig
  override val logger = NoLogging

  override val eventManager = TestActorRef(EventManager.props, "eventManager")

  subscribe((eventManager, classOf[ClientEvent]))

  val requestText = RequestText(
    "Marcora doesn't even have to talk in his mother tongue to spark a reaction: In his adopted hometown of Chatham in Kent, southeast of London, just speaking English with an Italian accent can be enough to provoke a reaction. This is post-Brexit referendum Britain. And it's a place Marcora, who has lived and worked in the UK for 18 years, barely recognizes.",
    Some(Array("MISC"))
  )

  val tokens = Set(
      EmbeddedToken("MISC", "English"),
      EmbeddedToken("MISC", "Italian"),
      EmbeddedToken("MISC", "post-Brexit")
  )

  "Service" should "respond to query with MISC tokens only" in {
    Get("/ner/aj", requestText) ~> routes ~> check {
      status shouldBe OK
      contentType shouldBe `application/json`
      responseAs[Set[EmbeddedToken]] shouldBe tokens
    }
  }

} 
开发者ID:ajmnsk,项目名称:ner-service,代码行数:42,代码来源:ServiceSpec.scala


示例7: ServiceSpec

//设置package包名称以及导入依赖的类
import akka.event.NoLogging

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.model.ContentTypes._
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.testkit.ScalatestRouteTest
import org.scalatest._

class ServiceSpec extends FlatSpec with Matchers with ScalatestRouteTest with Service with Protocols {
  override def testConfigSource = "akka.loglevel = WARNING"

  override def config = testConfig

  override val logger = NoLogging

  import domain.Services._
  import orderMgmr._
  import scenarios.Order

  "OrderMgr" should "allow adding a product given any customer auth info" in {

    import scenarios.ProductAddTest._

    Post(s"/${orderMgmr.name}/${api.productAdd}", orderMgmtService.request) ~> routes(orderMgmtService) ~> check {
      status shouldBe OK
      contentType shouldBe `application/json`
      val response = responseAs[(domain.ResultCode, scenarios.OrderSummary)]
      println(response)
      response._1 shouldBe true
      response._2.customerId shouldBe customer._3
      response._2.order.details.size shouldBe 1
      response._2.order.details.head.productId shouldBe xspaceIceCream
    }
  }

  "OrderMgr" should "allow viewing order history given any customer id" in {

    import scenarios.OrdersViewTest._

    Get(s"/${orderMgmr.name}/${api.ordersView}/${orderMgmtService.request}") ~> routes(orderMgmtService) ~> check {
      status shouldBe OK
      contentType shouldBe `application/json`
      val response = responseAs[List[Order]]
      println(response)
      response.size shouldBe 2
      response.dropWhile(_.customerId == customer._3) shouldBe List.empty
    }
  }
} 
开发者ID:SemanticBeeng,项目名称:akka-http-order-microservice,代码行数:50,代码来源:ServiceSpec.scala



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Scala DefaultHandler类代码示例发布时间:2022-05-23
下一篇:
Scala Authorization类代码示例发布时间: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