]> git.basschouten.com Git - openhab-addons.git/blob
3acd5fe987cd5d7fd159071110aa4c9b5b519e8b
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.siemensrds.test;
14
15 import static org.junit.jupiter.api.Assertions.*;
16 import static org.openhab.binding.siemensrds.internal.RdsBindingConstants.*;
17
18 import java.io.BufferedReader;
19 import java.io.FileReader;
20 import java.io.IOException;
21 import java.util.List;
22 import java.util.Map;
23 import java.util.Map.Entry;
24
25 import org.eclipse.jdt.annotation.NonNullByDefault;
26 import org.eclipse.jdt.annotation.Nullable;
27 import org.junit.jupiter.api.Test;
28 import org.openhab.binding.siemensrds.internal.RdsAccessToken;
29 import org.openhab.binding.siemensrds.internal.RdsCloudException;
30 import org.openhab.binding.siemensrds.internal.RdsDataPoints;
31 import org.openhab.binding.siemensrds.internal.RdsPlants;
32 import org.openhab.binding.siemensrds.internal.RdsPlants.PlantInfo;
33 import org.openhab.binding.siemensrds.points.BasePoint;
34 import org.openhab.core.library.types.DecimalType;
35 import org.openhab.core.library.types.QuantityType;
36 import org.openhab.core.library.types.StringType;
37 import org.openhab.core.library.unit.ImperialUnits;
38 import org.openhab.core.library.unit.SIUnits;
39 import org.openhab.core.library.unit.Units;
40 import org.openhab.core.types.State;
41
42 /**
43  * test suite
44  *
45  * @author Andrew Fiddian-Green - Initial contribution
46  *
47  */
48 @NonNullByDefault
49 public class RdsTestData {
50
51     private String load(String fileName) {
52         try (FileReader file = new FileReader(String.format("src/test/resources/%s.json", fileName));
53                 BufferedReader reader = new BufferedReader(file)) {
54             StringBuilder builder = new StringBuilder();
55             String line;
56             while ((line = reader.readLine()) != null) {
57                 builder.append(line).append("\n");
58             }
59             return builder.toString();
60         } catch (IOException e) {
61             fail(e.getMessage());
62         }
63         return "";
64     }
65
66     @Test
67     public void testRdsDataPointsFullNew() {
68         RdsDataPoints dataPoints = RdsDataPoints.createFromJson(load("datapoints_full_set_new"));
69         assertNotNull(dataPoints);
70         try {
71             assertEquals("Downstairs", dataPoints.getDescription());
72         } catch (RdsCloudException e) {
73             fail(e.getMessage());
74         }
75         @Nullable
76         Map<String, @Nullable BasePoint> points = dataPoints.points;
77         assertNotNull(points);
78         assertEquals(70, points.size());
79     }
80
81     @Test
82     public void confirmDegreeSymbolCodingNotTrashed() {
83         /*
84          * note: temperature symbols with a degree sign: the MVN Spotless trashes the
85          * "degree" (looks like *) symbol, so we must escape these symbols as octal \260
86          * or unicode \u00B00 - the following test will indicate is all is ok
87          */
88         assertTrue("\260C".equals(BasePoint.DEGREES_CELSIUS));
89         assertTrue("\u00B0C".equals(BasePoint.DEGREES_CELSIUS));
90         assertTrue("\260F".equals(BasePoint.DEGREES_FAHRENHEIT));
91         assertTrue("\u00B0F".equals(BasePoint.DEGREES_FAHRENHEIT));
92         assertTrue(BasePoint.DEGREES_FAHRENHEIT.startsWith(BasePoint.DEGREES_CELSIUS.substring(0, 1)));
93     }
94
95     @Test
96     public void testRdsDataPointsRefresh() {
97         RdsDataPoints refreshPoints = RdsDataPoints.createFromJson(load("datapoints_refresh_set"));
98         assertNotNull(refreshPoints);
99
100         assertNotNull(refreshPoints.points);
101         Map<String, @Nullable BasePoint> refreshMap = refreshPoints.points;
102         assertNotNull(refreshMap);
103
104         @Nullable
105         BasePoint point;
106         State state;
107
108         // check the parsed values
109         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;0!Online");
110         assertTrue(point instanceof BasePoint);
111         state = point.getState();
112         assertEquals(state.getClass(), DecimalType.class);
113         assertEquals(1, ((DecimalType) state).intValue());
114
115         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!00000000E000055");
116         assertTrue(point instanceof BasePoint);
117         state = point.getState();
118         assertEquals(state.getClass(), QuantityType.class);
119         assertEquals(12.60, ((QuantityType<?>) state).floatValue(), 0.01);
120
121         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!002000083000055");
122         assertTrue(point instanceof BasePoint);
123         state = point.getState();
124         assertEquals(state.getClass(), QuantityType.class);
125         assertEquals(16.0, ((QuantityType<?>) state).floatValue(), 0.01);
126
127         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!002000085000055");
128         assertTrue(point instanceof BasePoint);
129         state = point.getState();
130         assertEquals(state.getClass(), QuantityType.class);
131         assertEquals(39.13, ((QuantityType<?>) state).floatValue(), 0.01);
132
133         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!002000086000055");
134         assertTrue(point instanceof BasePoint);
135         state = point.getState();
136         assertEquals(state.getClass(), QuantityType.class);
137         assertEquals(21.51, ((QuantityType<?>) state).floatValue(), 0.01);
138
139         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!013000051000055");
140         assertTrue(point instanceof BasePoint);
141         state = point.getState();
142         assertEquals(state.getClass(), QuantityType.class);
143         assertEquals(2, ((QuantityType<?>) state).intValue());
144
145         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!013000052000055");
146         assertTrue(point instanceof BasePoint);
147         state = point.getState();
148         assertEquals(state.getClass(), QuantityType.class);
149         assertEquals(5, ((QuantityType<?>) state).intValue());
150
151         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!013000053000055");
152         assertTrue(point instanceof BasePoint);
153         state = point.getState();
154         assertEquals(state.getClass(), QuantityType.class);
155         assertEquals(2, ((QuantityType<?>) state).intValue());
156
157         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!013000056000055");
158         assertTrue(point instanceof BasePoint);
159         state = point.getState();
160         assertEquals(state.getClass(), QuantityType.class);
161         assertEquals(1, ((QuantityType<?>) state).intValue());
162
163         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!01300005A000055");
164         assertTrue(point instanceof BasePoint);
165         state = point.getState();
166         assertEquals(state.getClass(), QuantityType.class);
167         assertEquals(2, ((QuantityType<?>) state).intValue());
168
169         point = refreshMap.get("Pd1774247-7de7-4896-ac76-b7e0dd943c40;1!013000074000055");
170         assertTrue(point instanceof BasePoint);
171         state = point.getState();
172         assertEquals(state.getClass(), QuantityType.class);
173         assertEquals(4, ((QuantityType<?>) state).intValue());
174
175         RdsDataPoints originalPoints = RdsDataPoints.createFromJson(load("datapoints_full_set"));
176         assertNotNull(originalPoints);
177         assertNotNull(originalPoints.points);
178
179         // check that the refresh point types match the originals
180         Map<String, @Nullable BasePoint> originalMap = originalPoints.points;
181         assertNotNull(originalMap);
182         @Nullable
183         BasePoint refreshPoint;
184         @Nullable
185         BasePoint originalPoint;
186         for (String key : refreshMap.keySet()) {
187             refreshPoint = refreshMap.get(key);
188             assertTrue(refreshPoint instanceof BasePoint);
189             originalPoint = originalMap.get(key);
190             assertTrue(originalPoint instanceof BasePoint);
191             assertEquals(refreshPoint.getState().getClass(), originalPoint.getState().getClass());
192         }
193     }
194
195     @Test
196     public void testAccessToken() {
197         RdsAccessToken accessToken = RdsAccessToken.createFromJson(load("access_token"));
198         assertNotNull(accessToken);
199         try {
200             assertEquals("this-is-not-a-valid-access_token", accessToken.getToken());
201         } catch (RdsCloudException e) {
202             fail(e.getMessage());
203         }
204         assertTrue(accessToken.isExpired());
205     }
206
207     @Test
208     public void testRdsDataPointsFull() {
209         RdsDataPoints dataPoints = RdsDataPoints.createFromJson(load("datapoints_full_set"));
210         assertNotNull(dataPoints);
211         try {
212             assertEquals("Upstairs", dataPoints.getDescription());
213         } catch (RdsCloudException e) {
214             fail(e.getMessage());
215         }
216
217         @Nullable
218         Map<String, @Nullable BasePoint> points = dataPoints.points;
219         assertNotNull(points);
220         assertEquals(67, points.size());
221
222         try {
223             assertEquals("AAS-20:SU=SiUn;APT=HvacFnct18z_A;APTV=2.003;APS=1;",
224                     dataPoints.getPointByClass("ApplicationSoftwareVersion").getState().toString());
225             assertEquals("Device object", dataPoints.getPointByClass("Device Description").getState().toString());
226             assertEquals("FW=02.32.02.27;SVS-300.1:SBC=13.22;I",
227                     dataPoints.getPointByClass("FirmwareRevision").getState().toString());
228             assertEquals("RDS110", dataPoints.getPointByClass("ModelName").getState().toString());
229             assertEquals(0, dataPoints.getPointByClass("SystemStatus").asInt());
230             assertEquals(0, dataPoints.getPointByClass("UtcOffset").asInt());
231             assertEquals(19, dataPoints.getPointByClass("DatabaseRevision").asInt());
232             assertEquals(0, dataPoints.getPointByClass("LastRestartReason").asInt());
233             assertEquals("MDL:ASN= RDS110;HW=0.2.0;",
234                     dataPoints.getPointByClass("ModelInformation").getState().toString());
235             assertEquals(1, dataPoints.getPointByClass("Active SystemLanguge").asInt());
236             assertEquals(26, dataPoints.getPointByClass("TimeZone").asInt());
237             assertEquals("160100096D", dataPoints.getPointByClass("SerialNumber").getState().toString());
238             assertEquals("'10010'B", dataPoints.getPointByClass("Device Features").getState().toString());
239             assertEquals("Upstairs", dataPoints.getPointByClass("'Description").getState().toString());
240             assertEquals("192.168.1.1", dataPoints.getPointByClass("'IP gefault gateway").getState().toString());
241             assertEquals("255.255.255.0", dataPoints.getPointByClass("'IP subnet mask").getState().toString());
242             assertEquals("192.168.1.42", dataPoints.getPointByClass("'IP address").getState().toString());
243             assertEquals(47808, dataPoints.getPointByClass("'UDP Port").asInt());
244             assertEquals("'F0C77F6C1895'H", dataPoints.getPointByClass("'BACnet MAC address").getState().toString());
245             assertEquals("sth.connectivity.ccl-siemens.com",
246                     dataPoints.getPointByClass("'Connection URI").getState().toString());
247             assertEquals("this-is-not-a-valid-activation-key",
248                     dataPoints.getPointByClass("'Activation Key").getState().toString());
249             assertEquals(60, dataPoints.getPointByClass("'Reconection delay").asInt());
250             assertEquals(0, dataPoints.getPointByClass("#Item Updates per Minute").asInt());
251             assertEquals(286849, dataPoints.getPointByClass("#Item Updates Total").asInt());
252             assertEquals("-;en", dataPoints.getPointByClass("#Languages").getState().toString());
253             assertEquals(1, dataPoints.getPointByClass("#Online").asInt());
254             assertEquals(1473, dataPoints.getPointByClass("#Traffic Inbound per Minute").asInt());
255             assertEquals(178130801, dataPoints.getPointByClass("#Traffic Inbound Total").asInt());
256             assertEquals(616, dataPoints.getPointByClass("#Traffic Outbound per Minute").asInt());
257             assertEquals(60624666, dataPoints.getPointByClass("#Traffic Outbound Total").asInt());
258             assertEquals(0, dataPoints.getPointByClass("#Item Updates per Minute").asInt());
259
260             State state;
261             QuantityType<?> celsius;
262
263             state = dataPoints.getPointByClass("'TOa").getState();
264             assertTrue(state instanceof QuantityType<?>);
265             celsius = ((QuantityType<?>) state).toUnit(SIUnits.CELSIUS);
266             assertNotNull(celsius);
267             assertEquals(18.55, celsius.floatValue(), 0.01);
268
269             assertEquals("0.0", dataPoints.getPointByClass("'HDevElLd").getState().toString());
270
271             state = dataPoints.getPointByClass("'SpHPcf").getState();
272             assertTrue(state instanceof QuantityType<?>);
273             QuantityType<?> fahrenheit = ((QuantityType<?>) state).toUnit(ImperialUnits.FAHRENHEIT);
274             assertNotNull(fahrenheit);
275             assertEquals(24.00, fahrenheit.floatValue(), 0.01);
276
277             state = dataPoints.getPointByClass("'SpHEco").getState();
278             assertTrue(state instanceof QuantityType<?>);
279             celsius = ((QuantityType<?>) state).toUnit(SIUnits.CELSIUS);
280             assertNotNull(celsius);
281             assertEquals(16.00, celsius.floatValue(), 0.01);
282
283             state = dataPoints.getPointByClass("'SpHPrt").getState();
284             assertTrue(state instanceof QuantityType<?>);
285             celsius = ((QuantityType<?>) state).toUnit(SIUnits.CELSIUS);
286             assertNotNull(celsius);
287             assertEquals(6.00, celsius.floatValue(), 0.01);
288
289             state = dataPoints.getPointByClass("'SpTR").getState();
290             assertTrue(state instanceof QuantityType<?>);
291             celsius = ((QuantityType<?>) state).toUnit(SIUnits.CELSIUS);
292             assertNotNull(celsius);
293             assertEquals(24.00, celsius.floatValue(), 0.01);
294
295             state = dataPoints.getPointByClass("'SpTRShft").getState();
296             assertTrue(state instanceof QuantityType<?>);
297             QuantityType<?> kelvin = ((QuantityType<?>) state).toUnit(Units.KELVIN);
298             assertNotNull(kelvin);
299             assertEquals(0, kelvin.floatValue(), 0.01);
300
301             state = dataPoints.getPointByClass("'RHuRel").getState();
302             assertTrue(state instanceof QuantityType<?>);
303             QuantityType<?> relativeHumidity = ((QuantityType<?>) state).toUnit(Units.PERCENT);
304             assertNotNull(relativeHumidity);
305             assertEquals(46.86865, relativeHumidity.floatValue(), 0.1);
306
307             state = dataPoints.getPointByClass("'RTemp").getState();
308             assertTrue(state instanceof QuantityType<?>);
309             celsius = ((QuantityType<?>) state).toUnit(SIUnits.CELSIUS);
310             assertNotNull(celsius);
311             assertEquals(23.76, celsius.floatValue(), 0.01);
312
313             state = dataPoints.getPointByClass("'SpTRMaxHCmf").getState();
314             assertTrue(state instanceof QuantityType<?>);
315             celsius = ((QuantityType<?>) state).toUnit(SIUnits.CELSIUS);
316             assertNotNull(celsius);
317             assertEquals(35.00, celsius.floatValue(), 0.01);
318
319             assertEquals("30.0", dataPoints.getPointByClass("'WarmUpGrdnt").getState().toString());
320
321             state = dataPoints.getPointByClass("'TRBltnMsvAdj").getState();
322             assertTrue(state instanceof QuantityType<?>);
323             kelvin = ((QuantityType<?>) state).toUnit(Units.KELVIN);
324             assertNotNull(kelvin);
325             assertEquals(35.0, celsius.floatValue(), 0.01);
326
327             assertEquals("0.0", dataPoints.getPointByClass("'Q22Q24ElLd").getState().toString());
328             assertEquals("713.0", dataPoints.getPointByClass("'RAQual").getState().toString());
329             assertEquals("0.0", dataPoints.getPointByClass("'TmpCmfBtn").getState().toString());
330             assertEquals("0.0", dataPoints.getPointByClass("'CmfBtn").getState().toString());
331             assertEquals("0.0", dataPoints.getPointByClass("'RPscDet").getState().toString());
332             assertEquals("1.0", dataPoints.getPointByClass("'EnHCtl").getState().toString());
333             assertEquals("0.0", dataPoints.getPointByClass("'EnRPscDet").getState().toString());
334             assertEquals("2.0", dataPoints.getPointByClass("'OffPrtCnf").getState().toString());
335             assertEquals("3.0", dataPoints.getPointByClass("'OccMod").getState().toString());
336             assertEquals("5.0", dataPoints.getPointByClass("'REei").getState().toString());
337             assertEquals("2.0", dataPoints.getPointByClass("'DhwMod").getState().toString());
338             assertEquals("2.0", dataPoints.getPointByClass("'HCSta").getState().toString());
339             assertEquals("4.0", dataPoints.getPointByClass("'PrOpModRsn").getState().toString());
340             assertEquals("6.0", dataPoints.getPointByClass("'HCtrSet").getState().toString());
341             assertEquals("2.0", dataPoints.getPointByClass("'OsscSet").getState().toString());
342             assertEquals("4.0", dataPoints.getPointByClass("'RAQualInd").getState().toString());
343             assertEquals("500.0", dataPoints.getPointByClass("'KickCyc").getState().toString());
344             assertEquals("180000.0", dataPoints.getPointByClass("'BoDhwTiOnMin").getState().toString());
345             assertEquals("180000.0", dataPoints.getPointByClass("'BoDhwTiOffMin").getState().toString());
346             assertEquals("UNDEF", dataPoints.getPointByClass("'ROpModSched").getState().toString());
347             assertEquals("UNDEF", dataPoints.getPointByClass("'DhwSched").getState().toString());
348             assertEquals("UNDEF", dataPoints.getPointByClass("'ROpModSched").getState().toString());
349             assertEquals("UNDEF", dataPoints.getPointByClass("'DhwSched").getState().toString());
350             assertEquals("253140.0", dataPoints.getPointByClass("'OphH").getState().toString());
351         } catch (RdsCloudException e) {
352             fail(e.getMessage());
353         }
354
355         // test for a missing element
356         State test = null;
357         try {
358             test = dataPoints.getPointByClass("missing-element").getState();
359             fail("expected exception did not occur");
360         } catch (RdsCloudException e) {
361             assertEquals(null, test);
362         }
363
364         try {
365             // test the all-the-way-round lookup loop
366             assertNotNull(dataPoints.points);
367             Map<String, @Nullable BasePoint> pointsMap = dataPoints.points;
368             assertNotNull(pointsMap);
369             @Nullable
370             BasePoint point;
371             for (Entry<String, @Nullable BasePoint> entry : pointsMap.entrySet()) {
372                 point = entry.getValue();
373                 assertTrue(point instanceof BasePoint);
374                 // ignore UNDEF points where all-the-way-round lookup fails
375                 if (!"UNDEF".equals(point.getState().toString())) {
376                     @Nullable
377                     String x = entry.getKey();
378                     assertNotNull(x);
379                     String y = point.getPointClass();
380                     String z = dataPoints.pointClassToId(y);
381                     assertEquals(x, z);
382                 }
383             }
384
385             State state = null;
386
387             // test the specific points that we use
388             state = dataPoints.getPointByClass(HIE_DESCRIPTION).getState();
389             assertEquals("Upstairs", state.toString());
390
391             state = dataPoints.getPointByClass(HIE_ROOM_TEMP).getState();
392             assertEquals(state.getClass(), QuantityType.class);
393             assertEquals(23.761879, ((QuantityType<?>) state).floatValue(), 0.01);
394
395             state = dataPoints.getPointByClass(HIE_OUTSIDE_TEMP).getState();
396             assertEquals(state.getClass(), QuantityType.class);
397             assertEquals(18.55, ((QuantityType<?>) state).floatValue(), 0.01);
398
399             state = dataPoints.getPointByClass(HIE_TARGET_TEMP).getState();
400             assertEquals(state.getClass(), QuantityType.class);
401             assertEquals(24, ((QuantityType<?>) state).floatValue(), 0.01);
402
403             state = dataPoints.getPointByClass(HIE_ROOM_HUMIDITY).getState();
404             assertEquals(state.getClass(), QuantityType.class);
405             assertEquals(46.86, ((QuantityType<?>) state).floatValue(), 0.01);
406
407             state = dataPoints.getPointByClass(HIE_ROOM_AIR_QUALITY).getEnum();
408             assertEquals(state.getClass(), StringType.class);
409             assertEquals("Good", state.toString());
410             assertEquals("Good", dataPoints.getPointByClass(HIE_ROOM_AIR_QUALITY).getEnum().toString());
411
412             state = dataPoints.getPointByClass(HIE_ENERGY_SAVINGS_LEVEL).getEnum();
413             assertEquals(state.getClass(), StringType.class);
414             assertEquals("Excellent", state.toString());
415             assertEquals("Excellent", dataPoints.getPointByClass(HIE_ENERGY_SAVINGS_LEVEL).getEnum().toString());
416
417             state = dataPoints.getPointByClass(HIE_OUTPUT_STATE).getEnum();
418             assertEquals(state.getClass(), StringType.class);
419             assertEquals("Heating", state.toString());
420             assertEquals("Heating", dataPoints.getPointByClass(HIE_OUTPUT_STATE).getEnum().toString());
421
422             state = dataPoints.getPointByClass(HIE_STAT_OCC_MODE_PRESENT).getState();
423             assertEquals(state.getClass(), QuantityType.class);
424             assertEquals(3, ((QuantityType<?>) state).intValue());
425             assertEquals(3, dataPoints.getPointByClass(HIE_STAT_OCC_MODE_PRESENT).asInt());
426
427             state = dataPoints.getPointByClass(HIE_STAT_OCC_MODE_PRESENT).getEnum();
428             assertEquals(state.getClass(), StringType.class);
429             assertEquals("Present", state.toString());
430             assertEquals("Present", dataPoints.getPointByClass(HIE_STAT_OCC_MODE_PRESENT).getEnum().toString());
431
432             state = dataPoints.getPointByClass(HIE_DHW_OUTPUT_STATE).getState();
433             assertEquals(state.getClass(), QuantityType.class);
434             assertEquals(2, ((QuantityType<?>) state).intValue());
435             assertEquals(2, dataPoints.getPointByClass(HIE_DHW_OUTPUT_STATE).asInt());
436
437             state = dataPoints.getPointByClass(HIE_DHW_OUTPUT_STATE).getEnum();
438             assertEquals(state.getClass(), StringType.class);
439             assertEquals("On", state.toString());
440             assertEquals("On", dataPoints.getPointByClass(HIE_DHW_OUTPUT_STATE).getEnum().toString());
441
442             state = dataPoints.getPointByClass(HIE_PR_OP_MOD_RSN).getState();
443             assertEquals(state.getClass(), QuantityType.class);
444             assertEquals(4, ((QuantityType<?>) state).intValue());
445             assertEquals(4, dataPoints.getPointByClass(HIE_PR_OP_MOD_RSN).asInt());
446
447             state = dataPoints.getPointByClass(HIE_PR_OP_MOD_RSN).getEnum();
448             assertEquals(state.getClass(), StringType.class);
449             assertEquals("Comfort", state.toString());
450             assertEquals("Comfort", dataPoints.getPointByClass(HIE_PR_OP_MOD_RSN).getEnum().toString());
451
452             state = dataPoints.getPointByClass(HIE_STAT_CMF_BTN).getState();
453             assertEquals(state.getClass(), QuantityType.class);
454             assertEquals(0, ((QuantityType<?>) state).intValue());
455             assertEquals(0, dataPoints.getPointByClass(HIE_STAT_CMF_BTN).asInt());
456
457             state = dataPoints.getPointByClass(HIE_STAT_CMF_BTN).getEnum();
458             assertEquals(state.getClass(), StringType.class);
459             assertEquals("Inactive", state.toString());
460             assertEquals("Inactive", dataPoints.getPointByClass(HIE_STAT_CMF_BTN).getEnum().toString());
461
462             // test online code
463             assertTrue(dataPoints.isOnline());
464
465             // test present priority code
466             assertEquals(15, dataPoints.getPointByClass(HIE_TARGET_TEMP).getPresentPriority());
467
468             // test temperature units code (C)
469             BasePoint tempPoint = dataPoints.getPointByClass("'SpTR");
470             assertTrue(tempPoint instanceof BasePoint);
471             assertEquals(SIUnits.CELSIUS, tempPoint.getUnit());
472
473             // test temperature units code (F)
474             tempPoint = dataPoints.getPointByClass("'SpHPcf");
475             assertTrue(tempPoint instanceof BasePoint);
476             assertEquals(ImperialUnits.FAHRENHEIT, tempPoint.getUnit());
477
478             // test temperature units code (K)
479             tempPoint = dataPoints.getPointByClass("'SpHPcf");
480             assertTrue(tempPoint instanceof BasePoint);
481             assertEquals(ImperialUnits.FAHRENHEIT, tempPoint.getUnit());
482
483             tempPoint = dataPoints.getPointByClass("'SpTRShft");
484             assertTrue(tempPoint instanceof BasePoint);
485             assertEquals(Units.KELVIN, tempPoint.getUnit());
486         } catch (RdsCloudException e) {
487             fail(e.getMessage());
488         }
489     }
490
491     @Test
492     public void testRdsPlants() {
493         try {
494             RdsPlants plants = RdsPlants.createFromJson(load("plants"));
495             assertNotNull(plants);
496
497             @Nullable
498             List<PlantInfo> plantList = plants.getPlants();
499             assertNotNull(plantList);
500
501             @Nullable
502             PlantInfo plant;
503             plant = plantList.get(0);
504             assertTrue(plant instanceof PlantInfo);
505             assertEquals("Pd1774247-7de7-4896-ac76-b7e0dd943c40", plant.getId());
506             assertTrue(plant.isOnline());
507
508             plant = plantList.get(1);
509             assertTrue(plant instanceof PlantInfo);
510             assertEquals("Pfaf770c8-abeb-4742-ad65-ead39030d369", plant.getId());
511             assertTrue(plant.isOnline());
512         } catch (RdsCloudException e) {
513             fail(e.getMessage());
514         }
515     }
516 }