Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying no default port when building PropertiesEndpointGroup #993

Merged
merged 1 commit into from Feb 6, 2018

Conversation

trustin
Copy link
Member

@trustin trustin commented Feb 6, 2018

Motivation:

A user does not always want to specify the default port number when
building a PropertiesEndpointGroup, especially for HTTP and HTTPS
endpoints that run on their default ports.

Modifications:

  • Add two overloaded factory methods that do not require 'defaultPort'
  • Fix off-by-one validation bug with 'defaultPort'
  • Overall clean-up on Javadoc and exception messages

Result:

  • A user can build PropertiesEndpointGroup without defaultPort
  • Specifying 0 as defaultPort will trigger an exception at earlier point

getClass().getClassLoader(), "server-list.properties", "serverA.hosts");

assertThat(endpointGroup.endpoints()).containsOnly(Endpoint.of("127.0.0.1:8080"),
Endpoint.of("127.0.0.1:8081"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: alignment :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed :-)

@trustin
Copy link
Member Author

trustin commented Feb 6, 2018

Removed the 'defect' label because the exception message is actually correct. I made the exception is raised at earlier point for less confusion and correctness.

@codecov
Copy link

codecov bot commented Feb 6, 2018

Codecov Report

Merging #993 into master will decrease coverage by 0.01%.
The diff coverage is 84.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #993      +/-   ##
==========================================
- Coverage   72.27%   72.26%   -0.02%     
==========================================
  Files         505      505              
  Lines       21957    21967      +10     
  Branches     2683     2684       +1     
==========================================
+ Hits        15870    15874       +4     
- Misses       4668     4677       +9     
+ Partials     1419     1416       -3
Impacted Files Coverage Δ
...ain/java/com/linecorp/armeria/client/Endpoint.java 69.51% <0%> (+0.83%) ⬆️
...meria/client/endpoint/PropertiesEndpointGroup.java 88.37% <88.88%> (+16.49%) ⬆️
...armeria/server/tomcat/Tomcat85ProtocolHandler.java 54.54% <0%> (-9.1%) ⬇️
...meria/internal/AbstractHttp2ConnectionHandler.java 76.31% <0%> (-5.27%) ⬇️
.../linecorp/armeria/server/tomcat/TomcatService.java 61.27% <0%> (-4.69%) ⬇️
...linecorp/armeria/internal/Http2GoAwayListener.java 76% <0%> (-4%) ⬇️
...corp/armeria/common/logging/DefaultRequestLog.java 78.93% <0%> (-0.26%) ⬇️
...corp/armeria/common/stream/FixedStreamMessage.java 92.98% <0%> (+1.75%) ⬆️
...meria/common/stream/RegularFixedStreamMessage.java 89.36% <0%> (+6.38%) ⬆️
...com/linecorp/armeria/internal/grpc/GrpcStatus.java 44.44% <0%> (+11.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c002446...c967d01. Read the comment docs.

Motivation:

A user does not always want to specify the default port number when
building a PropertiesEndpointGroup, especially for HTTP and HTTPS
endpoints that run on their default ports.

Modifications:

- Add two overloaded factory methods that do not require 'defaultPort'
- Fix off-by-one validation bug with 'defaultPort'
- Overall clean-up on Javadoc and exception messages

Result:

- A user can build PropertiesEndpointGroup without defaultPort
- Specifying 0 as defaultPort will trigger an exception at earlier
  point.
@trustin
Copy link
Member Author

trustin commented Feb 6, 2018

Updated the test case to increase the test coverage.

@trustin trustin merged commit 8db26bc into line:master Feb 6, 2018
@trustin trustin deleted the fix_props_endpoint_groups branch February 6, 2018 05:53
@trustin
Copy link
Member Author

trustin commented Feb 6, 2018

Thanks, reviewers!

fmguerreiro pushed a commit to fmguerreiro/armeria that referenced this pull request Sep 19, 2020
line#993)

Motivation:

A user does not always want to specify the default port number when
building a PropertiesEndpointGroup, especially for HTTP and HTTPS
endpoints that run on their default ports.

Modifications:

- Add two overloaded factory methods that do not require 'defaultPort'
- Fix off-by-one validation bug with 'defaultPort'
- Overall clean-up on Javadoc and exception messages

Result:

- A user can build PropertiesEndpointGroup without defaultPort
- Specifying 0 as defaultPort will trigger an exception at earlier
  point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants