This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 7919d5de3222bcd975367eed905f7e30488a3745 Author: Christofer Dutz <[email protected]> AuthorDate: Fri Jan 22 12:01:37 2021 +0100 - Adjusted the "TestKnxNetIpPlc4goDiscovery" test to work with the updated Browse functionality. --- plc4go/cmd/main/drivers/knxnetip_test.go | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/plc4go/cmd/main/drivers/knxnetip_test.go b/plc4go/cmd/main/drivers/knxnetip_test.go index 4ff152a..ee2ee3e 100644 --- a/plc4go/cmd/main/drivers/knxnetip_test.go +++ b/plc4go/cmd/main/drivers/knxnetip_test.go @@ -148,7 +148,7 @@ func TestKnxNetIpPlc4goDiscovery(t *testing.T) { brr := browseRequest.Execute() browseRequestResults := <-brr if browseRequestResults.Err != nil { - fmt.Printf("Got error executing browse-request: %s", connectionResult.Err.Error()) + fmt.Printf("Got error executing browse-request: %s\n", connectionResult.Err.Error()) return } @@ -156,7 +156,7 @@ func TestKnxNetIpPlc4goDiscovery(t *testing.T) { for _, queryName := range browseRequestResults.Response.GetQueryNames() { results := browseRequestResults.Response.GetQueryResults(queryName) for _, result := range results { - fmt.Printf("Found KNX device at address: %v", result.Address) + fmt.Printf("Found KNX device at address: %v\n", result.Address) } } //}() @@ -172,8 +172,8 @@ func TestKnxNetIpPlc4goDiscovery(t *testing.T) { time.Sleep(time.Second * 2) fmt.Print("Found devices") return - case <-time.After(time.Second * 60): - t.Error("Couldn't find device in the last 60 seconds") + case <-time.After(time.Second * 600): + t.Error("Couldn't find device in the last 600 seconds") t.Fail() return } @@ -301,3 +301,23 @@ func knxEventHandler(event apiModel.PlcSubscriptionEvent) { } } } + +func TestKnxNetIpPlc4goMemoryRead(t *testing.T) { + driverManager := plc4go.NewPlcDriverManager() + driverManager.RegisterDriver(knxnetip.NewKnxNetIpDriver()) + driverManager.RegisterTransport(udp.NewUdpTransport()) + + // Get a connection to a remote PLC + crc := driverManager.GetConnection("knxnet-ip://192.168.42.11") + + // Wait for the driver to connect (or not) + connectionResult := <-crc + if connectionResult.Err != nil { + t.Errorf("error connecting to PLC: %s", connectionResult.Err.Error()) + t.Fail() + return + } + connection := connectionResult.Connection + defer connection.Close() + +}
