- * It would be better to have an API for requesting this list from the ST back end at runtime! - *
- * There is a PageId enum defined in PathHeader.java. We could link with the - * cldr-apps code and access that enum directly. However, there are difficulties - * with initiation, like "java.lang.RuntimeException: CLDRConfigImpl used before SurveyMain.init() called!" - * "Set -DCLDR_ENVIRONMENT=UNITTEST if you are in the test cases." Follow up on that possibility later. - * In the meantime, we can copy and simplify the enum from PathHeader.java, since all we need here - * is an array of strings. - *
- * PageId versus SectionId: PageId.Alphabetic_Information is in the section SectionId.Core_Data - *
- * Alphabetic_Information(SectionId.Core_Data, "Alphabetic Information") - *
- * Each page is one web page; a section may encompass multiple pages, not all visible at once. - * (There may also be multiple headers in one page. See PathHeader.txt which is a source file.) + * + *
It would be better to have an API for requesting this list from the ST back end at + * runtime! + * + *
There is a PageId enum defined in PathHeader.java. We could link with the cldr-apps code + * and access that enum directly. However, there are difficulties with initiation, like + * "java.lang.RuntimeException: CLDRConfigImpl used before SurveyMain.init() called!" "Set + * -DCLDR_ENVIRONMENT=UNITTEST if you are in the test cases." Follow up on that possibility + * later. In the meantime, we can copy and simplify the enum from PathHeader.java, since all we + * need here is an array of strings. + * + *
PageId versus SectionId: PageId.Alphabetic_Information is in the section + * SectionId.Core_Data + * + *
Alphabetic_Information(SectionId.Core_Data, "Alphabetic Information") + * + *
Each page is one web page; a section may encompass multiple pages, not all visible at + * once. (There may also be multiple headers in one page. See PathHeader.txt which is a source + * file.) */ private static final String[] pages = { - // prettier-ignore + // spotless:off "Alphabetic_Information", "Numbering_Systems", "LinguisticElements", "Locale_Name_Patterns", "Languages_A_D", "Languages_E_J", "Languages_K_N", "Languages_O_S", "Languages_T_Z", "Scripts", "Territories", "T_NAmerica", "T_SAmerica", "T_Africa", "T_Europe", "T_Asia", "T_Oceania", "Locale_Variants", @@ -55,23 +54,23 @@ public class SurveyDriverData { "WeekData", "Measurement", "Language", "RBNF", "Segmentation", "DayPeriod", "Category", "Smileys", "People", "Animals_Nature", "Food_Drink", "Travel_Places", "Activities", "Objects", "Symbols2", "Flags", "Component", "Typography", + // spotless:on }; - /** - * These are pages for which special annotation vote resolution is applicable - */ + /** These are pages for which special annotation vote resolution is applicable */ private static final String[] annotationPages = { - // prettier-ignore + // spotless:off "Category", "Smileys", "People", "Animals_Nature", "Food_Drink", "Travel_Places", "Activities", "Objects", "Symbols2", "Flags", + // spotless:on }; /** - * This list of locales was obtained by putting a breakpoint on SurveyAjax.getLocalesSet, getting its - * return value, and adding quotation marks by search/replace. + * This list of locales was obtained by putting a breakpoint on SurveyAjax.getLocalesSet, + * getting its return value, and adding quotation marks by search/replace. */ private static final String[] locales = { - // prettier-ignore + // spotless:off "aa", "aa_DJ", "aa_ER", "aa_ET", "af", "af_NA", "af_ZA", "agq", "agq_CM", "ak", "ak_GH", "am", "am_ET", "ar", "ar_001", "ar_AE", "ar_BH", "ar_DJ", "ar_DZ", "ar_EG", "ar_EH", "ar_ER", @@ -151,6 +150,7 @@ public class SurveyDriverData { "yue_Hans", "yue_Hans_CN", "yue_Hant", "yue_Hant_HK", "zgh", "zgh_MA", "zh", "zh_Hans", "zh_Hans_CN", "zh_Hans_HK", "zh_Hans_MO", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW", "zu", "zu_ZA", + // spotless:on }; public static String[] getPages() { diff --git a/src/test/java/org/unicode/cldr/surveydriver/SurveyDriverVettingTable.java b/src/test/java/org/unicode/cldr/surveydriver/SurveyDriverVettingTable.java index 42ed095..405a5bb 100644 --- a/src/test/java/org/unicode/cldr/surveydriver/SurveyDriverVettingTable.java +++ b/src/test/java/org/unicode/cldr/surveydriver/SurveyDriverVettingTable.java @@ -15,9 +15,11 @@ public class SurveyDriverVettingTable { /** - * Test the vetting table to make sure it contains the expected content under certain circumstances. - *
- * Purpose: make sure that code revisions do not cause unintended changes to the table contents. + * Test the vetting table to make sure it contains the expected content under certain + * circumstances. + * + *
Purpose: make sure that code revisions do not cause unintended changes to the table + * contents. */ public static boolean testVettingTable(SurveyDriver s) { if (!s.login()) { @@ -46,7 +48,8 @@ public static boolean testVettingTable(SurveyDriver s) { } JavascriptExecutor js = (JavascriptExecutor) driver; - js.executeScript("window.testTable = function(theTable, reuseTable) { console.log(theTable.json); }"); + js.executeScript( + "window.testTable = function(theTable, reuseTable) { console.log(theTable.json); }"); /* * Get the table three times. @@ -55,7 +58,7 @@ public static boolean testVettingTable(SurveyDriver s) { * Third time, after voting for new value "taml" in first row. * Finally, abstain so the next user will find the db the same as it was. */ - String[] table = { null, null, null }; + String[] table = {null, null, null}; final int tableCount = 3; String dataDirName; try { @@ -76,11 +79,12 @@ public static boolean testVettingTable(SurveyDriver s) { return false; } if (t > 0 && table[t].equals(table[t - 1])) { - SurveyDriverLog.println("File " + fName + " should not be identical to the previous file"); + SurveyDriverLog.println( + "File " + fName + " should not be identical to the previous file"); return false; } } - String[] cellClasses = { "proposedcell", "input", "nocell" }; + String[] cellClasses = {"proposedcell", "input", "nocell"}; String rowId = "r@7b8ee7884f773afa"; int i = 0; int goodTableCount = 0; @@ -106,7 +110,8 @@ public static boolean testVettingTable(SurveyDriver s) { try { Thread.sleep(5000); } catch (Exception e) { - SurveyDriverLog.println("Sleep interrupted before finished waiting to get table html; " + e); + SurveyDriverLog.println( + "Sleep interrupted before finished waiting to get table html; " + e); } /* @@ -125,18 +130,17 @@ public static boolean testVettingTable(SurveyDriver s) { ++goodTableCount; } else { SurveyDriverLog.println( - "❌ table " + - i + - " is different (" + - tableHtml.length() + - " units):\n" + - tableHtml + - "\n\nExpected (" + - table[i].length() + - " units):\n" + - table[i] + - "\n" - ); + "❌ table " + + i + + " is different (" + + tableHtml.length() + + " units):\n" + + tableHtml + + "\n\nExpected (" + + table[i].length() + + " units):\n" + + table[i] + + "\n"); } ++i; boolean doAdd = cell.equals("input"); @@ -145,7 +149,7 @@ public static boolean testVettingTable(SurveyDriver s) { WebElement rowEl = null, columnEl, clickEl = null; int repeats = 0; - for (;;) { + for (; ; ) { try { rowEl = driver.findElement(By.id(rowId)); } catch (StaleElementReferenceException e) { @@ -153,18 +157,18 @@ public static boolean testVettingTable(SurveyDriver s) { break; } SurveyDriverLog.println( - "Continuing after StaleElementReferenceException for findElement by id rowId " + - rowId + - " for " + - url - ); + "Continuing after StaleElementReferenceException for findElement by id rowId " + + rowId + + " for " + + url); continue; } catch (Exception e) { SurveyDriverLog.println(e); break; } if (rowEl == null) { - SurveyDriverLog.println("❌ Vetting-table test failed, missing row id " + rowId + " for " + url); + SurveyDriverLog.println( + "❌ Vetting-table test failed, missing row id " + rowId + " for " + url); return false; } try { @@ -174,11 +178,10 @@ public static boolean testVettingTable(SurveyDriver s) { break; } SurveyDriverLog.println( - "Continuing after StaleElementReferenceException for findElement by class cellClass " + - cellClass + - " for " + - url - ); + "Continuing after StaleElementReferenceException for findElement by class cellClass " + + cellClass + + " for " + + url); continue; } catch (Exception e) { SurveyDriverLog.println(e); @@ -186,8 +189,12 @@ public static boolean testVettingTable(SurveyDriver s) { } if (columnEl == null) { SurveyDriverLog.println( - "❌ Vetting-table test failed, no column " + cellClass + " for row " + rowId + " for " + url - ); + "❌ Vetting-table test failed, no column " + + cellClass + + " for row " + + rowId + + " for " + + url); return false; } try { @@ -197,11 +204,10 @@ public static boolean testVettingTable(SurveyDriver s) { break; } SurveyDriverLog.println( - "Continuing after StaleElementReferenceException for findElement by tagName " + - rowId + - " for " + - url - ); + "Continuing after StaleElementReferenceException for findElement by tagName " + + rowId + + " for " + + url); continue; } catch (Exception e) { SurveyDriverLog.println(e); @@ -211,11 +217,16 @@ public static boolean testVettingTable(SurveyDriver s) { } if (clickEl == null) { SurveyDriverLog.println( - "❌ Vetting-table test failed, no tag " + tagName + " for row " + rowId + " for " + url - ); + "❌ Vetting-table test failed, no tag " + + tagName + + " for row " + + rowId + + " for " + + url); return false; } - clickEl = s.waitUntilRowCellTagElementClickable(clickEl, rowId, cellClass, tagName, url); + clickEl = + s.waitUntilRowCellTagElementClickable(clickEl, rowId, cellClass, tagName, url); if (clickEl == null) { return false; } @@ -224,8 +235,10 @@ public static boolean testVettingTable(SurveyDriver s) { } catch (Exception e) { SurveyDriverLog.println(e); SurveyDriverLog.println( - "❌ Fast vote test failed, invisibilityOfElementLocated overlay for row " + rowId + " for " + url - ); + "❌ Fast vote test failed, invisibilityOfElementLocated overlay for row " + + rowId + + " for " + + url); return false; } try { @@ -235,12 +248,18 @@ public static boolean testVettingTable(SurveyDriver s) { break; } SurveyDriverLog.println( - "Continuing after StaleElementReferenceException for clickEl.click for row " + rowId + " for " + url - ); + "Continuing after StaleElementReferenceException for clickEl.click for row " + + rowId + + " for " + + url); continue; } catch (Exception e) { SurveyDriverLog.println(e); - SurveyDriverLog.println("❌ Vetting-table test failed, clickEl.click for row " + rowId + " for " + url); + SurveyDriverLog.println( + "❌ Vetting-table test failed, clickEl.click for row " + + rowId + + " for " + + url); return false; } if (doAdd) { @@ -254,9 +273,12 @@ public static boolean testVettingTable(SurveyDriver s) { SurveyDriverLog.println("Warning: continuing, didn't see input box for " + url); continue; } - inputEl = s.waitUntilRowCellTagElementClickable(inputEl, rowId, cellClass, "input", url); + inputEl = + s.waitUntilRowCellTagElementClickable( + inputEl, rowId, cellClass, "input", url); if (inputEl == null) { - SurveyDriverLog.println("Warning: continuing, input box not clickable for " + url); + SurveyDriverLog.println( + "Warning: continuing, input box not clickable for " + url); continue; } inputEl.clear(); @@ -281,7 +303,9 @@ private static String normalizeTable(String tableHtml) { * Work around it here by changing "fallback_root" to "fallback". */ tableHtml = tableHtml.replace("fallback_root", "fallback"); - tableHtml = tableHtml.replaceFirst("
\\s*