Class InfluxConnectorTest
java.lang.Object
test.de.iip_ecosphere.platform.connectors.influx.InfluxConnectorTest
@PrepareForTest({com.influxdb.client.InfluxDBClient.class,com.influxdb.client.InfluxDBClientFactory.class})
public class InfluxConnectorTest
extends Object
Tests the
InfluxConnector.- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classCustomizes the type translators/assertions for this case. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<test.de.iip_ecosphere.platform.connectors.MachineData> private com.influxdb.client.write.Point -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddFluxRecord(List<com.influxdb.query.FluxRecord> records, Instant now, String field, Object value) Adds a flux record torecords.private com.influxdb.client.domain.BucketReturns a bucket.private List<com.influxdb.query.FluxTable> Creates/returns INFLUX data/query result for mocking.voidTests theInfluxConnector.private booleanTurns an INFLUX object value to a boolean.private intTurns an INFLUX object value to an int.private test.de.iip_ecosphere.platform.connectors.MachineCommandtoMachineCommand(com.influxdb.client.write.Point point) Turns a point back to a machine command.
-
Field Details
-
written
private com.influxdb.client.write.Point written -
expectedData
-
-
Constructor Details
-
InfluxConnectorTest
public InfluxConnectorTest()
-
-
Method Details
-
getDataTable
Creates/returns INFLUX data/query result for mocking.- Returns:
- the table(s)
-
addFluxRecord
private void addFluxRecord(List<com.influxdb.query.FluxRecord> records, Instant now, String field, Object value) Adds a flux record torecords.- Parameters:
records- the records list to modifynow- the time stamp(s) of the recordfield- the field to representvalue- the value of the field
-
toMachineCommand
private test.de.iip_ecosphere.platform.connectors.MachineCommand toMachineCommand(com.influxdb.client.write.Point point) Turns a point back to a machine command.- Parameters:
point- the point- Returns:
- the machine command instance, null if value access is not possible
-
toBoolean
Turns an INFLUX object value to a boolean.- Parameters:
fields- the point fields to read the value fromfield- the field to read the value from- Returns:
- the boolean value, false if the value does not exist
-
toInt
Turns an INFLUX object value to an int.- Parameters:
fields- the point fields to read the value fromfield- the field to read the value fromdflt- a default value if the stored object does not exist or cannot be converted- Returns:
- the int value or
dflt
-
getBucket
private com.influxdb.client.domain.Bucket getBucket()Returns a bucket.- Returns:
- the bucket
-
testInfluxConnector
Tests theInfluxConnector.- Throws:
IOException- shall not occur
-