-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from seqsense/fix_options_field_name
Fix options field name
- Loading branch information
Showing
14 changed files
with
215 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("Broker is not added") | ||
} | ||
if mqttOpts.ClientID != "mqttsclientid" { | ||
t.Fatalf("ClientID is not set") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("Broker is not added") | ||
} | ||
if mqttOpts.ClientID != "wssclientid" { | ||
t.Fatalf("ClientID is not set") | ||
} | ||
if mqttOpts.AutoReconnect != false { | ||
t.Fatalf("AutoReconnect flag is not set") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpAIBAAKCAQEA16XOCUMfzZSLMuSXCFmnh/evq4Ah2mVqsJkt4EcAeZmsMo6/ | ||
IrNUktK/FZNjpVZvnhu0UX4RAoISonUWuJjl/AM+f8BVD5xnQrOdRs611kaTQefh | ||
V13rOULEsPe4nIxyBKMtSyb+gCZ73rUICJSLbiYLgZ0iZzEwoO05b75q4eFlyFT/ | ||
P6LRA+2C/bnonBRvF3zXZtV8Jcgy73ayJhpqHBgbkYLLr8nh8ng4rKjXANpvN85a | ||
aUXd5/5dlzJND36VgV3qPEMMru+pLVzOQRsr9iJddZe+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