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 2023/04/18 15:15:11 UTC
[plc4x] branch develop updated (0cbf147512 -> 5e4d57d057)
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 0cbf147512 fix(plc4go/spi): fix concurrency issue in DefaultCodec
new 57e3e6e857 test(plc4go/spi): add test for DefaultBrowser
new b433d0d8a4 test(plc4go/spi): add test for DefaultDriver
new 5e4d57d057 fux(plc4go/cbus): fix discovery stopping too early
The 3 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:
plc4go/internal/cbus/Discoverer.go | 2 +-
plc4go/spi/default/DefaultBrowser_test.go | 190 ++++++++++++
plc4go/spi/default/DefaultDriver_test.go | 466 ++++++++++++++++++++++++++++++
3 files changed, 657 insertions(+), 1 deletion(-)
create mode 100644 plc4go/spi/default/DefaultBrowser_test.go
create mode 100644 plc4go/spi/default/DefaultDriver_test.go
[plc4x] 03/03: fux(plc4go/cbus): fix discovery stopping too early
Posted by sr...@apache.org.
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 5e4d57d0574973344560416fded4fdcb3d1bb863
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Apr 18 17:10:30 2023 +0200
fux(plc4go/cbus): fix discovery stopping too early
---
plc4go/internal/cbus/Discoverer.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plc4go/internal/cbus/Discoverer.go b/plc4go/internal/cbus/Discoverer.go
index 05fa95e904..403c9894fb 100644
--- a/plc4go/internal/cbus/Discoverer.go
+++ b/plc4go/internal/cbus/Discoverer.go
@@ -255,7 +255,7 @@ func (d *Discoverer) createDeviceScanDispatcher(tcpTransportInstance *tcp.Transp
}
// Pass the event back to the callback
callback(discoveryEvent)
- return
+ continue
case <-timeout.C:
timeout.Stop()
continue
[plc4x] 01/03: test(plc4go/spi): add test for DefaultBrowser
Posted by sr...@apache.org.
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 57e3e6e8574763aaf38f5c36dd4fb6805f09d21e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Apr 18 16:49:38 2023 +0200
test(plc4go/spi): add test for DefaultBrowser
---
plc4go/spi/default/DefaultBrowser_test.go | 190 ++++++++++++++++++++++++++++++
1 file changed, 190 insertions(+)
diff --git a/plc4go/spi/default/DefaultBrowser_test.go b/plc4go/spi/default/DefaultBrowser_test.go
new file mode 100644
index 0000000000..c8567d03d9
--- /dev/null
+++ b/plc4go/spi/default/DefaultBrowser_test.go
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the 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. The 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
+ *
+ * https://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.
+ */
+
+package _default
+
+import (
+ "context"
+ spiModel "github.com/apache/plc4x/plc4go/spi/model"
+ "github.com/apache/plc4x/plc4go/spi/utils"
+ "github.com/stretchr/testify/assert"
+ "testing"
+ "time"
+
+ apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
+)
+
+func TestNewDefaultBrowser(t *testing.T) {
+ type args struct {
+ defaultBrowserRequirements DefaultBrowserRequirements
+ }
+ tests := []struct {
+ name string
+ args args
+ want DefaultBrowser
+ }{
+ {
+ name: "just create it",
+ want: &defaultBrowser{},
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := NewDefaultBrowser(tt.args.defaultBrowserRequirements); !assert.Equal(t, tt.want, got) {
+ t.Errorf("NewDefaultBrowser() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func Test_defaultBrowser_Browse(t *testing.T) {
+ type fields struct {
+ DefaultBrowserRequirements DefaultBrowserRequirements
+ }
+ type args struct {
+ ctx context.Context
+ browseRequest apiModel.PlcBrowseRequest
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ wantAsserter func(t *testing.T, results <-chan apiModel.PlcBrowseRequestResult) bool
+ }{
+ {
+ name: "Browse empty",
+ args: args{
+ ctx: context.Background(),
+ browseRequest: spiModel.NewDefaultPlcBrowseRequest(nil, nil, nil),
+ },
+ wantAsserter: func(t *testing.T, results <-chan apiModel.PlcBrowseRequestResult) bool {
+ timeout := time.NewTimer(2 * time.Second)
+ utils.CleanupTimer(timeout)
+ select {
+ case result := <-results:
+ assert.NotNil(t, result)
+ case <-timeout.C:
+ t.Error("timeout")
+ return false
+ }
+ return true
+ },
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ m := &defaultBrowser{
+ DefaultBrowserRequirements: tt.fields.DefaultBrowserRequirements,
+ }
+ assert.Truef(t, tt.wantAsserter(t, m.Browse(tt.args.ctx, tt.args.browseRequest)), "Browse(%v, %v)", tt.args.ctx, tt.args.browseRequest)
+ })
+ }
+}
+
+type testQuery struct {
+}
+
+func (testQuery) GetQueryString() string {
+ return "blub"
+}
+
+type testBrowser struct {
+ dispatcher func(ctx context.Context, interceptor func(result apiModel.PlcBrowseItem) bool, queryName string, query apiModel.PlcQuery) (apiModel.PlcResponseCode, []apiModel.PlcBrowseItem)
+}
+
+func (t testBrowser) BrowseQuery(ctx context.Context, interceptor func(result apiModel.PlcBrowseItem) bool, queryName string, query apiModel.PlcQuery) (apiModel.PlcResponseCode, []apiModel.PlcBrowseItem) {
+ if t.dispatcher != nil {
+ return t.dispatcher(ctx, interceptor, queryName, query)
+ }
+ interceptor(nil)
+ return apiModel.PlcResponseCode_OK, nil
+}
+
+func Test_defaultBrowser_BrowseWithInterceptor(t *testing.T) {
+ type fields struct {
+ DefaultBrowserRequirements DefaultBrowserRequirements
+ }
+ type args struct {
+ ctx context.Context
+ browseRequest apiModel.PlcBrowseRequest
+ interceptor func(result apiModel.PlcBrowseItem) bool
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ wantAsserter func(t *testing.T, results <-chan apiModel.PlcBrowseRequestResult) bool
+ }{
+ {
+ name: "Browse empty",
+ args: args{
+ ctx: context.Background(),
+ browseRequest: spiModel.NewDefaultPlcBrowseRequest(nil, nil, nil),
+ },
+ wantAsserter: func(t *testing.T, results <-chan apiModel.PlcBrowseRequestResult) bool {
+ timeout := time.NewTimer(2 * time.Second)
+ utils.CleanupTimer(timeout)
+ select {
+ case result := <-results:
+ assert.NotNil(t, result)
+ case <-timeout.C:
+ t.Error("timeout")
+ return false
+ }
+ return true
+ },
+ },
+ {
+ name: "Browse something",
+ fields: fields{
+ DefaultBrowserRequirements: testBrowser{},
+ },
+ args: args{
+ ctx: context.Background(),
+ browseRequest: spiModel.NewDefaultPlcBrowseRequest(
+ map[string]apiModel.PlcQuery{
+ "test": testQuery{},
+ },
+ []string{"test"},
+ nil,
+ ),
+ },
+ wantAsserter: func(t *testing.T, results <-chan apiModel.PlcBrowseRequestResult) bool {
+ timeout := time.NewTimer(2 * time.Second)
+ utils.CleanupTimer(timeout)
+ select {
+ case result := <-results:
+ assert.NotNil(t, result)
+ case <-timeout.C:
+ t.Error("timeout")
+ return false
+ }
+ return true
+ },
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ m := &defaultBrowser{
+ DefaultBrowserRequirements: tt.fields.DefaultBrowserRequirements,
+ }
+ assert.Truef(t, tt.wantAsserter(t, m.Browse(tt.args.ctx, tt.args.browseRequest)), "BrowseWithInterceptor(%v, %v, func())", tt.args.ctx, tt.args.browseRequest)
+ })
+ }
+}
[plc4x] 02/03: test(plc4go/spi): add test for DefaultDriver
Posted by sr...@apache.org.
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 b433d0d8a44e9543e345932dcf86150da06f17c2
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Apr 18 17:01:56 2023 +0200
test(plc4go/spi): add test for DefaultDriver
---
plc4go/spi/default/DefaultDriver_test.go | 466 +++++++++++++++++++++++++++++++
1 file changed, 466 insertions(+)
diff --git a/plc4go/spi/default/DefaultDriver_test.go b/plc4go/spi/default/DefaultDriver_test.go
new file mode 100644
index 0000000000..06eadc3e91
--- /dev/null
+++ b/plc4go/spi/default/DefaultDriver_test.go
@@ -0,0 +1,466 @@
+/*
+ * Licensed to the 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. The 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
+ *
+ * https://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.
+ */
+
+package _default
+
+import (
+ "context"
+ "fmt"
+ "github.com/stretchr/testify/assert"
+ "net/url"
+ "testing"
+
+ "github.com/apache/plc4x/plc4go/pkg/api"
+ apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
+ "github.com/apache/plc4x/plc4go/spi"
+ "github.com/apache/plc4x/plc4go/spi/options"
+ "github.com/apache/plc4x/plc4go/spi/transports"
+)
+
+func TestNewDefaultDriver(t *testing.T) {
+ type args struct {
+ defaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ args args
+ want DefaultDriver
+ }{
+ {
+ name: "create a new one",
+ want: &defaultDriver{},
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equalf(t, tt.want, NewDefaultDriver(tt.args.defaultDriverRequirements, tt.args.protocolCode, tt.args.protocolName, tt.args.defaultTransport, tt.args.plcTagHandler), "NewDefaultDriver(%v, %v, %v, %v, %v)", tt.args.defaultDriverRequirements, tt.args.protocolCode, tt.args.protocolName, tt.args.defaultTransport, tt.args.plcTagHandler)
+ })
+ }
+}
+
+type testTagHandler struct {
+}
+
+func (testTagHandler) ParseTag(tagAddress string) (apiModel.PlcTag, error) {
+ return nil, nil
+}
+
+func (testTagHandler) ParseQuery(query string) (apiModel.PlcQuery, error) {
+ return nil, nil
+}
+
+func Test_defaultDriver_CheckQuery(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ type args struct {
+ query string
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ wantErr assert.ErrorAssertionFunc
+ }{
+ {
+ name: "check it",
+ fields: fields{
+ plcTagHandler: testTagHandler{},
+ },
+ wantErr: assert.NoError,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ tt.wantErr(t, d.CheckQuery(tt.args.query), fmt.Sprintf("CheckQuery(%v)", tt.args.query))
+ })
+ }
+}
+
+func Test_defaultDriver_CheckTagAddress(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ type args struct {
+ query string
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ wantErr assert.ErrorAssertionFunc
+ }{
+ {
+ name: "check it",
+ fields: fields{
+ plcTagHandler: testTagHandler{},
+ },
+ wantErr: assert.NoError,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ tt.wantErr(t, d.CheckTagAddress(tt.args.query), fmt.Sprintf("CheckTagAddress(%v)", tt.args.query))
+ })
+ }
+}
+
+func Test_defaultDriver_Discover(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ type args struct {
+ callback func(event apiModel.PlcDiscoveryItem)
+ discoveryOptions []options.WithDiscoveryOption
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ wantErr assert.ErrorAssertionFunc
+ }{
+ {
+ name: "discover it",
+ wantErr: assert.Error,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ tt.wantErr(t, d.Discover(tt.args.callback, tt.args.discoveryOptions...), fmt.Sprintf("Discover(func(), %v)", tt.args.discoveryOptions))
+ })
+ }
+}
+
+func Test_defaultDriver_DiscoverWithContext(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ type args struct {
+ in0 context.Context
+ in1 func(event apiModel.PlcDiscoveryItem)
+ in2 []options.WithDiscoveryOption
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ wantErr assert.ErrorAssertionFunc
+ }{
+ {
+ name: "discover it",
+ wantErr: assert.Error,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ tt.wantErr(t, d.DiscoverWithContext(tt.args.in0, tt.args.in1, tt.args.in2...), fmt.Sprintf("DiscoverWithContext(%v, func(), %v)", tt.args.in0, tt.args.in2))
+ })
+ }
+}
+
+type testDriver struct {
+}
+
+func (testDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, options map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
+ return nil
+}
+func (testDriver) DiscoverWithContext(callback context.Context, event func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error {
+ return nil
+}
+
+func Test_defaultDriver_GetConnection(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ type args struct {
+ transportUrl url.URL
+ transports map[string]transports.Transport
+ options map[string][]string
+ }
+ tests := []struct {
+ name string
+ fields fields
+ args args
+ want <-chan plc4go.PlcConnectionConnectResult
+ }{
+ {
+ name: "get a connection",
+ fields: fields{
+ DefaultDriverRequirements: testDriver{},
+ },
+ args: args{},
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.GetConnection(tt.args.transportUrl, tt.args.transports, tt.args.options), "GetConnection(%v, %v, %v)", tt.args.transportUrl, tt.args.transports, tt.args.options)
+ })
+ }
+}
+
+func Test_defaultDriver_GetDefaultTransport(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want string
+ }{
+ {
+ name: "get it",
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.GetDefaultTransport(), "GetDefaultTransport()")
+ })
+ }
+}
+
+func Test_defaultDriver_GetPlcTagHandler(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want spi.PlcTagHandler
+ }{
+ {
+ name: "get it",
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.GetPlcTagHandler(), "GetPlcTagHandler()")
+ })
+ }
+}
+
+func Test_defaultDriver_GetProtocolCode(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want string
+ }{
+ {
+ name: "get it",
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.GetProtocolCode(), "GetProtocolCode()")
+ })
+ }
+}
+
+func Test_defaultDriver_GetProtocolName(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want string
+ }{
+ {
+ name: "get it",
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.GetProtocolName(), "GetProtocolName()")
+ })
+ }
+}
+
+func Test_defaultDriver_String(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want string
+ }{
+ {
+ name: "get it",
+ fields: fields{
+ protocolName: "abc",
+ protocolCode: "def",
+ defaultTransport: "ghi",
+ },
+ want: "abc (def) [ghi]",
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.String(), "String()")
+ })
+ }
+}
+
+func Test_defaultDriver_SupportsDiscovery(t *testing.T) {
+ type fields struct {
+ DefaultDriverRequirements DefaultDriverRequirements
+ protocolCode string
+ protocolName string
+ defaultTransport string
+ plcTagHandler spi.PlcTagHandler
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want bool
+ }{
+ {
+ name: "get it",
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ d := &defaultDriver{
+ DefaultDriverRequirements: tt.fields.DefaultDriverRequirements,
+ protocolCode: tt.fields.protocolCode,
+ protocolName: tt.fields.protocolName,
+ defaultTransport: tt.fields.defaultTransport,
+ plcTagHandler: tt.fields.plcTagHandler,
+ }
+ assert.Equalf(t, tt.want, d.SupportsDiscovery(), "SupportsDiscovery()")
+ })
+ }
+}