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

CLDR-16835 fix phase check for adding items #3816

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3613,6 +3613,9 @@ public static Phase surveyPhase(CLDRLocale locale) {
* @returns the current CheckCLDR phase for the locale. This is the preferred API.
*/
public static CheckCLDR.Phase checkCLDRPhase(CLDRLocale loc) {
if (CLDRConfig.getInstance().getEnvironment() == CLDRConfig.Environment.UNITTEST) {
return CheckCLDR.Phase.BUILD;
}
return surveyPhase(loc).toCheckCLDRPhase();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ public static VoteResponse getHandleVoteResponse(
CandidateInfo ci = calculateCandidateItem(result, val, dataRow);
// Now, recalculate the statusAction for accepting the new item
r.statusAction =
CLDRConfig.getInstance()
.getPhase()
SurveyMain.checkCLDRPhase(locale)
.getAcceptNewItemAction(
ci,
dataRow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.Map;
import java.util.TreeMap;
import org.unicode.cldr.draft.FileUtilities;
import org.unicode.cldr.test.CheckCLDR;
import org.unicode.cldr.util.CLDRConfig;
import org.unicode.cldr.util.CLDRFile;
import org.unicode.cldr.util.CLDRFile.DraftStatus;
import org.unicode.cldr.util.CLDRLocale;
Expand Down Expand Up @@ -462,6 +464,14 @@ private void handleElementApivote(
if (elem.equals("apiunvote")) {
value = null;
}
assertEquals(
CheckCLDR.Phase.BUILD,
SurveyMain.checkCLDRPhase(locale),
() -> "CheckCLDR Phase for " + locale);
assertEquals(
CheckCLDR.Phase.BUILD,
CLDRConfig.getInstance().getPhase(),
"CLDRConfig.getInstance().getPhase()");
final CookieSession mySession = CookieSession.getTestSession(u);
try {
final VoteAPI.VoteResponse r =
Expand All @@ -485,7 +495,8 @@ private void handleElementApivote(
System.out.println("Caught expected: " + iae);
} else {
iae.printStackTrace();
fail("Unexpected exception: " + iae);
fail("Phase: " + SurveyMain.checkCLDRPhase(locale));
fail("in" + attrs + "/" + elem + " / " + xpath + ": Unexpected exception: " + iae);
}
}
}
Expand Down
Loading