@@ -70,6 +70,7 @@ func TestExtractionFlow_defaultAggregation(t *testing.T) {
70
70
thingId := "91f30213-2bd7-480a-b1dc-f31b01840e7e"
71
71
propertyId := "c86f4ed9-7f52-4bd3-bdc6-b2936bec68ac"
72
72
propertyStringId := "a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb"
73
+ propertyIdOnChange := "b77f4ed5-7f52-4bd3-bdc6-b2936bec12de"
73
74
74
75
// Init client
75
76
iotcl := iotMocks .NewAPI (t )
@@ -106,7 +107,8 @@ func TestExtractionFlow_defaultAggregation(t *testing.T) {
106
107
107
108
tsextractorClient := New (iotcl , logger )
108
109
109
- propCount := int64 (2 )
110
+ lastValueTime := now .Add (- time .Minute * 1 )
111
+ propCount := int64 (3 )
110
112
thingsMap := make (map [string ]iotclient.ArduinoThing )
111
113
thingsMap [thingId ] = iotclient.ArduinoThing {
112
114
Id : thingId ,
@@ -122,6 +124,14 @@ func TestExtractionFlow_defaultAggregation(t *testing.T) {
122
124
Id : propertyStringId ,
123
125
Type : "CHARSTRING" ,
124
126
},
127
+ {
128
+ Name : "pOnChange" ,
129
+ Id : propertyIdOnChange ,
130
+ Type : "FLOAT" ,
131
+ UpdateStrategy : "ON_CHANGE" ,
132
+ LastValue : 2.34 ,
133
+ ValueUpdatedAt : & lastValueTime ,
134
+ },
125
135
},
126
136
PropertiesCount : & propCount ,
127
137
}
@@ -149,6 +159,7 @@ func TestExtractionFlow_defaultAggregation(t *testing.T) {
149
159
"91f30213-2bd7-480a-b1dc-f31b01840e7e,test,a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb,pstringVar,CHARSTRING,a," ,
150
160
"91f30213-2bd7-480a-b1dc-f31b01840e7e,test,a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb,pstringVar,CHARSTRING,b," ,
151
161
"91f30213-2bd7-480a-b1dc-f31b01840e7e,test,a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb,pstringVar,CHARSTRING,c," ,
162
+ "91f30213-2bd7-480a-b1dc-f31b01840e7e,test,b77f4ed5-7f52-4bd3-bdc6-b2936bec12de,pOnChange,FLOAT,2.34,LAST_VALUE" ,
152
163
}
153
164
for _ , entry := range entries {
154
165
assert .Contains (t , string (content ), entry )
@@ -162,6 +173,7 @@ func TestExtractionFlow_rawResolution(t *testing.T) {
162
173
thingId := "91f30213-2bd7-480a-b1dc-f31b01840e7e"
163
174
propertyId := "c86f4ed9-7f52-4bd3-bdc6-b2936bec68ac"
164
175
propertyStringId := "a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb"
176
+ propertyIdOnChange := "b77f4ed5-7f52-4bd3-bdc6-b2936bec12de"
165
177
166
178
// Init client
167
179
iotcl := iotMocks .NewAPI (t )
@@ -189,7 +201,8 @@ func TestExtractionFlow_rawResolution(t *testing.T) {
189
201
190
202
tsextractorClient := New (iotcl , logger )
191
203
192
- propCount := int64 (2 )
204
+ lastValueTime := now .Add (- time .Minute * 1 )
205
+ propCount := int64 (3 )
193
206
thingsMap := make (map [string ]iotclient.ArduinoThing )
194
207
thingsMap [thingId ] = iotclient.ArduinoThing {
195
208
Id : thingId ,
@@ -205,6 +218,14 @@ func TestExtractionFlow_rawResolution(t *testing.T) {
205
218
Id : propertyStringId ,
206
219
Type : "CHARSTRING" ,
207
220
},
221
+ {
222
+ Name : "pOnChange" ,
223
+ Id : propertyIdOnChange ,
224
+ Type : "FLOAT" ,
225
+ UpdateStrategy : "ON_CHANGE" ,
226
+ LastValue : 2.34 ,
227
+ ValueUpdatedAt : & lastValueTime ,
228
+ },
208
229
},
209
230
PropertiesCount : & propCount ,
210
231
}
@@ -232,6 +253,7 @@ func TestExtractionFlow_rawResolution(t *testing.T) {
232
253
"91f30213-2bd7-480a-b1dc-f31b01840e7e,test,a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb,pstringVar,CHARSTRING,a" ,
233
254
"91f30213-2bd7-480a-b1dc-f31b01840e7e,test,a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb,pstringVar,CHARSTRING,b" ,
234
255
"91f30213-2bd7-480a-b1dc-f31b01840e7e,test,a86f4ed9-7f52-4bd3-bdc6-b2936bec68bb,pstringVar,CHARSTRING,c" ,
256
+ "91f30213-2bd7-480a-b1dc-f31b01840e7e,test,b77f4ed5-7f52-4bd3-bdc6-b2936bec12de,pOnChange,FLOAT,2.34" ,
235
257
}
236
258
for _ , entry := range entries {
237
259
assert .Contains (t , string (content ), entry )
0 commit comments