revert zeebe duration type

Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
This commit is contained in:
Bernd Verst 2022-09-12 18:57:13 -07:00
parent e701aadae2
commit ed31cfa815
2 changed files with 8 additions and 7 deletions

View File

@ -15,6 +15,7 @@ package zeebe
import (
"errors"
"time"
"github.com/camunda/zeebe/clients/go/v8/pkg/zbc"
@ -36,10 +37,10 @@ type ClientFactoryImpl struct {
// https://docs.zeebe.io/operations/authentication.html
type clientMetadata struct {
GatewayAddr string `json:"gatewayAddr" mapstructure:"gatewayAddr"`
GatewayKeepAlive metadata.Duration `json:"gatewayKeepAlive" mapstructure:"gatewayKeepAlive"`
CaCertificatePath string `json:"caCertificatePath" mapstructure:"caCertificatePath"`
UsePlaintextConnection bool `json:"usePlainTextConnection,string" mapstructure:"usePlainTextConnection"`
GatewayAddr string `json:"gatewayAddr" mapstructure:"gatewayAddr"`
GatewayKeepAlive time.Duration `json:"gatewayKeepAlive" mapstructure:"gatewayKeepAlive"`
CaCertificatePath string `json:"caCertificatePath" mapstructure:"caCertificatePath"`
UsePlaintextConnection bool `json:"usePlainTextConnection,string" mapstructure:"usePlainTextConnection"`
}
// NewClientFactoryImpl returns a new ClientFactory instance.
@ -57,7 +58,7 @@ func (c *ClientFactoryImpl) Get(metadata bindings.Metadata) (zbc.Client, error)
GatewayAddress: meta.GatewayAddr,
UsePlaintextConnection: meta.UsePlaintextConnection,
CaCertificatePath: meta.CaCertificatePath,
KeepAlive: meta.GatewayKeepAlive.Duration,
KeepAlive: meta.GatewayKeepAlive,
})
if err != nil {
return nil, err

View File

@ -35,7 +35,7 @@ func TestParseMetadata(t *testing.T) {
meta, err := client.parseMetadata(m)
assert.NoError(t, err)
assert.Equal(t, "172.0.0.1:1234", meta.GatewayAddr)
assert.Equal(t, 5*time.Second, meta.GatewayKeepAlive.Duration)
assert.Equal(t, 5*time.Second, meta.GatewayKeepAlive)
assert.Equal(t, "/cert/path", meta.CaCertificatePath)
assert.Equal(t, true, meta.UsePlaintextConnection)
}
@ -54,7 +54,7 @@ func TestParseMetadataDefaultValues(t *testing.T) {
client := ClientFactoryImpl{logger: logger.NewLogger("test")}
meta, err := client.parseMetadata(m)
assert.NoError(t, err)
assert.Equal(t, time.Duration(0), meta.GatewayKeepAlive.Duration)
assert.Equal(t, time.Duration(0), meta.GatewayKeepAlive)
assert.Equal(t, "", meta.CaCertificatePath)
assert.Equal(t, false, meta.UsePlaintextConnection)
}