コード例 #1
0
ファイル: wrapper_test.go プロジェクト: yingkitw/loggregator
	"github.com/cloudfoundry/dropsonde/metrics"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"

	"github.com/cloudfoundry/gosteno"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Wrapper", func() {
	var (
		logger *gosteno.Logger
		sender *fake.FakeMetricSender

		client  *mockClient
		message []byte

		protocol string
		wrapper  *dopplerforwarder.Wrapper
	)

	BeforeEach(func() {
		logger = loggertesthelper.Logger()
		sender = fake.NewFakeMetricSender()
		metrics.Initialize(sender, metricbatcher.New(sender, time.Millisecond*10))

		client = newMockClient()
		envelope := &events.Envelope{
			Origin:     proto.String("fake-origin-1"),
			EventType:  events.Envelope_LogMessage.Enum(),
			LogMessage: factories.NewLogMessage(events.LogMessage_OUT, "message", "appid", "sourceType"),
コード例 #2
0
	"github.com/cloudfoundry/dropsonde/factories"
	"github.com/cloudfoundry/dropsonde/metric_sender/fake"
	"github.com/cloudfoundry/dropsonde/metrics"
	"github.com/cloudfoundry/gosteno"
	"github.com/cloudfoundry/loggregatorlib/loggertesthelper"
	"github.com/cloudfoundry/sonde-go/events"
	"github.com/gogo/protobuf/proto"
)

var _ = Describe("Wrapper", func() {
	var (
		logger      *gosteno.Logger
		sender      *fake.FakeMetricSender
		mockBatcher *mockMetricBatcher

		client  *mockClient
		message []byte

		protocol string
		wrapper  *dopplerforwarder.Wrapper
	)

	BeforeEach(func() {
		logger = loggertesthelper.Logger()
		sender = fake.NewFakeMetricSender()
		mockBatcher = newMockMetricBatcher()
		metrics.Initialize(sender, mockBatcher)

		client = newMockClient()
		envelope := &events.Envelope{
			Origin:     proto.String("fake-origin-1"),