Skip to content

Commit ea98935

Browse files
committed
Merge branch 'master' of https://github.com/openhab/openhab2
Signed-off-by: Thomas Eichstädt-Engelen <[email protected]> # Conflicts: # features/org.openhab.feature.runtime/feature.xml # targetplatform/openhab.target
2 parents a996149 + 59ec700 commit ea98935

File tree

297 files changed

+59626
-18433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+59626
-18433
lines changed

addons/binding/org.openhab.binding.freebox/META-INF/MANIFEST.MF

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Import-Package: com.google.common.base,
2323
org.eclipse.smarthome.core.thing,
2424
org.eclipse.smarthome.core.thing.binding,
2525
org.eclipse.smarthome.core.types,
26-
org.openhab.library.tel.items,
2726
org.osgi.framework,
2827
org.slf4j
2928
Service-Component: OSGI-INF/*

addons/binding/org.openhab.binding.max.test/src/test/groovy/org/openhab/binding/max/test/MaxBridgeHandlerOSGiTest.groovy

+36-40
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ import org.eclipse.smarthome.test.storage.VolatileStorageService
2323
import org.junit.Before
2424
import org.junit.Test
2525
import org.openhab.binding.max.MaxBinding
26-
import org.openhab.binding.max.internal.factory.MaxCubeHandlerFactory
2726
import org.openhab.binding.max.internal.handler.MaxCubeBridgeHandler
2827

29-
30-
3128
/**
3229
* Tests for {@link MaxCubeBridgeHandler}.
3330
*
@@ -36,55 +33,54 @@ import org.openhab.binding.max.internal.handler.MaxCubeBridgeHandler
3633
*/
3734
class MaxBridgeHandlerOSGiTest extends OSGiTest {
3835

39-
final ThingTypeUID BRIDGE_THING_TYPE_UID = new ThingTypeUID("max", "bridge")
40-
41-
ManagedThingProvider managedThingProvider
42-
VolatileStorageService volatileStorageService = new VolatileStorageService()
36+
final ThingTypeUID BRIDGE_THING_TYPE_UID = new ThingTypeUID("max", "bridge")
4337

38+
ManagedThingProvider managedThingProvider
39+
VolatileStorageService volatileStorageService = new VolatileStorageService()
4440

45-
@Before
46-
void setUp() {
47-
registerService(volatileStorageService)
48-
managedThingProvider = getService(ThingProvider, ManagedThingProvider)
49-
assertThat managedThingProvider, is(notNullValue())
50-
}
41+
@Before
42+
void setUp() {
43+
registerService(volatileStorageService)
44+
managedThingProvider = getService(ThingProvider, ManagedThingProvider)
45+
assertThat managedThingProvider, is(notNullValue())
46+
}
5147

52-
@Test
53-
void maxCubeBridgeHandlerRegisteredAndUnregister() {
48+
@Test
49+
void maxCubeBridgeHandlerRegisteredAndUnregister() {
5450

55-
MaxCubeBridgeHandler maxBridgeHandler = getService(ThingHandler, MaxCubeBridgeHandler)
56-
assertThat maxBridgeHandler, is(nullValue())
51+
MaxCubeBridgeHandler maxBridgeHandler = getService(ThingHandler, MaxCubeBridgeHandler)
52+
assertThat maxBridgeHandler, is(nullValue())
5753

58-
Configuration configuration = new Configuration().with {
59-
put(MaxBinding.SERIAL_NUMBER, "KEQ0565026")
60-
put(MaxBinding.IP_ADDRESS, "192.168.3.100")
61-
it
62-
}
54+
Configuration configuration = new Configuration().with {
55+
put(MaxBinding.SERIAL_NUMBER, "KEQ0565026")
56+
put(MaxBinding.IP_ADDRESS, "192.168.3.100")
57+
it
58+
}
6359

6460

65-
ThingUID cubeUid = new ThingUID(BRIDGE_THING_TYPE_UID, "testCube");
61+
ThingUID cubeUid = new ThingUID(BRIDGE_THING_TYPE_UID, "testCube");
6662

6763

68-
Bridge maxBridge = managedThingProvider.createThing(
69-
BRIDGE_THING_TYPE_UID,
70-
cubeUid,
71-
null, configuration)
64+
Bridge maxBridge = managedThingProvider.createThing(
65+
BRIDGE_THING_TYPE_UID,
66+
cubeUid,
67+
null, configuration)
7268

73-
assertThat maxBridge, is(notNullValue())
69+
assertThat maxBridge, is(notNullValue())
7470

75-
// wait for MaxCubeBridgeHandler to be registered
76-
waitForAssert({
77-
maxBridgeHandler = getService(ThingHandler, MaxCubeBridgeHandler)
78-
assertThat maxBridgeHandler, is(notNullValue())
79-
}, 10000)
71+
// wait for MaxCubeBridgeHandler to be registered
72+
waitForAssert({
73+
maxBridgeHandler = getService(ThingHandler, MaxCubeBridgeHandler)
74+
assertThat maxBridgeHandler, is(notNullValue())
75+
}, 10000)
8076

81-
managedThingProvider.remove(maxBridge.getUID())
77+
managedThingProvider.remove(maxBridge.getUID())
8278

83-
// wait for MaxCubeBridgeHandler to be unregistered
84-
waitForAssert({
85-
maxBridgeHandler = getService(ThingHandler, MaxCubeBridgeHandler)
86-
assertThat maxBridgeHandler, is(nullValue())
87-
}, 10000)
88-
}
79+
// wait for MaxCubeBridgeHandler to be unregistered
80+
waitForAssert({
81+
maxBridgeHandler = getService(ThingHandler, MaxCubeBridgeHandler)
82+
assertThat maxBridgeHandler, is(nullValue())
83+
}, 10000)
84+
}
8985

9086
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**
2+
* Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License v1.0
6+
* which accompanies this distribution, and is available at
7+
* http://www.eclipse.org/legal/epl-v10.html
8+
*/
9+
package org.openhab.binding.max.internal.command;
10+
11+
import static org.junit.Assert.assertEquals;
12+
13+
import org.apache.commons.net.util.Base64;
14+
import org.junit.Test;
15+
import org.openhab.binding.max.internal.Utils;
16+
import org.openhab.binding.max.internal.device.ThermostatModeType;
17+
18+
/**
19+
* Tests cases for {@link S_Command}.
20+
*
21+
* @author Marcel Verpaalen - Initial version
22+
*/
23+
public class S_CommandTest {
24+
25+
@Test
26+
public void PrefixTest() {
27+
S_Command scmd = new S_Command("0b0da3", 1, ThermostatModeType.MANUAL, 20.0);
28+
29+
String commandStr = scmd.getCommandString();
30+
31+
String prefix = commandStr.substring(0, 2);
32+
33+
assertEquals("s:", prefix);
34+
35+
}
36+
37+
@Test
38+
public void BaseCommandTest() {
39+
S_Command scmd = new S_Command("0b0da3", 1, ThermostatModeType.MANUAL, 20.0);
40+
41+
String commandStr = scmd.getCommandString();
42+
43+
String base64Data = commandStr.substring(3);
44+
byte[] bytes = Base64.decodeBase64(base64Data.getBytes());
45+
46+
int[] data = new int[bytes.length];
47+
48+
for (int i = 0; i < bytes.length; i++) {
49+
data[i] = bytes[i] & 0xFF;
50+
}
51+
52+
String decodedString = Utils.toHex(data);
53+
assertEquals("s:AARAAAAACw2jAWg=\r\n", commandStr);
54+
assertEquals("011000000002C368C05A", decodedString);
55+
56+
}
57+
58+
@Test
59+
public void boostModeTest() {
60+
S_Command scmd = new S_Command("0b0da3", 1, ThermostatModeType.BOOST, 21.0);
61+
62+
String commandStr = scmd.getCommandString();
63+
64+
assertEquals("s:AARAAAAACw2jAeo=\r\n", commandStr);
65+
66+
}
67+
68+
@Test
69+
public void autoModeTest() {
70+
S_Command scmd = new S_Command("0b0da3", 1, ThermostatModeType.AUTOMATIC, 0);
71+
72+
String commandStr = scmd.getCommandString();
73+
74+
assertEquals("s:AARAAAAACw2jAQA=\r\n", commandStr);
75+
76+
}
77+
}

addons/binding/org.openhab.binding.max.test/src/test/java/org/openhab/binding/max/internal/message/C_MessageTest.java

+27-27
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,50 @@
1616

1717
/**
1818
* Tests cases for {@link C_Message}.
19-
*
19+
*
2020
* @author Andreas Heil ([email protected])
2121
* @author Marcel Verpaalen - OH2 Version and updates
2222
* @since 1.4.0
2323
*/
2424
public class C_MessageTest {
2525

26-
public final String rawData = "C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==";
26+
public final String rawData = "C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==";
2727

28-
private C_Message message = null;
28+
private C_Message message = null;
2929

30-
@Before
31-
public void Before() {
32-
message = new C_Message(rawData);
33-
}
30+
@Before
31+
public void Before() {
32+
message = new C_Message(rawData);
33+
}
3434

35-
@Test
36-
public void getMessageTypeTest() {
35+
@Test
36+
public void getMessageTypeTest() {
3737

38-
MessageType messageType = ((Message) message).getType();
38+
MessageType messageType = ((Message) message).getType();
3939

40-
assertEquals(MessageType.C, messageType);
41-
}
40+
assertEquals(MessageType.C, messageType);
41+
}
4242

43-
@Test
44-
public void getRFAddressTest() {
43+
@Test
44+
public void getRFAddressTest() {
4545

46-
String rfAddress = message.getRFAddress();
46+
String rfAddress = message.getRFAddress();
4747

48-
assertEquals("0b0da3", rfAddress);
49-
}
48+
assertEquals("0b0da3", rfAddress);
49+
}
5050

51-
@Test
52-
public void getDeviceTypeTest() {
51+
@Test
52+
public void getDeviceTypeTest() {
5353

54-
DeviceType deviceType = message.getDeviceType();
54+
DeviceType deviceType = message.getDeviceType();
5555

56-
assertEquals(DeviceType.HeatingThermostatPlus, deviceType);
57-
}
56+
assertEquals(DeviceType.HeatingThermostatPlus, deviceType);
57+
}
5858

59-
@Test
60-
public void getSerialNumberTes() {
61-
String serialNumber = message.getSerialNumber();
59+
@Test
60+
public void getSerialNumberTes() {
61+
String serialNumber = message.getSerialNumber();
6262

63-
assertEquals("KEQ0544242", serialNumber);
64-
}
63+
assertEquals("KEQ0544242", serialNumber);
64+
}
6565
}

addons/binding/org.openhab.binding.max.test/src/test/java/org/openhab/binding/max/internal/message/ConfigurationTest.java

+29-30
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
*/
99
package org.openhab.binding.max.internal.message;
1010

11-
import static org.junit.Assert.assertEquals;
12-
import static org.junit.Assert.assertNotNull;
11+
import static org.junit.Assert.*;
1312

1413
import org.junit.Before;
1514
import org.junit.Test;
@@ -18,50 +17,50 @@
1817

1918
/**
2019
* Tests cases for {@link DeviceConfiguration}.
21-
*
20+
*
2221
* @author Andreas Heil ([email protected])
2322
* @author Marcel Verpaalen - OH2 Version and updates
2423
* @since 1.4.0
2524
*/
2625

2726
public class ConfigurationTest {
2827

29-
public final String rawData = "C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==";
28+
public final String rawData = "C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==";
3029

31-
private C_Message c_message = null;
32-
private DeviceConfiguration configuration = null;
30+
private C_Message c_message = null;
31+
private DeviceConfiguration configuration = null;
3332

34-
@Before
35-
public void Before() {
36-
c_message = new C_Message(rawData);
37-
configuration = DeviceConfiguration.create(c_message);
38-
}
33+
@Before
34+
public void Before() {
35+
c_message = new C_Message(rawData);
36+
configuration = DeviceConfiguration.create(c_message);
37+
}
3938

40-
@Test
41-
public void createTest() {
42-
assertNotNull(configuration);
43-
}
39+
@Test
40+
public void createTest() {
41+
assertNotNull(configuration);
42+
}
4443

45-
@Test
46-
public void getRfAddressTest() {
47-
String rfAddress = configuration.getRFAddress();
44+
@Test
45+
public void getRfAddressTest() {
46+
String rfAddress = configuration.getRFAddress();
4847

49-
assertEquals("0b0da3", rfAddress);
50-
}
48+
assertEquals("0b0da3", rfAddress);
49+
}
5150

52-
@Test
53-
public void getDeviceTypeTest() {
51+
@Test
52+
public void getDeviceTypeTest() {
5453

55-
DeviceType deviceType = configuration.getDeviceType();
54+
DeviceType deviceType = configuration.getDeviceType();
5655

57-
assertEquals(DeviceType.HeatingThermostatPlus, deviceType);
58-
}
56+
assertEquals(DeviceType.HeatingThermostatPlus, deviceType);
57+
}
5958

60-
@Test
61-
public void getSerialNumberTest() {
62-
String serialNumber = configuration.getSerialNumber();
59+
@Test
60+
public void getSerialNumberTest() {
61+
String serialNumber = configuration.getSerialNumber();
6362

64-
assertEquals("KEQ0544242", serialNumber);
65-
}
63+
assertEquals("KEQ0544242", serialNumber);
64+
}
6665

6766
}

0 commit comments

Comments
 (0)