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

Simplify TransportAddress #20798

Merged
merged 2 commits into from Oct 7, 2016

Conversation

Projects
None yet
2 participants
@s1monw
Copy link
Contributor

commented Oct 7, 2016

since TransportAddress is now final we can simplify it's interface a bit
and remove methods that are only used in tests or are plain delegates.

Simplify TransportAddress
since TransportAddress is now final we can simplify it's interface a bit
and remove methods that are only used in tests or are plain delegates.
@jasontedor
Copy link
Member

left a comment

I left a minor nit, it doesn't matter to me if you address it or not. LGTM.

@@ -144,8 +145,10 @@ static void log(final Logger logger, final String error) {
*/
// visible for testing
static boolean enforceLimits(BoundTransportAddress boundTransportAddress) {
return !(Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(TransportAddress::isLoopbackOrLinkLocalAddress) &&
boundTransportAddress.publishAddress().isLoopbackOrLinkLocalAddress());
Predicate<TransportAddress> isLoopbackOrLinkLocalAddress = (t) -> t.address().getAddress().isLinkLocalAddress()

This comment has been minimized.

Copy link
@jasontedor

jasontedor Oct 7, 2016

Member

The parentheses around t are unnecessary.

"open sesame", emptyMap());
ReindexRequestBuilder request = ReindexAction.INSTANCE.newRequestBuilder(client()).source("source").destination("dest")
.setRemoteInfo(remote);
assertThat(request.get(), matcher().created(1));
}

public void testReindexSendsHeaders() throws Exception {
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,

This comment has been minimized.

Copy link
@jasontedor

jasontedor Oct 7, 2016

Member

Checkstyle is unhappy with this.

@@ -107,7 +107,7 @@ public void testReindexSendsHeaders() throws Exception {
}

public void testReindexWithoutAuthenticationWhenRequired() throws Exception {
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,

This comment has been minimized.

Copy link
@jasontedor

jasontedor Oct 7, 2016

Member

Checkstyle is unhappy with this.

@@ -125,7 +125,7 @@ public void testReindex() throws Exception {
public void testReindexFromRemote() throws Exception {
NodeInfo nodeInfo = client().admin().cluster().prepareNodesInfo().get().getNodes().get(0);
TransportAddress address = nodeInfo.getHttp().getAddress().publishAddress();
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,

This comment has been minimized.

Copy link
@jasontedor

jasontedor Oct 7, 2016

Member

Checkstyle is unhappy with this.

@s1monw s1monw merged commit 7452028 into elastic:master Oct 7, 2016

1 of 2 checks passed

elasticsearch-ci Build started sha1 is merged.
Details
CLA Commit author is a member of Elasticsearch
Details

@s1monw s1monw deleted the s1monw:simplify_transport_address branch Oct 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.