Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

remove Apache commons lang dependency#1272

Merged
elharo merged 12 commits intomasterfrom
equals
Jan 25, 2021
Merged

remove Apache commons lang dependency#1272
elharo merged 12 commits intomasterfrom
equals

Conversation

@elharo
Copy link
Copy Markdown
Contributor

@elharo elharo commented Jan 15, 2021

@elharo elharo requested review from a team January 15, 2021 14:27
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jan 15, 2021
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 15, 2021

Codecov Report

Merging #1272 (77aa124) into master (da366ea) will increase coverage by 0.06%.
The diff coverage is 87.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1272      +/-   ##
============================================
+ Coverage     79.16%   79.23%   +0.06%     
- Complexity     1228     1236       +8     
============================================
  Files           209      209              
  Lines          5362     5378      +16     
  Branches        448      454       +6     
============================================
+ Hits           4245     4261      +16     
+ Misses          939      938       -1     
- Partials        178      179       +1     
Impacted Files Coverage Δ Complexity Δ
...java/com/google/api/gax/rpc/UnaryCallSettings.java 96.61% <87.50%> (-3.39%) 13.00 <7.00> (+7.00) ⬇️
.../java/com/google/api/gax/batching/BatcherImpl.java 98.06% <0.00%> (+1.29%) 17.00% <0.00%> (+1.00%)

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 da366ea...77aa124. Read the comment docs.

Copy link
Copy Markdown
Contributor Author

@elharo elharo left a comment

Choose a reason for hiding this comment

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

go/friendly-ping

Copy link
Copy Markdown
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

This is less important as it's a test dependency.

Comment on lines -271 to -341
private static class FakeSettings extends ClientSettings {

public UnaryCallSettings<Integer, Integer> fakeMethodSimple() {
return ((FakeStubSettings) getStubSettings()).fakeMethodSimple();
}

public PagedCallSettings<Integer, Integer, FakePagedListResponse> fakePagedMethod() {
return ((FakeStubSettings) getStubSettings()).fakePagedMethod();
}

public BatchingCallSettings<Integer, Integer> fakeMethodBatching() {
return ((FakeStubSettings) getStubSettings()).fakeMethodBatching();
}

public static Builder newBuilder() {
return Builder.createDefault();
}

public Builder toBuilder() {
return new Builder(this);
}

private FakeSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
}

private static class Builder extends ClientSettings.Builder {

protected Builder() throws IOException {
this((ClientContext) null);
}

protected Builder(ClientContext clientContext) {
super(FakeStubSettings.newBuilder(clientContext));
}

private static Builder createDefault() {
return new Builder(FakeStubSettings.newBuilder());
}

protected Builder(FakeSettings settings) {
super(settings.getStubSettings().toBuilder());
}

protected Builder(FakeStubSettings.Builder stubSettings) {
super(stubSettings);
}

public FakeStubSettings.Builder getStubSettingsBuilder() {
return ((FakeStubSettings.Builder) getStubSettings());
}

public UnaryCallSettings.Builder<Integer, Integer> fakeMethodSimple() {
return getStubSettingsBuilder().fakeMethodSimple();
}

public PagedCallSettings.Builder<Integer, Integer, FakePagedListResponse> fakePagedMethod() {
return getStubSettingsBuilder().fakePagedMethod();
}

public BatchingCallSettings.Builder<Integer, Integer> fakeMethodBatching() {
return getStubSettingsBuilder().fakeMethodBatching();
}

@Override
public FakeSettings build() throws IOException {
return new FakeSettings(this);
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these are used to simulate a gapic generated client

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you elaborate? It looks to me like this is simply testing that a fake is equal to a fake. I don't see where it tests any model code. What am I not seeing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TestSettingsTest#callSettingsBuildFromTimeoutNoRetries() seems like the only legit test here (that one which is not testing fake vs fake), and that one is not completely removed. So the cleanup looks legit to me.

Copy link
Copy Markdown
Contributor Author

@elharo elharo left a comment

Choose a reason for hiding this comment

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

FYI, although commons-lang is only a test dependency it seems to interfere with bazel builds when different hashes get pulled in from transitive dependencies so I really would like to get rid of this.

Comment on lines -271 to -341
private static class FakeSettings extends ClientSettings {

public UnaryCallSettings<Integer, Integer> fakeMethodSimple() {
return ((FakeStubSettings) getStubSettings()).fakeMethodSimple();
}

public PagedCallSettings<Integer, Integer, FakePagedListResponse> fakePagedMethod() {
return ((FakeStubSettings) getStubSettings()).fakePagedMethod();
}

public BatchingCallSettings<Integer, Integer> fakeMethodBatching() {
return ((FakeStubSettings) getStubSettings()).fakeMethodBatching();
}

public static Builder newBuilder() {
return Builder.createDefault();
}

public Builder toBuilder() {
return new Builder(this);
}

private FakeSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
}

private static class Builder extends ClientSettings.Builder {

protected Builder() throws IOException {
this((ClientContext) null);
}

protected Builder(ClientContext clientContext) {
super(FakeStubSettings.newBuilder(clientContext));
}

private static Builder createDefault() {
return new Builder(FakeStubSettings.newBuilder());
}

protected Builder(FakeSettings settings) {
super(settings.getStubSettings().toBuilder());
}

protected Builder(FakeStubSettings.Builder stubSettings) {
super(stubSettings);
}

public FakeStubSettings.Builder getStubSettingsBuilder() {
return ((FakeStubSettings.Builder) getStubSettings());
}

public UnaryCallSettings.Builder<Integer, Integer> fakeMethodSimple() {
return getStubSettingsBuilder().fakeMethodSimple();
}

public PagedCallSettings.Builder<Integer, Integer, FakePagedListResponse> fakePagedMethod() {
return getStubSettingsBuilder().fakePagedMethod();
}

public BatchingCallSettings.Builder<Integer, Integer> fakeMethodBatching() {
return getStubSettingsBuilder().fakeMethodBatching();
}

@Override
public FakeSettings build() throws IOException {
return new FakeSettings(this);
}
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you elaborate? It looks to me like this is simply testing that a fake is equal to a fake. I don't see where it tests any model code. What am I not seeing?

Copy link
Copy Markdown
Contributor Author

@elharo elharo left a comment

Choose a reason for hiding this comment

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

PTAL

Copy link
Copy Markdown
Contributor Author

@elharo elharo left a comment

Choose a reason for hiding this comment

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

Ping ping ping

Copy link
Copy Markdown
Contributor

@vam-google vam-google left a comment

Choose a reason for hiding this comment

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

LGTM.

I never liked that dependency anyways. And the removed testing logic seems really testing fake vs fake (except TestSettingsTest#callSettingsBuildFromTimeoutNoRetries(), but that test is not removed, so it is all good).

(I'm not sure about the transitive dependency issue note, since bazel does not have transitive dependencies and everything is pulled explicitly, but whatever.)

}

@Override
public int hashCode() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are equals/hascode manually written? Not a big deal but it is better to have equals/hashcode implementation in gax consistent with the others.

Comment on lines -271 to -341
private static class FakeSettings extends ClientSettings {

public UnaryCallSettings<Integer, Integer> fakeMethodSimple() {
return ((FakeStubSettings) getStubSettings()).fakeMethodSimple();
}

public PagedCallSettings<Integer, Integer, FakePagedListResponse> fakePagedMethod() {
return ((FakeStubSettings) getStubSettings()).fakePagedMethod();
}

public BatchingCallSettings<Integer, Integer> fakeMethodBatching() {
return ((FakeStubSettings) getStubSettings()).fakeMethodBatching();
}

public static Builder newBuilder() {
return Builder.createDefault();
}

public Builder toBuilder() {
return new Builder(this);
}

private FakeSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
}

private static class Builder extends ClientSettings.Builder {

protected Builder() throws IOException {
this((ClientContext) null);
}

protected Builder(ClientContext clientContext) {
super(FakeStubSettings.newBuilder(clientContext));
}

private static Builder createDefault() {
return new Builder(FakeStubSettings.newBuilder());
}

protected Builder(FakeSettings settings) {
super(settings.getStubSettings().toBuilder());
}

protected Builder(FakeStubSettings.Builder stubSettings) {
super(stubSettings);
}

public FakeStubSettings.Builder getStubSettingsBuilder() {
return ((FakeStubSettings.Builder) getStubSettings());
}

public UnaryCallSettings.Builder<Integer, Integer> fakeMethodSimple() {
return getStubSettingsBuilder().fakeMethodSimple();
}

public PagedCallSettings.Builder<Integer, Integer, FakePagedListResponse> fakePagedMethod() {
return getStubSettingsBuilder().fakePagedMethod();
}

public BatchingCallSettings.Builder<Integer, Integer> fakeMethodBatching() {
return getStubSettingsBuilder().fakeMethodBatching();
}

@Override
public FakeSettings build() throws IOException {
return new FakeSettings(this);
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TestSettingsTest#callSettingsBuildFromTimeoutNoRetries() seems like the only legit test here (that one which is not testing fake vs fake), and that one is not completely removed. So the cleanup looks legit to me.

@elharo elharo merged commit c41fb62 into master Jan 25, 2021
@elharo elharo deleted the equals branch January 25, 2021 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dependency on org.apache.commons:commons-lang3:3.6

4 participants