use of rhsm.data.Translation in project rhsm-qe by RedHatQE.
the class TranslationTests method buildTranslationMsgidSets.
@BeforeClass(groups = "setup", dependsOnMethods = { "buildTranslationFileMapsBeforeClass" })
public void buildTranslationMsgidSets() {
if (clienttasks == null)
return;
// UPDATE: The block below that skips the unsupportedLocales should alleviate the TODO concern above.
for (File translationFile : translationFileMapForSubscriptionManager.keySet()) {
// does this translationFile provide translations to an unsupportedLocale?
boolean isTranslationFileSupported = true;
for (String unsupportedLocale : unsupportedLocales) {
if (translationFile.getPath().contains(String.format("/%s/", unsupportedLocale)))
isTranslationFileSupported = false;
}
// skip the unsupportedLocales (so that the msgids from abandoned translations of prior releases do not interfere with expected msgids of this release)
if (!isTranslationFileSupported)
continue;
List<Translation> translationList = translationFileMapForSubscriptionManager.get(translationFile);
for (Translation translation : translationList) {
translationMsgidSetForSubscriptionManager.add(translation.msgid);
}
}
for (File translationFile : translationFileMapForCandlepin.keySet()) {
List<Translation> translationList = translationFileMapForCandlepin.get(translationFile);
for (Translation translation : translationList) {
translationMsgidSetForCandlepin.add(translation.msgid);
}
}
}
use of rhsm.data.Translation in project rhsm-qe by RedHatQE.
the class TranslationTests method testTranslationsDoNotEndInUnwantedColon.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "", "" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", role = DefTypes.Role.VERIFIES) }, 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 = "Tier2")
@Test(description = "verify that a colon character has not been appended to the end of the translated msgstr unless msgid also ends in a colon", groups = { "Tier2Tests" }, dataProvider = "getTranslationFileDataToTestTranslationsDoNotEndInUnwantedColon", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationsDoNotEndInUnwantedColon(Object bugzilla, File translationFile) {
boolean warningsFound = false;
List<String> colonChars = Arrays.asList(":", ":");
for (String colonChar : colonChars) {
for (Translation translation : translationFileMapForSubscriptionManager.get(translationFile)) {
if (translation.msgstr.trim().endsWith(colonChar) && !translation.msgid.trim().endsWith(":")) {
log.warning("Colon character \"" + colonChar + "\" should not be randomly appended to the end of " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
}
Assert.assertTrue(!warningsFound, "No translations found containing unexpected trailing colon characters. (Details for failed translations are listed in the WARNING messages above.)");
}
use of rhsm.data.Translation in project rhsm-qe by RedHatQE.
the class TranslationTests method testTranslationsDoNotUseParagraphCharacter.
@// update=true, // uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-36513", "RHEL7-32165" }, linkedWorkItems = { // RHSM-REQ : Translation
@LinkedItem(project = Project.RHEL6, workitemId = "RHEL6-28564", role = DefTypes.Role.VERIFIES), // RHSM-REQ : Translation
@LinkedItem(project = Project.RedHatEnterpriseLinux7, workitemId = "RHEL7-84942", role = DefTypes.Role.VERIFIES) }, 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 = "Tier2")
@Test(description = "verify that translation msgstr does NOT contain paragraph character ¶ unless also in msgid", groups = { "Tier2Tests" }, dataProvider = "getTranslationFileDataForVerifyTranslationsDoNotUseParagraphCharacter_Test", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationsDoNotUseParagraphCharacter(Object bugzilla, File translationFile) {
boolean warningsFound = false;
String paragraphChar = "¶";
// for (File translationFile: translationFileMapForSubscriptionManager.keySet()) { // use dataProvider="getTranslationFileData",
for (Translation translation : translationFileMapForSubscriptionManager.get(translationFile)) {
if (translation.msgstr.contains(paragraphChar) && !translation.msgid.contains(paragraphChar)) {
log.warning("Paragraph character \"" + paragraphChar + "\" should not be used in the " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
// }
Assert.assertTrue(!warningsFound, "No translations found containing unexpected paragraph character \"" + paragraphChar + "\".");
}
use of rhsm.data.Translation 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.");
}
use of rhsm.data.Translation in project rhsm-qe by RedHatQE.
the class TranslationTests method verifyTranslatedMsgIdContainsSubStringForAllLangs.
protected void verifyTranslatedMsgIdContainsSubStringForAllLangs(String msgid, String subString) {
if (!translationMsgidSetForSubscriptionManager.contains(msgid))
Assert.fail("Could not find expected msgid \"" + msgid + "\". Has this msgid changed?");
boolean warningsFound = false;
for (File translationFile : translationFileMapForSubscriptionManager.keySet()) {
Translation translation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgid, translationFileMapForSubscriptionManager.get(translationFile));
if (translation == null) {
log.warning("Translation file '" + translationFile + "' does not yet have a translation for msgid '" + msgid + "'.");
continue;
}
if (translation.msgstr.contains(subString)) {
Assert.assertTrue(translation.msgstr.contains(subString), "\"" + subString + "\" remains correctly untranslated in " + translationFile + " translation: " + translation);
} else {
log.warning("Expected \"" + subString + "\" to remain untranslated in " + translationFile + " translation: " + translation);
warningsFound = true;
}
}
Assert.assertFalse(warningsFound, "No errors were found in the translations for msgid \"" + msgid + "\".");
}
Aggregations