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

Fix #3322: Platform parameter singleton and Generic Interface #3323

Merged
merged 37 commits into from
Jul 7, 2021

Conversation

Arjupta
Copy link
Contributor

@Arjupta Arjupta commented Jun 13, 2021

Explanation

Fixes #3322
This PR introduces a new domain layer Singleton class which will help with storing and providing platform parameter values. This PR also includes a Generic Interface whose implementations will be provided containing Platform Parameters. (This PR is stacked over #3269). /cc @Sarthak2601

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

@Arjupta Arjupta changed the title Fixes #3322: Platform parameter singleton Fix #3322: Platform parameter singleton and Generic Interface Jun 14, 2021
@Arjupta Arjupta force-pushed the platform-parameter-singleton branch from 3344b17 to 5557775 Compare June 14, 2021 16:46
Copy link
Contributor

@jcqli jcqli left a comment

Choose a reason for hiding this comment

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

Nice job with the tests! A couple things

  1. Try to further split up test cases so that they're only checking on thing at a time. I like to think of it as if we want to minimize the number of assertions in a test so each test can be as specific as possible.
  2. I see that protos are included in this PR -- be sure to list only the newly-changed in the PR description in case reviewers are different.
  3. Be sure to build & test with both Gradle & Bazel to help speedup the review process. I also forget this sometimes :)

@oppiabot oppiabot bot unassigned jcqli Jun 15, 2021
@oppiabot
Copy link

oppiabot bot commented Jun 15, 2021

Unassigning @jcqli since the review is done.

@oppiabot
Copy link

oppiabot bot commented Jun 15, 2021

Hi @Arjupta, it looks like some changes were requested on this pull request by @jcqli. PTAL. Thanks!

@Arjupta Arjupta force-pushed the platform-parameter-singleton branch from 5557775 to a9cbdb3 Compare June 15, 2021 08:12
@Arjupta Arjupta force-pushed the platform-parameter-singleton branch from a9cbdb3 to d9f5111 Compare June 15, 2021 11:45
@Arjupta Arjupta assigned fsharpasharp and unassigned vinitamurthi and Arjupta Jun 15, 2021
@anandwana001 anandwana001 assigned Arjupta and unassigned anandwana001 Jul 2, 2021
@Arjupta Arjupta assigned anandwana001 and unassigned Arjupta Jul 2, 2021
…and its Impl. Also changed the tests accordingly
@vinitamurthi vinitamurthi removed their assignment Jul 3, 2021
@vinitamurthi
Copy link
Contributor

Note that tests are failing

@Arjupta
Copy link
Contributor Author

Arjupta commented Jul 3, 2021

Note that tests are failing

@vinitamurthi that test is failing due to some env reading error not because of the code changes


/**
* Initializes a platformParameterMap in case it is empty.
* @param platformParameterMap [Map<String, PlatformParameter>]
Copy link
Contributor

@jcqli jcqli Jul 3, 2021

Choose a reason for hiding this comment

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

nit: add newline above KDoc @ fields (but each @ line should be next to each other).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@jcqli jcqli left a comment

Choose a reason for hiding this comment

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

LGTM, just be sure to update the KDocs!

@jcqli jcqli assigned Arjupta and unassigned jcqli Jul 3, 2021
Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

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

LGTM

@anandwana001 anandwana001 removed their assignment Jul 3, 2021
@Arjupta Arjupta removed their assignment Jul 5, 2021
Copy link
Sponsor Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Approved for codeowners (BUILD file changes). Left one unrelated comment for one thing I noticed.

/** Singleton which helps in storing and providing Platform Parameters at runtime. */
@Singleton
class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSingleton {
private var platformParameterMap: Map<String, PlatformParameter> = mapOf()
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This could be a val with a mutable list, instead, where you clear & perform a putAll to reinitialize it versus changing the parameter itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@BenHenning BenHenning assigned Arjupta and unassigned BenHenning Jul 6, 2021
@oppiabot oppiabot bot added the PR: LGTM label Jul 6, 2021
@oppiabot
Copy link

oppiabot bot commented Jul 6, 2021

Hi @Arjupta, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks!

@Arjupta Arjupta removed their assignment Jul 6, 2021
@vinitamurthi vinitamurthi merged commit a237d00 into oppia:develop Jul 7, 2021
jcqli pushed a commit that referenced this pull request Jul 7, 2021
…ED on #3323] (#3361)

* Cumulative Changes from PR-1.1(#3269) and 1.2(#3323)

* Introduced a new Dagger Module to provide Platform Parameters. Also a PlatformParameter Constants file to store any constants related to Platform Parameters

* Nit changes

* Added a FakePlatformParameterModule and a PlatformParameterModuleTest

* Included a Fake Singleton approach for testing DaggerModule

* Lint check + updating with base PR

* Reverting .idea file

* Rename functions and constants, Added new Testcases for different data type PlatformParameter

* Nit KDoc changes

* Changing the Testing approach + Updating with Base PR

* Nit changes + New Test Case for Partial Map

* Changed the location of TestSpecific constants to Fake Module

* Renaming functions and removing redundant references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Introduce a Singleton Class and a Generic Interface for Platform Parameters
8 participants