pfirmstone / JGDMS

Infrastructure for providing secured micro services, that are dynamically discoverable and searchable over ipv6 networks
https://pfirmstone.github.io/JGDMS/
Apache License 2.0
14 stars 4 forks source link

MethodKey.compareTo in StringMethodConstraints is broken. #123

Closed pfirmstone closed 3 years ago

pfirmstone commented 3 years ago

StringMethodConstraints is the replacement for BasicMethodConstraints, the recently added method StringMethodConstraints#combine allows two separate instances of StringMethodConstraints to be combined. This feature was created to ensure that a proxy, would have the constraints applied to it, as well as any constraints that were applied to the service via which it was downloaded, to ensure that it wasn't unintentionally left unconstrained.

The order of method descriptors contained within StringMethodConstraints is intended to be in a natural order of widening scope, such that the most narrowly scoped method descriptors are listed first, and method descriptors containing wild cards are last in that natural order.

The class MethodKey was created to arrange method descriptors in their required natural order, however the logic used in its compareTo method was incomplete and broken, this logic was originally taken from the BasicMethodConstraints#check method.

MethodKey requires a test case to ensure it is functioning as intended.

Additionally, the test cases for BasicMethodConstraints should be ported to StringMethodConstraints.