diff --git a/internal/channelmanager/safe_wraps.go b/internal/channelmanager/safe_wraps.go index ccca4b1..57f6117 100644 --- a/internal/channelmanager/safe_wraps.go +++ b/internal/channelmanager/safe_wraps.go @@ -137,8 +137,6 @@ func (chanManager *ChannelManager) QosSafe( /* PublishSafe safely wraps the (*amqp.Channel).Publish method. - -Deprecated: Use PublishWithContextSafe instead. */ func (chanManager *ChannelManager) PublishSafe( exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing, @@ -155,7 +153,6 @@ func (chanManager *ChannelManager) PublishSafe( ) } - // PublishWithContextSafe safely wraps the (*amqp.Channel).PublishWithContext method. func (chanManager *ChannelManager) PublishWithContextSafe( ctx context.Context, exchange string, key string, mandatory bool, immediate bool, msg amqp.Publishing, diff --git a/internal/dispatcher/dispatcher_test.go b/internal/dispatcher/dispatcher_test.go new file mode 100644 index 0000000..437d1c8 --- /dev/null +++ b/internal/dispatcher/dispatcher_test.go @@ -0,0 +1,37 @@ +package dispatcher + +import ( + "testing" + "time" +) + +func TestNewDispatcher(t *testing.T) { + d := NewDispatcher() + if d == nil { + t.Error("Dispatcher is nil") + } + if d.subscribers == nil { + t.Error("Dispatcher subscribers is nil") + } + if d.subscribersMux == nil { + t.Error("Dispatcher subscribersMux is nil") + } +} + +func TestAddSubscriber(t *testing.T) { + d := NewDispatcher() + d.AddSubscriber() + if len(d.subscribers) != 1 { + t.Error("Dispatcher subscribers length is not 1") + } +} + +func TestCloseSubscriber(t *testing.T) { + d := NewDispatcher() + _, closeCh := d.AddSubscriber() + close(closeCh) + time.Sleep(time.Millisecond) + if len(d.subscribers) != 0 { + t.Error("Dispatcher subscribers length is not 0") + } +} diff --git a/publish.go b/publish.go index c88ac1a..ed0905a 100644 --- a/publish.go +++ b/publish.go @@ -132,8 +132,6 @@ func (publisher *Publisher) handleRestarts() { /* Publish publishes the provided data to the given routing keys over the connection. - -Deprecated: Use PublishWithContext instead. */ func (publisher *Publisher) Publish( data []byte,