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

Add a constructor to support tolerance for various time units #174

Merged
merged 1 commit into from
Jan 29, 2019
Merged

Add a constructor to support tolerance for various time units #174

merged 1 commit into from
Jan 29, 2019

Conversation

pbheemag
Copy link
Contributor

Description

Added overloaded constructor with an additional TimeUnit field which would convert the given tolerance to milli seconds

Motivation and Context

#173

Testing

Modified the test class to run with Parameterized.class to run all the existing test cases for the newly added constructor.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

* timeUnit must be non-null.
*/
public SkillRequestTimestampVerifier(long tolerance, TimeUnit timeUnit) {
this(ValidationUtils.assertNotNull(timeUnit, "timeUnit").toMillis(tolerance));
Copy link

Choose a reason for hiding this comment

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

Just one question. The SkillRequestTimestampVerifier constructor is called from the SkillServlet class: defaultVerifiers.add(new SkillRequestTimestampVerifier(timestampToleranceProperty != null ? timestampToleranceProperty : DEFAULT_TOLERANCE_MILLIS));

Therefore the old constructor will be called, or do you expect the developer to pass the verifiers in the SkillServlet constructor? Nevertheless the documentation should be adjusted here: https://developer.amazon.com/de/docs/custom-skills/host-a-custom-skill-as-a-web-service.html and here: https://github.com/alexa/skill-samples-java/blob/master/tidepooler/pom.xml

Copy link
Contributor

Choose a reason for hiding this comment

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

The existing constructor behavior can't be changed for backwards compatibility reasons, so effectively to opt in to the new behavior one would need to pass an instance of the verifier to the servlet. Totally agree that the docs need to be updated as they still reference some v1 concepts.

Copy link

Choose a reason for hiding this comment

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

OK I thought of that, thanks for the explanation 👍

Issue: #173
Changes: Added overloaded constructor with an additional TimeUnit field which would convert the given tolerance to milli seconds
Testing: Modified the test class to run with Parameterized.class to run all the existing test cases for the newly added constructor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants