Interactions-HSG / wot-td-java

A Java library for the W3C WoT Thing Description: https://www.w3.org/TR/wot-thing-description/
Other
8 stars 7 forks source link

Generalize the lib's binding API #145

Open vcharpenay opened 1 year ago

vcharpenay commented 1 year ago

The code base to merge has a generic API for protocol bindings. See the entry point bindings.ProtocolBindings. Clients can initiate operations without knowledge of the underlying protocol (HTTP, CoAP or anything else), as suggested in #72.

HTTP and CoAP bindings have been updated accordingly. Other protocol bindings are available for OPC-UA and for ROS.

The README isn't up to date regarding e.g. TdHttpRequest. It should be updated before merging.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 61.62% and project coverage change: -2.07 :warning:

Comparison is base (e48a1d4) 87.53% compared to head (ea17fda) 85.46%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #145 +/- ## ============================================ - Coverage 87.53% 85.46% -2.07% - Complexity 504 547 +43 ============================================ Files 43 53 +10 Lines 1901 2071 +170 Branches 254 283 +29 ============================================ + Hits 1664 1770 +106 - Misses 161 220 +59 - Partials 76 81 +5 ``` | [Impacted Files](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG) | Coverage Δ | | |---|---|---| | [...nisg/ics/interactions/wot/td/affordances/Link.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9hZmZvcmRhbmNlcy9MaW5rLmphdmE=) | `0.00% <0.00%> (ø)` | | | [...wot/td/bindings/BindingNotRegisteredException.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9iaW5kaW5ncy9CaW5kaW5nTm90UmVnaXN0ZXJlZEV4Y2VwdGlvbi5qYXZh) | `0.00% <0.00%> (ø)` | | | [...ractions/wot/td/bindings/InvalidFormException.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9iaW5kaW5ncy9JbnZhbGlkRm9ybUV4Y2VwdGlvbi5qYXZh) | `0.00% <0.00%> (ø)` | | | [...s/interactions/wot/td/security/SecurityScheme.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9zZWN1cml0eS9TZWN1cml0eVNjaGVtZS5qYXZh) | `100.00% <ø> (ø)` | | | [...ions/wot/td/security/TokenBasedSecurityScheme.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9zZWN1cml0eS9Ub2tlbkJhc2VkU2VjdXJpdHlTY2hlbWUuamF2YQ==) | `100.00% <ø> (ø)` | | | [...unisg/ics/interactions/wot/td/vocabularies/TD.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC92b2NhYnVsYXJpZXMvVEQuamF2YQ==) | `0.00% <ø> (ø)` | | | [...eractions/wot/td/bindings/coap/TDCoapResponse.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9iaW5kaW5ncy9jb2FwL1REQ29hcFJlc3BvbnNlLmphdmE=) | `66.66% <20.00%> (ø)` | | | [...ractions/wot/td/bindings/coap/TDCoapOperation.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9iaW5kaW5ncy9jb2FwL1REQ29hcE9wZXJhdGlvbi5qYXZh) | `40.00% <40.00%> (ø)` | | | [...ractions/wot/td/bindings/http/TDHttpOperation.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9iaW5kaW5ncy9odHRwL1RESHR0cE9wZXJhdGlvbi5qYXZh) | `48.27% <48.27%> (ø)` | | | [...eractions/wot/td/bindings/NoResponseException.java](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG#diff-c3JjL21haW4vamF2YS9jaC91bmlzZy9pY3MvaW50ZXJhY3Rpb25zL3dvdC90ZC9iaW5kaW5ncy9Ob1Jlc3BvbnNlRXhjZXB0aW9uLmphdmE=) | `50.00% <50.00%> (ø)` | | | ... and [12 more](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG) | | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/Interactions-HSG/wot-td-java/pull/145/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Interactions-HSG)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

danaivach commented 1 year ago

Hi @vcharpenay, I have this PR in mind to be looked this week (also see how to increase coverage to target).

Would you consider the branch stable enough to be merged with main?

vcharpenay commented 1 year ago

We've used this version of the lib in the ai4industry summer school last week. I also used it in another project. The binding API has been quite stable since then, and we haven't found bugs in the HTTP binding so far. I haven't tried to integrate the CoAP binding, though. I don't have a test bed for that.

danaivach commented 1 year ago

@vcharpenay is the README up to date?