You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
793 B
51 lines
793 B
package ui
|
|
|
|
import (
|
|
"cli-mon/yabl"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestNewAmqp(t *testing.T) {
|
|
t.Run("Amqp Test", func(t *testing.T) {
|
|
client := NewAmqp("amqp://user:password@localhost:5672/")
|
|
|
|
if client == nil {
|
|
t.Errorf("Can't create client")
|
|
}
|
|
|
|
client.Start()
|
|
|
|
now := time.Now()
|
|
field := yabl.FBoardReady
|
|
action := yabl.PPuErrors
|
|
tag := "localhost"
|
|
|
|
event := &yabl.Event{
|
|
Tag: &tag,
|
|
Field: &field,
|
|
ActionName: &action,
|
|
Object: nil,
|
|
//unit: 3,
|
|
Updated: &now,
|
|
Value: yabl.ERROR,
|
|
}
|
|
|
|
client.Consume(event)
|
|
|
|
event = &yabl.Event{
|
|
Tag: &tag,
|
|
Field: &field,
|
|
ActionName: &action,
|
|
Object: nil,
|
|
//unit: 3,
|
|
Updated: &now,
|
|
Value: nil,
|
|
}
|
|
|
|
client.Consume(event)
|
|
|
|
client.Stop()
|
|
})
|
|
|
|
}
|
|
|