From a91fa5ecfac8b68f7f52f5faba25dd7323e75013 Mon Sep 17 00:00:00 2001 From: t-asaka Date: Mon, 17 Dec 2018 11:09:08 +0900 Subject: [PATCH 1/5] Rename to URL from Url --- awsiotprotocol/config.go | 2 +- awsiotprotocol/loader.go | 4 ++-- awsiotprotocol/mqtts.go | 2 +- awsiotprotocol/wss.go | 2 +- connection_test.go | 4 ++-- device.go | 6 +++--- options.go | 6 +++--- sample/main.go | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/awsiotprotocol/config.go b/awsiotprotocol/config.go index 60d62fd9..7e8599b7 100644 --- a/awsiotprotocol/config.go +++ b/awsiotprotocol/config.go @@ -20,5 +20,5 @@ type Config struct { CertPath string CaPath string ClientId string - Url string + URL string } diff --git a/awsiotprotocol/loader.go b/awsiotprotocol/loader.go index 6c100e58..a9266e42 100644 --- a/awsiotprotocol/loader.go +++ b/awsiotprotocol/loader.go @@ -39,8 +39,8 @@ func init() { registerProtocol(MockProtocol{}) } -// ByUrl selects MQTT connection type by URL string. -func ByUrl(u string) (Protocol, error) { +// ByURL selects MQTT connection type by URL string. +func ByURL(u string) (Protocol, error) { url, err := url.Parse(u) if err != nil { return nil, err diff --git a/awsiotprotocol/mqtts.go b/awsiotprotocol/mqtts.go index 67e2fabd..429cefb6 100644 --- a/awsiotprotocol/mqtts.go +++ b/awsiotprotocol/mqtts.go @@ -37,7 +37,7 @@ func (s Mqtts) Name() string { // NewClientOptions returns MQTT connection options. func (s Mqtts) NewClientOptions(opt *Config) (*mqtt.ClientOptions, error) { - url, err := url.Parse(opt.Url) + url, err := url.Parse(opt.URL) if err != nil { return nil, err } diff --git a/awsiotprotocol/wss.go b/awsiotprotocol/wss.go index 04100d6f..30dca081 100644 --- a/awsiotprotocol/wss.go +++ b/awsiotprotocol/wss.go @@ -30,7 +30,7 @@ func (s Wss) Name() string { // NewClientOptions returns MQTT connection options. func (s Wss) NewClientOptions(opt *Config) (*mqtt.ClientOptions, error) { opts := mqtt.NewClientOptions() - opts.AddBroker(opt.Url) + opts.AddBroker(opt.URL) opts.SetClientID(opt.ClientId) opts.SetAutoReconnect(false) // use custom reconnection algorithm with offline queueing diff --git a/connection_test.go b/connection_test.go index 99745e66..fca9bfe0 100644 --- a/connection_test.go +++ b/connection_test.go @@ -36,7 +36,7 @@ func TestDeviceClient(t *testing.T) { MaximumReconnectTime: time.Millisecond * 50, MinimumConnectionTime: time.Millisecond * 50, Keepalive: time.Second * 2, - Url: "mock://", + URL: "mock://", OfflineQueueing: true, OfflineQueueMaxSize: 100, OfflineQueueDropBehavior: "oldest", @@ -178,7 +178,7 @@ func TestConnectionLostHandler(t *testing.T) { MaximumReconnectTime: time.Millisecond * 50, MinimumConnectionTime: time.Millisecond * 50, Keepalive: time.Second * 2, - Url: "mock://", + URL: "mock://", OfflineQueueing: true, OfflineQueueMaxSize: 100, OfflineQueueDropBehavior: "oldest", diff --git a/device.go b/device.go index 44dc4ecd..c19e0250 100644 --- a/device.go +++ b/device.go @@ -54,9 +54,9 @@ type DeviceClient struct { func New(opt *Options) *DeviceClient { if opt.Protocol != "" || opt.Host != "" { (&debugOut{opt.Debug}).print("Options.Protocol and Options.Host are deprecated. Use Options.URL instead.") - opt.Url = opt.Protocol + "://" + opt.Host + opt.URL = opt.Protocol + "://" + opt.Host } - p, err := awsiotprotocol.ByUrl(opt.Url) + p, err := awsiotprotocol.ByURL(opt.URL) if err != nil { panic(err) } @@ -66,7 +66,7 @@ func New(opt *Options) *DeviceClient { CertPath: opt.CertPath, CaPath: opt.CaPath, ClientId: opt.ClientId, - Url: opt.Url, + URL: opt.URL, }, ) if err != nil { diff --git a/options.go b/options.go index 8d5f730a..0aa2207e 100644 --- a/options.go +++ b/options.go @@ -40,9 +40,9 @@ type Options struct { MaximumReconnectTime time.Duration MinimumConnectionTime time.Duration Keepalive time.Duration - Url string - Protocol string // [deprecated] use Url - Host string // [deprecated] use Url + URL string + Protocol string // [deprecated] use URL + Host string // [deprecated] use URL Debug bool Qos byte Retain bool diff --git a/sample/main.go b/sample/main.go index 4f7851be..8dcc34ad 100644 --- a/sample/main.go +++ b/sample/main.go @@ -61,7 +61,7 @@ func main() { MaximumReconnectTime: time.Second * 2, MinimumConnectionTime: time.Second * 2, Keepalive: time.Second * 2, - Url: *url, + URL: *url, Debug: true, Qos: 1, Retain: false, From f50f3088f7058d42ab762130fda520ad2f5e1d86 Mon Sep 17 00:00:00 2001 From: t-asaka Date: Mon, 17 Dec 2018 11:13:22 +0900 Subject: [PATCH 2/5] Rename to ClientID from ClientId --- awsiotprotocol/config.go | 2 +- awsiotprotocol/mqtts.go | 2 +- awsiotprotocol/wss.go | 2 +- device.go | 2 +- options.go | 2 +- sample/main.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/awsiotprotocol/config.go b/awsiotprotocol/config.go index 7e8599b7..cb47fa00 100644 --- a/awsiotprotocol/config.go +++ b/awsiotprotocol/config.go @@ -19,6 +19,6 @@ type Config struct { KeyPath string CertPath string CaPath string - ClientId string + ClientID string URL string } diff --git a/awsiotprotocol/mqtts.go b/awsiotprotocol/mqtts.go index 429cefb6..8c19ae27 100644 --- a/awsiotprotocol/mqtts.go +++ b/awsiotprotocol/mqtts.go @@ -63,7 +63,7 @@ func (s Mqtts) NewClientOptions(opt *Config) (*mqtt.ClientOptions, error) { opts := mqtt.NewClientOptions() opts.AddBroker( fmt.Sprintf("ssl://%s:%d", host, port)) - opts.SetClientID(opt.ClientId) + opts.SetClientID(opt.ClientID) opts.SetTLSConfig(tlsconfig) return opts, nil diff --git a/awsiotprotocol/wss.go b/awsiotprotocol/wss.go index 30dca081..4d2243ac 100644 --- a/awsiotprotocol/wss.go +++ b/awsiotprotocol/wss.go @@ -31,7 +31,7 @@ func (s Wss) Name() string { func (s Wss) NewClientOptions(opt *Config) (*mqtt.ClientOptions, error) { opts := mqtt.NewClientOptions() opts.AddBroker(opt.URL) - opts.SetClientID(opt.ClientId) + opts.SetClientID(opt.ClientID) opts.SetAutoReconnect(false) // use custom reconnection algorithm with offline queueing return opts, nil diff --git a/device.go b/device.go index c19e0250..03591c64 100644 --- a/device.go +++ b/device.go @@ -65,7 +65,7 @@ func New(opt *Options) *DeviceClient { KeyPath: opt.KeyPath, CertPath: opt.CertPath, CaPath: opt.CaPath, - ClientId: opt.ClientId, + ClientID: opt.ClientID, URL: opt.URL, }, ) diff --git a/options.go b/options.go index 0aa2207e..d7f60480 100644 --- a/options.go +++ b/options.go @@ -34,7 +34,7 @@ type Options struct { KeyPath string CertPath string CaPath string - ClientId string + ClientID string Region string BaseReconnectTime time.Duration MaximumReconnectTime time.Duration diff --git a/sample/main.go b/sample/main.go index 8dcc34ad..3c93f7d7 100644 --- a/sample/main.go +++ b/sample/main.go @@ -55,7 +55,7 @@ func main() { KeyPath: *privatePath, CertPath: *certPath, CaPath: *caPath, - ClientId: *thingName, + ClientID: *thingName, Region: *region, BaseReconnectTime: time.Millisecond * 50, MaximumReconnectTime: time.Second * 2, From b0448d3f3b46a69f206fbb0f0ae561aee11ace79 Mon Sep 17 00:00:00 2001 From: t-asaka Date: Fri, 14 Dec 2018 20:25:16 +0900 Subject: [PATCH 3/5] Add loader test --- awsiotprotocol/loader_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 awsiotprotocol/loader_test.go diff --git a/awsiotprotocol/loader_test.go b/awsiotprotocol/loader_test.go new file mode 100644 index 00000000..4048f3bc --- /dev/null +++ b/awsiotprotocol/loader_test.go @@ -0,0 +1,35 @@ +// Copyright 2018 SEQSENSE, Inc. +// +// Licensed 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 +// +// http://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 awsiotprotocol + +import ( + "testing" +) + +func TestByURL(t *testing.T) { + testcase := []struct { + input string + expected Protocol + }{ + {input: "mqtts://example.com", expected: Mqtts{}}, + {input: "wss://example.com", expected: Wss{}}, + } + for _, v := range testcase { + actual, _ := ByURL(v.input) + if actual != v.expected { + t.Errorf("awsiotprotocol.ByURL failed.\ninput: %#v\nactual: %#v\nexpected: %#v\n", v.input, actual, v.expected) + } + } +} From a38f7c168e1a6a3acd6ab1203f6cee6ed6e3f92b Mon Sep 17 00:00:00 2001 From: t-asaka Date: Mon, 17 Dec 2018 13:25:51 +0900 Subject: [PATCH 4/5] Add wss and mqtts protocol tests --- awsiotprotocol/mqtts_test.go | 48 +++++++++++++++++++++++++++++++ awsiotprotocol/wss_test.go | 48 +++++++++++++++++++++++++++++++ sample/samplecerts/cafile.pem | 21 ++++++++++++++ sample/samplecerts/client-crt.pem | 19 ++++++++++++ sample/samplecerts/client-key.pem | 27 +++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 awsiotprotocol/mqtts_test.go create mode 100644 awsiotprotocol/wss_test.go create mode 100644 sample/samplecerts/cafile.pem create mode 100644 sample/samplecerts/client-crt.pem create mode 100644 sample/samplecerts/client-key.pem diff --git a/awsiotprotocol/mqtts_test.go b/awsiotprotocol/mqtts_test.go new file mode 100644 index 00000000..7fe8b657 --- /dev/null +++ b/awsiotprotocol/mqtts_test.go @@ -0,0 +1,48 @@ +// Copyright 2018 SEQSENSE, Inc. +// +// Licensed 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 +// +// http://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 awsiotprotocol + +import ( + "testing" +) + +func TestMqttsName(t *testing.T) { + name := Mqtts{}.Name() + + if name != "mqtts" { + t.Fatalf("MQTTS protocol name is bad") + } +} + +func TestMqttsNewClientOptions(t *testing.T) { + opt := &Config{ + URL: "mqtts://example.com:8882", + ClientID: "mqttsclientid", + CaPath: "../sample/samplecerts/cafile.pem", + CertPath: "../sample/samplecerts/client-crt.pem", + KeyPath: "../sample/samplecerts/client-key.pem", + } + mqttOpts, _ := Mqtts{}.NewClientOptions(opt) + + if mqttOpts == nil { + t.Fatalf("MQTT.ClientOptions is nil") + } + if mqttOpts.Servers[0].Scheme != "ssl" || mqttOpts.Servers[0].Host != "example.com:8882" { + t.Fatalf("MQTT Broker does not add correctly") + } + if mqttOpts.ClientID != "mqttsclientid" { + t.Fatalf("MQTT ClientID does not set correctly") + } +} diff --git a/awsiotprotocol/wss_test.go b/awsiotprotocol/wss_test.go new file mode 100644 index 00000000..d6c0813f --- /dev/null +++ b/awsiotprotocol/wss_test.go @@ -0,0 +1,48 @@ +// Copyright 2018 SEQSENSE, Inc. +// +// Licensed 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 +// +// http://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 awsiotprotocol + +import ( + "testing" +) + +func TestWssName(t *testing.T) { + name := Wss{}.Name() + + if name != "wss" { + t.Fatalf("Wss protocol name is bad") + } +} + +func TestWssNewClientOptions(t *testing.T) { + opt := &Config{ + URL: "wss://example.com:443", + ClientID: "wssclientid", + } + mqttOpts, _ := Wss{}.NewClientOptions(opt) + + if mqttOpts == nil { + t.Fatalf("MQTT.ClientOptions is nil") + } + if mqttOpts.Servers[0].Scheme != "wss" || mqttOpts.Servers[0].Host != "example.com:443" { + t.Fatalf("MQTT Broker does not add correctly") + } + if mqttOpts.ClientID != "wssclientid" { + t.Fatalf("MQTT ClientID does not set correctly") + } + if mqttOpts.AutoReconnect != false { + t.Fatalf("MQTT AutoReconnect flag does not set correctly") + } +} diff --git a/sample/samplecerts/cafile.pem b/sample/samplecerts/cafile.pem new file mode 100644 index 00000000..2c72e886 --- /dev/null +++ b/sample/samplecerts/cafile.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDXTCCAkWgAwIBAgIJALYnx/0t6Jk3MA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV +BAYTAkpQMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX +aWRnaXRzIFB0eSBMdGQwHhcNMTgxMjE3MDQwMjIwWhcNMjExMDA2MDQwMjIwWjBF +MQswCQYDVQQGEwJKUDETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAthAKd0PmlpNTCFGsCPb4iZsa2FpFbiSCKp3mKa3Rn0I4YvaD6Xj+r5zb +P0qjoyyAOr4lxKBxBZYeAYEwopncRRCzfGi67Ei6r3AXrRdyGjzkIb3r9QFl+v9k +y66iuVwy0/7vLxekpBfheezWTQWrREgza6MSdBjAT+9Iy3yg0IThHbm9MhThUU24 +ctvcDlMjFLXqJfmK3ZRPp/aYNGyJ5zBchdiYlIPD9kSp6mhJdDdisDZs21whWY4p +2LeRF4rTZuESuMzruFI83vEddZsZhfwgjOZbDPv7yVKNDam+BJc/XIZtD5Lg6IFn +WsZLL0VoHbu1TUciPHDGzZq2y9U16wIDAQABo1AwTjAdBgNVHQ4EFgQUyRliehkq +AfXoEHbhCkx2qaLTk6cwHwYDVR0jBBgwFoAUyRliehkqAfXoEHbhCkx2qaLTk6cw +DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEASNXZpGT3sJw07EHrjdme +GuyHmd9JJcajIfb0fgcqY3SnXNfQEFR0y1aYhjK+K5I7pKdFwLddvZjNCqZzlCeZ +6KUrwPpdnbwQqAngLrv9NW4OpQzcVlZUiJTpW4kvXQilqY7Cw18VJiNRc5WI+tKQ +e14iQJ5QNCcfPzruS/xZgYsbJlWGAGIr++v0MLb/6nDRu3fKGbgGddnsXQpy5Iwq +5LLHYyhEQIGVeDvAmLap72ALHpga0A66iZc819sJnJD+oubi/zjKBmYNFnGqN3VM +wKghyH8PGxIOcsFYb+sg6u8vaDINoBNryAvOFGR00OnCmte1LwzrtIUBQ90THjAD +gA== +-----END CERTIFICATE----- diff --git a/sample/samplecerts/client-crt.pem b/sample/samplecerts/client-crt.pem new file mode 100644 index 00000000..2656d47e --- /dev/null +++ b/sample/samplecerts/client-crt.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDBjCCAe4CCQD6x2uvM9t8JjANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJK +UDETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMB4XDTE4MTIxNzA0MDMwN1oXDTIwMDQzMDA0MDMwN1owRTELMAkG +A1UEBhMCSlAxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0 +IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ANelzglDH82UizLklwhZp4f3r6uAIdplarCZLeBHAHmZrDKOvyKzVJLSvxWTY6VW +b54btFF+EQKCEqJ1FriY5fwDPn/AVQ+cZ0KznUbOtdZGk0Hn4Vdd6zlCxLD3uJyM +cgSjLUsm/oAme961CAiUi24mC4GdImcxMKDtOW++auHhZchU/z+i0QPtgv256JwU +bxd812bVfCXIMu92siYaahwYG5GCy6/J4fJ4OKyo1wDabzfOWmlF3ef+XZcyTQ9+ +lYFd6jxDDK7vqS1czkEbK/YiXXWXvn8mP9gdq0sJ3GveYqusYE+GnoDTdgckwaJ/ +pKkoadgxCTupYb0hmunTfBkCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAJdONlGfF +oKl+8qdPv8+30nLufwGk1UCLBvTufGUEB9k36lpvXrpp6G7oUZC78fvdqDZ5nCIJ +PIVcrmAjxbCLp/4vVBCrmir/uYsB6buI5RvackJaafwB8NHKRiJxlXFnk+wEeQCf +8ODlzinCdTjI90MnqlNBe8zPJtlPMncdi6k6dO3uoSG1lBjkUkG0ag+aglJQVf9r +t8/uk4gF684KeOJkWMq3H6O/H6CiCCOd3/GmE1Q+9GtW59hkecizdfJju7otzDwo +k0x2mKKUOD9rOoUUc+fqoq/YdPSYITeGHaRfX4EijsS63I1Q49QvASbxETRGgaF3 +ZmmCTX+2SfSJWg== +-----END CERTIFICATE----- diff --git a/sample/samplecerts/client-key.pem b/sample/samplecerts/client-key.pem new file mode 100644 index 00000000..be1e369b --- /dev/null +++ b/sample/samplecerts/client-key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA16XOCUMfzZSLMuSXCFmnh/evq4Ah2mVqsJkt4EcAeZmsMo6/ +IrNUktK/FZNjpVZvnhu0UX4RAoISonUWuJjl/AM+f8BVD5xnQrOdRs611kaTQefh +V13rOULEsPe4nIxyBKMtSyb+gCZ73rUICJSLbiYLgZ0iZzEwoO05b75q4eFlyFT/ +P6LRA+2C/bnonBRvF3zXZtV8Jcgy73ayJhpqHBgbkYLLr8nh8ng4rKjXANpvN85a +aUXd5/5dlzJND36VgV3qPEMMru+pLVzOQRsr9iJddZe+fyY/2B2rSwnca95iq6xg +T4aegNN2ByTBon+kqShp2DEJO6lhvSGa6dN8GQIDAQABAoIBAQCdOoehmy5J7r8b +CS3RacTLTtznVxHXsU/7mIOpXTtMba3uYsObIlNMhZnKul7Rwta42Yw8SoVOZdX+ +Ww6I4vn0J81eybV7H1bufBT09mv/4g8l41IaKCED69mLCeKxSXksRmkUvUab2vM/ +qpBD6UJLujNzekUGJghFnRDel2BIdX4oBSsTfTGEC5nNp/g30mymaNd4FhkmMccc +xry0FWc2DNbMI9HxZyb304p5myUSsBbPT+vzgRlsPw3zFQl7em5+Ljcnm2uKDMjw +TKeh8AZF9k6HI2ufs5xaJyPDTO6d6vJ9TPTInEZERPy47u1ib1q7ePKJau2RBS+2 +qpbscTQ9AoGBAPsIMjXSh0a0lpeogD6w+rMNxGlgrw3u9tKQ5CCFCW8dPtLTDoi8 +UvrqLo76NxlSsX4oPEhr9KodelgExswxZ4gs0sx9s5ktAl2j9xW5CPSbqHUHwO7d +9CRYygt7COLMgbqtP3Nroqe95zFQQWoqc/VdNWJfpL5iKCI5wbKAaZwDAoGBANvq +V0j0MmVEOjK/ayWTwhv0hJiZ0/tbeYLLSfB1deuo5bLL/qbtWdoRNJGOHIUh2Z7R ++eoRbz4UwhUmpx6FgjrnV4rmbv0u9UcjQJ1hsmPPe2kocWeQWw4OePYlqtj1U4OZ +QaQnK5sUfYXAC8X/qa2ZaRqxHE8SWDBxc7YpwSKzAoGAPVnuc4sFdrlSCLSsyyWT +z8jwlNSFVAFwH1w79NquyJI8NWhRqAdmvF4ZjOYIK08zg+KvgP+pZx4XNYXNVEBK +zlQuHL4n86q1Zk9ZZty3HJkiXZ/MflSOg4eTsaSbMlrK5eXLmRjYQui9pSa5JgpE +FtZ14pn/eGwi5OJ6vXZ22SMCgYEAoMUNsIjNetjJDyZ/R0ZhBpzYftMedMin6WWC +lWbZoUGlQvP9I72rDU+8tZhF41IezQvGf0blo2X7iQjr7dU+op9TkXjqtO8qYyoz +Z5rvliYtm2/0j/ipiHouFgztfJTEzBUzNrVoHIR7S1ddhA9m1UGs49WM04WesTOP +myGlTx8CgYABkSgiYTO1zlG26w+/lBGAj3GCvvlGgPWXFopIMiyzYVi7vKedvHHz +CU4D7Pzb8q71Eu42s+TAI+M5TVwITwR1HhndeH/ctiLI9zrrRZ/SdNP8oMYOGR+f +LB49n7W6q/8RKCbbporKrycxHkIl9ClBGoHJjREIV5/+dr/d4NiFaA== +-----END RSA PRIVATE KEY----- From 020715a85db07c3a263c99a0a1f7dd1d53a5d122 Mon Sep 17 00:00:00 2001 From: t-asaka Date: Tue, 18 Dec 2018 14:34:28 +0900 Subject: [PATCH 5/5] Address review comments --- awsiotprotocol/mqtts_test.go | 4 ++-- awsiotprotocol/wss_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/awsiotprotocol/mqtts_test.go b/awsiotprotocol/mqtts_test.go index 7fe8b657..540b333d 100644 --- a/awsiotprotocol/mqtts_test.go +++ b/awsiotprotocol/mqtts_test.go @@ -40,9 +40,9 @@ func TestMqttsNewClientOptions(t *testing.T) { t.Fatalf("MQTT.ClientOptions is nil") } if mqttOpts.Servers[0].Scheme != "ssl" || mqttOpts.Servers[0].Host != "example.com:8882" { - t.Fatalf("MQTT Broker does not add correctly") + t.Fatalf("Broker is not added") } if mqttOpts.ClientID != "mqttsclientid" { - t.Fatalf("MQTT ClientID does not set correctly") + t.Fatalf("ClientID is not set") } } diff --git a/awsiotprotocol/wss_test.go b/awsiotprotocol/wss_test.go index d6c0813f..c6c7b1bb 100644 --- a/awsiotprotocol/wss_test.go +++ b/awsiotprotocol/wss_test.go @@ -37,12 +37,12 @@ func TestWssNewClientOptions(t *testing.T) { t.Fatalf("MQTT.ClientOptions is nil") } if mqttOpts.Servers[0].Scheme != "wss" || mqttOpts.Servers[0].Host != "example.com:443" { - t.Fatalf("MQTT Broker does not add correctly") + t.Fatalf("Broker is not added") } if mqttOpts.ClientID != "wssclientid" { - t.Fatalf("MQTT ClientID does not set correctly") + t.Fatalf("ClientID is not set") } if mqttOpts.AutoReconnect != false { - t.Fatalf("MQTT AutoReconnect flag does not set correctly") + t.Fatalf("AutoReconnect flag is not set") } }