[plc4x] 01/02: plc4go: fixed ascii box alignment issues

2021-04-17 Thread sruehl
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 15bc36516060df3f9656b694817999b004af3edf
Author: Sebastian Rühl 
AuthorDate: Sat Apr 17 22:31:57 2021 +0200

plc4go: fixed ascii box alignment issues
---
 plc4go/internal/plc4go/spi/utils/asciiBox.go  | 24 +--
 plc4go/internal/plc4go/spi/utils/asciiBox_test.go | 78 +++
 2 files changed, 98 insertions(+), 4 deletions(-)

diff --git a/plc4go/internal/plc4go/spi/utils/asciiBox.go 
b/plc4go/internal/plc4go/spi/utils/asciiBox.go
index 0e2cda4..1c163eb 100644
--- a/plc4go/internal/plc4go/spi/utils/asciiBox.go
+++ b/plc4go/internal/plc4go/spi/utils/asciiBox.go
@@ -133,23 +133,39 @@ func BoxString(name string, data string, charWidth int) 
AsciiBox {
return AsciiBox(boxedString)
 }
 
-func AlignBoxes(boxes []AsciiBox, desiredWith int) AsciiBox {
+func AlignBoxes(boxes []AsciiBox, desiredWidth int) AsciiBox {
+   if len(boxes) == 0 {
+   return boxes[0]
+   }
+   actualWidth := desiredWidth
+   for _, box := range boxes {
+   boxWidth := box.Width()
+   if boxWidth > desiredWidth {
+   if DebugAsciiBox {
+   log.Debug().Msgf("Overflow by %d chars", 
boxWidth-desiredWidth)
+   }
+   actualWidth = boxWidth
+   }
+   }
+   if DebugAsciiBox {
+   log.Debug().Msgf("Working with %d chars", actualWidth)
+   }
bigBox := AsciiBox("")
currentBoxRow := make([]AsciiBox, 0)
currentRowLength := 0
for _, box := range boxes {
currentRowLength += box.Width()
-   currentBoxRow = append(currentBoxRow, box)
-   if currentRowLength >= desiredWith {
+   if currentRowLength > actualWidth {
mergedBoxes := mergeHorizontal(currentBoxRow)
if bigBox == "" {
bigBox = mergedBoxes
} else {
bigBox = BoxBelowBox(bigBox, mergedBoxes)
}
-   currentRowLength = 0
+   currentRowLength = box.Width()
currentBoxRow = make([]AsciiBox, 0)
}
+   currentBoxRow = append(currentBoxRow, box)
}
if len(currentBoxRow) > 0 {
// Special case where all boxes fit into one row
diff --git a/plc4go/internal/plc4go/spi/utils/asciiBox_test.go 
b/plc4go/internal/plc4go/spi/utils/asciiBox_test.go
index 5b8788f..68a5857 100644
--- a/plc4go/internal/plc4go/spi/utils/asciiBox_test.go
+++ b/plc4go/internal/plc4go/spi/utils/asciiBox_test.go
@@ -24,6 +24,10 @@ import (
"testing"
 )
 
+func init() {
+   DebugAsciiBox = true
+}
+
 func TestBoxAnything(t *testing.T) {
type args struct {
name  string
@@ -470,6 +474,80 @@ func TestAlignBoxes(t *testing.T) {
desiredWith: 65,
},
want: `
+╔═sampleField╗╔═sampleField╗
+║  123123123123  ║║  123123123123  ║
+║123123ABABABABABAB123123║║123123123123123123123123║
+╚╝╚╝
+╔═sampleField╗╔═sampleField╗
+║  123123123123  ║║  123123123123  ║
+║123123ABABABABABAB123123║║123123123123123123123123║
+╚╝╚╝
+╔═sampleField╗╔═sampleField╗
+║  123123123123  ║║  123123123123  ║
+║123123ABABABABABAB123123║║123123123123123123123123║
+╚╝╚╝
+╔═sampleField╗╔═sampleField╗
+║  123123123123  ║║  123123123123  ║
+║123123ABABABABABAB123123║║123123123123123123123123║
+╚╝╚╝
+`,
+   },
+   {
+   name: "not enough space should result in multiple rows 
(3 columns)",
+   args: args{
+   boxes: []AsciiBox{
+   `
+╔═sampleField╗
+║  123123123123  ║
+║123123ABABABABABAB123123║
+╚╝
+`,
+   `
+╔═sampleField╗
+║  123123123123  ║
+║123123123123123123123123║
+╚╝
+`,
+   `
+╔═sampleField╗
+║  123123123123  ║
+║123123ABABABABABAB123123║
+╚╝
+`,
+   `
+╔═sampleField╗
+║  123123123123  ║
+║123123123123123123123123║
+╚╝
+`,
+   `

[plc4x] branch develop updated (152caa3 -> aa6f514)

2021-04-17 Thread sruehl
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git.


from 152caa3  plc4go: optimized hex output
 new 15bc365  plc4go: fixed ascii box alignment issues
 new aa6f514  plc4go: improved rendering of discriminated models

The 2 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:
 .../resources/templates/go/model-template.go.ftlh  | 17 ++---
 go.mod |  2 +-
 go.sum |  4 ++
 .../model/AdsAddDeviceNotificationRequest.go   | 11 +--
 .../model/AdsAddDeviceNotificationResponse.go  | 11 +--
 .../internal/plc4go/ads/readwrite/model/AdsData.go | 13 ++--
 .../model/AdsDeleteDeviceNotificationRequest.go| 11 +--
 .../model/AdsDeleteDeviceNotificationResponse.go   | 11 +--
 .../model/AdsDeviceNotificationRequest.go  | 11 +--
 .../model/AdsDeviceNotificationResponse.go | 11 +--
 .../ads/readwrite/model/AdsInvalidRequest.go   | 11 +--
 .../ads/readwrite/model/AdsInvalidResponse.go  | 11 +--
 .../ads/readwrite/model/AdsMultiRequestItem.go | 13 ++--
 .../ads/readwrite/model/AdsMultiRequestItemRead.go | 11 +--
 .../model/AdsMultiRequestItemReadWrite.go  | 11 +--
 .../readwrite/model/AdsMultiRequestItemWrite.go| 11 +--
 .../ads/readwrite/model/AdsNotificationSample.go   |  9 +--
 .../readwrite/model/AdsReadDeviceInfoRequest.go| 11 +--
 .../readwrite/model/AdsReadDeviceInfoResponse.go   | 11 +--
 .../plc4go/ads/readwrite/model/AdsReadRequest.go   | 11 +--
 .../plc4go/ads/readwrite/model/AdsReadResponse.go  | 11 +--
 .../ads/readwrite/model/AdsReadStateRequest.go | 11 +--
 .../ads/readwrite/model/AdsReadStateResponse.go| 11 +--
 .../ads/readwrite/model/AdsReadWriteRequest.go | 11 +--
 .../ads/readwrite/model/AdsReadWriteResponse.go| 11 +--
 .../plc4go/ads/readwrite/model/AdsStampHeader.go   |  9 +--
 .../ads/readwrite/model/AdsWriteControlRequest.go  | 11 +--
 .../ads/readwrite/model/AdsWriteControlResponse.go | 11 +--
 .../plc4go/ads/readwrite/model/AdsWriteRequest.go  | 11 +--
 .../plc4go/ads/readwrite/model/AdsWriteResponse.go | 11 +--
 .../plc4go/ads/readwrite/model/AmsNetId.go |  9 +--
 .../plc4go/ads/readwrite/model/AmsPacket.go|  9 +--
 .../readwrite/model/AmsSerialAcknowledgeFrame.go   |  9 +--
 .../plc4go/ads/readwrite/model/AmsSerialFrame.go   |  9 +--
 .../ads/readwrite/model/AmsSerialResetFrame.go |  9 +--
 .../plc4go/ads/readwrite/model/AmsTCPPacket.go |  9 +--
 .../internal/plc4go/ads/readwrite/model/State.go   |  9 +--
 .../plc4go/bacnetip/readwrite/model/APDU.go| 13 ++--
 .../plc4go/bacnetip/readwrite/model/APDUAbort.go   | 11 +--
 .../bacnetip/readwrite/model/APDUComplexAck.go | 11 +--
 .../readwrite/model/APDUConfirmedRequest.go| 11 +--
 .../plc4go/bacnetip/readwrite/model/APDUError.go   | 11 +--
 .../plc4go/bacnetip/readwrite/model/APDUReject.go  | 11 +--
 .../bacnetip/readwrite/model/APDUSegmentAck.go | 11 +--
 .../bacnetip/readwrite/model/APDUSimpleAck.go  | 11 +--
 .../readwrite/model/APDUUnconfirmedRequest.go  | 11 +--
 .../bacnetip/readwrite/model/BACnetAddress.go  |  9 +--
 .../readwrite/model/BACnetConfirmedServiceACK.go   | 13 ++--
 .../BACnetConfirmedServiceACKAtomicReadFile.go | 11 +--
 .../BACnetConfirmedServiceACKAtomicWriteFile.go| 11 +--
 ...tConfirmedServiceACKConfirmedPrivateTransfer.go | 11 +--
 .../model/BACnetConfirmedServiceACKCreateObject.go | 11 +--
 .../BACnetConfirmedServiceACKGetAlarmSummary.go| 11 +--
 ...ACnetConfirmedServiceACKGetEnrollmentSummary.go | 11 +--
 ...BACnetConfirmedServiceACKGetEventInformation.go | 11 +--
 .../model/BACnetConfirmedServiceACKReadProperty.go | 11 +--
 ...ACnetConfirmedServiceACKReadPropertyMultiple.go | 11 +--
 .../model/BACnetConfirmedServiceACKReadRange.go| 11 +--
 ...BACnetConfirmedServiceACKRemovedAuthenticate.go | 11 +--
 ...rmedServiceACKRemovedReadPropertyConditional.go | 11 +--
 .../model/BACnetConfirmedServiceACKVTData.go   | 11 +--
 .../model/BACnetConfirmedServiceACKVTOpen.go   | 11 +--
 .../model/BACnetConfirmedServiceRequest.go | 13 ++--
 ...ACnetConfirmedServiceRequestAcknowledgeAlarm.go | 11 +--
 .../BACnetConfirmedServiceRequestAddListElement.go | 11 +--
 .../BACnetConfirmedServiceRequestAtomicReadFile.go | 11 +--
 ...BACnetConfirmedServiceRequestAtomicWriteFile.go | 11 +--
 ...firmedServiceRequestConfirmedCOVNotification.go | 11 +--
 ...rviceRequestConfirmedCOVNotificationMultiple.go | 11 +--
 ...rmedServiceRequestConfirmedEventNotification.go | 11 +--
 ...firmedServiceRequestConfirmedPrivateTransfer.go | 11 +--
 ...tConfirmedServiceRequestConfirmedTextMessage.go | 11 +--
 

[plc4x] branch develop updated: plc4go: optimized hex output

2021-04-17 Thread sruehl
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
 new 152caa3  plc4go: optimized hex output
152caa3 is described below

commit 152caa3a9f5095338c9f82db6acc62ad929e4349
Author: Sebastian Rühl 
AuthorDate: Sat Apr 17 21:22:03 2021 +0200

plc4go: optimized hex output

+ use | to divide index from data
+ reduced size required for bytes from 4 to 3
---
 plc4go/internal/plc4go/s7/s7Io_test.go   |   6 +-
 plc4go/internal/plc4go/spi/utils/hex.go  |  19 +-
 plc4go/internal/plc4go/spi/utils/hex_test.go | 312 +--
 3 files changed, 170 insertions(+), 167 deletions(-)

diff --git a/plc4go/internal/plc4go/s7/s7Io_test.go 
b/plc4go/internal/plc4go/s7/s7Io_test.go
index 515ef0c..ecd1d68 100644
--- a/plc4go/internal/plc4go/s7/s7Io_test.go
+++ b/plc4go/internal/plc4go/s7/s7Io_test.go
@@ -89,9 +89,9 @@ func TestS7MessageBytes(t *testing.T) {
 
╚═══╝
 `,
wantDump: `
-00 03  00  00  1d  05  f0  0d  c0  01  0c  '..'
-10 32  03  00  00  00  0b  00  02  00  05  '2.'
-20 00  00  04  04  ff  03  00  01  01  '. '
+00|03 00 00 1d 05 f0 0d c0 01 0c '..'
+10|32 03 00 00 00 0b 00 02 00 05 '2.'
+20|00 00 04 04 ff 03 00 01 01'. '
 `,
},
}
diff --git a/plc4go/internal/plc4go/spi/utils/hex.go 
b/plc4go/internal/plc4go/spi/utils/hex.go
index 80e9a81..592ac17 100644
--- a/plc4go/internal/plc4go/spi/utils/hex.go
+++ b/plc4go/internal/plc4go/spi/utils/hex.go
@@ -30,17 +30,20 @@ import (
 )
 
 // DefaultWidth defaults to a default screen dumps size
-const DefaultWidth = 56 // 10 bytes per line on a []byte < 999
+const DefaultWidth = 46 // 10 bytes per line on a []byte < 999
 
 // boxLineOverheat Overheat per line when drawing boxes
 const boxLineOverheat = 1 + 1
 
-// byteWidth required size of runes required to print one bytes 2 hex digits + 
2 blanks
-const byteWidth = 2 + 2
-
-// blank size of blank
+// blankWidth blank size of blank
 const blankWidth = 1
 
+// byteWidth required size of runes required to print one bytes 2 hex digits + 
1 blanks
+const byteWidth = 2 + 1
+
+// pipeWidth size of the pipe char
+const pipeWidth = 1
+
 // DebugHex set to true to get debug messages
 var DebugHex bool
 
@@ -82,12 +85,12 @@ func DumpFixedWidth(data []byte, desiredCharWidth int) 
string {
maxBytesPerRow, indexWidth := 
calculateBytesPerRowAndIndexWidth(len(data), desiredCharWidth)
 
for byteIndex, rowIndex := 0, 0; byteIndex < len(data); byteIndex, 
rowIndex = byteIndex+maxBytesPerRow, rowIndex+1 {
-   indexString := fmt.Sprintf("%0*d ", indexWidth, byteIndex)
+   indexString := fmt.Sprintf("%0*d|", indexWidth, byteIndex)
hexString += indexString
for columnIndex := 0; columnIndex < maxBytesPerRow; 
columnIndex++ {
absoluteIndex := byteIndex + columnIndex
if absoluteIndex < len(data) {
-   hexString += fmt.Sprintf("%02x  ", 
data[absoluteIndex])
+   hexString += fmt.Sprintf("%02x ", 
data[absoluteIndex])
} else {
// align with empty byte representation
hexString += strings.Repeat(" ", byteWidth)
@@ -112,7 +115,7 @@ func calculateBytesPerRowAndIndexWidth(numberOfBytes, 
desiredStringWidth int) (i
log.Debug().Msgf("Calculating max row and index for %d number 
of bytes and a desired string width of %d", numberOfBytes, desiredStringWidth)
}
indexDigits := int(math.Log10(float64(numberOfBytes))) + 1
-   requiredIndexWidth := indexDigits + blankWidth
+   requiredIndexWidth := indexDigits + pipeWidth
if DebugHex {
log.Debug().Msgf("index width %d for indexDigits %d for bytes 
%d", requiredIndexWidth, indexDigits, numberOfBytes)
}
diff --git a/plc4go/internal/plc4go/spi/utils/hex_test.go 
b/plc4go/internal/plc4go/spi/utils/hex_test.go
index e8f5cf2..a00f694 100644
--- a/plc4go/internal/plc4go/spi/utils/hex_test.go
+++ b/plc4go/internal/plc4go/spi/utils/hex_test.go
@@ -44,10 +44,10 @@ func TestDump(t *testing.T) {
data: 
[]byte("1234567890abcdefghijklmnopqrstuvwxyz"),
},
want: `
-00 31  32  33  34  35  36  37  38  39  30  '1234567890'
-10 61  62  63  64  65  66  67  68  69  6a  'abcdefghij'
-20 6b  6c  6d  6e  6f  70  71  72  73  74  'klmnopqrst'
-30 75  76  77  78  79  7a  'uvwxyz'
+00|31 32 33 34 35 36 37 38 39 30 '1234567890'
+10|61 62 63 64 65 66 

[plc4x] branch develop updated (0bd4116 -> e414452)

2021-04-17 Thread sruehl
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git.


from 0bd4116  Fix: replaced the xslt processor with the latest saxon-he 
version
 new 6ba5bbe  plc4go: fixed issues in length calculation in hex
 new e414452  plc4go: fixed AsciiBoxer rendering discriminated types wrong

The 2 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:
 .../resources/templates/go/model-template.go.ftlh  |  25 +-
 go.mod |   2 +-
 go.sum |   2 +
 .../model/AdsAddDeviceNotificationRequest.go   |  19 +-
 .../model/AdsAddDeviceNotificationResponse.go  |  11 +-
 .../internal/plc4go/ads/readwrite/model/AdsData.go |   9 +-
 .../model/AdsDeleteDeviceNotificationRequest.go|   9 +-
 .../model/AdsDeleteDeviceNotificationResponse.go   |   9 +-
 .../model/AdsDeviceNotificationRequest.go  |  13 +-
 .../model/AdsDeviceNotificationResponse.go |   7 +-
 .../ads/readwrite/model/AdsInvalidRequest.go   |   7 +-
 .../ads/readwrite/model/AdsInvalidResponse.go  |   7 +-
 .../ads/readwrite/model/AdsMultiRequestItem.go |   9 +-
 .../ads/readwrite/model/AdsMultiRequestItemRead.go |  13 +-
 .../model/AdsMultiRequestItemReadWrite.go  |  15 +-
 .../readwrite/model/AdsMultiRequestItemWrite.go|  13 +-
 .../readwrite/model/AdsReadDeviceInfoRequest.go|   7 +-
 .../readwrite/model/AdsReadDeviceInfoResponse.go   |  17 +-
 .../plc4go/ads/readwrite/model/AdsReadRequest.go   |  13 +-
 .../plc4go/ads/readwrite/model/AdsReadResponse.go  |  11 +-
 .../ads/readwrite/model/AdsReadStateRequest.go |   7 +-
 .../ads/readwrite/model/AdsReadStateResponse.go|  13 +-
 .../ads/readwrite/model/AdsReadWriteRequest.go |  17 +-
 .../ads/readwrite/model/AdsReadWriteResponse.go|  11 +-
 .../ads/readwrite/model/AdsWriteControlRequest.go  |  13 +-
 .../ads/readwrite/model/AdsWriteControlResponse.go |   9 +-
 .../plc4go/ads/readwrite/model/AdsWriteRequest.go  |  13 +-
 .../plc4go/ads/readwrite/model/AdsWriteResponse.go |   9 +-
 .../plc4go/bacnetip/readwrite/model/APDU.go|   9 +-
 .../plc4go/bacnetip/readwrite/model/APDUAbort.go   |  13 +-
 .../bacnetip/readwrite/model/APDUComplexAck.go |  19 +-
 .../readwrite/model/APDUConfirmedRequest.go|  25 +-
 .../plc4go/bacnetip/readwrite/model/APDUError.go   |  11 +-
 .../plc4go/bacnetip/readwrite/model/APDUReject.go  |  11 +-
 .../bacnetip/readwrite/model/APDUSegmentAck.go |  17 +-
 .../bacnetip/readwrite/model/APDUSimpleAck.go  |  11 +-
 .../readwrite/model/APDUUnconfirmedRequest.go  |   9 +-
 .../readwrite/model/BACnetConfirmedServiceACK.go   |   9 +-
 .../BACnetConfirmedServiceACKAtomicReadFile.go |   7 +-
 .../BACnetConfirmedServiceACKAtomicWriteFile.go|   7 +-
 ...tConfirmedServiceACKConfirmedPrivateTransfer.go |   7 +-
 .../model/BACnetConfirmedServiceACKCreateObject.go |   7 +-
 .../BACnetConfirmedServiceACKGetAlarmSummary.go|   7 +-
 ...ACnetConfirmedServiceACKGetEnrollmentSummary.go |   7 +-
 ...BACnetConfirmedServiceACKGetEventInformation.go |   7 +-
 .../model/BACnetConfirmedServiceACKReadProperty.go |   7 +-
 ...ACnetConfirmedServiceACKReadPropertyMultiple.go |   7 +-
 .../model/BACnetConfirmedServiceACKReadRange.go|   7 +-
 ...BACnetConfirmedServiceACKRemovedAuthenticate.go |   7 +-
 ...rmedServiceACKRemovedReadPropertyConditional.go |   7 +-
 .../model/BACnetConfirmedServiceACKVTData.go   |   7 +-
 .../model/BACnetConfirmedServiceACKVTOpen.go   |   7 +-
 .../model/BACnetConfirmedServiceRequest.go |   9 +-
 ...ACnetConfirmedServiceRequestAcknowledgeAlarm.go |   7 +-
 .../BACnetConfirmedServiceRequestAddListElement.go |   7 +-
 .../BACnetConfirmedServiceRequestAtomicReadFile.go |   7 +-
 ...BACnetConfirmedServiceRequestAtomicWriteFile.go |   7 +-
 ...firmedServiceRequestConfirmedCOVNotification.go |  23 +-
 ...rviceRequestConfirmedCOVNotificationMultiple.go |   7 +-
 ...rmedServiceRequestConfirmedEventNotification.go |   7 +-
 ...firmedServiceRequestConfirmedPrivateTransfer.go |   7 +-
 ...tConfirmedServiceRequestConfirmedTextMessage.go |   7 +-
 .../BACnetConfirmedServiceRequestCreateObject.go   |   7 +-
 .../BACnetConfirmedServiceRequestDeleteObject.go   |   7 +-
 ...rmedServiceRequestDeviceCommunicationControl.go |   7 +-
 ...tConfirmedServiceRequestGetEnrollmentSummary.go |   7 +-
 ...etConfirmedServiceRequestGetEventInformation.go |   7 +-
 ...etConfirmedServiceRequestLifeSafetyOperation.go |   7 +-
 .../BACnetConfirmedServiceRequestReadProperty.go   |  15 +-
 ...tConfirmedServiceRequestReadPropertyMultiple.go |   7 +-
 .../BACnetConfirmedServiceRequestReadRange.go  |   7 +-
 

[plc4x] 01/02: plc4go: fixed issues in length calculation in hex

2021-04-17 Thread sruehl
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 6ba5bbe7f6c407ec66a296431952764f4ba658f1
Author: Sebastian Rühl 
AuthorDate: Sat Apr 17 15:56:18 2021 +0200

plc4go: fixed issues in length calculation in hex

+ calculated DefaultWidth so that it can contain 10 bytes per line in most 
cases
+ removed panic from undumpable items
+ fixed issues with sizes too small
+ moved size calculation to separate function
---
 plc4go/internal/plc4go/spi/utils/asciiBox.go  |  12 +-
 plc4go/internal/plc4go/spi/utils/asciiBox_test.go | 362 ++--
 plc4go/internal/plc4go/spi/utils/hex.go   |  93 ++--
 plc4go/internal/plc4go/spi/utils/hex_test.go  | 503 --
 4 files changed, 792 insertions(+), 178 deletions(-)

diff --git a/plc4go/internal/plc4go/spi/utils/asciiBox.go 
b/plc4go/internal/plc4go/spi/utils/asciiBox.go
index 9969686..0e2cda4 100644
--- a/plc4go/internal/plc4go/spi/utils/asciiBox.go
+++ b/plc4go/internal/plc4go/spi/utils/asciiBox.go
@@ -27,8 +27,12 @@ import (
"strings"
 )
 
+// AsciiBox is a string surrounded by a ascii border (and a optional name)
 type AsciiBox string
 
+// DebugAsciiBox set to true to get debug messages
+var DebugAsciiBox bool
+
 // Width returns the width of the box without the newlines
 func (m AsciiBox) Width() int {
maxWidth := 0
@@ -41,7 +45,7 @@ func (m AsciiBox) Width() int {
return maxWidth
 }
 
-// Boxer is used to render something in a box
+// AsciiBoxer is used to render something in a box
 type AsciiBoxer interface {
// Box where int param is the proposed width
Box(string, int) AsciiBox
@@ -96,7 +100,7 @@ func BoxAnything(name string, anything interface{}, 
charWidth int) AsciiBox {
}
 }
 
-// BoxString boxes a box
+// BoxBox boxes a box
 func BoxBox(name string, box AsciiBox, charWidth int) AsciiBox {
return BoxString(name, string(box), charWidth)
 }
@@ -105,7 +109,9 @@ func BoxBox(name string, box AsciiBox, charWidth int) 
AsciiBox {
 func BoxString(name string, data string, charWidth int) AsciiBox {
longestLine := AsciiBox(data).Width()
if charWidth < longestLine {
-   log.Debug().Msgf("Overflow by %d chars", longestLine-charWidth)
+   if DebugAsciiBox {
+   log.Debug().Msgf("Overflow by %d chars", 
longestLine-charWidth)
+   }
charWidth = longestLine + 2
}
boxedString := ""
diff --git a/plc4go/internal/plc4go/spi/utils/asciiBox_test.go 
b/plc4go/internal/plc4go/spi/utils/asciiBox_test.go
index b746ace..5b8788f 100644
--- a/plc4go/internal/plc4go/spi/utils/asciiBox_test.go
+++ b/plc4go/internal/plc4go/spi/utils/asciiBox_test.go
@@ -19,7 +19,10 @@
 
 package utils
 
-import "testing"
+import (
+   "strings"
+   "testing"
+)
 
 func TestBoxAnything(t *testing.T) {
type args struct {
@@ -39,9 +42,11 @@ func TestBoxAnything(t *testing.T) {
anything:  true,
charWidth: 0,
},
-   want: `╔═exampleBool╗
+   want: `
+╔═exampleBool╗
 ║true║
-╚╝`,
+╚╝
+`,
},
{
name: "test int",
@@ -50,9 +55,11 @@ func TestBoxAnything(t *testing.T) {
anything:  1,
charWidth: 0,
},
-   want: `╔═exampleInt╗
+   want: `
+╔═exampleInt╗
 ║ 1 ║
-╚═══╝`,
+╚═══╝
+`,
},
{
name: "test int 123123123",
@@ -61,13 +68,16 @@ func TestBoxAnything(t *testing.T) {
anything:  123123123,
charWidth: 0,
},
-   want: `╔═exampleInt╗
+   want: `
+╔═exampleInt╗
 ║ 123123123 ║
-╚═══╝`,
+╚═══╝
+`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
+   tt.want = trimBox(tt.want)
if got := BoxAnything(tt.args.name, tt.args.anything, 
tt.args.charWidth); got != tt.want {
t.Errorf("BoxAnything() = '\n%v\n', want 
'\n%v\n'", got, tt.want)
}
@@ -88,12 +98,15 @@ func TestBoxSideBySide(t *testing.T) {
{
name: "Test2Boxes",
args: args{
-   box1: `000 0x: 31  32  33  34  35  36  37  38  
'12345678'
+   box1: `
+000 0x: 31  32  33  34  35  36  37  38  '12345678'
 008 0x: 39  30  61  62  63  64  65  66  '90abcdef'
 016 0x: 67  68  69  6a  6b  

[plc4x] branch develop updated: Fix: replaced the xslt processor with the latest saxon-he version

2021-04-17 Thread hutcheb
This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
 new 0bd4116  Fix: replaced the xslt processor with the latest saxon-he 
version
0bd4116 is described below

commit 0bd41161ceca3685de7a214c265e356dbc562a77
Author: hutcheb 
AuthorDate: Sat Apr 17 07:03:13 2021 -0400

Fix: replaced the xslt processor with the latest saxon-he version
---
 .../knxnetip/readwrite/model/KnxManufacturer.go| 26 +-
 protocols/knxnetip/pom.xml |  6 ++---
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/plc4go/internal/plc4go/knxnetip/readwrite/model/KnxManufacturer.go 
b/plc4go/internal/plc4go/knxnetip/readwrite/model/KnxManufacturer.go
index ef25167..ccdda37 100644
--- a/plc4go/internal/plc4go/knxnetip/readwrite/model/KnxManufacturer.go
+++ b/plc4go/internal/plc4go/knxnetip/readwrite/model/KnxManufacturer.go
@@ -585,8 +585,9 @@ const (
KnxManufacturer_M_IRIS_CERAMICA_GROUP
KnxManufacturer = 544
KnxManufacturer_M_WIREEO 
KnxManufacturer = 545
KnxManufacturer_M_NVCLIGHTING
KnxManufacturer = 546
-   KnxManufacturer_M_ABB___RESERVED 
KnxManufacturer = 547
-   KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED
KnxManufacturer = 548
+   KnxManufacturer_M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_ 
KnxManufacturer = 547
+   KnxManufacturer_M_ABB___RESERVED 
KnxManufacturer = 548
+   KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED
KnxManufacturer = 549
 )
 
 var KnxManufacturerValues []KnxManufacturer
@@ -1140,6 +1141,7 @@ func init() {
KnxManufacturer_M_IRIS_CERAMICA_GROUP,
KnxManufacturer_M_WIREEO,
KnxManufacturer_M_NVCLIGHTING,
+   
KnxManufacturer_M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_,
KnxManufacturer_M_ABB___RESERVED,
KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED,
}
@@ -3141,10 +3143,14 @@ func (e KnxManufacturer) Number() uint16 {
}
case 547:
{ /* '547' */
-   return 43954
+   return 604
}
case 548:
{ /* '548' */
+   return 43954
+   }
+   case 549:
+   { /* '549' */
return 43959
}
case 55:
@@ -5346,10 +5352,14 @@ func (e KnxManufacturer) Name() string {
}
case 547:
{ /* '547' */
-   return "ABB - reserved"
+   return "Jinan Tian Da Sheng Information Technology Co."
}
case 548:
{ /* '548' */
+   return "ABB - reserved"
+   }
+   case 549:
+   { /* '549' */
return "Busch-Jaeger Elektro - reserved"
}
case 55:
@@ -6553,8 +6563,10 @@ func KnxManufacturerByValue(value uint16) 
KnxManufacturer {
case 546:
return KnxManufacturer_M_NVCLIGHTING
case 547:
-   return KnxManufacturer_M_ABB___RESERVED
+   return 
KnxManufacturer_M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_
case 548:
+   return KnxManufacturer_M_ABB___RESERVED
+   case 549:
return KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED
case 55:
return KnxManufacturer_M_WINDOWMASTER_AS
@@ -7656,6 +7668,8 @@ func KnxManufacturerByName(value string) KnxManufacturer {
return KnxManufacturer_M_WIREEO
case "M_NVCLIGHTING":
return KnxManufacturer_M_NVCLIGHTING
+   case "M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_":
+   return 
KnxManufacturer_M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_
case "M_ABB___RESERVED":
return KnxManufacturer_M_ABB___RESERVED
case "M_BUSCH_JAEGER_ELEKTRO___RESERVED":
@@ -8817,6 +8831,8 @@ func (e KnxManufacturer) String() string {
return "M_WIREEO"
case KnxManufacturer_M_NVCLIGHTING:
return "M_NVCLIGHTING"
+   case KnxManufacturer_M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_:
+   return "M_JINAN_TIAN_DA_SHENG_INFORMATION_TECHNOLOGY_CO_"
case KnxManufacturer_M_ABB___RESERVED:
return "M_ABB___RESERVED"
case KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED:
diff --git a/protocols/knxnetip/pom.xml b/protocols/knxnetip/pom.xml
index 0d3fe76..a6d71df 100644
--- a/protocols/knxnetip/pom.xml