Documentation ¶
Index ¶
- Constants
- Variables
- func GetImg() ([]byte, string)
- type MockResendSink
- func (m *MockResendSink) Close(_ api.StreamContext) error
- func (m *MockResendSink) Collect(ctx api.StreamContext, item interface{}) error
- func (m *MockResendSink) CollectResend(ctx api.StreamContext, item interface{}) error
- func (m *MockResendSink) Configure(_ map[string]interface{}) error
- func (m *MockResendSink) GetResendResults() [][]byte
- func (m *MockResendSink) GetResults() [][]byte
- func (m *MockResendSink) Open(ctx api.StreamContext) error
- type MockSink
- type MockSource
- func (m *MockSource) Close(_ api.StreamContext) error
- func (m *MockSource) Configure(dataKey string, _ map[string]interface{}) error
- func (m *MockSource) GetOffset() (interface{}, error)
- func (m *MockSource) Open(ctx api.StreamContext, consumer chan<- api.SourceTuple, _ chan<- error)
- func (m *MockSource) ResetOffset(input map[string]interface{}) error
- func (m *MockSource) Rewind(offset interface{}) error
Constants ¶
View Source
const TIMELEAP = 200
Variables ¶
View Source
var Image, _ = GetImg()
View Source
var TestData = map[string][]*xsql.Tuple{ "sharedDemo": { { Emitter: "sharedDemo", Message: map[string]interface{}{ "a": 1, "b": 2, "c": 3, }, Timestamp: 1541152486013, }, }, "demo": { { Emitter: "demo", Message: map[string]interface{}{ "color": "red", "size": 3, "ts": 1541152486013, }, Timestamp: 1541152486013, }, { Emitter: "demo", Message: map[string]interface{}{ "color": "blue", "size": 6, "ts": 1541152486822, }, Timestamp: 1541152486822, }, { Emitter: "demo", Message: map[string]interface{}{ "color": "blue", "size": 2, "ts": 1541152487632, }, Timestamp: 1541152487632, }, { Emitter: "demo", Message: map[string]interface{}{ "color": "yellow", "size": 4, "ts": 1541152488442, }, Timestamp: 1541152488442, }, { Emitter: "demo", Message: map[string]interface{}{ "color": "red", "size": 1, "ts": 1541152489252, }, Timestamp: 1541152489252, }, }, "demoError": { { Emitter: "demoError", Message: map[string]interface{}{ "color": "blue", "size": "red", "ts": 1541152486013, }, Timestamp: 1541152486013, }, { Emitter: "demoError", Message: map[string]interface{}{ "color": "blue", "size": 6, "ts": 1541152486822, }, Timestamp: 1541152486822, }, { Emitter: "demoError", Message: map[string]interface{}{ "color": "blue", "size": 2, "ts": 1541152487632, }, Timestamp: 1541152487632, }, { Emitter: "demoError", Message: map[string]interface{}{ "color": 7, "size": 4, "ts": 1541152488442, }, Timestamp: 1541152488442, }, { Emitter: "demoError", Message: map[string]interface{}{ "color": "red", "size": "blue", "ts": 1541152489252, }, Timestamp: 1541152489252, }, }, "demo1": { { Emitter: "demo1", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "from": "device1", "ts": 1541152486013, }, Timestamp: 1541152486115, }, { Emitter: "demo1", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "from": "device2", "ts": 1541152486823, }, Timestamp: 1541152486903, }, { Emitter: "demo1", Message: map[string]interface{}{ "temp": 28.1, "hum": 75, "from": "device3", "ts": 1541152487632, }, Timestamp: 1541152487702, }, { Emitter: "demo1", Message: map[string]interface{}{ "temp": 27.4, "hum": 80, "from": "device1", "ts": 1541152488442, }, Timestamp: 1541152488605, }, { Emitter: "demo1", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "from": "device3", "ts": 1541152489252, }, Timestamp: 1541152489305, }, }, "sessionDemo": { { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152486013, }, Timestamp: 1541152486013, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "ts": 1541152486823, }, Timestamp: 1541152486823, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 28.1, "hum": 75, "ts": 1541152487932, }, Timestamp: 1541152487932, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 27.4, "hum": 80, "ts": 1541152488442, }, Timestamp: 1541152488442, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "ts": 1541152489252, }, Timestamp: 1541152489252, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 26.2, "hum": 63, "ts": 1541152490062, }, Timestamp: 1541152490062, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 26.8, "hum": 71, "ts": 1541152490872, }, Timestamp: 1541152490872, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 28.9, "hum": 85, "ts": 1541152491682, }, Timestamp: 1541152491682, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 29.1, "hum": 92, "ts": 1541152492492, }, Timestamp: 1541152492492, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 32.2, "hum": 99, "ts": 1541152493202, }, Timestamp: 1541152493202, }, { Emitter: "sessionDemo", Message: map[string]interface{}{ "temp": 30.9, "hum": 87, "ts": 1541152494112, }, Timestamp: 1541152494112, }, }, "demoE": { { Emitter: "demoE", Message: map[string]interface{}{ "color": "red", "size": 3, "ts": 1541152486013, }, Timestamp: 1541152586023, }, { Emitter: "demoE", Message: map[string]interface{}{ "color": "blue", "size": 2, "ts": 1541152487632, }, Timestamp: 1541152587822, }, { Emitter: "demoE", Message: map[string]interface{}{ "color": "red", "size": 1, "ts": 1541152489252, }, Timestamp: 1541152589632, }, { Emitter: "demoE", Message: map[string]interface{}{ "color": "blue", "size": 6, "ts": 1541152486822, }, Timestamp: 1541152589842, }, { Emitter: "demoE", Message: map[string]interface{}{ "color": "yellow", "size": 4, "ts": 1541152488442, }, Timestamp: 1541152590052, }, { Emitter: "demoE", Message: map[string]interface{}{ "color": "yellow", "size": 4, "ts": 1541152492342, }, Timestamp: 1541152598888, }, }, "demo1E": { { Emitter: "demo1E", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "ts": 1541152486823, }, Timestamp: 1541152587250, }, { Emitter: "demo1E", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152486013, }, Timestamp: 1541152587751, }, { Emitter: "demo1E", Message: map[string]interface{}{ "temp": 27.4, "hum": 80, "ts": 1541152488442, }, Timestamp: 1541152589252, }, { Emitter: "demo1E", Message: map[string]interface{}{ "temp": 28.1, "hum": 75, "ts": 1541152487632, }, Timestamp: 1541152589753, }, { Emitter: "demo1E", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "ts": 1541152489252, }, Timestamp: 1541152589954, }, { Emitter: "demo1E", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "ts": 1541152499252, }, Timestamp: 1541152599755, }, }, "sessionDemoE": { { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152486013, }, Timestamp: 1541152586250, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 28.1, "hum": 75, "ts": 1541152487932, }, Timestamp: 1541152587951, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "ts": 1541152486823, }, Timestamp: 1541152588552, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "ts": 1541152489252, }, Timestamp: 1541152589353, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 27.4, "hum": 80, "ts": 1541152488442, }, Timestamp: 1541152589854, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 26.2, "hum": 63, "ts": 1541152490062, }, Timestamp: 1541152590155, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 28.9, "hum": 85, "ts": 1541152491682, }, Timestamp: 1541152591686, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 26.8, "hum": 71, "ts": 1541152490872, }, Timestamp: 1541152591972, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 29.1, "hum": 92, "ts": 1541152492492, }, Timestamp: 1541152592592, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 30.9, "hum": 87, "ts": 1541152494112, }, Timestamp: 1541152594212, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 32.2, "hum": 99, "ts": 1541152493202, }, Timestamp: 1541152595202, }, { Emitter: "sessionDemoE", Message: map[string]interface{}{ "temp": 32.2, "hum": 99, "ts": 1541152499202, }, Timestamp: 1541152599402, }, }, "demoErr": { { Emitter: "demoErr", Message: map[string]interface{}{ "color": "red", "size": 3, "ts": 1541152486013, }, Timestamp: 1541152486221, }, { Emitter: "demoErr", Message: map[string]interface{}{ "color": 2, "size": 5, "ts": 1541152487632, }, Timestamp: 1541152487722, }, { Emitter: "demoErr", Message: map[string]interface{}{ "color": "red", "size": 1, "ts": 1541152489252, }, Timestamp: 1541152489332, }, { Emitter: "demoErr", Message: map[string]interface{}{ "color": "blue", "size": 6, "ts": 1541152486822, }, Timestamp: 1541152489822, }, { Emitter: "demoErr", Message: map[string]interface{}{ "color": "yellow", "size": 4, "ts": 1541152488442, }, Timestamp: 1541152490042, }, { Emitter: "demoErr", Message: map[string]interface{}{ "color": "yellow", "size": 4, "ts": 1541152492342, }, Timestamp: 1541152493842, }, }, "ldemo": { { Emitter: "ldemo", Message: map[string]interface{}{ "color": "red", "size": 3, "ts": 1541152486013, }, Timestamp: 1541152486013, }, { Emitter: "ldemo", Message: map[string]interface{}{ "color": "blue", "size": "string", "ts": 1541152486822, }, Timestamp: 1541152486822, }, { Emitter: "ldemo", Message: map[string]interface{}{ "size": 3, "ts": 1541152487632, }, Timestamp: 1541152487632, }, { Emitter: "ldemo", Message: map[string]interface{}{ "color": 49, "size": 2, "ts": 1541152488442, }, Timestamp: 1541152488442, }, { Emitter: "ldemo", Message: map[string]interface{}{ "color": "red", "ts": 1541152489252, }, Timestamp: 1541152489252, }, }, "ldemo1": { { Emitter: "ldemo1", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152486013, }, Timestamp: 1541152486013, }, { Emitter: "ldemo1", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "ts": 1541152486823, }, Timestamp: 1541152486823, }, { Emitter: "ldemo1", Message: map[string]interface{}{ "temp": 28.1, "hum": 75, "ts": 1541152487632, }, Timestamp: 1541152487632, }, { Emitter: "ldemo1", Message: map[string]interface{}{ "temp": 27.4, "hum": 80, "ts": "1541152488442", }, Timestamp: 1541152488442, }, { Emitter: "ldemo1", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "ts": 1541152489252, }, Timestamp: 1541152489252, }, }, "lsessionDemo": { { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152486013, }, Timestamp: 1541152486013, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "ts": 1541152486823, }, Timestamp: 1541152486823, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 28.1, "hum": 75, "ts": 1541152487932, }, Timestamp: 1541152487932, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 27.4, "hum": 80, "ts": 1541152488442, }, Timestamp: 1541152488442, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 25.5, "hum": 62, "ts": 1541152489252, }, Timestamp: 1541152489252, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 26.2, "hum": 63, "ts": 1541152490062, }, Timestamp: 1541152490062, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 26.8, "hum": 71, "ts": 1541152490872, }, Timestamp: 1541152490872, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 28.9, "hum": 85, "ts": 1541152491682, }, Timestamp: 1541152491682, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 29.1, "hum": 92, "ts": 1541152492492, }, Timestamp: 1541152492492, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 2.2, "hum": 99, "ts": 1541152493202, }, Timestamp: 1541152493202, }, { Emitter: "lsessionDemo", Message: map[string]interface{}{ "temp": 30.9, "hum": 87, "ts": 1541152494112, }, Timestamp: 1541152494112, }, }, "text": { { Emitter: "text", Message: map[string]interface{}{ "slogan": "Impossible is nothing", "brand": "Adidas", }, Timestamp: 1541152486500, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "Stronger than dirt", "brand": "Ajax", }, Timestamp: 1541152487400, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "Belong anywhere", "brand": "Airbnb", }, Timestamp: 1541152488300, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "I can'T believe I ate the whole thing", "brand": "Alka Seltzer", }, Timestamp: 1541152489200, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "You're in good hands", "brand": "Allstate", }, Timestamp: 1541152490100, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "Don'T leave home without it", "brand": "American Express", }, Timestamp: 1541152491200, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "Think different", "brand": "Apple", }, Timestamp: 1541152492300, }, { Emitter: "text", Message: map[string]interface{}{ "slogan": "We try harder", "brand": "Avis", }, Timestamp: 1541152493400, }, }, "binDemo": { { Emitter: "binDemo", Message: map[string]interface{}{ "self": Image, }, Timestamp: 1541152486013, }, }, "fakeBin": { { Emitter: "fakeBin", Message: map[string]interface{}{ "self": []byte("golang"), }, Timestamp: 1541152486013, }, { Emitter: "fakeBin", Message: map[string]interface{}{ "self": []byte("peacock"), }, Timestamp: 1541152487013, }, { Emitter: "fakeBin", Message: map[string]interface{}{ "self": []byte("bullfrog"), }, Timestamp: 1541152488013, }, }, "helloStr": { { Emitter: "helloStr", Message: map[string]interface{}{ "name": "world", }, Timestamp: 1541152486013, }, { Emitter: "helloStr", Message: map[string]interface{}{ "name": "golang", }, Timestamp: 1541152487013, }, { Emitter: "helloStr", Message: map[string]interface{}{ "name": "peacock", }, Timestamp: 1541152488013, }, }, "commands": { { Emitter: "commands", Message: map[string]interface{}{ "cmd": "get", "base64_img": "my image", "encoded_json": "{\"name\": \"name1\",\"size\": 22}", }, Timestamp: 1541152486013, }, { Emitter: "commands", Message: map[string]interface{}{ "cmd": "detect", "base64_img": "my image", "encoded_json": "{\"name\": \"name2\",\"size\": 33}", }, Timestamp: 1541152487013, }, { Emitter: "commands", Message: map[string]interface{}{ "cmd": "delete", "base64_img": "my image", "encoded_json": "{\"name\": \"name3\",\"size\": 11}", }, Timestamp: 1541152488013, }, }, "demoTable": { { Emitter: "demoTable", Message: map[string]interface{}{ "ts": 1541152486013, "device": "device1", }, Timestamp: 1541152486501, }, { Emitter: "demoTable", Message: map[string]interface{}{ "ts": 1541152486822, "device": "device2", }, Timestamp: 1541152486502, }, { Emitter: "demoTable", Message: map[string]interface{}{ "ts": 1541152487632, "device": "device3", }, Timestamp: 1541152488001, }, { Emitter: "demoTable", Message: map[string]interface{}{ "ts": 1541152488442, "device": "device4", }, Timestamp: 1541152488002, }, { Emitter: "demoTable", Message: map[string]interface{}{ "ts": 1541152489252, "device": "device5", }, Timestamp: 1541152488003, }, }, "shelves": { { Emitter: "shelves", Message: map[string]interface{}{ "name": "name1", "size": 2, "shelf": map[string]interface{}{ "id": 1541152486013, "theme": "tandra", "subfield": "sub1", }, }, Timestamp: 1541152486501, }, { Emitter: "shelves", Message: map[string]interface{}{ "name": "name2", "size": 3, "shelf": map[string]interface{}{ "id": 1541152486822, "theme": "claro", "subfield": "sub2", }, }, Timestamp: 1541152486502, }, { Emitter: "shelves", Message: map[string]interface{}{ "name": "name3", "size": 4, "shelf": map[string]interface{}{ "id": 1541152487632, "theme": "dark", "subfield": "sub3", }, }, Timestamp: 1541152488001, }, }, "mes": { { Emitter: "mes", Message: map[string]interface{}{ "message_id": "1541152486013", "text": "message1", }, Timestamp: 1541152486501, }, { Emitter: "mes", Message: map[string]interface{}{ "message_id": "1541152486501", "text": "message2", }, Timestamp: 1541152486501, }, { Emitter: "mes", Message: map[string]interface{}{ "message_id": "1541152487013", "text": "message3", }, Timestamp: 1541152487501, }, }, "demoArr": { { Emitter: "demoArr", Message: map[string]interface{}{ "arr": []int{1, 2, 3, 4, 5}, "x": 1, "y": 2, "arr2": []interface{}{ map[string]interface{}{ "a": 1, "b": 2, }, map[string]interface{}{ "a": 3, "b": 4, }, }, "a": 6, "arr3": []interface{}{1, 2, 3}, }, Timestamp: 1541152489253, }, }, "demoArr2": { { Emitter: "demoArr2", Message: map[string]interface{}{ "arr": []interface{}{1, 2, 3, 4, 5}, "x": 1, }, Timestamp: 1541152489253, }, { Emitter: "demoArr2", Message: map[string]interface{}{ "arr": []interface{}{1, 2, 3, 4, 5}, "x": 1, }, Timestamp: 1541152489254, }, }, "demoE2": { { Emitter: "demoE2", Message: map[string]interface{}{ "temp": 27.5, "hum": 59, "ts": 1541152486000, }, Timestamp: 1541152486000, }, { Emitter: "demoE2", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152487000, }, Timestamp: 1541152487000, }, { Emitter: "demoE2", Message: map[string]interface{}{ "temp": 25.5, "hum": 65, "ts": 1541152488000, }, Timestamp: 1541152488000, }, }, "demoE3": { { Emitter: "demoE3", Message: map[string]interface{}{ "temp": 26.0, "ts": 1541152486000, }, Timestamp: 1541152486000, }, { Emitter: "demoE3", Message: map[string]interface{}{ "temp": 27.0, "ts": 1541152487000, }, Timestamp: 1541152487000, }, { Emitter: "demoE3", Message: map[string]interface{}{ "temp": 28.0, "ts": 1541152488000, }, Timestamp: 1541152488000, }, { Emitter: "demoE3", Message: map[string]interface{}{ "temp": 28.5, "ts": 1541152488500, }, Timestamp: 1541152488500, }, { Emitter: "demoE3", Message: map[string]interface{}{ "temp": 29.0, "ts": 1541152489000, }, Timestamp: 1541152488500, }, { Emitter: "demoE3", Message: map[string]interface{}{ "temp": 29.5, "ts": 1541152489500, }, Timestamp: 1541152489500, }, }, "optional_commands": { { Emitter: "optional_commands", Message: map[string]interface{}{ "base64_img": "my image1", }, Timestamp: 1541152486013, }, { Emitter: "optional_commands", Message: map[string]interface{}{ "base64_img": "my image2", }, Timestamp: 1541152487013, }, { Emitter: "optional_commands", Message: map[string]interface{}{ "base64_img": "my image3", }, Timestamp: 1541152488013, }, }, "schemaless_commands": { { Emitter: "schemaless_commands", Message: map[string]interface{}{ "cmd": "get", "base64_img": "my image", "encoded_json": map[string]interface{}{"name": "name1", "size": 22}, }, Timestamp: 1541152486013, }, { Emitter: "schemaless_commands", Message: map[string]interface{}{ "cmd": "detect", "base64_img": "my image", "encoded_json": map[string]interface{}{"name": "name2", "size": 33}, }, Timestamp: 1541152487013, }, { Emitter: "schemaless_commands", Message: map[string]interface{}{ "cmd": "delete", "base64_img": "my image", "encoded_json": map[string]interface{}{"name": "name3", "size": 11}, }, Timestamp: 1541152488013, }, }, }
TestData The time diff must larger than timeleap
Functions ¶
Types ¶
type MockResendSink ¶
type MockResendSink struct {
// contains filtered or unexported fields
}
func NewMockResendSink ¶
func NewMockResendSink(onHit chan int) *MockResendSink
func (*MockResendSink) Close ¶
func (m *MockResendSink) Close(_ api.StreamContext) error
func (*MockResendSink) Collect ¶
func (m *MockResendSink) Collect(ctx api.StreamContext, item interface{}) error
func (*MockResendSink) CollectResend ¶
func (m *MockResendSink) CollectResend(ctx api.StreamContext, item interface{}) error
func (*MockResendSink) Configure ¶
func (m *MockResendSink) Configure(_ map[string]interface{}) error
func (*MockResendSink) GetResendResults ¶
func (m *MockResendSink) GetResendResults() [][]byte
func (*MockResendSink) GetResults ¶
func (m *MockResendSink) GetResults() [][]byte
func (*MockResendSink) Open ¶
func (m *MockResendSink) Open(ctx api.StreamContext) error
type MockSink ¶
type MockSink struct {
// contains filtered or unexported fields
}
func NewMockSink ¶
func NewMockSink() *MockSink
func (*MockSink) Collect ¶
func (m *MockSink) Collect(ctx api.StreamContext, item interface{}) error
func (*MockSink) GetResults ¶
type MockSource ¶
func (*MockSource) Close ¶
func (m *MockSource) Close(_ api.StreamContext) error
func (*MockSource) Configure ¶
func (m *MockSource) Configure(dataKey string, _ map[string]interface{}) error
func (*MockSource) GetOffset ¶
func (m *MockSource) GetOffset() (interface{}, error)
func (*MockSource) Open ¶
func (m *MockSource) Open(ctx api.StreamContext, consumer chan<- api.SourceTuple, _ chan<- error)
func (*MockSource) ResetOffset ¶
func (m *MockSource) ResetOffset(input map[string]interface{}) error
func (*MockSource) Rewind ¶
func (m *MockSource) Rewind(offset interface{}) error
Click to show internal directories.
Click to hide internal directories.