-
Notifications
You must be signed in to change notification settings - Fork 290
Ssrc bugbash fix #1117
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
Open
rathovarun1032
wants to merge
21
commits into
ssrc
Choose a base branch
from
ssrc-bugbash
base: ssrc
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ssrc bugbash fix #1117
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
486e841
Handle empty context
91acd60
fix issue related to update time
422d227
fix string equality
38f658d
fix textcase
ee44298
Fix lint errors
23b1b95
Add unit tests
7a28b89
fix for [438426692](getDouble() logs a malformed warning on type conv…
rathovarun1032 ce4caea
Update ServerTemplateResponse.java to fix b/438607881
rathovarun1032 6135680
Update getServerRemoteConfig.json to fix b/438607881
rathovarun1032 28166e0
Update getServerTemplateData.json to fix b/438607881
rathovarun1032 8932e7e
fix for bugs
dfecfc6
Resolve comment related to revert of ServerVersion Class
a0b71bd
remove serverVersion
8fc3cb7
Resolve comments related to Evaluator
95910ad
fix indentation
3257dc5
fix indentation
d75cfb2
fix indentations
9fabd60
fix multi line indent
db3fc82
fix multi line indents
4dd8b1d
Update ConditionEvaluator.java
rathovarun1032 1a8006b
Update ConditionEvaluator.java
rathovarun1032 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
213 changes: 213 additions & 0 deletions
213
src/main/java/com/google/firebase/remoteconfig/ServerVersion.java
rathovarun1032 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.firebase.remoteconfig; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
import com.google.firebase.internal.NonNull; | ||
import com.google.firebase.internal.Nullable; | ||
import com.google.firebase.remoteconfig.internal.TemplateResponse; | ||
import com.google.firebase.remoteconfig.internal.TemplateResponse.VersionResponse; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Represents a Server Remote Config template version. | ||
* Output only, except for the version description. Contains metadata about a particular | ||
* version of the Remote Config template. All fields are set at the time the specified Remote | ||
* Config template is published. A version's description field may be specified when | ||
* publishing a template. | ||
*/ | ||
public final class ServerVersion { | ||
|
||
private final String versionNumber; | ||
private final String updateTime; | ||
private final String updateOrigin; | ||
private final String updateType; | ||
private final User updateUser; | ||
private final String rollbackSource; | ||
private final boolean legacy; | ||
private String description; | ||
|
||
private ServerVersion() { | ||
this.versionNumber = null; | ||
this.updateTime = null; | ||
this.updateOrigin = null; | ||
this.updateType = null; | ||
this.updateUser = null; | ||
this.rollbackSource = null; | ||
this.legacy = false; | ||
} | ||
|
||
ServerVersion(@NonNull VersionResponse versionResponse) { | ||
checkNotNull(versionResponse); | ||
this.versionNumber = versionResponse.getVersionNumber(); | ||
this.updateTime = versionResponse.getUpdateTime(); | ||
this.updateOrigin = versionResponse.getUpdateOrigin(); | ||
this.updateType = versionResponse.getUpdateType(); | ||
TemplateResponse.UserResponse userResponse = versionResponse.getUpdateUser(); | ||
this.updateUser = (userResponse != null) ? new User(userResponse) : null; | ||
this.description = versionResponse.getDescription(); | ||
this.rollbackSource = versionResponse.getRollbackSource(); | ||
this.legacy = versionResponse.isLegacy(); | ||
} | ||
|
||
/** | ||
* Creates a new {@link Version} with a description. | ||
*/ | ||
public static ServerVersion withDescription(String description) { | ||
return new ServerVersion().setDescription(description); | ||
} | ||
|
||
/** | ||
* Gets the version number of the template. | ||
* | ||
* @return The version number or null. | ||
*/ | ||
@Nullable | ||
public String getVersionNumber() { | ||
return versionNumber; | ||
} | ||
|
||
/** | ||
* Gets the update time of the version. The timestamp of when this version of the Remote Config | ||
* template was written to the Remote Config backend. | ||
* | ||
* @return The update time of the version or null. | ||
*/ | ||
@Nullable | ||
public String getUpdateTime() { | ||
return updateTime; | ||
} | ||
|
||
/** | ||
* Gets the origin of the template update action. | ||
* | ||
* @return The origin of the template update action or null. | ||
*/ | ||
@Nullable | ||
public String getUpdateOrigin() { | ||
return updateOrigin; | ||
} | ||
|
||
/** | ||
* Gets the type of the template update action. | ||
* | ||
* @return The type of the template update action or null. | ||
*/ | ||
@Nullable | ||
public String getUpdateType() { | ||
return updateType; | ||
} | ||
|
||
/** | ||
* Gets the update user of the template. | ||
* An aggregation of all metadata fields about the account that performed the update. | ||
* | ||
* @return The update user of the template or null. | ||
*/ | ||
@Nullable | ||
public User getUpdateUser() { | ||
return updateUser; | ||
} | ||
|
||
/** | ||
* Gets the user-provided description of the corresponding Remote Config template. | ||
* | ||
* @return The description of the template or null. | ||
*/ | ||
@Nullable | ||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
/** | ||
* Gets the rollback source of the template. | ||
* | ||
* <p>The serverVersion number of the Remote Config template that has become the current | ||
* serverVersion due to a rollback. Only present if this serverVersion is the result of a | ||
* rollback. | ||
* | ||
* @return The rollback source of the template or null. | ||
*/ | ||
@Nullable | ||
public String getRollbackSource() { | ||
return rollbackSource; | ||
} | ||
|
||
/** | ||
* Indicates whether this Remote Config template was published before serverVersion history was | ||
* supported. | ||
* | ||
* @return true if the template was published before serverVersion history was supported, | ||
* and false otherwise. | ||
*/ | ||
public boolean isLegacy() { | ||
return legacy; | ||
} | ||
|
||
/** | ||
* Sets the user-provided description of the template. | ||
* | ||
* @param description The description of the template. | ||
* @return This {@link ServerVersion}. | ||
*/ | ||
public ServerVersion setDescription(String description) { | ||
this.description = description; | ||
return this; | ||
} | ||
|
||
VersionResponse toVersionResponse(boolean includeAll) { | ||
VersionResponse versionResponse = new VersionResponse().setDescription(this.description); | ||
if (includeAll) { | ||
versionResponse.setUpdateTime(this.updateTime) | ||
.setLegacy(this.legacy) | ||
.setRollbackSource(this.rollbackSource) | ||
.setUpdateOrigin(this.updateOrigin) | ||
.setUpdateType(this.updateType) | ||
.setUpdateUser((this.updateUser == null) ? null : this.updateUser.toUserResponse()) | ||
.setVersionNumber(this.versionNumber); | ||
} | ||
return versionResponse; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
ServerVersion serverVersion = (ServerVersion) o; | ||
return legacy == serverVersion.legacy | ||
&& Objects.equals(updateTime, serverVersion.updateTime) | ||
&& Objects.equals(versionNumber, serverVersion.versionNumber) | ||
&& Objects.equals(updateOrigin, serverVersion.updateOrigin) | ||
&& Objects.equals(updateType, serverVersion.updateType) | ||
&& Objects.equals(updateUser, serverVersion.updateUser) | ||
&& Objects.equals(description, serverVersion.description) | ||
&& Objects.equals(rollbackSource, serverVersion.rollbackSource); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects | ||
.hash(versionNumber, updateTime, updateOrigin, updateType, updateUser, description, | ||
rollbackSource, legacy); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.