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


Scala UDPAddressingMode类代码示例

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


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

示例1: GangliaReporterFactorySpec

//设置package包名称以及导入依赖的类
package de.khamrakulov.play.metrics.ganglia

import java.util.UUID

import com.codahale.metrics.MetricRegistry
import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode
import org.scalatest.{FlatSpec, Matchers}
import play.api.{Configuration, Environment}

import scala.concurrent.duration._


class GangliaReporterFactorySpec extends FlatSpec with Matchers {
  val env = Environment.simple()
  val config = Configuration.load(env)

  "GangliaReporterFactory" should "properly parse config with defaults" in {
    val c = GangliaReporterFactory.config(config.getConfig("metrics.reporterPlain").get)
    c.durationUnit shouldBe MILLISECONDS
    c.frequency shouldBe 1.minute
    c.rateUnit shouldBe SECONDS
    c.host shouldBe "localhost"
    c.port shouldBe 8649
    c.prefix shouldBe ""
    c.ttl shouldBe 1
    c.mode shouldBe UDPAddressingMode.UNICAST
    c.uuid shouldBe None
    c.spoof shouldBe None
    c.tmax shouldBe 60
    c.dmax shouldBe 0
  }

  it should "properly parse config with all values" in {
    val c = GangliaReporterFactory.config(config.getConfig("metrics.reporterBasic").get)
    c.durationUnit shouldBe SECONDS
    c.frequency shouldBe 10.seconds
    c.rateUnit shouldBe MINUTES
    c.host shouldBe "localhost2"
    c.port shouldBe 9090
    c.prefix shouldBe "some"
    c.ttl shouldBe 2
    c.mode shouldBe UDPAddressingMode.MULTICAST
    c.uuid shouldBe Some(UUID.fromString("123e4567-e89b-12d3-a456-426655440000"))
    c.spoof shouldBe Some("test")
    c.tmax shouldBe 1
    c.dmax shouldBe 1

  }

  it should "not create factory for incorrect config" in {
    GangliaReporterFactory(
      new MetricRegistry(), config.getConfig("metrics.gangliaIncorrectConfig").get
    ) shouldBe None
  }
} 
开发者ID:htimur,项目名称:metrics-reporter-play,代码行数:56,代码来源:GangliaReporterFactorySpec.scala


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