test

package
v2.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestResourceSwitchesHref = "/switches"
)

Variables

View Source
var (
	TestDeviceName                     string
	TestDeviceNameWithOicResObservable string
	TestDeviceModelNumber              = "CS-0"
	TestDeviceSoftwareVersion          = "1.0.1-rc1"
	TestDeviceType                     device.Type

	TestResourceSwitchesInstanceResourceTypes = []string{types.BINARY_SWITCH}
	TestResourceSwitchesResourceTypes         = []string{collection.ResourceType}
	TestResourceLightInstanceResourceTypes    = []string{types.CORE_LIGHT}
	TestResourceDeviceResourceTypes           = []string{types.DEVICE_CLOUD, schemaDevice.ResourceType}
)

Functions

func AddDeviceSwitchResources

func AddDeviceSwitchResources(ctx context.Context, t *testing.T, deviceID string, c pb.GrpcGatewayClient, resourceIDs ...string) []schema.ResourceLink

func AssertToCheckFunc

func AssertToCheckFunc(checFunc func(t assert.TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool) func(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...interface{})

func CheckProtobufs

func CheckProtobufs(t *testing.T, expected interface{}, actual interface{}, checkFunc func(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...interface{}))

func CleanUpResourcesArray

func CleanUpResourcesArray(resources []*commands.Resource) []*commands.Resource

func DecodeCbor

func DecodeCbor(t *testing.T, data []byte) interface{}
func DefaultSwitchResourceLink(deviceID, id string) schema.ResourceLink

func DeviceIsBatchObservable added in v2.13.1

func DeviceIsBatchObservable(ctx context.Context, t *testing.T, deviceID string) bool

func EncodeToCbor

func EncodeToCbor(t *testing.T, v interface{}) []byte

func EncodeToSortedCbor added in v2.16.0

func EncodeToSortedCbor(v interface{}) ([]byte, error)

func FieldJsonTag

func FieldJsonTag(v interface{}, fieldName string) string

Get json tag of field with given name in struct v

func FilterResourceLink(filter func(schema.ResourceLink) bool, links []schema.ResourceLink) []schema.ResourceLink

func GenerateDeviceIDbyIdx added in v2.16.0

func GenerateDeviceIDbyIdx(deviceIndex int) string

func GenerateIDbyIdx added in v2.16.0

func GenerateIDbyIdx(prefix string, deviceIndex int) string
func GetAllBackendResourceLinks() schema.ResourceLinks

func GetDeviceResourceRepresentation added in v2.7.16

func GetDeviceResourceRepresentation(deviceID, deviceName string) schemaDevice.Device

func GetIotivityLiteVersion added in v2.13.1

func GetIotivityLiteVersion(t *testing.T, deviceID string) uint32

func GetResource added in v2.13.1

func GetResource(ctx context.Context, deviceID, resourceURI, resourceType string, resp interface{}, opts ...deviceClient.GetOption) error

func GetRootCertificateAuthorities

func GetRootCertificateAuthorities(t *testing.T) []*x509.Certificate

func GetRootCertificatePool

func GetRootCertificatePool(t *testing.T) *x509.CertPool

func IsDiscoveryResourceBatchObservable added in v2.3.7

func IsDiscoveryResourceBatchObservable(ctx context.Context, t *testing.T, deviceID string) bool

func IsListenSocketClosed added in v2.16.1

func IsListenSocketClosed(t require.TestingT, target string, addStr string) bool

func MakeSwitchResourceData

func MakeSwitchResourceData(overrides map[string]interface{}) map[string]interface{}

func MakeSwitchResourceDefaultData

func MakeSwitchResourceDefaultData() map[string]interface{}

func MustFindDeviceByName

func MustFindDeviceByName(name string) (deviceID string)

func MustFindTestDevice added in v2.16.4

func MustFindTestDevice() device.Device

func MustGetHostname

func MustGetHostname() string

func NATSSStart

func NATSSStart(ctx context.Context, t *testing.T)

func NATSSStop

func NATSSStop(ctx context.Context, t *testing.T)

func OffBoardDevSim added in v2.7.8

func OffBoardDevSim(ctx context.Context, t *testing.T, deviceID string)

func OffboardDevice added in v2.16.4

func OffboardDevice(ctx context.Context, t *testing.T, d device.Device)

func OnboardDevSim

func OnboardDevSim(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, deviceID, hubEndpoint string, expectedResources []schema.ResourceLink) (string, func())

func OnboardDevSimForClient

func OnboardDevSimForClient(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, clientID, deviceID, hubEndpoint string, expectedResources []schema.ResourceLink) (string, func())

func OnboardDevice added in v2.16.4

func OnboardDevice(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, d device.Device, hubEndpoint string, expectedResources []schema.ResourceLink) func()

func OnboardDeviceForClient added in v2.16.4

func OnboardDeviceForClient(ctx context.Context, t *testing.T, c pb.GrpcGatewayClient, d device.Device, clientID, hubEndpoint string, expectedResources []schema.ResourceLink) func()

func ProtobufToInterface

func ProtobufToInterface(t *testing.T, val interface{}) interface{}

func RequireToCheckFunc

func RequireToCheckFunc(checFunc func(t require.TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{})) func(t *testing.T, expected interface{}, actual interface{}, msgAndArgs ...interface{})

func ResourceLinksToResourceIds

func ResourceLinksToResourceIds(deviceID string, s []schema.ResourceLink) []*commands.ResourceId

func ResourceLinksToResources

func ResourceLinksToResources(deviceID string, s []schema.ResourceLink) []*commands.Resource

func ResourceLinksToResources2

func ResourceLinksToResources2(deviceID string, s []schema.ResourceLink) []*pb.Resource

func SortResources

func SortResources(s commands.Resources) commands.Resources

func StringToApplicationProtocol added in v2.7.0

func StringToApplicationProtocol(p string) commands.Connection_Protocol

func TestResourceLightInstanceHref

func TestResourceLightInstanceHref(id string) string

func TestResourceSwitchesInstanceHref

func TestResourceSwitchesInstanceHref(id string) string

func WaitForDevice added in v2.3.1

func WaitForDevice(t *testing.T, client pb.GrpcGateway_SubscribeToEventsClient, deviceID, subID, correlationID string, expectedResources []schema.ResourceLink)

Types

type CollectionLinkRepresentation added in v2.13.1

type CollectionLinkRepresentation struct {
	Href           string      `json:"href"`
	Representation interface{} `json:"rep"`
}

type CollectionLinkRepresentations added in v2.13.1

type CollectionLinkRepresentations []CollectionLinkRepresentation

type LightResourceRepresentation added in v2.7.16

type LightResourceRepresentation struct {
	Name  string `json:"name"`
	Power uint64 `json:"power"`
	State bool   `json:"state"`
}

type MaintenanceResourceRepresentation added in v2.7.16

type MaintenanceResourceRepresentation struct {
	FactoryReset bool `json:"fr"`
}

type PlgdTimeResourceRepresentation added in v2.7.16

type PlgdTimeResourceRepresentation struct {
	Time           string `json:"time"`
	LastSyncedTime string `json:"lastSyncedTime"`
}

type ResourceLinkRepresentation added in v2.7.16

type ResourceLinkRepresentation struct {
	Href           string      /*`json:"href"`*/
	ResourceTypes  []string    /*`json:"rt"`*/
	Representation interface{} /*`json:"rep"`*/
}

func (*ResourceLinkRepresentation) MarshalJSON added in v2.7.16

func (d *ResourceLinkRepresentation) MarshalJSON() ([]byte, error)

func (*ResourceLinkRepresentation) UnmarshalJSON added in v2.7.16

func (d *ResourceLinkRepresentation) UnmarshalJSON(data []byte) error

type ResourceLinkRepresentations added in v2.7.16

type ResourceLinkRepresentations []ResourceLinkRepresentation

func GetAllBackendResourceRepresentations added in v2.7.16

func GetAllBackendResourceRepresentations(t *testing.T, deviceID, deviceName string) ResourceLinkRepresentations

func (ResourceLinkRepresentations) Sort added in v2.7.16

type SwitchResourceRepresentation added in v2.7.16

type SwitchResourceRepresentation struct {
	Value bool `json:"value"`
}

Directories

Path Synopsis
coap-gateway
ocf
iotivity-lite
oauth-server
uri
pb
cmd
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL