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 2021/10/06 09:53:53 UTC
[plc4x] branch feature/mspec-ng updated: - Fixed the last parts of
the refactoring regarding byteOrder
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/mspec-ng
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/mspec-ng by this push:
new a6a4591 - Fixed the last parts of the refactoring regarding byteOrder
a6a4591 is described below
commit a6a459146d26f139d62eb7a48cdfe6b3a5b14fce
Author: cdutz <ch...@c-ware.de>
AuthorDate: Wed Oct 6 11:53:44 2021 +0200
- Fixed the last parts of the refactoring regarding byteOrder
---
plc4go/internal/plc4go/ads/fieldtype_string.go | 17 ++
plc4go/internal/plc4go/modbus/fieldtype_string.go | 17 ++
plc4go/internal/plc4go/s7/fieldtype_string.go | 17 ++
.../plc4go/spi/testutils/DriverTestRunner.go | 18 +-
.../spi/testutils/ParserSerializerTestRunner.go | 12 +-
.../plc4go/spi/testutils/steptype_string.go | 17 ++
.../plc4go/spi/utils/ReadBufferByteBased.go | 8 +
.../plc4go/spi/utils/WriteBufferByteBased.go | 116 ++++++------
plc4go/pom.xml | 196 +++++++++++----------
.../org/apache/plc4x/java/df1/util/DF1Utils.java | 2 +-
10 files changed, 264 insertions(+), 156 deletions(-)
diff --git a/plc4go/internal/plc4go/ads/fieldtype_string.go b/plc4go/internal/plc4go/ads/fieldtype_string.go
index 6c2fa73..4b0da39 100644
--- a/plc4go/internal/plc4go/ads/fieldtype_string.go
+++ b/plc4go/internal/plc4go/ads/fieldtype_string.go
@@ -1,3 +1,20 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
// Code generated by "stringer -type FieldType"; DO NOT EDIT.
package ads
diff --git a/plc4go/internal/plc4go/modbus/fieldtype_string.go b/plc4go/internal/plc4go/modbus/fieldtype_string.go
index 4ef728b..ec3ec50 100644
--- a/plc4go/internal/plc4go/modbus/fieldtype_string.go
+++ b/plc4go/internal/plc4go/modbus/fieldtype_string.go
@@ -1,3 +1,20 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
// Code generated by "stringer -type FieldType"; DO NOT EDIT.
package modbus
diff --git a/plc4go/internal/plc4go/s7/fieldtype_string.go b/plc4go/internal/plc4go/s7/fieldtype_string.go
index 02ae83f..3045fc1 100644
--- a/plc4go/internal/plc4go/s7/fieldtype_string.go
+++ b/plc4go/internal/plc4go/s7/fieldtype_string.go
@@ -1,3 +1,20 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
// Code generated by "stringer -type FieldType"; DO NOT EDIT.
package s7
diff --git a/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go b/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go
index b8ca21b..db0f704 100644
--- a/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go
+++ b/plc4go/internal/plc4go/spi/testutils/DriverTestRunner.go
@@ -20,6 +20,7 @@
package testutils
import (
+ "encoding/binary"
"encoding/hex"
"fmt"
"github.com/apache/plc4x/plc4go/internal/plc4go/spi"
@@ -45,7 +46,7 @@ type DriverTestsuite struct {
outputFlavor string
driverName string
driverParameters map[string]string
- bigEndian bool
+ byteOrder binary.ByteOrder
parser XmlParser
rootTypeParser func(utils.ReadBufferByteBased) (interface{}, error)
setupSteps []TestStep
@@ -274,7 +275,7 @@ func (m DriverTestsuite) ExecuteStep(connection plc4go.PlcConnection, testcase *
return errors.Errorf("error converting type %t into Serializable type", expectedMessage)
}
var expectedWriteBuffer utils.WriteBufferByteBased
- if m.bigEndian {
+ if m.byteOrder == binary.BigEndian {
expectedWriteBuffer = utils.NewWriteBufferByteBased()
} else {
expectedWriteBuffer = utils.NewLittleEndianWriteBufferByteBased()
@@ -304,7 +305,7 @@ func (m DriverTestsuite) ExecuteStep(connection plc4go.PlcConnection, testcase *
}
var bufferFactory func([]byte) utils.ReadBufferByteBased
- if m.bigEndian {
+ if m.byteOrder == binary.BigEndian {
bufferFactory = utils.NewReadBufferByteBased
} else {
bufferFactory = utils.NewLittleEndianReadBufferByteBased
@@ -360,7 +361,7 @@ func (m DriverTestsuite) ExecuteStep(connection plc4go.PlcConnection, testcase *
return errors.New("error converting type into Serializable type")
}
var wb utils.WriteBufferByteBased
- if m.bigEndian {
+ if m.byteOrder == binary.BigEndian {
wb = utils.NewWriteBufferByteBased()
} else {
wb = utils.NewLittleEndianWriteBufferByteBased()
@@ -566,7 +567,12 @@ func ParseDriverTestsuite(node xmldom.Node, parser XmlParser, rootTypeParser fun
if node.Name != "driver-testsuite" {
return nil, errors.New("invalid document structure")
}
- bigEndian := node.GetAttributeValue("bigEndian") != "false"
+ var byteOrder binary.ByteOrder
+ if node.GetAttributeValue("byteOrder") != "LITTLE_ENDIAN" {
+ byteOrder = binary.BigEndian
+ } else {
+ byteOrder = binary.LittleEndian
+ }
var testsuiteName string
var protocolName string
var outputFlavor string
@@ -639,7 +645,7 @@ func ParseDriverTestsuite(node xmldom.Node, parser XmlParser, rootTypeParser fun
outputFlavor: outputFlavor,
driverName: driverName,
driverParameters: driverParameters,
- bigEndian: bigEndian,
+ byteOrder: byteOrder,
parser: parser,
rootTypeParser: rootTypeParser,
setupSteps: setupSteps,
diff --git a/plc4go/internal/plc4go/spi/testutils/ParserSerializerTestRunner.go b/plc4go/internal/plc4go/spi/testutils/ParserSerializerTestRunner.go
index 83c7253..d6101c5 100644
--- a/plc4go/internal/plc4go/spi/testutils/ParserSerializerTestRunner.go
+++ b/plc4go/internal/plc4go/spi/testutils/ParserSerializerTestRunner.go
@@ -20,6 +20,7 @@
package testutils
import (
+ "encoding/binary"
"encoding/hex"
"fmt"
abethModel "github.com/apache/plc4x/plc4go/internal/plc4go/abeth/readwrite"
@@ -71,7 +72,12 @@ func RunParserSerializerTestsuite(t *testing.T, testPath string, skippedTestCase
if node.Name != "testsuite" {
t.Error("Invalid document structure")
}
- littleEndian := node.GetAttributeValue("bigEndian") != "true"
+ var byteOrder binary.ByteOrder
+ if node.GetAttributeValue("byteOrder") != "LITTLE_ENDIAN" {
+ byteOrder = binary.BigEndian
+ } else {
+ byteOrder = binary.LittleEndian
+ }
var (
testsuiteName string
protocolName string
@@ -117,7 +123,7 @@ func RunParserSerializerTestsuite(t *testing.T, testPath string, skippedTestCase
return
}
var readBuffer utils.ReadBuffer
- if littleEndian {
+ if byteOrder == binary.LittleEndian {
readBuffer = utils.NewLittleEndianReadBufferByteBased(rawInput)
} else {
readBuffer = utils.NewReadBufferByteBased(rawInput)
@@ -202,7 +208,7 @@ func RunParserSerializerTestsuite(t *testing.T, testPath string, skippedTestCase
return
}
var writeBuffer utils.WriteBufferByteBased
- if littleEndian {
+ if byteOrder == binary.LittleEndian {
writeBuffer = utils.NewLittleEndianWriteBufferByteBased()
} else {
writeBuffer = utils.NewWriteBufferByteBased()
diff --git a/plc4go/internal/plc4go/spi/testutils/steptype_string.go b/plc4go/internal/plc4go/spi/testutils/steptype_string.go
index 8506728..c99ce3e 100644
--- a/plc4go/internal/plc4go/spi/testutils/steptype_string.go
+++ b/plc4go/internal/plc4go/spi/testutils/steptype_string.go
@@ -1,3 +1,20 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
// Code generated by "stringer -type StepType"; DO NOT EDIT.
package testutils
diff --git a/plc4go/internal/plc4go/spi/utils/ReadBufferByteBased.go b/plc4go/internal/plc4go/spi/utils/ReadBufferByteBased.go
index 78bd379..bc49c36 100644
--- a/plc4go/internal/plc4go/spi/utils/ReadBufferByteBased.go
+++ b/plc4go/internal/plc4go/spi/utils/ReadBufferByteBased.go
@@ -82,6 +82,14 @@ func (rb *byteReadBuffer) Reset() {
rb.reader = bitio.NewReader(bytes.NewBuffer(rb.data))
}
+func (rb *byteReadBuffer) SetByteOrder(byteOrder binary.ByteOrder) {
+ rb.byteOrder = byteOrder
+}
+
+func (rb *byteReadBuffer) GetByteOrder() binary.ByteOrder {
+ return rb.byteOrder
+}
+
func (rb *byteReadBuffer) GetPos() uint16 {
return uint16(rb.pos / 8)
}
diff --git a/plc4go/internal/plc4go/spi/utils/WriteBufferByteBased.go b/plc4go/internal/plc4go/spi/utils/WriteBufferByteBased.go
index 71b5d24..6dd1536 100644
--- a/plc4go/internal/plc4go/spi/utils/WriteBufferByteBased.go
+++ b/plc4go/internal/plc4go/spi/utils/WriteBufferByteBased.go
@@ -73,37 +73,45 @@ type byteWriteBuffer struct {
///////////////////////////////////////
///////////////////////////////////////
-func (rb *byteWriteBuffer) PushContext(_ string, _ ...WithWriterArgs) error {
+func (wb *byteWriteBuffer) PushContext(_ string, _ ...WithWriterArgs) error {
return nil
}
-func (rb *byteWriteBuffer) PopContext(_ string, _ ...WithWriterArgs) error {
+func (wb *byteWriteBuffer) PopContext(_ string, _ ...WithWriterArgs) error {
return nil
}
-func (rb *byteWriteBuffer) GetPos() uint16 {
+func (wb *byteWriteBuffer) SetByteOrder(byteOrder binary.ByteOrder) {
+ wb.byteOrder = byteOrder
+}
+
+func (wb *byteWriteBuffer) GetByteOrder() binary.ByteOrder {
+ return wb.byteOrder
+}
+
+func (wb *byteWriteBuffer) GetPos() uint16 {
return 0
}
-func (rb *byteWriteBuffer) GetBytes() []byte {
- return rb.data.Bytes()
+func (wb *byteWriteBuffer) GetBytes() []byte {
+ return wb.data.Bytes()
}
-func (rb *byteWriteBuffer) GetTotalBytes() uint64 {
- return uint64(rb.data.Len())
+func (wb *byteWriteBuffer) GetTotalBytes() uint64 {
+ return uint64(wb.data.Len())
}
-func (rb *byteWriteBuffer) WriteBit(_ string, value bool, _ ...WithWriterArgs) error {
- return rb.writer.WriteBool(value)
+func (wb *byteWriteBuffer) WriteBit(_ string, value bool, _ ...WithWriterArgs) error {
+ return wb.writer.WriteBool(value)
}
-func (rb *byteWriteBuffer) WriteByte(_ string, value byte, _ ...WithWriterArgs) error {
- return rb.writer.WriteBits(uint64(value), 8)
+func (wb *byteWriteBuffer) WriteByte(_ string, value byte, _ ...WithWriterArgs) error {
+ return wb.writer.WriteBits(uint64(value), 8)
}
-func (rb *byteWriteBuffer) WriteByteArray(_ string, data []byte, _ ...WithWriterArgs) error {
+func (wb *byteWriteBuffer) WriteByteArray(_ string, data []byte, _ ...WithWriterArgs) error {
for _, dataElement := range data {
- err := rb.writer.WriteBits(uint64(dataElement), 8)
+ err := wb.writer.WriteBits(uint64(dataElement), 8)
if err != nil {
return err
}
@@ -111,100 +119,100 @@ func (rb *byteWriteBuffer) WriteByteArray(_ string, data []byte, _ ...WithWriter
return nil
}
-func (rb *byteWriteBuffer) WriteUint8(_ string, bitLength uint8, value uint8, _ ...WithWriterArgs) error {
- return rb.writer.WriteBits(uint64(value), bitLength)
+func (wb *byteWriteBuffer) WriteUint8(_ string, bitLength uint8, value uint8, _ ...WithWriterArgs) error {
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteUint16(_ string, bitLength uint8, value uint16, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteUint16(_ string, bitLength uint8, value uint16, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
- return rb.writer.WriteBits(uint64(value), bitLength)
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteUint32(_ string, bitLength uint8, value uint32, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteUint32(_ string, bitLength uint8, value uint32, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
- return rb.writer.WriteBits(uint64(value), bitLength)
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteUint64(_ string, bitLength uint8, value uint64, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteUint64(_ string, bitLength uint8, value uint64, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
- return rb.writer.WriteBits(value, bitLength)
+ return wb.writer.WriteBits(value, bitLength)
}
-func (rb *byteWriteBuffer) WriteInt8(_ string, bitLength uint8, value int8, _ ...WithWriterArgs) error {
- return rb.writer.WriteBits(uint64(value), bitLength)
+func (wb *byteWriteBuffer) WriteInt8(_ string, bitLength uint8, value int8, _ ...WithWriterArgs) error {
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteInt16(_ string, bitLength uint8, value int16, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteInt16(_ string, bitLength uint8, value int16, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
- return rb.writer.WriteBits(uint64(value), bitLength)
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteInt32(_ string, bitLength uint8, value int32, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteInt32(_ string, bitLength uint8, value int32, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
- return rb.writer.WriteBits(uint64(value), bitLength)
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteInt64(_ string, bitLength uint8, value int64, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteInt64(_ string, bitLength uint8, value int64, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
- return rb.writer.WriteBits(uint64(value), bitLength)
+ return wb.writer.WriteBits(uint64(value), bitLength)
}
-func (rb *byteWriteBuffer) WriteBigInt(_ string, bitLength uint8, value *big.Int, _ ...WithWriterArgs) error {
+func (wb *byteWriteBuffer) WriteBigInt(_ string, bitLength uint8, value *big.Int, _ ...WithWriterArgs) error {
return errors.New("not implemented yet")
}
-func (rb *byteWriteBuffer) WriteFloat32(_ string, bitLength uint8, value float32, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteFloat32(_ string, bitLength uint8, value float32, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
res := math.Float32bits(value)
- return rb.writer.WriteBits(uint64(res), bitLength)
+ return wb.writer.WriteBits(uint64(res), bitLength)
}
-func (rb *byteWriteBuffer) WriteFloat64(_ string, bitLength uint8, value float64, _ ...WithWriterArgs) error {
- if rb.byteOrder == binary.LittleEndian {
+func (wb *byteWriteBuffer) WriteFloat64(_ string, bitLength uint8, value float64, _ ...WithWriterArgs) error {
+ if wb.byteOrder == binary.LittleEndian {
// TODO: indirection till we have a native LE implementation
// TODO: validate that this produces the desired result
- return binary.Write(rb.data, rb.byteOrder, value)
+ return binary.Write(wb.data, wb.byteOrder, value)
}
res := math.Float64bits(value)
- return rb.writer.WriteBits(res, bitLength)
+ return wb.writer.WriteBits(res, bitLength)
}
-func (rb *byteWriteBuffer) WriteBigFloat(_ string, bitLength uint8, value *big.Float, _ ...WithWriterArgs) error {
+func (wb *byteWriteBuffer) WriteBigFloat(_ string, bitLength uint8, value *big.Float, _ ...WithWriterArgs) error {
return errors.New("not implemented yet")
}
-func (rb *byteWriteBuffer) WriteString(_ string, bitLength uint8, encoding string, value string, _ ...WithWriterArgs) error {
+func (wb *byteWriteBuffer) WriteString(_ string, bitLength uint8, encoding string, value string, _ ...WithWriterArgs) error {
// TODO: the implementation completely ignores encoding for now. Fix this
for _, theByte := range []byte(value) {
- rb.writer.TryWriteByte(theByte)
+ wb.writer.TryWriteByte(theByte)
}
- return rb.writer.TryError
+ return wb.writer.TryError
}
diff --git a/plc4go/pom.xml b/plc4go/pom.xml
index 6858ca1..3c45a44 100644
--- a/plc4go/pom.xml
+++ b/plc4go/pom.xml
@@ -298,34 +298,35 @@
<version>2.3.9</version>
<extensions>true</extensions>
<executions>
- <execution>
- <id>default-fix</id>
- <phase>process-sources</phase>
- <goals>
- <goal>fix</goal>
- </goals>
- </execution>
+
+ <!-- Downloads the dependencies of the project -->
<execution>
<id>default-get</id>
- <phase>process-sources</phase>
+ <phase>initialize</phase>
<goals>
<goal>get</goal>
</goals>
</execution>
+
+ <!-- Make sure the "stringer" extension as well als the "licenser" is downloaded -->
<execution>
- <id>get-stringer</id>
+ <id>get-tools</id>
+ <phase>initialize</phase>
<goals>
<goal>get</goal>
</goals>
<configuration>
<packages>
<package>golang.org/x/tools/cmd/stringer</package>
+ <package>github.com/elastic/go-licenser</package>
</packages>
</configuration>
</execution>
+
+ <!-- Run the go code-generation -->
<execution>
<id>default-generate</id>
- <phase>process-sources</phase>
+ <phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
@@ -336,6 +337,91 @@
</packages>
</configuration>
</execution>
+
+ <!-- Add the apache license header to stuff generated by the stringer -->
+ <!--
+ NOTE: Don't try merging the following 4 executions ...
+ It doesn't work by merging the "packages" sections
+ -->
+ <execution>
+ <id>add-license</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>custom</goal>
+ </goals>
+ <configuration>
+ <exec>go-licenser</exec>
+ <customCommand>-licensor</customCommand>
+ <buildFlags>
+ <flag>Apache Software Foundation (ASF)</flag>
+ </buildFlags>
+ <packages>
+ <package>internal/plc4go/modbus/fieldtype_string.go</package>
+ </packages>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-license2</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>custom</goal>
+ </goals>
+ <configuration>
+ <exec>go-licenser</exec>
+ <customCommand>-licensor</customCommand>
+ <buildFlags>
+ <flag>Apache Software Foundation (ASF)</flag>
+ </buildFlags>
+ <packages>
+ <package>internal/plc4go/ads/fieldtype_string.go</package>
+ </packages>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-license3</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>custom</goal>
+ </goals>
+ <configuration>
+ <exec>go-licenser</exec>
+ <customCommand>-licensor</customCommand>
+ <buildFlags>
+ <flag>Apache Software Foundation (ASF)</flag>
+ </buildFlags>
+ <packages>
+ <package>internal/plc4go/s7/fieldtype_string.go</package>
+ </packages>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-license4</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>custom</goal>
+ </goals>
+ <configuration>
+ <exec>go-licenser</exec>
+ <customCommand>-licensor</customCommand>
+ <buildFlags>
+ <flag>Apache Software Foundation (ASF)</flag>
+ </buildFlags>
+ <packages>
+ <package>internal/plc4go/spi/testutils/steptype_string.go</package>
+ </packages>
+ </configuration>
+ </execution>
+
+ <!-- Processes code that uses old APIs and rewrites them use newer ones -->
+ <execution>
+ <id>default-fix</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>fix</goal>
+ </goals>
+ </execution>
+
+ <!-- Format the codebase correctly (this mainly has an effect on generated code) -->
<execution>
<id>default-fmt</id>
<phase>process-sources</phase>
@@ -352,8 +438,8 @@
<!-- Get all dependencies for test cases -->
<execution>
- <id>getTestDependencies</id>
- <phase>process-test-sources</phase>
+ <id>get-test-dependencies</id>
+ <phase>generate-test-sources</phase>
<goals>
<goal>get</goal>
</goals>
@@ -367,7 +453,7 @@
</configuration>
</execution>
- <!-- Get xunit generator -->
+ <!-- Make sure the xunit generator as well as gotestsum is installed -->
<execution>
<id>test-get</id>
<phase>process-test-resources</phase>
@@ -386,6 +472,7 @@
<execution>
<id>default-test</id>
<phase>test</phase>
+ <!-- TODO: Which goal?!? -->
<configuration>
<buildFlags>
<flag>-v</flag>
@@ -400,6 +487,8 @@
<execution>
<id>readable-test</id>
+ <!-- TODO: Possibly move to test or prepare-package -->
+ <phase>test</phase>
<goals>
<goal>custom</goal>
</goals>
@@ -447,85 +536,6 @@
<goal>vet</goal>
</goals>
</execution>
-
- <!-- Get licenser generator -->
- <execution>
- <id>get-licenser</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>get</goal>
- </goals>
- <configuration>
- <packages>
- <package>github.com/elastic/go-licenser</package>
- </packages>
- </configuration>
- </execution>
-
- <execution>
- <id>add-license</id>
- <goals>
- <goal>custom</goal>
- </goals>
- <configuration>
- <exec>go-licenser</exec>
- <customCommand>-licensor</customCommand>
- <buildFlags>
- <flag>Apache Software Foundation (ASF)</flag>
- </buildFlags>
- <packages>
- <package>internal/plc4go/modbus/fieldtype_string.go</package>
- </packages>
- </configuration>
- </execution>
- <execution>
- <id>add-license2</id>
- <goals>
- <goal>custom</goal>
- </goals>
- <configuration>
- <exec>go-licenser</exec>
- <customCommand>-licensor</customCommand>
- <buildFlags>
- <flag>Apache Software Foundation (ASF)</flag>
- </buildFlags>
- <packages>
- <package>internal/plc4go/ads/fieldtype_string.go</package>
- </packages>
- </configuration>
- </execution>
- <execution>
- <id>add-license3</id>
- <goals>
- <goal>custom</goal>
- </goals>
- <configuration>
- <exec>go-licenser</exec>
- <customCommand>-licensor</customCommand>
- <buildFlags>
- <flag>Apache Software Foundation (ASF)</flag>
- </buildFlags>
- <packages>
- <package>internal/plc4go/s7/fieldtype_string.go</package>
- </packages>
- </configuration>
- </execution>
- <execution>
- <id>add-license4</id>
- <goals>
- <goal>custom</goal>
- </goals>
- <configuration>
- <exec>go-licenser</exec>
- <customCommand>-licensor</customCommand>
- <buildFlags>
- <flag>Apache Software Foundation (ASF)</flag>
- </buildFlags>
- <packages>
- <package>internal/plc4go/spi/testutils/steptype_string.go</package>
- </packages>
- </configuration>
- </execution>
</executions>
<configuration>
<packages>
@@ -540,7 +550,9 @@
Create surefire folder for report
-->
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
+ <version>3.0.0</version>
<executions>
<execution>
<id>generate-sources</id>
diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java
index be116ab..b285d68 100644
--- a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java
+++ b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java
@@ -30,7 +30,7 @@ public class DF1Utils {
CRC crc = new CRC(new CRC.Parameters(16, 0x8005, 0x0000, true, true, 0x0000));
long df1crc = crc.init();
df1crc = crc.update(df1crc, new byte[]{(byte) destinationAddress, (byte) sourceAddress});
- WriteBufferByteBased writeBuffer = new WriteBufferByteBased(command.getLengthInBytes(), ByteOrder.LITTLE_ENDIAN);
+ WriteBufferByteBased writeBuffer = new WriteBufferByteBased(command.getLengthInBytes(), ByteOrder.BIG_ENDIAN);
try {
DF1CommandIO.staticSerialize(writeBuffer, command);
} catch (ParseException e) {