Skip to content

Commit

Permalink
update to plgd-dev/device to main
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed May 12, 2023
1 parent 33fa1bd commit 716d329
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cloud2cloud-gateway/service/retrieveDevice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func getDevicesBaseRepresentation(deviceID, deviceName, switchID string) Devices
links = append(links, test.DefaultSwitchResourceLink(deviceID, switchID))
for i := range links {
links[i].DeviceID = deviceID
links[i].Href = commands.NewResourceID(deviceID, links[i].Href).ToString()
links[i].Href = "/" + commands.NewResourceID(deviceID, links[i].Href).ToString()
}
return DevicesBaseRepresentation{
Device: GetDeviceResourceRepresentation(deviceID, deviceName),
Expand All @@ -71,7 +71,7 @@ func getDevicesAllRepresentation(deviceID, deviceName, switchID string) DevicesA
}
}
links = append(links, test.ResourceLinkRepresentation{
Href: commands.NewResourceID(deviceID, test.TestResourceSwitchesInstanceHref(switchID)).ToString(),
Href: "/" + commands.NewResourceID(deviceID, test.TestResourceSwitchesInstanceHref(switchID)).ToString(),
Representation: test.SwitchResourceRepresentation{},
})
return DevicesAllRepresentation{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/panjf2000/ants/v2 v2.7.3
github.com/pion/dtls/v2 v2.2.6
github.com/pion/logging v0.2.2
github.com/plgd-dev/device/v2 v2.2.1-0.20230509063201-5de544b46790
github.com/plgd-dev/device/v2 v2.2.1-0.20230509085510-2a60018de063
github.com/plgd-dev/go-coap/v3 v3.1.2-0.20230502085839-d07b10ac1104
github.com/plgd-dev/kit/v2 v2.0.0-20211006190727-057b33161b90
github.com/sirupsen/logrus v1.9.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ github.com/plgd-dev/device/v2 v2.2.1-0.20230505154727-15d6dd943f91 h1:ROTIkdZCVn
github.com/plgd-dev/device/v2 v2.2.1-0.20230505154727-15d6dd943f91/go.mod h1:DHu3RKPPT8KDFd2foCbQ7j0sD/lVLkycC5gBbf1xnuw=
github.com/plgd-dev/device/v2 v2.2.1-0.20230509063201-5de544b46790 h1:8FUTtge65yhlharMNFP27kDH8PNziX+nfZfQruFIwT4=
github.com/plgd-dev/device/v2 v2.2.1-0.20230509063201-5de544b46790/go.mod h1:DHu3RKPPT8KDFd2foCbQ7j0sD/lVLkycC5gBbf1xnuw=
github.com/plgd-dev/device/v2 v2.2.1-0.20230509085510-2a60018de063 h1:LTTnX1P4Wk9GfWuGLfQ9c9lcFc951Da7+UfhTzpCiXc=
github.com/plgd-dev/device/v2 v2.2.1-0.20230509085510-2a60018de063/go.mod h1:DHu3RKPPT8KDFd2foCbQ7j0sD/lVLkycC5gBbf1xnuw=
github.com/plgd-dev/go-coap/v2 v2.0.4-0.20200819112225-8eb712b901bc/go.mod h1:+tCi9Q78H/orWRtpVWyBgrr4vKFo2zYtbbxUllerBp4=
github.com/plgd-dev/go-coap/v2 v2.4.1-0.20210517130748-95c37ac8e1fa/go.mod h1:rA7fc7ar+B/qa+Q0hRqv7yj/EMtIlmo1l7vkQGSrHPU=
github.com/plgd-dev/go-coap/v3 v3.1.2-0.20230502085839-d07b10ac1104 h1:SEgcDe0Pfvoe5z0+3O3ePI+TzHBY0INnheCIZQs829k=
Expand Down
2 changes: 1 addition & 1 deletion resource-aggregate/commands/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (r *ResourceId) ToString() string {
}

func ResourceIdFromString(v string) *ResourceId {
if v[0] == '/' {
if len(v) > 0 && v[0] == '/' {
v = v[1:]
}
val := strings.SplitN(v, "/", 2)
Expand Down
2 changes: 1 addition & 1 deletion resource-directory/service/getEvents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func getOnboardEventForResource(t *testing.T, deviceID, href string) interface{} {
rid := commands.NewResourceID(deviceID, href)
for _, r := range test.GetAllBackendResourceRepresentations(deviceID, test.TestDeviceName) {
if r.Href == rid.ToString() {
if rid.ToString() == commands.ResourceIdFromString(r.Href).ToString() {
return pbTest.MakeResourceChanged(t, deviceID, href, "", r.Representation)
}
}
Expand Down
14 changes: 7 additions & 7 deletions test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,39 +270,39 @@ func GetAllBackendResourceRepresentations(deviceID, deviceName string) ResourceL
dev.ResourceTypes = nil
return ResourceLinkRepresentations{
{
Href: commands.NewResourceID(deviceID, TestResourceLightInstanceHref("1")).ToString(),
Href: "/" + commands.NewResourceID(deviceID, TestResourceLightInstanceHref("1")).ToString(),
Representation: LightResourceRepresentation{
Name: "Light",
Power: 0,
State: false,
},
},
{
Href: commands.NewResourceID(deviceID, configuration.ResourceURI).ToString(),
Href: "/" + commands.NewResourceID(deviceID, configuration.ResourceURI).ToString(),
Representation: configuration.Configuration{
Name: deviceName,
},
},
{
Href: commands.NewResourceID(deviceID, device.ResourceURI).ToString(),
Href: "/" + commands.NewResourceID(deviceID, device.ResourceURI).ToString(),
Representation: dev,
},
{
Href: commands.NewResourceID(deviceID, maintenance.ResourceURI).ToString(),
Href: "/" + commands.NewResourceID(deviceID, maintenance.ResourceURI).ToString(),
Representation: MaintenanceResourceRepresentation{},
},
{
Href: commands.NewResourceID(deviceID, platform.ResourceURI).ToString(),
Href: "/" + commands.NewResourceID(deviceID, platform.ResourceURI).ToString(),
Representation: platform.Platform{
ManufacturerName: "ocfcloud.com",
},
},
{
Href: commands.NewResourceID(deviceID, TestResourceSwitchesHref).ToString(),
Href: "/" + commands.NewResourceID(deviceID, TestResourceSwitchesHref).ToString(),
Representation: schema.ResourceLinks{},
},
{
Href: commands.NewResourceID(deviceID, plgdtime.ResourceURI).ToString(),
Href: "/" + commands.NewResourceID(deviceID, plgdtime.ResourceURI).ToString(),
Representation: PlgdTimeResourceRepresentation{},
},
}
Expand Down

0 comments on commit 716d329

Please sign in to comment.