use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForRhnMigrateClassicToRhsm.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21779", "RHEL7-51596" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "check the rhn-migrate-classic-to-rhsm man page for misspelled words and typos", groups = { "Tier3Tests", "blockedByBug-1390712" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForRhnMigrateClassicToRhsm() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
String tool = "rhn-migrate-classic-to-rhsm";
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
modifiedManPage = modifyMisspellingsInManPage(manPageResult.getStdout());
// rhn-migrate-classic-to-rhsm(System Manager's Manrhn-migrate-classic-to-rhsm(8)
if (modifiedManPage.contains("System Manager's Manr")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1192574 - typos and poor grammar in subscription-manager-gui man page
String bugId = "1192574";
// TODO Wrong bug 1192574
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring poor man page title while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("System Manager's Manr", "System Manager's Manual r");
}
}
// TEMPORARY WORKAROUND FOR BUG
if (modifiedManPage.contains("unregister") || modifiedManPage.contains("Unregister")) /*||modifiedManPage.contains("UNREGISTER")*/
{
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1149098 - Grammar issue, "unregister" not a word.
String bugId = "1149098";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "unregister" + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("unregister", "deregister");
modifiedManPage = modifiedManPage.replaceAll("Unregister", "Deregister");
// modifiedManPage = modifiedManPage.replaceAll("UNREGISTER", "DEREGISTER");
// deregister is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("deregister", "register");
// Deregister is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("Deregister", "Register");
// modifiedManPage = modifiedManPage.replaceAll("DEREGISTER", "REGISTER"); // DEREGISTERING is not recognized by hunspell -d en_US
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForRhsmDebug.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21781", "RHEL7-51598" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "check the rhsm-debug man page for misspelled words and typos", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForRhsmDebug() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
String tool = "rhsm-debug";
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
modifiedManPage = modifyMisspellingsInManPage(manPageResult.getStdout());
modifiedManPage = modifiedManPage.replaceAll("System Manager's Manual", " bugzilla1194468comment2isNotFixed ");
// TEMPORARY WORKAROUND FOR BUG
for (String word : Arrays.asList(new String[] { "intead", "bugzilla1194468comment2isNotFixed" })) {
if (modifiedManPage.contains(word)) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1194468 - typos and poor grammar in rhsm-debug man page
String bugId = "1194468";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring known misspelling of '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("intead") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 23e0c319ae3ed9ff2dc684b46fc1c2bf4e05f840
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingsOnManPageForSubscriptionManager.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21785", "RHEL7-51602" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "check the subscription-manager man page for misspelled words and typos", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingsOnManPageForSubscriptionManager() throws IOException {
if (clienttasks == null)
throw new SkipException("A client connection is needed for this test.");
// "subscription-manager";
String tool = clienttasks.command;
SSHCommandResult manPageResult = client.runCommandAndWait("man " + tool);
Assert.assertEquals(manPageResult.getExitCode(), Integer.valueOf(0), "ExitCode from man page for '" + tool + "'.");
// modify the contents of manPageResult for acceptable word spellings
String modifiedManPage = manPageResult.getStdout();
modifiedManPage = modifyMisspellingsInManPage(modifiedManPage);
// TODO: should not fail on "PLUGIN OPTIONS" since it is a valid module
modifiedManPage = modifiedManPage.replaceAll("PLUGIN OPTIONS", "PLUG-IN OPTIONS");
// TODO: should not fail on "PLUGIN OPTIONS" since it is a valid module
modifiedManPage = modifiedManPage.replaceAll("The plugins command", "The plug-ins command");
modifiedManPage = modifiedManPage.replaceAll("plugins", " bugzilla1192120comment13isNotFixed ");
modifiedManPage = modifiedManPage.replaceAll("plugin", " bugzilla1192120comment13isNotFixed ");
// TEMPORARY WORKAROUND FOR BUG
if (doesStringContainMatches(modifiedManPage, "[^-]servicelevel")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1192094 - man page for subscription-manager references "servicelevel" command when it should say "service-level
String bugId = "1192094";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
String word = "servicelevel";
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("([^-])" + word, "$1service-level");
}
if (clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 961aa8d43ef6e18ef9cde2e740be8462101bb4c6
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring unrecognized word '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
}
// TEMPORARY WORKAROUND FOR BUG
if (modifiedManPage.contains("unregister") || modifiedManPage.contains("Unregister") || modifiedManPage.contains("UNREGISTER")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1149098 - Grammar issue, "unregister" not a word.
String bugId = "1149098";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "unregister" + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("unregister", "deregister");
modifiedManPage = modifiedManPage.replaceAll("Unregister", "Deregister");
modifiedManPage = modifiedManPage.replaceAll("UNREGISTER", "DEREGISTER");
// deregister is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("deregister", "register");
// Deregister is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("Deregister", "Register");
// DEREGISTERING is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("DEREGISTER", "REGISTER");
// Deregistration is not recognized by hunspell -d en_US
modifiedManPage = modifiedManPage.replaceAll("Deregistration", "Registration");
}
}
// TEMPORARY WORKAROUND FOR BUG
for (String word : Arrays.asList(new String[] { "wildcards", "wildcard", "suborganizations", "expirations", "reregistered", "reregister", "instaled", "equilivent", "bugzilla1192120comment13isNotFixed" })) {
if (modifiedManPage.contains(word)) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1192120 - typos and poor grammar in subscription-manager man page
String bugId = "1192120";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring known misspelling of '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("suborganizations") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 063747b1b1d83fe89eff91fc5fb96f57d95eb5d5
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("expirations") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 063747b1b1d83fe89eff91fc5fb96f57d95eb5d5
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("reregistered")) /*&& clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1" FailedQA)*/
{
// commit 063747b1b1d83fe89eff91fc5fb96f57d95eb5d5
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("instaled") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 063747b1b1d83fe89eff91fc5fb96f57d95eb5d5
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
if (word.equals("equilivent") && clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 063747b1b1d83fe89eff91fc5fb96f57d95eb5d5
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + word + "' which is fixed in newer release subscription-manager-1.15.1-1.");
modifiedManPage = modifiedManPage.replace(word, "TYPO");
}
}
}
// TEMPORARY WORKAROUND FOR BUG
if (modifiedManPage.contains("Specifes")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1440319 - typo in the word "Specifes" in subscription-manager man page
String bugId = "1440319";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "Specifes" + "' while bug '" + bugId + "' is open.");
modifiedManPage = modifiedManPage.replaceAll("Specifes", "Specifies");
}
}
// END OF WORKAROUND
// assert that there were no unexpected hunspell check failures in the modified man page
Assert.assertEquals(getSpellCheckFailuresForModifiedManPage(tool, manPageResult.getStdout(), modifiedManPage).size(), 0, "There are zero unexpected hunspell check failures in the man page for '" + tool + "'.");
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SpellCheckTests method testSpellingOfAllMsgidsForSubscriptionManager.
// Test Methods ***********************************************************************
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21777", "RHEL7-51594" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.HIGH, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "check the subscription-manager msgid strings for misspelled words and typos", groups = { "Tier3Tests" }, enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testSpellingOfAllMsgidsForSubscriptionManager() throws IOException {
File remoteFile = new File("/tmp/sm-modifiedMsgIdsForSubscriptionManager.txt");
File localFile = new File((getProperty("automation.dir", "/tmp") + "/tmp/" + remoteFile.getName()).replace("tmp/tmp", "tmp"));
// adjust the msgids for known acceptable words that will fail the hunspell check
Set<String> msgIds = new HashSet<String>();
for (String msgId : translationMsgidSetForSubscriptionManager) {
msgId = msgId.replace("Proxy _Username:", "Proxy Username:");
msgId = msgId.replace("Configure Pro_xy", "Configure Proxy");
msgId = msgId.replace("Proxy P_assword:", "Proxy Password:");
msgId = msgId.replace("Repo_sitories", "Repositories");
msgId = msgId.replace("R_edeem", "Redeem");
msgId = msgId.replace("Au_thentication", "Authentication");
msgId = msgId.replace("sla_", "service_level_agreement_");
msgId = msgId.replace("_combobox", "_combination_box");
msgId = msgId.replace("--servicelevel", "--service_level");
msgId = msgId.replace("--ondate", "--on_date");
msgId = msgId.replace("serverurl", "server_url");
msgId = msgId.replace("baseurl", "base_url");
msgId = msgId.replace("stdin", "standard in");
msgId = msgId.replace("%prog", "%program");
msgId = msgId.replace("Username", "User Name");
msgId = msgId.replace("username", "user name");
msgId = msgId.replace("Virt-who", "Virtualization-who");
msgId = msgId.replace("Virt Only", "Virtualization Only");
msgId = msgId.replace("Virt Limit", "Virtualization Limit");
msgId = msgId.replace("Virtualization", "Virtual");
msgId = msgId.replace("cert's", "certificate's");
msgId = msgId.replace("(Examples: en-us, de-de)", "(Examples: English, German)");
msgId = msgId.replace("sos report", "save our ship report");
msgId = msgId.replace("connectionStatusLabel", "connection Status Label");
msgId = msgId.replace("autoheal_checkbox", "auto_heal_check_box");
msgId = msgId.replace("checkbox", "check box");
msgId = msgId.replace("Checkbox", "Check box");
msgId = msgId.replace("Candlepin", "Candle pin");
msgId = msgId.replace("Gpgcheck", "GNU privacy guard");
msgId = msgId.replace("CLI", "Command Line Interface");
msgId = msgId.replace("owner_treeview", "owner_tree_view");
msgId = msgId.replace("progressbar", "progress_bar");
msgId = msgId.replace("%(mappingfile)s", "mapping file");
msgId = msgId.replace("mappingfile", "mapping file");
msgId = msgId.replace("scrolledwindow", "scrolled_window");
// msgid: prod 1, prod2, prod 3, prod 4, prod 5, prod 6, prod 7, prod 8
msgId = msgId.replace("prod2", "prod 2");
msgId = msgId.replace("environment_treeview", "environment_tree_view");
msgId = msgId.replace("rhsmcertd", "red hat subscription management certificate daemon");
msgId = msgId.replace("up2date_client.config", "up to date client configuration");
msgId = msgId.replace("up2date_client.rhnChannel", "up to date client red hat network channel");
msgId = msgId.replace("up2date", "up to date");
msgId = msgId.replace("firstboot", "first boot");
msgId = msgId.replace("hostname", "host name");
msgId = msgId.replace("Hostname", "Host name");
msgId = msgId.replace("redhat", "red hat");
msgId = msgId.replace("\\tManifest", "Manifest");
msgId = msgId.replace("jbappplatform", "java boss application platform");
msgId = msgId.replace("_vbox", "_vertical_box");
msgId = msgId.replace("env_select", "environment_select");
msgId = msgId.replace("login", "log-in");
msgId = msgId.replace("Login", "Log-in");
msgId = msgId.replace("Repo ", "Repository ");
msgId = msgId.replace("repo ", "repository ");
msgId = msgId.replace("repo-", "repository-");
msgId = msgId.replace("repos ", "repositories ");
msgId = msgId.replace("orgs", "organizations");
msgId = msgId.replaceAll("repo$", "repository");
msgId = msgId.replace("YYYY-MM-DD", "YEAR-MONTH-DAY");
msgId = msgId.replace("privacy_statement.html", "privacy_statement.HTML");
msgId = msgId.replace("rhn", "red hat network");
msgId = msgId.replace("RHN", "Red Hat Network");
msgId = msgId.replace("RHEL", "Red Hat Enterprise Linux");
// locator is not recognized by hunspell-1.2.8-16.el6
msgId = msgId.replace("url", "uniform resource location");
// Locator is not recognized by hunspell-1.2.8-16.el6
msgId = msgId.replace("URL", "Uniform Resource Location");
msgId = msgId.replace("DER size", "binary size");
msgId = msgId.replace("SSL", "Secure Sockets Layer");
msgId = msgId.replace("UUID", "universally unique identifier");
msgId = msgId.replace("uuid", "universally unique identifier");
msgId = msgId.replace("SKU", "Stock Keeping Unit");
msgId = msgId.replace("SLA", "Service Level Agreement");
msgId = msgId.replace("DMI", "Desktop Management Interface");
msgId = msgId.replace("UEP", "Unified Entitlement and Product");
msgId = msgId.replace("GPG", "GNU privacy guard");
msgId = msgId.replace("GNU", "G Not Unix");
msgId = msgId.replace("GPLv2", "General Public License, version 2");
msgId = msgId.replace("MERCHANTABILITY", "MERCHANTABLE");
// python variable used in msgid: Date entered is invalid. Date should be in YYYY-MM-DD format (example: {dateexample})
msgId = msgId.replace("{dateexample}", "");
msgId = msgId.replace("'subscription-manager plugins'", "subscription-manager plugins");
msgId = msgId.replace("'subscription-manager register --help'", "subscription-manager register --help");
msgId = msgId.replace("'Subscription Manager'", "Subscription Manager");
msgId = msgId.replace("'release --list'", "release --list");
msgId = msgId.replace("'red hat network-channel --remove --channel=<conflicting_channel>'", "red hat network-channel --remove --channel=<conflicting_channel>");
// Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563
msgId = msgId.replace("/kb/", "/knowledge-base/");
// not recognized by hunspell-1.2.8-16.el6
msgId = msgId.replace("Doesn't", "Does not");
msgId = msgId.replace("doesn't", "does not");
msgId = msgId.replace("Couldn't", "Could not");
msgId = msgId.replace("couldn't", "could not");
msgId = msgId.replace("Shouldn't", "Should not");
msgId = msgId.replace("shouldn't", "should not");
// fails on hunspell-1.2.8-16.el6
msgId = msgId.replace("isn't", "is not");
// fails on hunspell-1.2.8-16.el6
msgId = msgId.replace("aren't", "are not");
msgId = msgId.replace("consumerid", "consumer_id");
msgId = msgId.replace("consumer_uuid", "consumer_universally_unique_identifier");
msgId = msgId.replace("subscription-manager config --rhsm", "subscription-manager configure --red-hat-subscription-manager");
msgId = msgId.replace("•", "bullet");
// msgId = msgId.replace("'%s'", "%s"); // already fixed by adjustment below
// remove surrounding single quotes from single words
msgId = msgId.replaceAll("'([^ ]+)'", "$1");
msgId = msgId.replaceFirst("^Ok$", "Okay");
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1188265
if (msgId.contains("Susbscriptions")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1188265 - typo in subscription-manager-gui popup message
String bugId = "1188265";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring known misspelling of '" + "Susbscriptions" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("Susbscriptions", "Subscriptions");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1189880
if (msgId.contains("unentitle")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1189880 - Grammar issue, "unentitle" not a word.
String bugId = "1189880";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "unentitle" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("unentitle", "unsubscribed");
}
if (clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 599f217a4cf06248720fa0a30bd08b0b4ecc0f18
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring known misspelling of '" + "unentitle" + "' which is fixed in newer release subscription-manager-1.15.1-1.");
msgId = msgId.replace("unentitle", "unsubscribed");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1149098
if (msgId.contains("unregister") || msgId.contains("Unregister") || msgId.contains("unregistration") || msgId.contains("reregister")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1149098 - Grammar issue, "unregister" not a word.
String bugId = "1149098";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "unregister" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("unregister", "deregister");
msgId = msgId.replace("Unregister", "Deregister");
msgId = msgId.replace("unregistration", "Deregistration");
msgId = msgId.replace("reregister", "register again");
// deregister is not recognized by hunspell -d en_US
msgId = msgId.replace("deregister", "register");
// Deregister is not recognized by hunspell -d en_US
msgId = msgId.replace("Deregister", "Register");
// Deregistration is not recognized by hunspell -d en_US
msgId = msgId.replace("Deregistration", "Registration");
} else {
log.info("Bug '" + bugId + "' was CLOSED WONTFIX. Tolerating 'unregister'.");
msgId = msgId.replace("unregister", "deregister");
msgId = msgId.replace("Unregister", "Deregister");
msgId = msgId.replace("unregistration", "Deregistration");
msgId = msgId.replace("reregister", "register again");
// deregister is not recognized by hunspell -d en_US
msgId = msgId.replace("deregister", "register");
// Deregister is not recognized by hunspell -d en_US
msgId = msgId.replace("Deregister", "Register");
// Deregistration is not recognized by hunspell -d en_US
msgId = msgId.replace("Deregistration", "Registration");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1189937
if (msgId.contains("Wildcard")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1189937 - Grammar issue, "Wildcard" is not a word
String bugId = "1189937";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "Wildcard" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("Wildcard", "Wild card");
} else {
log.info("Bug '" + bugId + "' was CLOSED WONTFIX. Tolerating 'Wildcard'.");
msgId = msgId.replace("Wildcard", "Wild card");
}
}
// TEMPORARY WORKAROUND FOR BUG
if (msgId.contains("_Ok") || msgId.contains("Ok ")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1189933 - Grammar issue, "Ok" not a word.
String bugId = "1189933";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "Ok" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("_Ok", "OK");
msgId = msgId.replace("Ok ", "OK ");
}
}
// TEMPORARY WORKAROUND FOR BUG
if (msgId.contains("startup")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1189953 - Grammar issue, "startup" is not a word.
String bugId = "1189953";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "startup" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("startup", "start-up");
} else {
log.info("Bug '" + bugId + "' was CLOSED WONTFIX. Tolerating 'startup'.");
msgId = msgId.replace("startup", "start-up");
}
}
// TEMPORARY WORKAROUND FOR BUG
if (msgId.contains("pre-configure")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1189946 - Grammar issue, "pre-configure" versus "preconfigure".
String bugId = "1189946";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "pre-configure" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("pre-configure", "preconfigure");
}
if (clienttasks.isPackageVersion("subscription-manager", "<", "1.15.1-1")) {
// commit 0162a16a4dde7c54985ec27fd1515f1b664d829c
log.fine("Invoking workaround for Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
log.warning("Ignoring unrecognized word '" + "pre-configure" + "' which is fixed in newer release subscription-manager-1.15.1-1.");
msgId = msgId.replace("pre-configure", "preconfigure");
}
}
// END OF WORKAROUND
// hunspell -d en_US does not recognize preconfigure
msgId = msgId.replace("preconfigure", "prior configure");
// TEMPORARY WORKAROUND FOR BUG
if (msgId.contains("plugin")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1200507 - Grammar issue, "plugin" should be hyphenated.
String bugId = "1200507";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "plugin" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("plugin", "plug-in");
} else {
log.info("Bug '" + bugId + "' was CLOSED WONTFIX. Tolerating 'plugin'.");
msgId = msgId.replace("plugin", "plug-in");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1223852
if (msgId.contains("Deletedfd")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1223852 - repolib report has 'deletedfd' typo in string catalog
String bugId = "1223852";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + "Deletedfd" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("Deletedfd", "Deleted");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1233379
if (msgId.contains("systemid")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1233379 - Grammar issue, "systemid" is not a word
String bugId = "1233379";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
String word = "systemid";
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring unrecognized word '" + word + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("systemid", "system id");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1188265
if (msgId.contains("Editition")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1317613 - typo in src/subscription_manager/gui/data/ui/selectsla.ui
String bugId = "1317613";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring known misspelling of '" + "Awesome Developer Editition" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("Awesome Developer Editition", "Awesome Developer Edition");
}
}
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1372779
if (msgId.contains("Proxy connnection")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1372779 - another typo in "Proxy connnection failed, please check your settings."
String bugId = "1372779";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Ignoring known misspelling of '" + "Proxy connnection" + "' while bug '" + bugId + "' is open.");
msgId = msgId.replace("Proxy connnection", "Proxy connection");
}
}
// END OF WORKAROUND
msgIds.add(msgId);
}
// write the msgIds to a temporary file on the client
writeSetOfStringsToFile(msgIds, localFile, System.getProperty("line.separator") + "--------" + System.getProperty("line.separator"));
RemoteFileTasks.putFile(client, localFile.getPath(), remoteFile.getPath(), "0644");
// run a hunspell check on the msgIds
SSHCommandResult hunspellResult = client.runCommandAndWait("hunspell -l -d en_US " + remoteFile);
Assert.assertEquals(hunspellResult.getExitCode(), Integer.valueOf(0), "ExitCode from running hunspell check on " + remoteFile);
Assert.assertEquals(hunspellResult.getStderr(), "", "Stderr from running hunspell check on " + remoteFile);
// report the hunspell check failures and the msgIds that the failed words are found in
List<String> hunspellFailures = new ArrayList<String>();
if (!hunspellResult.getStdout().trim().isEmpty())
hunspellFailures = Arrays.asList(hunspellResult.getStdout().trim().split("\n"));
for (String hunspellFailure : hunspellFailures) {
log.warning("'" + hunspellFailure + "' was identified by hunspell check as a potential misspelling.");
for (String msgId : translationMsgidSetForSubscriptionManager) {
if (msgId.contains(hunspellFailure)) {
log.info(" '" + hunspellFailure + "' was found in msgid: " + msgId);
}
}
}
// assert that there were no unexpected hunspell check failures
Assert.assertEquals(hunspellFailures.size(), 0, "There are zero unexpected hunspell check failures in the msgids.");
// How to demonstrate spellcheck failures...
// Failure: "startup"
// [root@jsefler-os7 ~]# msgunfmt --no-wrap /usr/share/locale/as/LC_MESSAGES/rhsm.mo | grep "startup"
// msgid "launches the registration dialog on startup"
// How to use hunspell check to find failures...
// [root@jsefler-os7 ~]# msgunfmt --no-wrap /usr/share/locale/ja/LC_MESSAGES/rhsm.mo | grep msgid | sed 's/msgid //' > /tmp/msgids.txt && hunspell -l -d en_US /tmp/msgids.txt
// [root@jsefler-os7 ~]# msgunfmt --no-wrap /usr/share/locale/ja/LC_MESSAGES/rhsm.mo | grep msgid | sed 's/msgid //' > /tmp/msgids.txt && hunspell -w -d en_US /tmp/msgids.txt
// [root@jsefler-os7 ~]# msgunfmt --no-wrap /usr/share/locale/ja/LC_MESSAGES/rhsm.mo | grep msgid | sed 's/msgid //' > /tmp/msgids.txt && hunspell -L -d en_US /tmp/msgids.txt
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class TranslationTests method testCandlepinTranslationsDoNotContainUnescapedSingleQuotes.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-21767", "RHEL7-51283" }, level = DefTypes.Level.COMPONENT, component = "subscription-manager", testtype = @TestType(testtype = DefTypes.TestTypes.FUNCTIONAL, subtype1 = DefTypes.Subtypes.RELIABILITY, subtype2 = DefTypes.Subtypes.EMPTY), posneg = PosNeg.POSITIVE, importance = DefTypes.Importance.LOW, automation = DefTypes.Automation.AUTOMATED, tags = "Tier3")
@Test(description = "verify that candlepin translation msgstr does NOT contain unescaped single quotes in the msgid", groups = { "Tier3Tests" }, dataProvider = "getTranslationFileDataForVerifyCandlepinTranslationsDoNotContainUnescapedSingleQuotes_Test", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testCandlepinTranslationsDoNotContainUnescapedSingleQuotes(Object bugzilla, File translationFile) {
boolean warningsFound = false;
// for (File translationFile: translationFileMapForCandlepin.keySet()) { // use dataProvider="getTranslationFileData",
for (Translation translation : translationFileMapForCandlepin.get(translationFile)) {
// TEMPORARY WORKAROUND FOR BUG:
if (translation.msgid.trim().equals("Cannot add pools that are restricted to unit type 'person' to activation keys.") || translation.msgid.trim().equals("A unit type of 'person' cannot be used with activation keys") || translation.msgid.trim().equals("Unit type with id '") || translation.msgid.trim().equals("The activation key name ''{0}'' must be alphanumeric or include the characters '-' or '_'") || translation.msgid.trim().equals("couldn't read rules file") || translation.msgid.trim().equals("couldn't generate statistics") || translation.msgid.trim().equals("the order parameter must be either 'ascending' or 'descending'")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1167856 - candlepin msgids with unescaped single quotes will not print the single quotes
String bugId = "1167856";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping test for unescaped single quotes on this translation while bug '" + bugId + "' is open. Translation: " + translation);
continue;
}
}
if (doesStringContainMatches(translation.msgstr, "(^|[^'])'([^']|$)")) {
// this regex is used to find solo single quotes in the translated msgstr
log.warning("Found a translation containing an unescaped single quote in the " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
// }
Assert.assertTrue(!warningsFound, "No candlepin translations found containing unescaped single quotes.");
}
Aggregations