You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/01/04 08:59:44 UTC
[incubator-plc4x] branch refactoring/java_generify updated (d4fdb5b
-> 78780b9)
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a change to branch refactoring/java_generify
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git.
from d4fdb5b Java-Gernerify APIs
add bcd1cea missing break
add a79535d - Fixed a potential bug Justin found (We were incrementing the array one byte too much).
add ddd71cb - Added some initial content to the how to build plc4x section of the website.
add bbbbed4 - Increased the size of the video preview.
add 15baa1c Merge branch 'master' of https://gitbox.apache.org/repos/asf/incubator-plc4x
add 52c0c2d add some mocks (mostly auto generated)
add 9b5a254 add some more tests
add 29098a8 looks like size of header was off - can someone double check
add 2d1b219 stop RTE when passing empty or null messages
add ce7f0c8 stop RTE when passing empty or null messages
add 1e49bb5 stop RTE when passing empty or null messages
add 4c6f9bd - Added some comment to the getHeaderLenght method.
add 9942cc3 sonar project properties
add 70b1a8e add .scannerwork
add f49a686 ignore test and mock classes
add 0bc9f43 private final static is the preferred order
add 6b64873 fix version and add tests and coverage
add fe4b740 add api coverage
new 78780b9 Merge remote-tracking branch 'origin/master' into refactoring/java_generify
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.gitignore | 1 +
.../apache/plc4x/edgent/PlcConnectionAdapter.java | 2 +-
.../plc4x/java/isotp/netty/IsoTPProtocol.java | 25 +-
.../plc4x/java/s7/connection/S7PlcConnection.java | 2 +-
.../plc4x/java/s7/netty/Plc4XS7Protocol.java | 12 +-
.../org/apache/plc4x/java/s7/netty/S7Protocol.java | 2 +-
.../plc4x/java/isotp/netty/IsoTPProtocolTest.java | 362 ++++++++++++++++++++-
.../apache/plc4x/java/isotp/netty/MockChannel.java | 225 +++++++++++++
.../isotp/netty/MockChannelHandlerContext.java | 216 ++++++++++++
.../java/isotp/netty/MockChannelPipeline.java | 336 +++++++++++++++++++
.../apache/plc4x/java/s7/S7PlcReaderSample.java | 2 +-
.../org/apache/plc4x/java/s7/S7PlcScanner.java | 2 +-
.../org/apache/plc4x/java/s7/S7PlcTestConsole.java | 2 +-
.../apache/plc4x/java/s7/S7PlcWriterSample.java | 2 +-
sonar-project.properties | 29 ++
src/site/asciidoc/development/building.adoc | 82 +++++
16 files changed, 1286 insertions(+), 16 deletions(-)
create mode 100644 plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/MockChannel.java
create mode 100644 plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/MockChannelHandlerContext.java
create mode 100644 plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/MockChannelPipeline.java
create mode 100644 sonar-project.properties
--
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].
[incubator-plc4x] 01/01: Merge remote-tracking branch
'origin/master' into refactoring/java_generify
Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch refactoring/java_generify
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 78780b9237d845fe66735fd7dba2cf636b26400b
Merge: d4fdb5b fe4b740
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jan 4 09:59:17 2018 +0100
Merge remote-tracking branch 'origin/master' into refactoring/java_generify
# Conflicts:
# integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
# plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
.gitignore | 1 +
.../apache/plc4x/edgent/PlcConnectionAdapter.java | 2 +-
.../plc4x/java/isotp/netty/IsoTPProtocol.java | 25 +-
.../plc4x/java/s7/connection/S7PlcConnection.java | 2 +-
.../plc4x/java/s7/netty/Plc4XS7Protocol.java | 12 +-
.../org/apache/plc4x/java/s7/netty/S7Protocol.java | 2 +-
.../plc4x/java/isotp/netty/IsoTPProtocolTest.java | 362 ++++++++++++++++++++-
.../apache/plc4x/java/isotp/netty/MockChannel.java | 225 +++++++++++++
.../isotp/netty/MockChannelHandlerContext.java | 216 ++++++++++++
.../java/isotp/netty/MockChannelPipeline.java | 336 +++++++++++++++++++
.../apache/plc4x/java/s7/S7PlcReaderSample.java | 2 +-
.../org/apache/plc4x/java/s7/S7PlcScanner.java | 2 +-
.../org/apache/plc4x/java/s7/S7PlcTestConsole.java | 2 +-
.../apache/plc4x/java/s7/S7PlcWriterSample.java | 2 +-
sonar-project.properties | 29 ++
src/site/asciidoc/development/building.adoc | 82 +++++
16 files changed, 1286 insertions(+), 16 deletions(-)
diff --cc integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
index 1a91c26,2bff661..ab55af8
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
+++ b/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
@@@ -53,17 -53,17 +53,17 @@@ import java.util.Calendar
* support for multiple connections from a single client.
* <p>
* A single PlcConnectionAdapter can be used by multiple threads concurrently
- * (e.g., used by multiple PlcFunctions Consumers for {@code Topology.poll()} and/or
- * multiple Suppliers for {@code TStream.sink()}).
- *
+ * (e.g., used by multiple PlcFunctions Consumers for {@code Topology.poll()} and/or
+ * multiple Suppliers for {@code TStream.sink()}).
+ *
* @see PlcFunctions
*/
-public class PlcConnectionAdapter implements AutoCloseable{
+public class PlcConnectionAdapter implements AutoCloseable {
- private final static Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
- private static final Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
-
- private String plcConnectionUrl;
- private PlcConnection plcConnection;
++ private static final Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
+
+ private String plcConnectionUrl;
+ private PlcConnection plcConnection;
/*
* NOTES:
diff --cc plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
index 09eea8f,d234a46..ad46f53
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
@@@ -294,13 -293,13 +294,13 @@@ public class Plc4XS7Protocol extends Me
Class valueType = values[0].getClass();
if (valueType == Boolean.class) {
// TODO: Check if this is true and the result is not Math.ceil(values.lenght / 8)
- result = new byte[values.length * 1];
+ result = new byte[values.length];
- for(int i = 0; i < values.length; i++) {
+ for (int i = 0; i < values.length; i++) {
result[i] = (byte) (((Boolean) values[i]) ? 0x01 : 0x00);
}
} else if (valueType == Byte[].class) {
- result = new byte[values.length * 1];
+ result = new byte[values.length];
- for(int i = 0; i < values.length; i++) {
+ for (int i = 0; i < values.length; i++) {
result[i] = (byte) values[i];
}
} else if (valueType == Short.class) {
@@@ -355,22 -354,21 +355,22 @@@
return ResponseCode.INTERNAL_ERROR;
}
- private List<Object> decodeData(Class<?> datatype, byte[] s7Data) throws PlcProtocolException {
- if(s7Data.length == 0) {
+ @SuppressWarnings("unchecked")
- private <T> List<T> decodeData(Class<T> datatype, byte[] s7Data) {
++ private <T> List<T> decodeData(Class<T> datatype, byte[] s7Data) throws PlcProtocolException {
+ if (s7Data.length == 0) {
return null;
}
List<Object> result = new LinkedList<>();
- for (int i = 0; i < s7Data.length; i++) {
- for(int i = 0; i < s7Data.length;) {
++ for (int i = 0; i < s7Data.length;) {
if (datatype == Boolean.class) {
result.add((s7Data[i] & 0x01) == 0x01);
- i+=1;
+ i += 1;
} else if (datatype == Byte.class) {
result.add(s7Data[i]);
- i+=1;
+ i += 1;
} else if (datatype == Short.class) {
- result.add((short) (((s7Data[i] & 0xff) << 8) | (s7Data[i+1] & 0xff)));
- i+=2;
+ result.add((short) (((s7Data[i] & 0xff) << 8) | (s7Data[i + 1] & 0xff)));
+ i += 2;
} else if (datatype == Integer.class) {
result.add((((s7Data[i] & 0xff) << 24) | ((s7Data[i + 1] & 0xff) << 16) |
((s7Data[i + 2] & 0xff) << 8) | (s7Data[i + 3] & 0xff)));
@@@ -382,10 -380,12 +382,12 @@@
int intValue = (((s7Data[i] & 0xff) << 24) | ((s7Data[i + 1] & 0xff) << 16) |
((s7Data[i + 2] & 0xff) << 8) | (s7Data[i + 3] & 0xff));
result.add(Float.intBitsToFloat(intValue));
- i+=4;
+ i += 4;
+ } else {
+ throw new PlcProtocolException("Unsupported datatype " + datatype.getSimpleName());
}
}
- return result;
+ return (List<T>) result;
}
}
--
To stop receiving notification emails like this one, please contact
"commits@plc4x.apache.org" <co...@plc4x.apache.org>.