use of org.apache.plc4x.java.ads.model.AdsPlcFieldHandler in project plc4x by apache.
the class Plc4x2AdsProtocolTest method data.
@Parameterized.Parameters(name = "{index} Type:{0} {3} {5}")
public static Collection<Object[]> data() {
AmsNetId targetAmsNetId = AmsNetId.of("1.2.3.4.5.6");
AmsPort targetAmsPort = AmsPort.of(7);
AmsNetId sourceAmsNetId = AmsNetId.of("8.9.10.11.12.13");
AmsPort sourceAmsPort = AmsPort.of(14);
Invoke invokeId = Invoke.of(2);
return streamOfLittleEndianDataTypePairs().filter(o -> o.getDataTypeClass() != LocalDateTime.class).filter(o -> o.getDataTypeClass() != Byte[].class).filter(o -> o.getDataTypeClass() != byte[].class).map(Plc4x2AdsProtocolTest::mapToAdsDataType).map(pair -> Stream.of(ImmutablePair.of(new PlcRequestContainer<>((InternalPlcRequest) // TODO: remove null
new DefaultPlcWriteRequest.Builder(null, new AdsPlcFieldHandler()).addItem(RandomStringUtils.randomAscii(10), "1/1:" + pair.adsDataType.name(), pair.getValue()).build(), new CompletableFuture<>()), AdsWriteResponse.of(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId, Result.of(0))), ImmutablePair.of(new PlcRequestContainer<>((InternalPlcRequest) // TODO: remove null
new DefaultPlcReadRequest.Builder(null, new AdsPlcFieldHandler()).addItem(RandomStringUtils.randomAscii(10), "1/1:" + pair.adsDataType.name()).build(), new CompletableFuture<>()), AdsReadResponse.of(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId, Result.of(0), Data.of(pair.getByteRepresentation()))))).flatMap(stream -> stream).map(pair -> new Object[] { "???", pair.left, pair.left.getResponseFuture(), pair.left.getRequest().getClass().getSimpleName(), pair.right, pair.right.getClass().getSimpleName() }).collect(Collectors.toList());
}
Aggregations