smartdevicelink / sdl_javascript_suite

SmartDeviceLink library for applications developed in JavaScript
BSD 3-Clause "New" or "Revised" License
15 stars 13 forks source link

SystemCapabilityManager should automatically subscribe to capability updates and not save AppServiceCapabilities with duplicate serviceIDs #567

Closed renonick87 closed 1 year ago

renonick87 commented 1 year ago

Bug Summary

The SystemCapabilityManager needs to align with the other mobile SDL libraries to automatically subscribe to SystemCapability updates from SDL Core. This ensures that the library will be notified of updates as they happen. Additionally, if an update for an AppServiceCapability is received by the library with the same ServiceID as an existing capability and if the update doesn't include the ServiceUpdateReason.REMOVED, then it will result in duplicate AppServiceCapability objects being saved. The library should prevent this from happening. There are AppServiceCapability comparison methods that are missing from the library that would resolve this. The methods _updateAppServices and _matchesAppService would be added to the SystemCapabilityManager.

Reproduction Steps

  1. Run SystemCapabilityManager unit tests

Expected Behavior: The tests for updating an existing AppServiceCapability with the same serviceID will remove the old capability and replace it with the new one. The tests for handling capability subscriptions successfully subscribe to the required capabilities and can later verify that each capability is subscribed. The tests mentioned above should pass.

Observed Behavior: The tests mentioned above fail, AppServiceCapability objects with the same serviceID are allowed to coexist, and the capability updates are not automatically subscribed.

Which projects have you seen this bug on?

No response

JavaScript Version(s)

No response

sdl_javascript Version

1.7.0

Testing Environment(s)

Manticore v2.9.0

Relevant log output

No response

renonick87 commented 1 year ago

Resolved by https://github.com/smartdevicelink/sdl_javascript_suite/pull/566