Search in sources :

Example 1 with ModbusSerialSlaveEndpoint

use of org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint in project openhab1-addons by openhab.

the class ModbusSlaveEndpointTestCase method testEqualsDifferentSerial.

@Test
public void testEqualsDifferentSerial() {
    ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
    ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters("port2", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
    Assert.assertNotEquals(e1, e2);
    Assert.assertNotEquals(e1.hashCode(), e2.hashCode());
}
Also used : ModbusSerialSlaveEndpoint(org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint) SerialParameters(net.wimpi.modbus.util.SerialParameters) Test(org.junit.Test)

Example 2 with ModbusSerialSlaveEndpoint

use of org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint in project openhab1-addons by openhab.

the class ModbusSlaveEndpointTestCase method testEqualsDifferentProtocol2.

@Test
public void testEqualsDifferentProtocol2() {
    ModbusTCPSlaveEndpoint e1 = new ModbusTCPSlaveEndpoint("127.0.0.1", 500);
    ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters());
    Assert.assertNotEquals(e1, e2);
    Assert.assertNotEquals(e1.hashCode(), e2.hashCode());
}
Also used : ModbusSerialSlaveEndpoint(org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint) ModbusTCPSlaveEndpoint(org.openhab.binding.modbus.internal.pooling.ModbusTCPSlaveEndpoint) SerialParameters(net.wimpi.modbus.util.SerialParameters) Test(org.junit.Test)

Example 3 with ModbusSerialSlaveEndpoint

use of org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint in project openhab1-addons by openhab.

the class ModbusSlaveEndpointTestCase method testEqualsSameSerial3.

/**
     * even though different echo parameter & baud rate, the endpoints are considered the same due to same port
     */
@Test
public void testEqualsSameSerial3() {
    ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
    ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, false, 500));
    Assert.assertEquals(e1, e2);
    Assert.assertEquals(e1.hashCode(), e2.hashCode());
}
Also used : ModbusSerialSlaveEndpoint(org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint) SerialParameters(net.wimpi.modbus.util.SerialParameters) Test(org.junit.Test)

Example 4 with ModbusSerialSlaveEndpoint

use of org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint in project openhab1-addons by openhab.

the class ModbusSlaveEndpointTestCase method testEqualsSameSerial.

@Test
public void testEqualsSameSerial() {
    ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters());
    ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters());
    Assert.assertEquals(e1, e2);
}
Also used : ModbusSerialSlaveEndpoint(org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint) SerialParameters(net.wimpi.modbus.util.SerialParameters) Test(org.junit.Test)

Example 5 with ModbusSerialSlaveEndpoint

use of org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint in project openhab1-addons by openhab.

the class ModbusSlaveEndpointTestCase method testEqualsSameSerial2.

@Test
public void testEqualsSameSerial2() {
    ModbusSerialSlaveEndpoint e1 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
    ModbusSerialSlaveEndpoint e2 = new ModbusSerialSlaveEndpoint(new SerialParameters("port1", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, Modbus.DEFAULT_SERIAL_ENCODING, true, 500));
    Assert.assertEquals(e1, e2);
}
Also used : ModbusSerialSlaveEndpoint(org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint) SerialParameters(net.wimpi.modbus.util.SerialParameters) Test(org.junit.Test)

Aggregations

SerialParameters (net.wimpi.modbus.util.SerialParameters)5 Test (org.junit.Test)5 ModbusSerialSlaveEndpoint (org.openhab.binding.modbus.internal.pooling.ModbusSerialSlaveEndpoint)5 ModbusTCPSlaveEndpoint (org.openhab.binding.modbus.internal.pooling.ModbusTCPSlaveEndpoint)1