本文整理汇总了Golang中metron/writers/dopplerforwarder.DopplerForwarder类的典型用法代码示例。如果您正苦于以下问题:Golang DopplerForwarder类的具体用法?Golang DopplerForwarder怎么用?Golang DopplerForwarder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DopplerForwarder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
"github.com/cloudfoundry/loggregatorlib/loggregatorclient"
"time"
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DopplerForwarder", func() {
var (
clientPool *mockClientPool
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
)
BeforeEach(func() {
clientPool = &mockClientPool{}
logger = loggertesthelper.Logger()
forwarder = dopplerforwarder.New(clientPool, logger)
})
It("sends messages to a random doppler", func() {
message := []byte("Some message")
forwarder.Write(message)
Expect(clientPool.randomClient).ToNot(BeNil())
示例2:
"metron/writers/dopplerforwarder"
. "github.com/apoydence/eachers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/gosteno"
"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
)
var _ = Describe("DopplerForwarder", func() {
var (
clientPool *mockClientPool
client *mockClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
fakeWrapper *mockNetworkWrapper
message []byte
)
BeforeEach(func() {
message = []byte("I am a message!")
client = newMockClient()
clientPool = newMockClientPool()
clientPool.RandomClientOutput.Client <- client
close(clientPool.RandomClientOutput.Err)
logger = loggertesthelper.Logger()
loggertesthelper.TestLoggerSink.Clear()
示例3:
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/dropsonde/signature"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var sharedSecret = []byte("secret")
var _ = Describe("DopplerForwarder", func() {
var (
sender *fake.FakeMetricSender
clientPool *fakes.FakeClientPool
client *fakeclient.FakeClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
envelope *events.Envelope
)
BeforeEach(func() {
sender = fake.NewFakeMetricSender()
metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
client = &fakeclient.FakeClient{}
clientPool = &fakes.FakeClientPool{}
clientPool.RandomClientReturns(client, nil)
logger = loggertesthelper.Logger()
loggertesthelper.TestLoggerSink.Clear()
示例4:
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/dropsonde/signature"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var sharedSecret = []byte("secret")
var _ = Describe("DopplerForwarder", func() {
var (
sender *fake.FakeMetricSender
clientPool *fakes.FakeClientPool
client *fakeclient.FakeClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
envelope *events.Envelope
doneChan chan struct{}
bufferSize uint
)
BeforeEach(func() {
sender = fake.NewFakeMetricSender()
metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
client = &fakeclient.FakeClient{}
clientPool = &fakes.FakeClientPool{}
clientPool.RandomClientReturns(client, nil)
logger = loggertesthelper.Logger()
loggertesthelper.TestLoggerSink.Clear()
示例5:
"time"
"github.com/cloudfoundry/dropsonde/metric_sender/fake"
"github.com/cloudfoundry/dropsonde/metricbatcher"
"github.com/cloudfoundry/dropsonde/metrics"
"github.com/cloudfoundry/gosteno"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DopplerForwarder", func() {
var (
sender *fake.FakeMetricSender
clientPool *mockClientPool
client *mockClient
logger *gosteno.Logger
forwarder *dopplerforwarder.DopplerForwarder
fakeWrapper *mockNetworkWrapper
message []byte
)
BeforeEach(func() {
message = []byte("I am a message!")
sender = fake.NewFakeMetricSender()
metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))
client = newMockClient()
clientPool = newMockClientPool()
clientPool.RandomClientOutput.client <- client
close(clientPool.RandomClientOutput.err)