From ed31cfa81560452fe0c9f0d3245a4d8968dd9bdc Mon Sep 17 00:00:00 2001 From: Bernd Verst <4535280+berndverst@users.noreply.github.com> Date: Mon, 12 Sep 2022 18:57:13 -0700 Subject: [PATCH] revert zeebe duration type Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com> --- bindings/zeebe/client.go | 11 ++++++----- bindings/zeebe/client_test.go | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bindings/zeebe/client.go b/bindings/zeebe/client.go index e581da7c7..cc5a419d0 100644 --- a/bindings/zeebe/client.go +++ b/bindings/zeebe/client.go @@ -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 diff --git a/bindings/zeebe/client_test.go b/bindings/zeebe/client_test.go index 740acb53a..182f237f4 100644 --- a/bindings/zeebe/client_test.go +++ b/bindings/zeebe/client_test.go @@ -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) }