Skip to content

Commit

Permalink
Merge db833d0 into 1747e0c
Browse files Browse the repository at this point in the history
  • Loading branch information
buddhamagnet committed Dec 21, 2015
2 parents 1747e0c + db833d0 commit dea69c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pubsub/awssub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ func (s *TestSQSAPI) GetQueueAttributesRequest(*sqs.GetQueueAttributesInput) (*r
func (s *TestSQSAPI) GetQueueAttributes(*sqs.GetQueueAttributesInput) (*sqs.GetQueueAttributesOutput, error) {
return nil, errNotImpl
}
func (s *TestSQSAPI) GetQueueUrlRequest(*sqs.GetQueueUrlInput) (*request.Request, *sqs.GetQueueUrlOutput) {
func (s *TestSQSAPI) GetQueueURLRequest(*sqs.GetQueueURLInput) (*request.Request, *sqs.GetQueueUrlOutput) {
return nil, nil
}
func (s *TestSQSAPI) GetQueueUrl(*sqs.GetQueueUrlInput) (*sqs.GetQueueUrlOutput, error) {
func (s *TestSQSAPI) GetQueueURL(*sqs.GetQueueURLInput) (*sqs.GetQueueURLOutput, error) {
return nil, errNotImpl
}
func (s *TestSQSAPI) ListDeadLetterSourceQueuesRequest(*sqs.ListDeadLetterSourceQueuesInput) (*request.Request, *sqs.ListDeadLetterSourceQueuesOutput) {
Expand Down
7 changes: 6 additions & 1 deletion pubsub/pubsubtest/pub.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ type (
// the protobuf struct.
FoundError error
}
// TestPublishMsg is a test publish message.
TestPublishMsg struct {
Key string
// Key represents the message key.
Key string
// Body represents the message body.
Body []byte
}
)

// Publish publishes the message, delegating to PublishRaw.
func (t *TestPublisher) Publish(key string, msg proto.Message) error {
data, err := proto.Marshal(msg)
t.FoundError = err
return t.PublishRaw(key, data)
}

// PublishRaw publishes the raw message byte slice.
func (t *TestPublisher) PublishRaw(key string, msg []byte) error {
t.Published = append(t.Published, TestPublishMsg{key, msg})
return t.GivenError
Expand Down
8 changes: 6 additions & 2 deletions pubsub/pubsubtest/sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

type (
// TestPublisher is a simple implementation of pubsub.Publisher meant to
// TestSubscriber is a simple implementation of pubsub.Publisher meant to
// help mock out any implementations.
TestSubscriber struct {
// ProtoMessages will be marshalled into []byte and used to mock out
Expand All @@ -31,17 +31,19 @@ type (
// the JSON and protobuf struct.
FoundError error
}

// TestSubsMessage represents a test subscriber message.
TestSubsMessage struct {
Msg []byte
Doned bool
}
)

// Message returns the subscriber message.
func (m *TestSubsMessage) Message() []byte {
return m.Msg
}

// Done sets the Doned field to true.
func (m *TestSubsMessage) Done() error {
m.Doned = true
return nil
Expand Down Expand Up @@ -72,10 +74,12 @@ func (t *TestSubscriber) Start() <-chan pubsub.SubscriberMessage {
return msgs
}

// Err ertuens the GivenErrError value.
func (t *TestSubscriber) Err() error {
return t.GivenErrError
}

// Stop returns the GivenStopError value.
func (t *TestSubscriber) Stop() error {
return t.GivenStopError
}

0 comments on commit dea69c8

Please sign in to comment.