You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/04/30 07:17:19 UTC
[plc4x] 02/02: PLC4X-114 - Some tests fail starting with Java 12 -
Seems for the modbus driver the code was not needed (Removed the code in
question)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 4ede511ffd466b69d88c75785dce3ffced52fe71
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Apr 29 16:45:41 2019 +0200
PLC4X-114 - Some tests fail starting with Java 12
- Seems for the modbus driver the code was not needed (Removed the code in question)
---
.../java/modbus/netty/Plc4XModbusProtocolTest.java | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java b/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java
index 657c0ce..c181533 100644
--- a/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java
+++ b/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java
@@ -31,7 +31,6 @@ import org.apache.plc4x.java.base.messages.*;
import org.apache.plc4x.java.base.protocol.Plc4XSupportedDataTypes;
import org.apache.plc4x.java.modbus.util.ModbusPlcFieldHandler;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -40,12 +39,9 @@ import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -330,13 +326,11 @@ public class Plc4XModbusProtocolTest {
}
@Test
- @Ignore("This test fails on Java 12 and above")
public void decode() throws Exception {
assumeThat(payloadClazzName + " not yet implemented", notYetSupportedDataType, not(hasItem(payloadClazzName)));
ArrayList<Object> in = new ArrayList<>();
SUT.encode(null, plcRequestContainer, in);
assertThat(in, hasSize(1));
- syncInvoiceId();
ArrayList<Object> out = new ArrayList<>();
SUT.decode(null, modbusTcpPayload, out);
assertThat(out, hasSize(0));
@@ -413,17 +407,4 @@ public class Plc4XModbusProtocolTest {
return dataTypePair;
}
}
-
- private void syncInvoiceId() throws Exception {
- Field transactionId = SUT.getClass().getDeclaredField("transactionId");
- transactionId.setAccessible(true);
- AtomicInteger correlationBuilder = (AtomicInteger) transactionId.get(SUT);
-
- Field invokeIdField = ModbusTcpPayload.class.getDeclaredField("transactionId");
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(invokeIdField, invokeIdField.getModifiers() & ~Modifier.FINAL);
- invokeIdField.setAccessible(true);
- invokeIdField.set(modbusTcpPayload, (short) (correlationBuilder.get() - 1));
- }
}
\ No newline at end of file