Skip to content

Commit

Permalink
CLDR-16835 fix phase check for adding items (#3816)
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored Jun 20, 2024
1 parent 4d13413 commit 13b1e0c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
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

0 comments on commit 13b1e0c

Please sign in to comment.