forked from hootrhino/rulex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabsdevice_test.go
50 lines (43 loc) · 990 Bytes
/
absdevice_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package test
import (
"github.com/hootrhino/rulex/core"
"github.com/hootrhino/rulex/engine"
"testing"
"time"
"github.com/hootrhino/rulex/typex"
)
func Test_ABS_device1(t *testing.T) {
engine := engine.NewRuleEngine(core.InitGlobalConfig("conf/rulex.ini"))
engine.Start()
demoDev := &typex.Device{
UUID: "Test1",
Name: "Test1",
Type: "SIMPLE",
Description: "Test1",
Config: map[string]interface{}{
"K": "V",
},
}
engine.LoadDevice(demoDev)
t.Log(engine.SnapshotDump())
time.Sleep(20 * time.Second)
engine.Stop()
}
func Test_ABS_device2(t *testing.T) {
engine := engine.NewRuleEngine(core.InitGlobalConfig("conf/rulex.ini"))
engine.Start()
demoDev := &typex.Device{
UUID: "Test1",
Name: "Test1",
Type: "NO-SUCH",
Description: "Test1",
Config: map[string]interface{}{
"K": "V",
},
}
if err := engine.LoadDevice(demoDev); err != nil {
t.Log(err)
}
time.Sleep(1 * time.Second)
engine.Stop()
}