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/06/20 06:47:31 UTC
[plc4x] 03/03: test(plc4go/cbus): removed superfluous executor creation
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 0a1dc0202ebb8a97b5fa890cf94e5e949645f59b
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 20 08:47:22 2023 +0200
test(plc4go/cbus): removed superfluous executor creation
---
plc4go/internal/cbus/Browser_test.go | 14 ---
plc4go/internal/cbus/CBusMessageMapper_test.go | 133 ++++---------------------
plc4go/internal/cbus/Reader_test.go | 16 +--
3 files changed, 25 insertions(+), 138 deletions(-)
diff --git a/plc4go/internal/cbus/Browser_test.go b/plc4go/internal/cbus/Browser_test.go
index c1860d88e8..3fef9b7ee8 100644
--- a/plc4go/internal/cbus/Browser_test.go
+++ b/plc4go/internal/cbus/Browser_test.go
@@ -35,9 +35,7 @@ import (
readWriteModel "github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model"
_default "github.com/apache/plc4x/plc4go/spi/default"
spiModel "github.com/apache/plc4x/plc4go/spi/model"
- "github.com/apache/plc4x/plc4go/spi/pool"
"github.com/apache/plc4x/plc4go/spi/testutils"
- "github.com/apache/plc4x/plc4go/spi/transactions"
"github.com/apache/plc4x/plc4go/spi/transports"
"github.com/apache/plc4x/plc4go/spi/transports/test"
"github.com/apache/plc4x/plc4go/spi/utils"
@@ -90,13 +88,6 @@ func TestBrowser_BrowseQuery(t *testing.T) {
setup: func(t *testing.T, fields *fields) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 10, _options...)
- executor.Start()
- t.Cleanup(executor.Stop)
- _options = append(_options,
- transactions.WithCustomExecutor(executor),
- )
-
transport := test.NewTransport(_options...)
transportUrl := url.URL{Scheme: "test"}
transportInstance, err := transport.CreateTransportInstance(transportUrl, nil, _options...)
@@ -255,11 +246,6 @@ func TestBrowser_browseUnitInfo(t *testing.T) {
setup: func(t *testing.T, fields *fields) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 10, _options...)
- executor.Start()
- t.Cleanup(executor.Stop)
- _options = append(_options, transactions.WithCustomExecutor(executor))
-
transport := test.NewTransport(_options...)
transportUrl := url.URL{Scheme: "test"}
transportInstance, err := transport.CreateTransportInstance(transportUrl, nil, _options...)
diff --git a/plc4go/internal/cbus/CBusMessageMapper_test.go b/plc4go/internal/cbus/CBusMessageMapper_test.go
index 0857832a47..eddb65008b 100644
--- a/plc4go/internal/cbus/CBusMessageMapper_test.go
+++ b/plc4go/internal/cbus/CBusMessageMapper_test.go
@@ -26,7 +26,6 @@ import (
apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
apiValues "github.com/apache/plc4x/plc4go/pkg/api/values"
readWriteModel "github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model"
- "github.com/apache/plc4x/plc4go/spi/pool"
"github.com/apache/plc4x/plc4go/spi/testutils"
"github.com/apache/plc4x/plc4go/spi/transactions"
"github.com/apache/plc4x/plc4go/spi/utils"
@@ -1470,13 +1469,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1544,13 +1539,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1620,13 +1611,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1685,13 +1672,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1740,13 +1723,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1798,13 +1777,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1876,13 +1851,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -1972,13 +1943,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2031,13 +1998,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2086,13 +2049,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2141,13 +2100,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2196,13 +2151,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2251,13 +2202,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2326,13 +2273,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2381,13 +2324,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2436,13 +2375,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2491,13 +2426,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2546,13 +2477,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2601,13 +2528,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2672,13 +2595,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2727,13 +2646,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -2782,13 +2697,9 @@ func TestMapEncodedReply(t *testing.T) {
},
setup: func(t *testing.T, args *args) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(10, 50, _options...)
- executor.Start()
transactionManager := transactions.NewRequestTransactionManager(
1,
- append(_options,
- transactions.WithCustomExecutor(executor),
- )...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
diff --git a/plc4go/internal/cbus/Reader_test.go b/plc4go/internal/cbus/Reader_test.go
index faf5822937..12b503501f 100644
--- a/plc4go/internal/cbus/Reader_test.go
+++ b/plc4go/internal/cbus/Reader_test.go
@@ -34,7 +34,6 @@ import (
readWriteModel "github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model"
spiModel "github.com/apache/plc4x/plc4go/spi/model"
"github.com/apache/plc4x/plc4go/spi/options"
- "github.com/apache/plc4x/plc4go/spi/pool"
"github.com/apache/plc4x/plc4go/spi/testutils"
"github.com/apache/plc4x/plc4go/spi/transactions"
"github.com/apache/plc4x/plc4go/spi/transports/test"
@@ -184,12 +183,9 @@ func TestReader_readSync(t *testing.T) {
setup: func(t *testing.T, fields *fields) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(5, 5)
- executor.Start()
- t.Cleanup(executor.Stop)
transactionManager := transactions.NewRequestTransactionManager(
10,
- append(_options, transactions.WithCustomExecutor(executor))...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -265,12 +261,9 @@ func TestReader_readSync(t *testing.T) {
setup: func(t *testing.T, fields *fields) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(5, 5, _options...)
- executor.Start()
- t.Cleanup(executor.Stop)
transactionManager := transactions.NewRequestTransactionManager(
10,
- append(_options, transactions.WithCustomExecutor(executor))...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())
@@ -353,12 +346,9 @@ func TestReader_readSync(t *testing.T) {
setup: func(t *testing.T, fields *fields) {
_options := testutils.EnrichOptionsWithOptionsForTesting(t)
- executor := pool.NewFixedSizeExecutor(5, 5)
- executor.Start()
- t.Cleanup(executor.Stop)
transactionManager := transactions.NewRequestTransactionManager(
10,
- append(_options, transactions.WithCustomExecutor(executor))...,
+ _options...,
)
t.Cleanup(func() {
assert.NoError(t, transactionManager.Close())