-
Notifications
You must be signed in to change notification settings - Fork 229
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
Add HttpTransportFactory class, make credentials serializable, add tests #69
Add HttpTransportFactory class, make credentials serializable, add tests #69
Conversation
This also updates the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have some very minor things. Thanks for the contribution!
import com.google.appengine.api.appidentity.AppIdentityService; | ||
import com.google.appengine.api.appidentity.AppIdentityService.GetAccessTokenResult; | ||
import com.google.appengine.api.appidentity.AppIdentityServiceFactory; | ||
import com.google.appengine.repackaged.com.google.common.collect.ImmutableSet; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
// Allow clock to be overriden by test code | ||
Clock clock = Clock.SYSTEM; | ||
// Until we expose this to the users it can remain transient and non-serializable | ||
transient Clock clock = Clock.SYSTEM; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
public String toString() { | ||
return toStringHelper() | ||
.add("clientId", clientId) | ||
.add("clientSecret", clientSecret) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Also related to #68 we should decide the java version we want to support adding something like the following to the <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin> Right now we are not specifying any java version, which defaults us to 1.5. This is a very old version and prevents from using features like try-with-resources and diamond operator. Any reason we are targeting 1.5? Can we explicitly target 1.7 instead? |
The change LGTM. It might be good to have one more reviewer. Regarding Java 1.5 vs 1.7 - @anthmgoogle should have more background on that than me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me from a product perspective.
I had some comments about the unit tests, but none are serious so no concerns with merging this in its current form, although some consideration or discussion of the comments may be good.
MockAppIdentityService appIdentity = new MockAppIdentityService(); | ||
GoogleCredentials credentials = new AppEngineCredentials(emptyScopes, appIdentity); | ||
GoogleCredentials otherCredentials = new AppEngineCredentials(scopes, appIdentity); | ||
assertFalse(credentials.hashCode() == otherCredentials.hashCode()); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
public class BaseSerializationTest { | ||
|
||
@SuppressWarnings("unchecked") | ||
public <T> T serializeAndDeserialize(T obj) throws IOException, ClassNotFoundException { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
@Test | ||
public void equals_false() throws IOException { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@anthmgoogle Thanks for the comments. Are you fine with using |
@mziccard regarding Java versions and dependencies: The original plan with dependencies for this library was to be consistent with the google-oauth-java-client and related libraries, which were constrained to older versions of Java because of the need to work on Android. For example, 2 years ago you could not using Java compiler 1.7 for that reason and had to stick to 1.6. I don't know if there is any existing use on Android, or if these constraints still apply. To play it safe I would keep the compiler version at 1.6 unless we confirm that 1.7 works on Android now. No concerns I'm aware of on the Guava version. |
https://developer.android.com/guide/platform/j8-jack.html |
From @lesv's link it seems that java7 should be safe to use. Also doing some digging in the library I found out it already uses classes introduced only since 1.7, see StandardCharsets usage, for instance. |
Cool. No concerns with these dependencies then. It sounds like we need to tread more carefully with Java 8. |
I added 4 commits that fix all the comments. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed deltas. LGTM.
Can you guys merge this PR? I still don't have write access here. Write access would also allow me to setup Travis. Do you know who has the rights to add users to this repo? |
I am one of the admins. I have given you admin access. |
Thank you @anthmgoogle |
No description provided.