Documentation ¶
Index ¶
- Variables
- func ClearDB(ctx context.Context, t *testing.T)
- func DecodeCbor(t *testing.T, data []byte) interface{}
- func DoHTTPRequest(t *testing.T, req *http.Request) *http.Response
- func EncodeToCbor(t *testing.T, v interface{}) []byte
- func FindDeviceByName(ctx context.Context, name string) (deviceID string, _ error)
- func FindResourceLink(href string) schema.ResourceLink
- func GetAllBackendResourceLinks() []schema.ResourceLink
- func GetRootCertificateAuthorities(t *testing.T) []*x509.Certificate
- func GetRootCertificatePool(t *testing.T) *x509.CertPool
- func MustFindDeviceByName(name string) (deviceID string)
- func MustGetHostname() string
- func NewSDKClient() (*local.Client, error)
- func OnboardDevSim(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, deviceID string, ...) func()
- func ResourceLinkToPublishEvent(deviceID string, instanceID int64, links []schema.ResourceLink) *pb.Event
- func ResourceLinkToResourceChangedEvent(deviceID string, l schema.ResourceLink) *pb.Event
- func ResourceLinksToExpectedResourceChangedEvents(deviceID string, links []schema.ResourceLink) map[string]*pb.Event
- func ResourceLinksToPb(deviceID string, s []schema.ResourceLink) []*pb.ResourceLink
- func SetUp(ctx context.Context, t *testing.T) (TearDown func())
- func SortResources(s []*pb.ResourceLink) []*pb.ResourceLink
- type HTTPRequestBuilder
- func (c *HTTPRequestBuilder) AddHeader(key, value string) *HTTPRequestBuilder
- func (c *HTTPRequestBuilder) AddQuery(key, value string) *HTTPRequestBuilder
- func (c *HTTPRequestBuilder) AuthToken(token string) *HTTPRequestBuilder
- func (c *HTTPRequestBuilder) Build(ctx context.Context, t *testing.T) *http.Request
- type SortResourcesByHref
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CertIdentity = "00000000-0000-0000-0000-000000000001" MfgCert = []byte(`-----BEGIN CERTIFICATE----- MIIB9zCCAZygAwIBAgIRAOwIWPAt19w7DswoszkVIEIwCgYIKoZIzj0EAwIwEzER MA8GA1UEChMIVGVzdCBPUkcwHhcNMTkwNTAyMjAwNjQ4WhcNMjkwMzEwMjAwNjQ4 WjBHMREwDwYDVQQKEwhUZXN0IE9SRzEyMDAGA1UEAxMpdXVpZDpiNWEyYTQyZS1i Mjg1LTQyZjEtYTM2Yi0wMzRjOGZjOGVmZDUwWTATBgcqhkjOPQIBBggqhkjOPQMB BwNCAAQS4eiM0HNPROaiAknAOW08mpCKDQmpMUkywdcNKoJv1qnEedBhWne7Z0jq zSYQbyqyIVGujnI3K7C63NRbQOXQo4GcMIGZMA4GA1UdDwEB/wQEAwIDiDAzBgNV HSUELDAqBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMBBgorBgEEAYLefAEG MAwGA1UdEwEB/wQCMAAwRAYDVR0RBD0wO4IJbG9jYWxob3N0hwQAAAAAhwR/AAAB hxAAAAAAAAAAAAAAAAAAAAAAhxAAAAAAAAAAAAAAAAAAAAABMAoGCCqGSM49BAMC A0kAMEYCIQDuhl6zj6gl2YZbBzh7Th0uu5izdISuU/ESG+vHrEp7xwIhANCA7tSt aBlce+W76mTIhwMFXQfyF3awWIGjOcfTV8pU -----END CERTIFICATE----- `) MfgKey = []byte(`-----BEGIN EC PRIVATE KEY----- MHcCAQEEIMPeADszZajrkEy4YvACwcbR0pSdlKG+m8ALJ6lj/ykdoAoGCCqGSM49 AwEHoUQDQgAEEuHojNBzT0TmogJJwDltPJqQig0JqTFJMsHXDSqCb9apxHnQYVp3 u2dI6s0mEG8qsiFRro5yNyuwutzUW0Dl0A== -----END EC PRIVATE KEY----- `) MfgTrustedCA = []byte(`-----BEGIN CERTIFICATE----- MIIBaTCCAQ+gAwIBAgIQR33gIB75I7Vi/QnMnmiWvzAKBggqhkjOPQQDAjATMREw DwYDVQQKEwhUZXN0IE9SRzAeFw0xOTA1MDIyMDA1MTVaFw0yOTAzMTAyMDA1MTVa MBMxETAPBgNVBAoTCFRlc3QgT1JHMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE xbwMaS8jcuibSYJkCmuVHfeV3xfYVyUq8Iroz7YlXaTayspW3K4hVdwIsy/5U+3U vM/vdK5wn2+NrWy45vFAJqNFMEMwDgYDVR0PAQH/BAQDAgEGMBMGA1UdJQQMMAoG CCsGAQUFBwMBMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0RBAQwAoIAMAoGCCqGSM49 BAMCA0gAMEUCIBWkxuHKgLSp6OXDJoztPP7/P5VBZiwLbfjTCVRxBvwWAiEAnzNu 6gKPwtKmY0pBxwCo3NNmzNpA6KrEOXE56PkiQYQ= -----END CERTIFICATE----- `) MfgTrustedCAKey = []byte(`-----BEGIN EC PRIVATE KEY----- MHcCAQEEICzfC16AqtSv3wt+qIbrgM8dTqBhHANJhZS5xCpH6P2roAoGCCqGSM49 AwEHoUQDQgAExbwMaS8jcuibSYJkCmuVHfeV3xfYVyUq8Iroz7YlXaTayspW3K4h VdwIsy/5U+3UvM/vdK5wn2+NrWy45vFAJg== -----END EC PRIVATE KEY----- `) )
View Source
var ( TestDeviceName string TestDevsimResources []schema.ResourceLink TestDevsimBackendResources []schema.ResourceLink )
Functions ¶
func DecodeCbor ¶
func EncodeToCbor ¶
func FindDeviceByName ¶
func FindResourceLink ¶
func FindResourceLink(href string) schema.ResourceLink
func GetAllBackendResourceLinks ¶
func GetAllBackendResourceLinks() []schema.ResourceLink
func GetRootCertificateAuthorities ¶
func GetRootCertificateAuthorities(t *testing.T) []*x509.Certificate
func MustFindDeviceByName ¶
func MustGetHostname ¶
func MustGetHostname() string
func NewSDKClient ¶
func OnboardDevSim ¶
func OnboardDevSim(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, deviceID string, gwHost string, expectedResources []schema.ResourceLink) func()
func ResourceLinkToResourceChangedEvent ¶
func ResourceLinkToResourceChangedEvent(deviceID string, l schema.ResourceLink) *pb.Event
func ResourceLinksToPb ¶
func ResourceLinksToPb(deviceID string, s []schema.ResourceLink) []*pb.ResourceLink
func SortResources ¶
func SortResources(s []*pb.ResourceLink) []*pb.ResourceLink
Types ¶
type HTTPRequestBuilder ¶
type HTTPRequestBuilder struct {
// contains filtered or unexported fields
}
func NewHTTPRequest ¶
func NewHTTPRequest(method, url string, body io.Reader) *HTTPRequestBuilder
func (*HTTPRequestBuilder) AddHeader ¶
func (c *HTTPRequestBuilder) AddHeader(key, value string) *HTTPRequestBuilder
func (*HTTPRequestBuilder) AddQuery ¶
func (c *HTTPRequestBuilder) AddQuery(key, value string) *HTTPRequestBuilder
func (*HTTPRequestBuilder) AuthToken ¶
func (c *HTTPRequestBuilder) AuthToken(token string) *HTTPRequestBuilder
type SortResourcesByHref ¶
type SortResourcesByHref []*pb.ResourceLink
func (SortResourcesByHref) Len ¶
func (a SortResourcesByHref) Len() int
func (SortResourcesByHref) Less ¶
func (a SortResourcesByHref) Less(i, j int) bool
func (SortResourcesByHref) Swap ¶
func (a SortResourcesByHref) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.