public abstract class AbstractSerializingConnectorTest extends Object
byte[] types.| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractSerializingConnectorTest.ConnectorParameterConfigurer
Allows to configure the connector parameters.
|
| Modifier and Type | Field and Description |
|---|---|
private static String |
CMD_CHANNEL |
private static String |
PROD_CHANNEL |
| Constructor and Description |
|---|
AbstractSerializingConnectorTest() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract de.iip_ecosphere.platform.transport.connectors.TransportParameter.TransportParameterBuilder |
configureTransportParameter(de.iip_ecosphere.platform.transport.connectors.TransportParameter.TransportParameterBuilder builder)
Configures the transport parameters used to connect the instance from
createConnector(ChannelProtocolAdapter). |
protected abstract de.iip_ecosphere.platform.connectors.Connector<byte[],byte[],test.de.iip_ecosphere.platform.transport.Product,test.de.iip_ecosphere.platform.transport.Command> |
createConnector(de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[],byte[],test.de.iip_ecosphere.platform.transport.Product,test.de.iip_ecosphere.platform.transport.Command> adapter)
Creates the connector to be tested.
|
protected de.iip_ecosphere.platform.connectors.ConnectorParameter |
createConnectorParameter(de.iip_ecosphere.platform.support.ServerAddress addr,
AbstractSerializingConnectorTest.ConnectorParameterConfigurer configurer)
Creates the coonnector parameter instance.
|
protected abstract de.iip_ecosphere.platform.support.Server |
createTestServer(de.iip_ecosphere.platform.support.ServerAddress addr,
File configDir)
Creates the test server to test against.
|
protected abstract de.iip_ecosphere.platform.transport.connectors.TransportConnector |
createTransportConnector()
Returns the transport connector to test against behind the test server.
|
protected de.iip_ecosphere.platform.transport.connectors.TransportParameter |
createTransportParameter(de.iip_ecosphere.platform.support.ServerAddress addr,
test.de.iip_ecosphere.platform.transport.AbstractTransportConnectorTest.TransportParameterConfigurer configurer)
Creates the transport parameter instance.
|
protected void |
doTest(de.iip_ecosphere.platform.support.ServerAddress addr,
AbstractSerializingConnectorTest.ConnectorParameterConfigurer configurer)
Implements a MQTT connector test.
|
protected abstract AbstractSerializingConnectorTest.ConnectorParameterConfigurer |
getConfigurer()
Returns the test configurer (for TLS tests).
|
protected abstract Class<? extends de.iip_ecosphere.platform.connectors.ConnectorDescriptor> |
getConnectorDescriptor()
Returns the connector descriptor for
createConnector(ChannelProtocolAdapter). |
protected abstract boolean |
implementsEncryption()
Returns whether the connector implementation supports encryption.
|
void |
testConnector()
Tests the connector through explicitly setting/resetting the factory
implementation.
|
private void |
testEnc(de.iip_ecosphere.platform.connectors.Connector<?,?,?,?> connector,
AbstractSerializingConnectorTest.ConnectorParameterConfigurer configurer,
boolean connected)
Tests encryption statements of
connector, i.e., Connector.supportedEncryption()
and Connector.enabledEncryption(). |
void |
testTlsConnector()
Tests the TLS connector through explicitly setting/resetting the factory
implementation.
|
private static final String CMD_CHANNEL
private static final String PROD_CHANNEL
protected abstract de.iip_ecosphere.platform.connectors.Connector<byte[],byte[],test.de.iip_ecosphere.platform.transport.Product,test.de.iip_ecosphere.platform.transport.Command> createConnector(de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[],byte[],test.de.iip_ecosphere.platform.transport.Product,test.de.iip_ecosphere.platform.transport.Command> adapter)
adapter - the protocol adapter used to create the connectorprotected abstract Class<? extends de.iip_ecosphere.platform.connectors.ConnectorDescriptor> getConnectorDescriptor()
createConnector(ChannelProtocolAdapter).protected abstract de.iip_ecosphere.platform.support.Server createTestServer(de.iip_ecosphere.platform.support.ServerAddress addr,
File configDir)
addr - the server address (schema may be ignored)configDir - specific configuration directory for this test server, may be null for noneprotected abstract de.iip_ecosphere.platform.transport.connectors.TransportConnector createTransportConnector()
protected abstract de.iip_ecosphere.platform.transport.connectors.TransportParameter.TransportParameterBuilder configureTransportParameter(de.iip_ecosphere.platform.transport.connectors.TransportParameter.TransportParameterBuilder builder)
createConnector(ChannelProtocolAdapter).builder - the parameter builderbuilderpublic void testConnector()
throws IOException
Server based on #createTestServer(ServerAddress) that the test is
self-contained.IOException - in case that connection/communication failspublic void testTlsConnector()
throws IOException
Server based on #createTestServer(ServerAddress) that the test is
self-contained.IOException - in case that connection/communication failsgetConfigurer()protected abstract AbstractSerializingConnectorTest.ConnectorParameterConfigurer getConfigurer()
protected abstract boolean implementsEncryption()
true for supported, false for not supportedprotected de.iip_ecosphere.platform.connectors.ConnectorParameter createConnectorParameter(de.iip_ecosphere.platform.support.ServerAddress addr,
AbstractSerializingConnectorTest.ConnectorParameterConfigurer configurer)
addr - the server address (schema is ignored)configurer - the parameter configurer, may be null for noneprotected de.iip_ecosphere.platform.transport.connectors.TransportParameter createTransportParameter(de.iip_ecosphere.platform.support.ServerAddress addr,
test.de.iip_ecosphere.platform.transport.AbstractTransportConnectorTest.TransportParameterConfigurer configurer)
#configureTransportParameter(TransportParameterBuilder)
for basic, test-wide configuration.addr - the server address (schema is ignored)configurer - the parameter configurer, may be null for noneprotected void doTest(de.iip_ecosphere.platform.support.ServerAddress addr,
AbstractSerializingConnectorTest.ConnectorParameterConfigurer configurer)
throws IOException
addr - the server address (schema is ignored)configurer - the parameter configurer, may be null for noneIOException - in case that connection/communication failsprivate void testEnc(de.iip_ecosphere.platform.connectors.Connector<?,?,?,?> connector,
AbstractSerializingConnectorTest.ConnectorParameterConfigurer configurer,
boolean connected)
connector, i.e., Connector.supportedEncryption()
and Connector.enabledEncryption().connector - the connector instance to testconfigurer - the configurer indicating whether encryption shall be activated if connectedconnected - whether the connector is supposed to be connectedCopyright © 2022. All rights reserved.