Class AbstractModbusInformationModelConnectorTest<D>
java.lang.Object
test.de.iip_ecosphere.platform.connectors.modbustcpipv1.AbstractModbusInformationModelConnectorTest<D>
- Type Parameters:
D- the internal data type of the connector under test
- All Implemented Interfaces:
test.de.iip_ecosphere.platform.connectors.MachineCommandInputTranslator.InputCustomizer,test.de.iip_ecosphere.platform.connectors.MachineDataOutputTranslator.OutputCustomizer
- Direct Known Subclasses:
AbstractModbusTcpIpConnectorTest
public abstract class AbstractModbusInformationModelConnectorTest<D>
extends Object
implements test.de.iip_ecosphere.platform.connectors.MachineCommandInputTranslator.InputCustomizer, test.de.iip_ecosphere.platform.connectors.MachineDataOutputTranslator.OutputCustomizer
Implements a MODBUS TCP/IP connector test.
- Author:
- Christian Nikolajew
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final de.iip_ecosphere.platform.support.logging.Logger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an instance and sets the internal data type. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidblock(AtomicInteger count, int receptions) Blocks until a certain number of (accumulated) receptions is reached or fails after 4s.protected abstract de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> createConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> adapter) Creates the connector to be tested.protected abstract Class<? extends de.iip_ecosphere.platform.connectors.ConnectorDescriptor> Returns the connector descriptor forcreateConnector(ProtocolAdapter).protected abstract de.iip_ecosphere.platform.connectors.ConnectorParameterReturns the connector parameters forConnector.connect(ConnectorParameter).private voidtestAllToZero(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write all values to 0.voidtestConnector(boolean withNotifications) Tests the connector.private voidtestDouble(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a double value.private voidtestFloat(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a float value.private voidtestInt(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write an int value.private voidtestLong(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a long value.private voidtestShort(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a short value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface test.de.iip_ecosphere.platform.connectors.MachineCommandInputTranslator.InputCustomizer
additionalFromActions, assertOperationExceptions, assertSetExceptions, getQNameOperationStartMachine, getQNameOperationStopMachine, getQNameStart, getQNameStop, getQNameVarLotSize, getTopLevelModelPartNameMethods inherited from interface test.de.iip_ecosphere.platform.connectors.MachineDataOutputTranslator.OutputCustomizer
assertNotExistingProperties, getQNameVarLotSize, getQNameVarPowerConsumption, getTopLevelModelPartName, getVendor, initializeModelAccess
-
Field Details
-
LOGGER
private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER
-
-
Constructor Details
-
AbstractModbusInformationModelConnectorTest
protected AbstractModbusInformationModelConnectorTest()Creates an instance and sets the internal data type.
-
-
Method Details
-
testConnector
Tests the connector.- Parameters:
withNotifications- operate with/without notifications (for testing)- Throws:
IOException- in case that creating the connector fails
-
testShort
private void testShort(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, throws IOExceptionModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a short value.- Parameters:
connector- the connectorcount- the test countermd- the machine data- Throws:
IOException- if an I/O problem occurs
-
testInt
private void testInt(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, throws IOExceptionModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write an int value.- Parameters:
connector- the connectorcount- the test countermd- the machine data- Throws:
IOException- if an I/O problem occurs
-
testFloat
private void testFloat(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, throws IOExceptionModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a float value.- Parameters:
connector- the connectorcount- the test countermd- the machine data- Throws:
IOException- if an I/O problem occurs
-
testLong
private void testLong(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, throws IOExceptionModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a long value.- Parameters:
connector- the connectorcount- the test countermd- the machine data- Throws:
IOException- if an I/O problem occurs
-
testDouble
private void testDouble(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, throws IOExceptionModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write a double value.- Parameters:
connector- the connectorcount- the test countermd- the machine data- Throws:
IOException- if an I/O problem occurs
-
testAllToZero
private void testAllToZero(de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, throws IOExceptionModbusDataC, ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) Tries to write all values to 0.- Parameters:
connector- the connectorcount- the test countermd- the machine data- Throws:
IOException- if an I/O problem occurs
-
block
Blocks until a certain number of (accumulated) receptions is reached or fails after 4s.- Parameters:
count- the counterreceptions- the expected number of receptions
-
getConnectorDescriptor
protected abstract Class<? extends de.iip_ecosphere.platform.connectors.ConnectorDescriptor> getConnectorDescriptor()Returns the connector descriptor forcreateConnector(ProtocolAdapter).- Returns:
- the connector descriptor
-
createConnector
protected abstract de.iip_ecosphere.platform.connectors.Connector<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem,Object, createConnectorModbusDataC, ModbusCommandC> (de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<de.iip_ecosphere.platform.connectors.modbustcpipv1.ModbusItem, Object, ModbusDataC, ModbusCommandC> adapter) Creates the connector to be tested.- Parameters:
adapter- the protocol adapter to use- Returns:
- the connector instance to test
-
getConnectorParameter
protected abstract de.iip_ecosphere.platform.connectors.ConnectorParameter getConnectorParameter()Returns the connector parameters forConnector.connect(ConnectorParameter).- Returns:
- the connector parameters
-