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 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

      public void testConnector(boolean withNotifications) throws IOException
      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,ModbusDataC,ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) throws IOException
      Tries to write a short value.
      Parameters:
      connector - the connector
      count - the test counter
      md - 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,ModbusDataC,ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) throws IOException
      Tries to write an int value.
      Parameters:
      connector - the connector
      count - the test counter
      md - 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,ModbusDataC,ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) throws IOException
      Tries to write a float value.
      Parameters:
      connector - the connector
      count - the test counter
      md - 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,ModbusDataC,ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) throws IOException
      Tries to write a long value.
      Parameters:
      connector - the connector
      count - the test counter
      md - 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,ModbusDataC,ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) throws IOException
      Tries to write a double value.
      Parameters:
      connector - the connector
      count - the test counter
      md - 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,ModbusDataC,ModbusCommandC> connector, AtomicInteger count, AtomicReference<ModbusDataC> md) throws IOException
      Tries to write all values to 0.
      Parameters:
      connector - the connector
      count - the test counter
      md - the machine data
      Throws:
      IOException - if an I/O problem occurs
    • block

      protected void block(AtomicInteger count, int receptions)
      Blocks until a certain number of (accumulated) receptions is reached or fails after 4s.
      Parameters:
      count - the counter
      receptions - the expected number of receptions
    • getConnectorDescriptor

      protected abstract Class<? extends de.iip_ecosphere.platform.connectors.ConnectorDescriptor> getConnectorDescriptor()
      Returns the connector descriptor for createConnector(ProtocolAdapter).
      Returns:
      the connector descriptor
    • createConnector

      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.
      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 for Connector.connect(ConnectorParameter).
      Returns:
      the connector parameters