Class AbstractInformationModelConnectorTest<D>
java.lang.Object
test.de.iip_ecosphere.platform.connectors.AbstractInformationModelConnectorTest<D>
- Type Parameters:
D- the internal data type of the connector under test
- All Implemented Interfaces:
MachineCommandInputTranslator.InputCustomizer,MachineDataOutputTranslator.OutputCustomizer
public abstract class AbstractInformationModelConnectorTest<D>
extends Object
implements MachineCommandInputTranslator.InputCustomizer, MachineDataOutputTranslator.OutputCustomizer
Implements a re-usable information model connector test.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractInformationModelConnectorTest(Class<? extends D> dataType) Creates an instance and sets the internal data type. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidafterActions(de.iip_ecosphere.platform.connectors.Connector<D, Object, MachineData, MachineCommand> connector) Do additional actions after testing.protected abstract voidAsserts additional properties for the given step of testing.protected 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<D, Object, MachineData, MachineCommand> createConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<D, Object, MachineData, MachineCommand> 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).voidtestConnector(boolean withNotifications) Tests the connector.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 -
dataType
-
-
Constructor Details
-
AbstractInformationModelConnectorTest
Creates an instance and sets the internal data type.- Parameters:
dataType- the internal data type
-
-
Method Details
-
getConnectorDescriptor
protected abstract Class<? extends de.iip_ecosphere.platform.connectors.ConnectorDescriptor> getConnectorDescriptor()Returns the connector descriptor forcreateConnector(ProtocolAdapter).- Returns:
- the connector descriptor
-
assertAdditionalProperties
protected abstract void assertAdditionalProperties(AbstractInformationModelConnectorTest.Step step, MachineData received) Asserts additional properties for the given step of testing.- Parameters:
step- the testing stepreceived- the received machine data from the connector
-
afterActions
protected abstract void afterActions(de.iip_ecosphere.platform.connectors.Connector<D, Object, MachineData, MachineCommand> connector) Do additional actions after testing.- Parameters:
connector- the connector instance
-
createConnector
protected abstract de.iip_ecosphere.platform.connectors.Connector<D,Object, createConnectorMachineData, MachineCommand> (de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<D, Object, MachineData, MachineCommand> 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
-
testConnector
Tests the connector.- Parameters:
withNotifications- operate with/without notifications (for testing)- Throws:
IOException- in case that creating the connector fails
-
block
Blocks until a certain number of (accumulated) receptions is reached or fails after 4s.- Parameters:
count- the counterreceptions- the expected number of receptions
-