Skip to content

Commit

Permalink
Fix component ID priority bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-sheng committed Mar 9, 2023
1 parent 4118b65 commit d0e1667
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

* Fix wrong layer of metric `user error` in DynamoDB monitoring.
* Support to bind TLS status as a part of component for service topology.
* Fix component ID priority bug.

#### Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private Optional<Integer> tlsStatus(String tlsMode) {
// component ID, mtls = 142
return Optional.of(142);
case Const.TLS_MODE.TLS:
// component ID, mtls = 130
// component ID, tls = 130
return Optional.of(130);
case Const.TLS_MODE.NON_TLS:
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ private void init() throws InitialComponentCatalogException {
public boolean compare(int componentA, int componentB) {
final Integer priorityA = componentIDPriorities.getOrDefault(componentA, 50);
final Integer priorityB = componentIDPriorities.getOrDefault(componentB, 50);
return priorityA.compareTo(priorityB) > 0;
return priorityA.compareTo(priorityB) < 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public void testInitAndSettings() {
@Test
public void testPriority() {
ComponentLibraryCatalogService service = new ComponentLibraryCatalogService();
Assertions.assertEquals(false, service.compare(service.getComponentId("Unknown"), service.getComponentId("tcp")));
Assertions.assertEquals(false, service.compare(service.getComponentId("tcp"), service.getComponentId("tls")));
Assertions.assertEquals(false, service.compare(service.getComponentId("tls"), service.getComponentId("rpc")));
Assertions.assertEquals(false, service.compare(service.getComponentId("rpc"), service.getComponentId("http")));
Assertions.assertEquals(false, service.compare(service.getComponentId("http"), service.getComponentId("https")));
Assertions.assertEquals(false, service.compare(service.getComponentId("https"), service.getComponentId("SpringMVC")));
Assertions.assertEquals(true, service.compare(service.getComponentId("Unknown"), service.getComponentId("tcp")));
Assertions.assertEquals(true, service.compare(service.getComponentId("tcp"), service.getComponentId("tls")));
Assertions.assertEquals(true, service.compare(service.getComponentId("tls"), service.getComponentId("rpc")));
Assertions.assertEquals(true, service.compare(service.getComponentId("rpc"), service.getComponentId("http")));
Assertions.assertEquals(true, service.compare(service.getComponentId("http"), service.getComponentId("https")));
Assertions.assertEquals(true, service.compare(service.getComponentId("https"), service.getComponentId("SpringMVC")));

// Equal priority
Assertions.assertEquals(false, service.compare(service.getComponentId("Dubbo"), service.getComponentId("SpringMVC")));
Expand Down

0 comments on commit d0e1667

Please sign in to comment.