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 2022/06/14 10:40:01 UTC
[plc4x] branch develop updated: feat(bacnet): renamed access credential all
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 10de05bda6 feat(bacnet): renamed access credential all
10de05bda6 is described below
commit 10de05bda6c82d941242b5d908554f9de84e116f
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 14 12:39:52 2022 +0200
feat(bacnet): renamed access credential all
+ worked a bit on tests
---
plc4go/internal/ads/fieldtype_string.go | 2 +-
plc4go/internal/modbus/fieldtype_string.go | 2 +-
plc4go/internal/s7/fieldtype_string.go | 2 +-
plc4go/internal/spi/testutils/steptype_string.go | 2 +-
.../readwrite/model/BACnetConstructedData.go | 4 +-
...=> BACnetConstructedDataAccessCredentialAll.go} | 66 +++++++++++-----------
.../java/org/apache/plc4x/java/bacnetip/Utils.java | 22 ++++----
.../resources/protocols/bacnetip/bacnetip.mspec | 2 +-
.../bacnetip/ObjectPropertyDeDuplicationTest.java | 19 +++++--
9 files changed, 67 insertions(+), 54 deletions(-)
diff --git a/plc4go/internal/ads/fieldtype_string.go b/plc4go/internal/ads/fieldtype_string.go
index b594183df4..4b0da398ac 100644
--- a/plc4go/internal/ads/fieldtype_string.go
+++ b/plc4go/internal/ads/fieldtype_string.go
@@ -6,7 +6,7 @@
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// https://www.apache.org/licenses/LICENSE-2.0
+// 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
diff --git a/plc4go/internal/modbus/fieldtype_string.go b/plc4go/internal/modbus/fieldtype_string.go
index ca05f6e43f..ec3ec5099d 100644
--- a/plc4go/internal/modbus/fieldtype_string.go
+++ b/plc4go/internal/modbus/fieldtype_string.go
@@ -6,7 +6,7 @@
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// https://www.apache.org/licenses/LICENSE-2.0
+// 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
diff --git a/plc4go/internal/s7/fieldtype_string.go b/plc4go/internal/s7/fieldtype_string.go
index 928e6b438d..3045fc100e 100644
--- a/plc4go/internal/s7/fieldtype_string.go
+++ b/plc4go/internal/s7/fieldtype_string.go
@@ -6,7 +6,7 @@
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// https://www.apache.org/licenses/LICENSE-2.0
+// 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
diff --git a/plc4go/internal/spi/testutils/steptype_string.go b/plc4go/internal/spi/testutils/steptype_string.go
index c8cdae1e6f..c99ce3e0f5 100644
--- a/plc4go/internal/spi/testutils/steptype_string.go
+++ b/plc4go/internal/spi/testutils/steptype_string.go
@@ -6,7 +6,7 @@
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// https://www.apache.org/licenses/LICENSE-2.0
+// 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
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
index 45abd501d2..6fcd776849 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedData.go
@@ -280,8 +280,8 @@ func BACnetConstructedDataParse(readBuffer utils.ReadBuffer, tagNumber uint8, ob
_child, typeSwitchError = BACnetConstructedDataAlarmValuesParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument, arrayIndexArgument)
case true && propertyIdentifierArgument == BACnetPropertyIdentifier_ALIGN_INTERVALS && peekedTagNumber == uint8(1): // BACnetConstructedDataAlignIntervals
_child, typeSwitchError = BACnetConstructedDataAlignIntervalsParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument, arrayIndexArgument)
- case objectTypeArgument == BACnetObjectType_ACCESS_CREDENTIAL && propertyIdentifierArgument == BACnetPropertyIdentifier_ALL: // BACnetConstructedDataAccessCredentialAl
- _child, typeSwitchError = BACnetConstructedDataAccessCredentialAlParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument, arrayIndexArgument)
+ case objectTypeArgument == BACnetObjectType_ACCESS_CREDENTIAL && propertyIdentifierArgument == BACnetPropertyIdentifier_ALL: // BACnetConstructedDataAccessCredentialAll
+ _child, typeSwitchError = BACnetConstructedDataAccessCredentialAllParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument, arrayIndexArgument)
case objectTypeArgument == BACnetObjectType_ACCESS_DOOR && propertyIdentifierArgument == BACnetPropertyIdentifier_ALL: // BACnetConstructedDataAccessDoorAll
_child, typeSwitchError = BACnetConstructedDataAccessDoorAllParse(readBuffer, tagNumber, objectTypeArgument, propertyIdentifierArgument, arrayIndexArgument)
case objectTypeArgument == BACnetObjectType_ACCESS_POINT && propertyIdentifierArgument == BACnetPropertyIdentifier_ALL: // BACnetConstructedDataAccessPointAll
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAl.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAll.go
similarity index 59%
rename from plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAl.go
rename to plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAll.go
index 1e7c751660..868c79cbfa 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAl.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetConstructedDataAccessCredentialAll.go
@@ -26,8 +26,8 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// BACnetConstructedDataAccessCredentialAl is the data-structure of this message
-type BACnetConstructedDataAccessCredentialAl struct {
+// BACnetConstructedDataAccessCredentialAll is the data-structure of this message
+type BACnetConstructedDataAccessCredentialAll struct {
*BACnetConstructedData
// Arguments.
@@ -35,8 +35,8 @@ type BACnetConstructedDataAccessCredentialAl struct {
ArrayIndexArgument *BACnetTagPayloadUnsignedInteger
}
-// IBACnetConstructedDataAccessCredentialAl is the corresponding interface of BACnetConstructedDataAccessCredentialAl
-type IBACnetConstructedDataAccessCredentialAl interface {
+// IBACnetConstructedDataAccessCredentialAll is the corresponding interface of BACnetConstructedDataAccessCredentialAll
+type IBACnetConstructedDataAccessCredentialAll interface {
IBACnetConstructedData
// GetLengthInBytes returns the length in bytes
GetLengthInBytes() uint16
@@ -51,11 +51,11 @@ type IBACnetConstructedDataAccessCredentialAl interface {
/////////////////////// Accessors for discriminator values.
///////////////////////
-func (m *BACnetConstructedDataAccessCredentialAl) GetObjectTypeArgument() BACnetObjectType {
+func (m *BACnetConstructedDataAccessCredentialAll) GetObjectTypeArgument() BACnetObjectType {
return BACnetObjectType_ACCESS_CREDENTIAL
}
-func (m *BACnetConstructedDataAccessCredentialAl) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
+func (m *BACnetConstructedDataAccessCredentialAll) GetPropertyIdentifierArgument() BACnetPropertyIdentifier {
return BACnetPropertyIdentifier_ALL
}
@@ -64,64 +64,64 @@ func (m *BACnetConstructedDataAccessCredentialAl) GetPropertyIdentifierArgument(
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *BACnetConstructedDataAccessCredentialAl) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, peekedTagHeader *BACnetTagHeader, closingTag *BACnetClosingTag) {
+func (m *BACnetConstructedDataAccessCredentialAll) InitializeParent(parent *BACnetConstructedData, openingTag *BACnetOpeningTag, peekedTagHeader *BACnetTagHeader, closingTag *BACnetClosingTag) {
m.BACnetConstructedData.OpeningTag = openingTag
m.BACnetConstructedData.PeekedTagHeader = peekedTagHeader
m.BACnetConstructedData.ClosingTag = closingTag
}
-func (m *BACnetConstructedDataAccessCredentialAl) GetParent() *BACnetConstructedData {
+func (m *BACnetConstructedDataAccessCredentialAll) GetParent() *BACnetConstructedData {
return m.BACnetConstructedData
}
-// NewBACnetConstructedDataAccessCredentialAl factory function for BACnetConstructedDataAccessCredentialAl
-func NewBACnetConstructedDataAccessCredentialAl(openingTag *BACnetOpeningTag, peekedTagHeader *BACnetTagHeader, closingTag *BACnetClosingTag, tagNumber uint8, arrayIndexArgument *BACnetTagPayloadUnsignedInteger) *BACnetConstructedDataAccessCredentialAl {
- _result := &BACnetConstructedDataAccessCredentialAl{
+// NewBACnetConstructedDataAccessCredentialAll factory function for BACnetConstructedDataAccessCredentialAll
+func NewBACnetConstructedDataAccessCredentialAll(openingTag *BACnetOpeningTag, peekedTagHeader *BACnetTagHeader, closingTag *BACnetClosingTag, tagNumber uint8, arrayIndexArgument *BACnetTagPayloadUnsignedInteger) *BACnetConstructedDataAccessCredentialAll {
+ _result := &BACnetConstructedDataAccessCredentialAll{
BACnetConstructedData: NewBACnetConstructedData(openingTag, peekedTagHeader, closingTag, tagNumber, arrayIndexArgument),
}
_result.Child = _result
return _result
}
-func CastBACnetConstructedDataAccessCredentialAl(structType interface{}) *BACnetConstructedDataAccessCredentialAl {
- if casted, ok := structType.(BACnetConstructedDataAccessCredentialAl); ok {
+func CastBACnetConstructedDataAccessCredentialAll(structType interface{}) *BACnetConstructedDataAccessCredentialAll {
+ if casted, ok := structType.(BACnetConstructedDataAccessCredentialAll); ok {
return &casted
}
- if casted, ok := structType.(*BACnetConstructedDataAccessCredentialAl); ok {
+ if casted, ok := structType.(*BACnetConstructedDataAccessCredentialAll); ok {
return casted
}
if casted, ok := structType.(BACnetConstructedData); ok {
- return CastBACnetConstructedDataAccessCredentialAl(casted.Child)
+ return CastBACnetConstructedDataAccessCredentialAll(casted.Child)
}
if casted, ok := structType.(*BACnetConstructedData); ok {
- return CastBACnetConstructedDataAccessCredentialAl(casted.Child)
+ return CastBACnetConstructedDataAccessCredentialAll(casted.Child)
}
return nil
}
-func (m *BACnetConstructedDataAccessCredentialAl) GetTypeName() string {
- return "BACnetConstructedDataAccessCredentialAl"
+func (m *BACnetConstructedDataAccessCredentialAll) GetTypeName() string {
+ return "BACnetConstructedDataAccessCredentialAll"
}
-func (m *BACnetConstructedDataAccessCredentialAl) GetLengthInBits() uint16 {
+func (m *BACnetConstructedDataAccessCredentialAll) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *BACnetConstructedDataAccessCredentialAl) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *BACnetConstructedDataAccessCredentialAll) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
return lengthInBits
}
-func (m *BACnetConstructedDataAccessCredentialAl) GetLengthInBytes() uint16 {
+func (m *BACnetConstructedDataAccessCredentialAll) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func BACnetConstructedDataAccessCredentialAlParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier, arrayIndexArgument *BACnetTagPayloadUnsignedInteger) (*BACnetConstructedDataAccessCredentialAl, error) {
+func BACnetConstructedDataAccessCredentialAllParse(readBuffer utils.ReadBuffer, tagNumber uint8, objectTypeArgument BACnetObjectType, propertyIdentifierArgument BACnetPropertyIdentifier, arrayIndexArgument *BACnetTagPayloadUnsignedInteger) (*BACnetConstructedDataAccessCredentialAll, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("BACnetConstructedDataAccessCredentialAl"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for BACnetConstructedDataAccessCredentialAl")
+ if pullErr := readBuffer.PullContext("BACnetConstructedDataAccessCredentialAll"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for BACnetConstructedDataAccessCredentialAll")
}
currentPos := positionAware.GetPos()
_ = currentPos
@@ -131,35 +131,35 @@ func BACnetConstructedDataAccessCredentialAlParse(readBuffer utils.ReadBuffer, t
return nil, errors.WithStack(utils.ParseValidationError{"All should never occur in context of constructed data. If it does please report"})
}
- if closeErr := readBuffer.CloseContext("BACnetConstructedDataAccessCredentialAl"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for BACnetConstructedDataAccessCredentialAl")
+ if closeErr := readBuffer.CloseContext("BACnetConstructedDataAccessCredentialAll"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for BACnetConstructedDataAccessCredentialAll")
}
// Create a partially initialized instance
- _child := &BACnetConstructedDataAccessCredentialAl{
+ _child := &BACnetConstructedDataAccessCredentialAll{
BACnetConstructedData: &BACnetConstructedData{},
}
_child.BACnetConstructedData.Child = _child
return _child, nil
}
-func (m *BACnetConstructedDataAccessCredentialAl) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *BACnetConstructedDataAccessCredentialAll) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("BACnetConstructedDataAccessCredentialAl"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for BACnetConstructedDataAccessCredentialAl")
+ if pushErr := writeBuffer.PushContext("BACnetConstructedDataAccessCredentialAll"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for BACnetConstructedDataAccessCredentialAll")
}
- if popErr := writeBuffer.PopContext("BACnetConstructedDataAccessCredentialAl"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for BACnetConstructedDataAccessCredentialAl")
+ if popErr := writeBuffer.PopContext("BACnetConstructedDataAccessCredentialAll"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for BACnetConstructedDataAccessCredentialAll")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *BACnetConstructedDataAccessCredentialAl) String() string {
+func (m *BACnetConstructedDataAccessCredentialAll) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/Utils.java b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/Utils.java
index 74b3b14bb5..896c14cd61 100644
--- a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/Utils.java
+++ b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/Utils.java
@@ -34,35 +34,37 @@ public class Utils {
static int PAYLOAD_START_INDEX = 42;
- static void tryParseBytes(int[] rawBytesAsInts) throws ParseException {
- tryParseBytes(rawBytesAsInts, PAYLOAD_START_INDEX);
+ static BVLC tryParseBytes(int[] rawBytesAsInts) throws ParseException {
+ return tryParseBytes(rawBytesAsInts, PAYLOAD_START_INDEX);
}
- static void tryParseBytes(int[] rawBytesAsInts, int startIndex) throws ParseException {
- tryParseBytes(rawBytesAsInts, PAYLOAD_START_INDEX, DUMP_PACKAGES);
+ static BVLC tryParseBytes(int[] rawBytesAsInts, int startIndex) throws ParseException {
+ return tryParseBytes(rawBytesAsInts, startIndex, DUMP_PACKAGES);
}
- static void tryParseBytes(int[] rawBytesAsInts, int startIndex, boolean dumpPackages) throws ParseException {
+ static BVLC tryParseBytes(int[] rawBytesAsInts, int startIndex, boolean dumpPackages) throws ParseException {
var rawBytes = (byte[]) ArrayUtils.toPrimitive(IntStream.of(rawBytesAsInts).boxed().map(Integer::byteValue).toArray(Byte[]::new));
rawBytes = ArrayUtils.subarray(rawBytes, startIndex, rawBytes.length);
BVLC bvlc = BVLC.staticParse(new ReadBufferByteBased(rawBytes));
assertNotNull(bvlc);
if (dumpPackages) System.out.println(bvlc);
+ return bvlc;
}
- static void tryParseHex(String hex) throws ParseException, DecoderException {
- tryParseHex(hex, DUMP_PACKAGES);
+ static BVLC tryParseHex(String hex) throws ParseException, DecoderException {
+ return tryParseHex(hex, DUMP_PACKAGES);
}
- static void tryParseHex(String hex, boolean dumpPackages) throws ParseException, DecoderException {
- tryParseHex(hex, 0, dumpPackages);
+ static BVLC tryParseHex(String hex, boolean dumpPackages) throws ParseException, DecoderException {
+ return tryParseHex(hex, 0, dumpPackages);
}
- static void tryParseHex(String hex, int startIndex, boolean dumpPackages) throws ParseException, DecoderException {
+ static BVLC tryParseHex(String hex, int startIndex, boolean dumpPackages) throws ParseException, DecoderException {
byte[] rawBytes = Hex.decodeHex(hex);
rawBytes = ArrayUtils.subarray(rawBytes, startIndex, rawBytes.length);
BVLC bvlc = BVLC.staticParse(new ReadBufferByteBased(rawBytes));
assertNotNull(bvlc);
if (dumpPackages) System.out.println(bvlc);
+ return bvlc;
}
}
diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
index f5e9853af4..7a78ccbe9a 100644
--- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
+++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec
@@ -2484,7 +2484,7 @@
/////
// All property implementations for every object
- ['ACCESS_CREDENTIAL' , 'ALL' BACnetConstructedDataAccessCredentialAl
+ ['ACCESS_CREDENTIAL' , 'ALL' BACnetConstructedDataAccessCredentialAll
[validation '1==2' "All should never occur in context of constructed data. If it does please report"]
]
['ACCESS_DOOR' , 'ALL' BACnetConstructedDataAccessDoorAll
diff --git a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java
index ccced8f4b2..0e19d5fdca 100644
--- a/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java
+++ b/protocols/bacnetip/src/test/java/org/apache/plc4x/protocol/bacnetip/ObjectPropertyDeDuplicationTest.java
@@ -19,12 +19,9 @@
package org.apache.plc4x.protocol.bacnetip;
import org.apache.plc4x.plugins.codegenerator.protocol.TypeContext;
-import org.apache.plc4x.plugins.codegenerator.types.definitions.ComplexTypeDefinition;
-import org.apache.plc4x.plugins.codegenerator.types.definitions.EnumTypeDefinition;
-import org.apache.plc4x.plugins.codegenerator.types.definitions.TypeDefinition;
+import org.apache.plc4x.plugins.codegenerator.types.definitions.*;
import org.apache.plc4x.plugins.codegenerator.types.enums.EnumValue;
import org.apache.plc4x.plugins.codegenerator.types.fields.Field;
-import org.apache.plc4x.plugins.codegenerator.types.fields.FieldConversions;
import org.apache.plc4x.plugins.codegenerator.types.fields.PropertyField;
import org.apache.plc4x.plugins.codegenerator.types.fields.ValidationField;
import org.junit.jupiter.api.*;
@@ -35,6 +32,7 @@ import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static org.apache.plc4x.protocol.bacnetip.BACnetObjectsDefinitions.*;
import static org.junit.jupiter.api.Assertions.*;
@@ -374,5 +372,18 @@ public class ObjectPropertyDeDuplicationTest {
LOGGER.info("property {} is used by {} non uniquely", propertyIdentifier, bacNetObjectNames);
});
}
+
+ @Test
+ void outputDataConstructedDataChilds(){
+ ComplexTypeDefinition baCnetConstructedData = typeDefinitions.get("BACnetConstructedData").asComplexTypeDefinition().orElseThrow();
+ Set<String> childsOfConstructedData = typeDefinitions.values().stream()
+ .filter(TypeDefinitionConversions::isDiscriminatedComplexTypeDefinition)
+ .map(DiscriminatedComplexTypeDefinition.class::cast)
+ .filter(discriminatedComplexTypeDefinition -> discriminatedComplexTypeDefinition.getParentType().isPresent())
+ .filter(discriminatedComplexTypeDefinition -> discriminatedComplexTypeDefinition.getParentType().get() == baCnetConstructedData)
+ .map(TypeDefinition::getName)
+ .collect(Collectors.toSet());
+ childsOfConstructedData.stream().sorted().forEach(System.out::println);
+ }
}
}