mock

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)

This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)

This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockDriver

func NewMockDriver() broker.Interface

NewMockDriver creates a new mock driver

Returns: *MockDriver,

Types

type MockConsumer

type MockConsumer struct {
	// contains filtered or unexported fields
}

A MockConsumer mocks the Consumer interface

func (*MockConsumer) AddClientProducer added in v0.0.3

func (mc *MockConsumer) AddClientProducer(producer producer.BrokerProducerI)

func (*MockConsumer) ConsumeMessages

func (mc *MockConsumer) ConsumeMessages() consumer.BrokerConsumerI

ConsumeMessages consumes messages from the broker (mock)

func (*MockConsumer) GetClientProducer added in v0.0.3

func (mc *MockConsumer) GetClientProducer() producer.BrokerProducerI

func (*MockConsumer) SetMessageHandler

func (mc *MockConsumer) SetMessageHandler(handler func(msg *consumer.BrokerConsumerMessage, routingKey string, userID string, sessionID string)) consumer.BrokerConsumerI

SetMessageHandler sets the message handler for this consumer (mock)

handler: func(msg *broker.Message), a functino to handle the message

type MockDriver

type MockDriver struct {
	// Mock messages that are published by producers on this broker
	// Key is the routing key
	// Value is a slice of messages, in order of being sent 'first -> last'
	Messages map[string][]broker.Message
}

MockDriver is a mock broker implementing the Interface

func (*MockDriver) CreateConsumer

func (md *MockDriver) CreateConsumer(exchangeName string, queueName string, routingKey string, routingKeyStore keyvaluestore.Interface, serviceName string) consumer.BrokerConsumerI

CreateConsumer creates a consumer with the specified parameters (mock)

exchangeName: string, the name of the exchange to which this consumer will bind its queue
queueName: string, the name of the queue this consumer will consume messages from
routingKey: string, the routingKey this consumer listens to
Returns: An object implementing the Consumer interface

func (*MockDriver) CreateConsumerWithClient added in v0.0.3

func (md *MockDriver) CreateConsumerWithClient(exchangeName string, queueName string, routingKey string, routingKeyStore keyvaluestore.Interface, serviceName string) (consumer.BrokerConsumerI, producer.BrokerProducerI)

func (*MockDriver) CreateProducer

func (md *MockDriver) CreateProducer(exchangeName string, serviceName string) producer.BrokerProducerI

CreateProducer creates a producer with the specified parameters (mock)

exchangeName: string, the name of the exchange to which this producer will publish messages
Returns: An object implementing the Producer interface

type MockProducer

type MockProducer struct {
	// contains filtered or unexported fields
}

A MockProducer mocks the Producer interface

func (*MockProducer) PublishAnalyticsRequest added in v0.0.3

func (mp *MockProducer) PublishAnalyticsRequest(msg message.MessageFrontend, sessionID, userID, routingKey string)

func (*MockProducer) PublishErrorMessage added in v0.0.3

func (mp *MockProducer) PublishErrorMessage(err error, sessionID, routingKey string)

func (*MockProducer) PublishFrontendMessage added in v0.0.3

func (mp *MockProducer) PublishFrontendMessage(msg message.MessageFrontend, sessionID, userID, routingKey string)

func (*MockProducer) PublishFrontendSuccessMessage added in v0.0.3

func (mp *MockProducer) PublishFrontendSuccessMessage(typeVal string, value interface{}, sessionID, userID, routingKey string)

func (*MockProducer) PublishMessageJsonHeaders added in v0.0.3

func (mp *MockProducer) PublishMessageJsonHeaders(body *[]byte, routingKey string, headers *map[string]interface{}) producer.BrokerProducerI

PublishMessage publishes a message to the given queue (mock)

body: *[]byte, the body of the message
routingKey: string, the routingkey of the message
headers: *map[string]interface{}, the headers of the message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL