Search in sources :

Example 6 with Translation

use of rhsm.data.Translation in project rhsm-qe by RedHatQE.

the class TranslationTests method testPofilter_DEPRECATED.

@Test(description = "run pofilter translate tests on the translation file", groups = { "Tier2Tests" }, dataProvider = "getTranslationFilePofilterTestData", // 07/12/2012 this was the initial test created for the benefit of fsharath who further developed the test in PofilterTranslationTests.java; disabling this test in favor of his
enabled = false)
@Deprecated
public // @ImplementsNitrateTest(caseId=)
void testPofilter_DEPRECATED(Object bugzilla, String pofilterTest, File translationFile) {
    log.info("For an explanation of pofilter test '" + pofilterTest + "', see: http://translate.sourceforge.net/wiki/toolkit/pofilter_tests");
    File translationPoFile = new File(translationFile.getPath().replaceFirst(".mo$", ".po"));
    // execute the pofilter test
    String pofilterCommand = "pofilter --gnome -t " + pofilterTest;
    SSHCommandResult pofilterResult = client.runCommandAndWait(pofilterCommand + " " + translationPoFile);
    Assert.assertEquals(pofilterResult.getExitCode(), new Integer(0), "Successfully executed the pofilter tests.");
    // convert the pofilter test results into a list of failed Translation objects for simplified handling of special cases
    List<Translation> pofilterFailedTranslations = Translation.parse(pofilterResult.getStdout());
    // remove the first translation which contains only meta data
    if (!pofilterFailedTranslations.isEmpty() && pofilterFailedTranslations.get(0).msgid.equals(""))
        pofilterFailedTranslations.remove(0);
    // ignore the following special cases of acceptable results..........
    List<String> ignorableMsgIds = Arrays.asList();
    if (pofilterTest.equals("accelerators")) {
        if (translationFile.getPath().contains("/hi/"))
            ignorableMsgIds = Arrays.asList("proxy url in the form of proxy_hostname:proxy_port");
        if (translationFile.getPath().contains("/ru/"))
            ignorableMsgIds = Arrays.asList("proxy url in the form of proxy_hostname:proxy_port");
    }
    if (pofilterTest.equals("newlines")) {
        ignorableMsgIds = Arrays.asList("Optional language to use for email notification when subscription redemption is complete. Examples: en-us, de-de", "\n" + "Unable to register.\n" + "For further assistance, please contact Red Hat Global Support Services.", "Tip: Forgot your login or password? Look it up at http://red.ht/lost_password", "Unable to perform refresh due to the following exception: %s", "" + "This migration script requires the system to be registered to RHN Classic.\n" + "However this system appears to be registered to '%s'.\n" + "Exiting.", "The tool you are using is attempting to re-register using RHN Certificate-Based technology. Red Hat recommends (except in a few cases) that customers only register with RHN once.", // bug 825388	""+"We have detected that you have multiple service level\n"+"agreements on various products. Please select how you\n"+"want them assigned.", // bug 825388 or 825397 should fix this
        "\n" + "This machine appears to be already registered to Certificate-based RHN.  Exiting.", "\n" + "This machine appears to be already registered to Red Hat Subscription Management.  Exiting.");
    }
    if (pofilterTest.equals("unchanged")) {
        ignorableMsgIds = Arrays.asList("close_button", "facts_view", "register_button", "register_dialog_main_vbox", "registration_dialog_action_area\n", "prod 1, prod2, prod 3, prod 4, prod 5, prod 6, prod 7, prod 8");
    }
    // pluck out the ignorable pofilter test results
    for (String msgid : ignorableMsgIds) {
        Translation ignoreTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgid, pofilterFailedTranslations);
        if (ignoreTranslation != null) {
            log.info("Ignoring result of pofiliter test '" + pofilterTest + "' for msgid: " + ignoreTranslation.msgid);
            pofilterFailedTranslations.remove(ignoreTranslation);
        }
    }
    // assert that there are no failed pofilter translation test results
    Assert.assertEquals(pofilterFailedTranslations.size(), 0, "Discounting the ignored test results, the number of failed pofilter '" + pofilterTest + "' tests for translation file '" + translationFile + "'.");
}
Also used : Translation(rhsm.data.Translation) SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) File(java.io.File) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Example 7 with Translation

use of rhsm.data.Translation in project rhsm-qe by RedHatQE.

the class SubscriptionManagerCLITestScript method buildTranslationFileMapForSubscriptionManager.

protected Map<File, List<Translation>> buildTranslationFileMapForSubscriptionManager() {
    Map<File, List<Translation>> translationFileMapForSubscriptionManager = new HashMap<File, List<Translation>>();
    if (client == null)
        return translationFileMapForSubscriptionManager;
    SSHCommandResult translationFileListingResult = client.runCommandAndWait("rpm -ql subscription-manager | grep rhsm.mo");
    for (String translationFilePath : translationFileListingResult.getStdout().trim().split("\\n")) {
        // skip empty lines
        if (translationFilePath.isEmpty())
            continue;
        File translationFile = new File(translationFilePath);
        // decompile the rhsm.mo file into its original-like rhsm.po file
        log.info("Decompiling the rhsm.mo file...");
        File translationPoFile = new File(translationFile.getPath().replaceFirst(".mo$", ".po"));
        RemoteFileTasks.runCommandAndAssert(client, "msgunfmt --no-wrap " + translationFile + " -o " + translationPoFile, new Integer(0));
        // parse the translations from the rhsm.mo into the translationFileMap
        SSHCommandResult msgunfmtListingResult = client.runCommandAndWaitWithoutLogging("msgunfmt --no-wrap " + translationFilePath);
        translationFileMapForSubscriptionManager.put(translationFile, Translation.parse(msgunfmtListingResult.getStdout()));
    }
    return translationFileMapForSubscriptionManager;
}
Also used : Translation(rhsm.data.Translation) HashMap(java.util.HashMap) SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) List(java.util.List) ArrayList(java.util.ArrayList) File(java.io.File)

Example 8 with Translation

use of rhsm.data.Translation in project rhsm-qe by RedHatQE.

the class SubscriptionManagerCLITestScript method buildTranslationFileMapForCandlepin.

protected Map<File, List<Translation>> buildTranslationFileMapForCandlepin() {
    Map<File, List<Translation>> translationFileMapForCandlepin = new HashMap<File, List<Translation>>();
    if (server == null)
        return translationFileMapForCandlepin;
    // SSHCommandResult translationFileListingResult = server.runCommandAndWait("find "+sm_serverInstallDir+"/po -name *.po");
    SSHCommandResult translationFileListingResult = server.runCommandAndWait("find " + sm_serverInstallDir + " -name *.po");
    for (String translationFilePath : translationFileListingResult.getStdout().trim().split("\\n")) {
        // skip empty lines
        if (translationFilePath.isEmpty())
            continue;
        File translationFile = new File(translationFilePath);
        // parse the translations from the po file into the translationFileMap
        SSHCommandResult catListingResult = server.runCommandAndWaitWithoutLogging("cat " + translationFilePath);
        translationFileMapForCandlepin.put(translationFile, Translation.parse(catListingResult.getStdout()));
    }
    return translationFileMapForCandlepin;
}
Also used : Translation(rhsm.data.Translation) HashMap(java.util.HashMap) SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) List(java.util.List) ArrayList(java.util.ArrayList) File(java.io.File)

Example 9 with Translation

use of rhsm.data.Translation in project rhsm-qe by RedHatQE.

the class PofilterTranslationTests method pofilter_Test.

protected void pofilter_Test(SSHCommandRunner sshCommandRunner, String pofilterTest, File translationFile) {
    log.info("For an explanation of pofilter test '" + pofilterTest + "', see: http://translate.sourceforge.net/wiki/toolkit/pofilter_tests");
    File translationPoFile = new File(translationFile.getPath().replaceFirst(".mo$", ".po"));
    List<String> ignorableMsgIds = new ArrayList<String>();
    // if pofilter test -> notranslatewords, create a file with words that don't have to be translated to native language
    final String notranslateFile = "/tmp/notranslatefile";
    if (pofilterTest.equals("notranslatewords")) {
        // append words that should not be translated to this list
        // CAUTION: the pofilter notranslatewords work ONLY when the noTranslateWords does not contain spaces or non-alphabetic chars such as "Red Hat" and "subscription-manager".  Alternatively, use VerifyTranslationsDoNotTranslateSubStrings_Test for these types of "words"
        List<String> noTranslateWords = Arrays.asList();
        // echo all of the notranslateWords to the notranslateFile
        // remove the old one from the last run
        sshCommandRunner.runCommandAndWait("rm -f " + notranslateFile);
        for (String noTranslateWord : noTranslateWords) sshCommandRunner.runCommandAndWait("echo \"" + noTranslateWord + "\" >> " + notranslateFile);
        if (noTranslateWords.isEmpty())
            throw new SkipException("Skipping this test since the list of noTranslateWords is empty.");
        Assert.assertTrue(RemoteFileTasks.testExists(sshCommandRunner, notranslateFile), "The pofilter notranslate file '" + notranslateFile + "' has been created on the client.");
    }
    // execute the pofilter test
    String pofilterCommand = "pofilter --gnome -t " + pofilterTest;
    if (pofilterTest.equals("notranslatewords"))
        pofilterCommand += " --notranslatefile=" + notranslateFile;
    SSHCommandResult pofilterResult = sshCommandRunner.runCommandAndWait(pofilterCommand + " " + translationPoFile);
    Assert.assertEquals(pofilterResult.getExitCode(), new Integer(0), "Successfully executed the pofilter tests.");
    // convert the pofilter test results into a list of failed Translation objects for simplified handling of special cases
    List<Translation> pofilterFailedTranslations = Translation.parse(pofilterResult.getStdout());
    // remove the first translation which contains only meta data
    if (!pofilterFailedTranslations.isEmpty() && pofilterFailedTranslations.get(0).msgid.equals(""))
        pofilterFailedTranslations.remove(0);
    // *******************************************************************************************
    if (pofilterTest.equals("accelerators")) {
        // these msgids are ignorable for all accelerator language tests because they are NOT used as gnome menu items
        // Note: If these fail the accelerators test, then that means the underscored words were translated which may or may
        // not be a bug as determined by the notranslatewords test or VerifyTranslationsDoNotTranslateSubStrings_Test.
        ignorableMsgIds.add("proxy url in the form of proxy_hostname:proxy_port");
        ignorableMsgIds.add("proxy URL in the form of proxy_hostname:proxy_port");
        ignorableMsgIds.add("%%prog %s [OPTIONS] CERT_FILE");
        ignorableMsgIds.add("%%prog %s [OPTIONS] MANIFEST_FILE");
        ignorableMsgIds.add("To remove a channel, use 'rhn-channel --remove --channel=<conflicting_channel>'.");
        ignorableMsgIds.add("consumer_uuid=%s is not a valid consumer_uuid. Not attempting to sync %s cache with server.");
        // these are various GTK widget ids, not gnome menu items
        ignorableMsgIds.addAll(Arrays.asList(new String[] { "progress_label", "org_selection_label", "no_subs_label", "system_name_label", "org_selection_scrolledwindow", "owner_treeview", "progress_label", "activation_key_entry", "environment_treeview", "env_select_vbox_label", "default_button", "choose_server_label", "consumer_entry", "organization_entry", "registration_dialog_action_area", "server_label", "server_entry", "proxy_button", "close_button", "facts_view", "register_button", "register_dialog_main_vbox", "registration_dialog_action_area\n", "register_details_label", "register_progressbar", "system_instructions_label", "sla_selection_combobox", "release_selection_combobox", "manage_repositories_dialog", "remove_all_overrides_button", "register_widget_main_vbox", "system_name_grid" }));
    }
    // *******************************************************************************************
    if (pofilterTest.equals("newlines")) {
        // common newlines msgid translations to ignore for all langs
        ignorableMsgIds.add("" + "\n" + "This software is licensed to you under the GNU General Public License, version 2 (GPLv2). There is NO WARRANTY for this software, express or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 along with this software; if not, see:\n" + "\n" + "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt\n" + "\n" + "Red Hat trademarks are not licensed under GPLv2. No permission is granted to use or replicate Red Hat trademarks that are incorporated in this software or its documentation.\n");
        // ignorable because the message is printed on the CLI terminal and not rendered in the GUI
        ignorableMsgIds.add("" + "Did not receive a completed unregistration message from RHN Classic for system %s.\n" + "Please investigate on the Customer Portal at https://access.redhat.com.");
        // newlines translations to ignore for specific langs
        if (translationFile.getPath().contains("/bn_IN/"))
            ignorableMsgIds.addAll(Arrays.asList("Tip: Forgot your login or password? Look it up at http://red.ht/lost_password"));
        // bug 908488		if (translationFile.getPath().contains("/or/"))		ignorableMsgIds.addAll(Arrays.asList("\n"+"Unable to register.\n"+"For further assistance, please contact Red Hat Global Support Services."));
        // bug 908488		if (translationFile.getPath().contains("/or/"))		ignorableMsgIds.addAll(Arrays.asList("Unable to perform refresh due to the following exception: %s"));
        // newlines translations to ignore for specific langs
        String msgId = "" + "Redeeming the subscription may take a few minutes.\n" + "Please provide an email address to receive notification\n" + "when the redemption is complete.";
        Translation failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/ko/") && failedTranslation != null && failedTranslation.msgstr.equals("서브스크립션 교환에는 시간이 몇 분 소요될 수 있습니다. \n" + "완료 시 통지를 받기 위한 이메일 주소를 알려주십시오. "))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/ru/") && failedTranslation != null && failedTranslation.msgstr.equals("Получение подписки может занять несколько минут.\n" + "Укажите электронный адрес для получения \n" + "уведомления об завершении операции."))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/ta_IN/") && failedTranslation != null && failedTranslation.msgstr.equals("சந்தாவை மீட்டெடுப்பதற்கு சில நிமிடங்கள் எடுக்கலாம்.\n" + "மீட்டெடுத்தல் முடிந்ததும் அறிவிப்பை பெற ஒரு மின்னஞ்சல் முகவரியை கொடுக்கவும்."))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/te/") && failedTranslation != null && failedTranslation.msgstr.equals("సబ్‌స్క్రిప్షన్‌ను వెచ్చించుటకు కొంత సమయం పట్టవచ్చును.\n" + "వెచ్చింపు పూర్తవగానే నోటీసును స్వీకరించుటకు వొక ఈమెయిల్ చిరునామాను అందించుము."))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/zh_CN/") && failedTranslation != null && failedTranslation.msgstr.equals("兑换订阅可能需要几分钟的时间。\n" + "请提供电子邮件以在兑换完成时接收通知。"))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/zh_CN/") && failedTranslation != null && failedTranslation.msgstr.equals("兑换订阅可能需要几分钟的时间。请提供电子邮件以在兑换完成时接收通知。"))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/hi/") && failedTranslation != null && failedTranslation.msgstr.equals("सदस्यता रिडीम करना कुछ समय ले सकता है.\n" + "कृपया अधिसूचना पाने के लिए कोई ईमेल पता दाखिल करें जब रिडेप्शन पूरा होता है."))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/zh_TW/") && failedTranslation != null && failedTranslation.msgstr.equals("兌換訂閱服務可能會花上幾分鐘。\n" + "請提供電子郵件信箱,好在兌換服務完成時通知您。"))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/as/") && failedTranslation != null && failedTranslation.msgstr.equals("স্বাক্ষৰণ ঘুৰাই নিয়ায় কিছু সময় লব পাৰে। ঘুৰাই নিয়া সম্পূৰ্ণ হলে \n" + "অধিসূচনা গ্ৰহণ কৰিবলে এটা ই-মেইল ঠিকনা প্ৰদান কৰক।"))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/bn_IN/") && failedTranslation != null && failedTranslation.msgstr.equals("সাবস্ক্রিপশন ব্যবহার করতে কয়েক মিনিট ব্যয় হতে পারে।\n" + "প্রয়োগ সম্পূর্ণ হওয়ার পরে সূচনা প্রদানের উদ্দেশ্যে অনুগ্রহ করে একটি ই-মেইল ঠিকানা উল্লেখ করুন।"))
            ignorableMsgIds.add(msgId);
        if (translationFile.getPath().contains("/kn/") && failedTranslation != null && failedTranslation.msgstr.equals("ಚಂದಾದಾರಿಕೆಯನ್ನು ಹಿಂದಕ್ಕೆ ಪಡೆಯುವಿಕೆ ಕೆಲಹೊತ್ತು ಹಿಡಿಯಬಹುದು.\n" + "ಹಿಂದಕ್ಕೆ ಪಡೆಯುವಿಕೆಯು ಪೂರ್ಣಗೊಂಡ ನಂತರ ಸೂಚಿಸಲು ಒಂದು ಇಮೈಲ್ ವಿಳಾಸವನ್ನು ಒದಗಿಸಿ."))
            ignorableMsgIds.add(msgId);
        // TEMPORARY WORKAROUND FOR BUG
        if (failedTranslation != null) {
            String bugId = "928401";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter newlines test translation while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
        // END OF WORKAROUND
        msgId = "Please provide an email address to receive notification\n" + "when the redemption is complete.";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/zh_TW/") && failedTranslation != null && failedTranslation.msgstr.equals("請輸入電子郵件地址,好在兌換完成時收到通知。"))
            ignorableMsgIds.add(msgId);
        msgId = "" + "Did not receive a completed unregistration message from RHN Classic for system %s.\n" + "Please investigate on the Customer Portal at https://access.redhat.com.";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/zh_CN/") && failedTranslation != null && failedTranslation.msgstr.equals("未从 RHN 传统订阅收到关于系统 %s 的 完整未注册信息。请在 https://access.redhat.com 客户门户网站中检查。"))
            ignorableMsgIds.add(msgId);
        msgId = "" + "We have detected that you have multiple service levels on various products.\n" + "Please select how you want them assigned.";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/zh_CN/") && failedTranslation != null && failedTranslation.msgstr.equals("已探测到您在不同产品中有多个服务等级。请选择如何分配它们。"))
            ignorableMsgIds.add(msgId);
        msgId = "Tip: Forgot your login or password? Look it up at http://redhat.com/forgot_password";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/or/") && failedTranslation != null && failedTranslation.msgstr.equals("ସୂଚନା: ଆପଣଙ୍କର ଲଗଇନ କିମ୍ବା ପ୍ରବେଶ ସଂକେତ ଭୁଲିଯାଇଛନ୍ତି କି?" + "\n" + "http://redhat.com/forgot_password ରେ ଦେଖନ୍ତୁ"))
            ignorableMsgIds.add(msgId);
        msgId = "\n" + "Retrieving existing RHN Classic subscription information...";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        // TEMPORARY WORKAROUND FOR BUG
        if (failedTranslation != null) {
            String bugId = "928401";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter newlines test translation while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
        // END OF WORKAROUND
        msgId = "\n" + "Attempting to register system to Red Hat Subscription Management...";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        // TEMPORARY WORKAROUND FOR BUG
        if (failedTranslation != null) {
            String bugId = "928401";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter newlines test translation while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
    // END OF WORKAROUND
    }
    // *******************************************************************************************
    if (pofilterTest.equals("xmltags")) {
        String msgid;
        // failed xmltags msgids to ignore for specific langs
        for (Translation failedTranslation : pofilterFailedTranslations) {
            msgid = "To remove a channel, use 'rhn-channel --remove --channel=<conflicting_channel>'.";
            // msgstr "Чтобы удалить канал, выполните  «rhn-channel --remove --channel=<канал>»."
            if ((translationFile.getPath().contains("/ru/")) && failedTranslation.msgid.equals(msgid) && failedTranslation.msgstr.contains("<канал>"))
                ignorableMsgIds.add(failedTranslation.msgid);
            msgid = "Receive the latest software updates, including security updates, keeping this Red Hat Enterprise Linux system <b>updated</b> and <b>secure</b>.";
            // msgstr "セキュリティ更新など最新のソフトウェア更新を受信し、Red Hat Enterprise Linux システムを最新で安全な状態に維持します。"
            if ((translationFile.getPath().contains("/ja/")) && failedTranslation.msgid.equals(msgid) && !failedTranslation.msgstr.contains("b>"))
                ignorableMsgIds.add(failedTranslation.msgid);
        }
        Boolean match = false;
        for (Translation pofilterFailedTranslation : pofilterFailedTranslations) {
            // Parsing mgID and msgStr for XMLTags
            Pattern xmlTags = Pattern.compile("<.+?>");
            Matcher tagsMsgID = xmlTags.matcher(pofilterFailedTranslation.msgid);
            Matcher tagsMsgStr = xmlTags.matcher(pofilterFailedTranslation.msgstr);
            // Populating a msgID tags into a list
            ArrayList<String> msgIDTags = new ArrayList<String>();
            while (tagsMsgID.find()) {
                msgIDTags.add(tagsMsgID.group());
            }
            // Sorting an list of msgID tags
            ArrayList<String> msgIDTagsSort = new ArrayList<String>(msgIDTags);
            Collections.sort(msgIDTagsSort);
            // Populating a msgStr tags into a list
            ArrayList<String> msgStrTags = new ArrayList<String>();
            while (tagsMsgStr.find()) {
                msgStrTags.add(tagsMsgStr.group());
            }
            // Sorting an list of msgStr tags
            ArrayList<String> msgStrTagsSort = new ArrayList<String>(msgStrTags);
            Collections.sort(msgStrTagsSort);
            // If the above condition holds, then check for XML Tag ordering
            if (msgIDTagsSort.equals(msgStrTagsSort) && msgIDTagsSort.size() == msgStrTagsSort.size()) {
                int size = msgIDTags.size(), count = 0;
                // Stack to hold XML tags
                Stack<String> stackMsgIDTags = new Stack<String>();
                Stack<String> stackMsgStrTags = new Stack<String>();
                // Temporary stack to hold popped elements
                Stack<String> tempStackMsgIDTags = new Stack<String>();
                Stack<String> tempStackMsgStrTags = new Stack<String>();
                while (count < size) {
                    // If it's not a close tag push into stack
                    if (!msgIDTags.get(count).contains("/"))
                        stackMsgIDTags.push(msgIDTags.get(count));
                    else {
                        if (checkTags(stackMsgIDTags, tempStackMsgIDTags, msgIDTags.get(count)))
                            match = true;
                        else {
                            // If an open XMLtag doesn't have an appropriate close tag exit loop
                            match = false;
                            break;
                        }
                    }
                    // If it's not a close tag push into stack
                    if (!msgStrTags.get(count).contains("/"))
                        stackMsgStrTags.push(msgStrTags.get(count));
                    else {
                        if (checkTags(stackMsgStrTags, tempStackMsgStrTags, msgStrTags.get(count)))
                            match = true;
                        else {
                            // If an open XMLtag doesn't have an appropriate close tag exit loop
                            match = false;
                            break;
                        }
                    }
                    // Incrementing count to point to the next element
                    count++;
                }
            }
            if (match)
                ignorableMsgIds.add(pofilterFailedTranslation.msgid);
        }
    }
    // *******************************************************************************************
    if (pofilterTest.equals("filepaths")) {
        // filepaths translations to ignore for specific langs
        String msgId = "Could not read installation number from /etc/sysconfig/rhn/install-num.  Aborting.";
        Translation failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/ko/") && failedTranslation != null && failedTranslation.msgstr.equals("/etc/sysconfig/rhn/install-num에서 설치 번호를 읽을 수 없습니다. 중지 중 "))
            ignorableMsgIds.add(msgId);
        for (Translation pofilterFailedTranslation : pofilterFailedTranslations) {
            // Parsing mgID and msgStr for FilePaths ending ' ' (space)
            Pattern filePath = Pattern.compile("/.*?( |$)", Pattern.MULTILINE);
            Matcher filePathMsgID = filePath.matcher(pofilterFailedTranslation.msgid);
            Matcher filePathMsgStr = filePath.matcher(pofilterFailedTranslation.msgstr);
            ArrayList<String> filePathsInID = new ArrayList<String>();
            ArrayList<String> filePathsInStr = new ArrayList<String>();
            // Reading the filePaths into a list
            while (filePathMsgID.find()) {
                filePathsInID.add(filePathMsgID.group());
            }
            while (filePathMsgStr.find()) {
                filePathsInStr.add(filePathMsgStr.group());
            }
            // if(filePathsInID.size() == filePathsInStr.size()) {
            for (int i = 0; i < filePathsInID.size(); i++) {
                // If the msgID->filePath ends with '.', remove '.' and compare with msgStr->filePath
                if (filePathsInID.get(i).trim().startsWith("//")) {
                    ignorableMsgIds.add(pofilterFailedTranslation.msgid);
                    continue;
                }
                // contains("//")) ignoreMsgIDs.add(pofilterFailedTranslation.msgid);
                if (filePathsInID.get(i).trim().charAt(filePathsInID.get(i).trim().length() - 1) == '.') {
                    String filePathID = filePathsInID.get(i).trim().substring(0, filePathsInID.get(i).trim().length() - 1);
                    if (filePathID.equals(filePathsInStr.get(i).trim()))
                        ignorableMsgIds.add(pofilterFailedTranslation.msgid);
                }
            /*else {
							if(filePathsInID.get(i).trim().equals(filePathsInStr.get(i).trim())) ignoreMsgIDs.add(pofilterFailedTranslation.msgid);
						}*/
            }
        // }
        }
    }
    // *******************************************************************************************
    if (pofilterTest.equals("options")) {
    }
    // *******************************************************************************************
    if (pofilterTest.equals("short")) {
        // common short msgid translations to ignore for all langs
        ignorableMsgIds.addAll(Arrays.asList("No", "Yes", "Key", "Value", "N/A", "None", "Number", "and"));
        // ignore short translation for " and " ONLY when the msgstr has NOT trimmed the white space
        String msgId = " and ";
        Translation failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (failedTranslation != null && failedTranslation.msgstr.startsWith(" ") && failedTranslation.msgstr.endsWith(" "))
            ignorableMsgIds.add(msgId);
        else // TEMPORARY WORKAROUND FOR BUG 984206 - def friendly_join(items): in utils.py should not use string " and "
        if (failedTranslation != null) {
            String bugId = "984206";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter short test translation while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
        // short msgids to ignore for specific langs
        if ((translationFile.getPath().contains("/zh_TW/")))
            ignorableMsgIds.addAll(Arrays.asList("automatically attach compatible subscriptions to this system", "automatically attach compatible                                subscriptions to this system"));
    }
    // *******************************************************************************************
    if (pofilterTest.equals("long")) {
        // msgstr "Соглашение об уровне обслуживания"	// "SLA" is actually a placeholder string for the actual value in the confirm SLA workflow dialog.  This string/translation will not be seen.
        if ((translationFile.getPath().contains("/ru/")))
            ignorableMsgIds.addAll(Arrays.asList("SLA"));
    }
    // *******************************************************************************************
    if (pofilterTest.equals("doublewords")) {
        // common doublewords in the translation to ignore for all langs
        ignorableMsgIds.addAll(Arrays.asList("Subscription Subscriptions Box", "Subscription Subscriptions Label"));
        // doublewords in the translation to ignore for specific langs
        if (/*sub-man*/
        (translationFile.getPath().contains("/pa/")))
            ignorableMsgIds.addAll(Arrays.asList("Server URL can not be None"));
        // more info in bug 861095
        if (/*sub-man*/
        (translationFile.getPath().contains("/hi/")))
            ignorableMsgIds.addAll(Arrays.asList("Server URL can not be None"));
        // msgstr "Le service de gestion des abonnements « Subscription Management » avec lequel vous vous enregistrez fournira à votre système des mises à jour et permettra une gestion supplémentaire."	//	# (pofilter) doublewords: The word 'vous' is repeated
        if (/*sub-man*/
        (translationFile.getPath().contains("/fr/")))
            ignorableMsgIds.addAll(Arrays.asList("The Subscription Management Service you register with will provide your system with updates and allow additional management.", "The subscription management service you register with will provide your system with updates and allow additional management."));
        if (/*sub-man*/
        (translationFile.getPath().contains("/or/")))
            ignorableMsgIds.addAll(Arrays.asList("Run the initial checks immediately, with no delay.", "Run the initial checks immediatly, with no delay.", "run the initial checks immediately, with no delay"));
        // msgstr "Enregistrement sur : %s:%s%s"	//	# (pofilter) doublewords: The word ':' is repeated
        if (/*sub-man*/
        (translationFile.getPath().contains("/fr/")))
            ignorableMsgIds.addAll(Arrays.asList("Registering to: %s:%s%s"));
        // msgstr "Le service de gestion des abonnements avec lequel vous vous enregistrez fournira à votre système des mises à jour et permettra une gestion supplémentaire."	//	# (pofilter) doublewords: The word 'vous' is repeated
        if (/*sub-man*/
        (translationFile.getPath().contains("/fr/")))
            ignorableMsgIds.addAll(Arrays.asList("The subscription management service you register with will provide your system with updates and allow additional management.s"));
        // msgstr "Annulation de l’inscription de : %s : %s %s"	//	# (pofilter) doublewords: The word ':' is repeated
        if (/*sub-man*/
        (translationFile.getPath().contains("/fr/")))
            ignorableMsgIds.addAll(Arrays.asList("Unregistering from: %s:%s%s"));
        // msgstr "Ungültige Zeichenkette für Zeitzonen. Zeitzonen müssen erkannte Zeitzonennamen oder Offsets sein, die in folgender Form angegeben sind \"GMT[+-]HH:?MM\"."	//	# (pofilter) doublewords: The word 'zeitzonen' is repeated
        if (/*candlepin*/
        (translationFile.getPath().endsWith("/de.po")))
            ignorableMsgIds.addAll(Arrays.asList("Invalid time zone string. Time zones must be recognized time zone names or offsets specified in the form of \"GMT[+-]HH:?MM\".".replaceAll("\\\"", "\\\\\"")));
    }
    // *******************************************************************************************
    if (pofilterTest.equals("unchanged")) {
        // common unchanged translations to ignore for all langs
        ignorableMsgIds.addAll(Arrays.asList("prod 1, prod2, prod 3, prod 4, prod 5, prod 6, prod 7, prod 8", "Awesome OS 14, Awesome OS 14 Super Edition, Awesome Middle Ware For Awesome App Platform Awesome Developer Editition", "Awesome OS 14, Awesome OS 14 Super Edition, Awesome Middle Ware For Awesome App Platform Awesome Developer Edition", "connectionStatusLabel", "progress_label", "org_selection_label", "no_subs_label", "system_name_label", "org_selection_scrolledwindow", "owner_treeview", "progress_label", "activation_key_entry", "environment_treeview", "env_select_vbox_label", "default_button", "choose_server_label", "consumer_entry", "organization_entry", "registration_dialog_action_area", "server_label", "server_entry", "proxy_button", "close_button", "facts_view", "register_button", "register_dialog_main_vbox", "registration_dialog_action_area\n", "register_details_label", "register_progressbar", "system_instructions_label", "sla_selection_combobox", "release_selection_combobox", "autoheal_checkbox", "gpgcheck_combobox", "gpgcheck_edit_button", "gpgcheck_readonly", "gpgcheck_remove_button", "manage_repositories_dialog", "remove_all_overrides_button", "repository_listview", "apply_button", "register_notebook", "register_widget_main_vbox", "cancel_button", "back_button", "credentials_grid", "system_name_grid", "hostname[:port][/prefix]", // "Enabled (1)",	// this is a string from src/subscription_manager/gui/data/repositories.glade that is marked as translatable="yes", however it is never seen in the GUI because it gets overwritten by string "Enabled" or "Disabled"
        "python-rhsm: %s", "subscription-manager: %s", "python-rhsm: %s", "%s of %s", "<b>SKU:</b>", "<b>HTTP Proxy</b>", "<b>Gpgcheck:</b>", "<b>python-rhsm version:</b> %s", "<b>python-rhsm Version:</b> %s", "GPG", "Gpgcheck", "RHN Classic", "Red Hat Subscription Manager", "Red Hat Subscription Management", "Red Hat Subscription Validity Applet", "floating-point", "integer", "long integer", "Copyright (c) 2012 Red Hat, Inc.", "\nThis software is licensed to you under the GNU General Public License, version 2 (GPLv2). There is NO WARRANTY for this software, express or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 along with this software; if not, see:\n" + "\n" + "http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt\n" + "\n" + "Red Hat trademarks are not licensed under GPLv2. No permission is granted to use or replicate Red Hat trademarks that are incorporated in this software or its documentation.\n"));
        // Move de_DE to be just de; Move es_ES to be just es; candlepin commit 51c338274b7194b70b472f15a0deef48d61f7804
        if (doesStringContainMatches(translationFile.getPath(), "/bn_IN/|/bn_IN\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Subscription Validity Applet", "Auto-attach"));
        if (doesStringContainMatches(translationFile.getPath(), "/ta_IN/|/ta_IN\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Org: ", "org id: %s", "org ID: %s", "Repo Id:              \\t%s", "Repo Url:             \\t%s"));
        if (doesStringContainMatches(translationFile.getPath(), "/pt_BR/|/pt_BR\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Org: ", "org id: %s", "org ID: %s", "<b>subscription management service version:</b> %s", "Status", "Status:               \\t%s", "<b>Status:</b>", "Login:", "Virtual", "_Help", "virtual", "Repo Id:              \\t%s", "Arch:                 \\t%s", /* omaciel says "Arquitetura:" is better */
            "Pool Id:              \\t%s", /* omaciel says "ID do pool:" is better */
            "<b>Base URL:</b>", "Ok", "_Ok", "Login", "_Login:", "Proxy"));
        if (doesStringContainMatches(translationFile.getPath(), "/de_DE/|/de_DE\\.po$|/de/|de\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Subscription Manager", "Red Hat account: ", "Account", "<b>Account:</b>", "Account:              \\t%s", "<b>Subscription Management Service Version:</b> %s", "<b>subscription management service version:</b> %s", "subscription management server: %s", "Login:", "Arch", "Arch:", "Name", "Name:                 \\t%s", "Name:", "<b>Name:</b>", "Status", "<b>Status:</b>", "Status:               \\t%s", "Status: $0", "Status:", "<b>Status Details:</b>", "Status Details", "Status Details:", "Status Details Text", "System Status Details", "Version: %s", "Version", "Version:              \\t%s", "Version:", "<b>%s version:</b> %s", "_System", "long integer", "name: %s", "label", "Label", "Name: %s", "Release: %s", "integer", "Tags", "Org: ", "org ID: %s", "\\tManifest", "<b>Account:</b>", "Account", "Account:", "Red Hat account: ", "Server", "Standard", "Repository: %s", "Ok", "_Ok", "<b>Support:</b>", "<b>Downloads &amp; Upgrades:</b>", "Bypass Proxy Checkbox", "Hostname/Domain Bypass Text", "Proxy"));
        if (doesStringContainMatches(translationFile.getPath(), "/es_ES/|/es_ES\\.po$|/es/|es\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Org: ", "Serial", "Serial:", "No", "%s: error: %s", "General:", "_Login:", "Login", "Proxy"));
        if (doesStringContainMatches(translationFile.getPath(), "/te/|/te\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("page 2"));
        if (doesStringContainMatches(translationFile.getPath(), "/pa/|/pa\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("<b>python-rhsm version:</b> %s"));
        if (doesStringContainMatches(translationFile.getPath(), "/fr/|/fr\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Auto-attach", "Options", "options", "Type", "Arch", "Arches", "Architectures", "Version", "page 2", "Standard", "Proxy"));
        if (doesStringContainMatches(translationFile.getPath(), "/it/|/it\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Auto-attach", "Org: ", "org id: %s", "org ID: %s", "Account", "Account:", "<b>Account:</b>", "Account:              \\t%s", "<b>Arch:</b>", "Arch:                 \\t%s", "Arch", "Arch:", "Login", "Login:", "_Login:", "No", "Password", "Password:", "Password: ", "_Password:", "Release: %s", "Server", "Standard", "Stack ", "Ok", "_Ok", "Proxy"));
        if (doesStringContainMatches(translationFile.getPath(), "/ru/|/ru\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Ok", "_Ok"));
        if (doesStringContainMatches(translationFile.getPath(), "/ja/|/ja\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Ok", "_Ok"));
        if (doesStringContainMatches(translationFile.getPath(), "/zh_TW/|/zh_TW\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Auto-attach"));
        if (doesStringContainMatches(translationFile.getPath(), "/zh_CN/|/zh_CN\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("Section: %s, Name: %s", "Subscription Manager"));
        if (doesStringContainMatches(translationFile.getPath(), "/fr/|/fr\\.po$"))
            ignorableMsgIds.addAll(Arrays.asList("%prog [options]", "%prog [OPTIONS]", "%%prog %s [OPTIONS]", "%%prog %s [OPTIONS] CERT_FILE", "%%prog %s [OPTIONS] MANIFEST_FILE", "%%prog %s [OPTIONS] "));
        // TEMPORARY WORKAROUND FOR BUG
        String msgId = "pinsetter.";
        Translation failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/server/") && failedTranslation != null) {
            String bugId = "1142824";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter " + pofilterTest + " test while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
        msgId = "pool_id";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/server/") && failedTranslation != null) {
            String bugId = "1142824";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter " + pofilterTest + " test while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
        msgId = "owner_key";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/server/") && failedTranslation != null) {
            String bugId = "1142824";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter " + pofilterTest + " test while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
        msgId = "uri";
        failedTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgId, pofilterFailedTranslations);
        if (translationFile.getPath().contains("/server/") && failedTranslation != null) {
            String bugId = "1142824";
            boolean invokeWorkaroundWhileBugIsOpen = true;
            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 this failed pofilter " + pofilterTest + " test while bug '" + bugId + "' is open. " + failedTranslation);
                ignorableMsgIds.add(msgId);
            }
        }
    // END OF WORKAROUND
    }
    // *******************************************************************************************
    if (pofilterTest.equals("urls")) {
        // search for failed pofilter urls translation and ignore acceptable cases
        for (Translation failedTranslation : pofilterFailedTranslations) {
            // ignore translations that excluded the trailing period on the url
            if (failedTranslation.msgid.replaceAll("\\n", "").matches(".*https://access\\.redhat\\.com\\.$") && failedTranslation.msgstr.contains("https://access.redhat.com")) {
                ignorableMsgIds.add(failedTranslation.msgid);
            }
            // ignore translations that excluded the trailing period on the url
            if (failedTranslation.msgid.replaceAll("</?[A-Za-z]+>", "").matches(".*http://www\\.redhat\\.com/legal/privacy_statement\\.html\\.$") && failedTranslation.msgstr.contains("http://www.redhat.com/legal/privacy_statement.html")) {
                ignorableMsgIds.add(failedTranslation.msgid);
            }
            // ignore translations that appended the url with a period or surrounded the url with parenthesis since their inclusion does NOT appear to affect the linkability of the url (e.g. "https://access.redhat.com/knowledge/node/129003)" resolves to the expected page and so does "https://access.redhat.com/knowledge/node/129003." )
            if (failedTranslation.msgid.replaceAll("\\n", "").contains("https://access.redhat.com/knowledge/node/129003 ") && failedTranslation.msgstr.contains("https://access.redhat.com/knowledge/node/129003")) {
                ignorableMsgIds.add(failedTranslation.msgid);
            }
        }
    }
    // pluck out the ignorable pofilter test results
    for (String msgid : ignorableMsgIds) {
        Translation ignoreTranslation = Translation.findFirstInstanceWithMatchingFieldFromList("msgid", msgid, pofilterFailedTranslations);
        if (ignoreTranslation != null) {
            log.info("Ignoring result of pofiliter test '" + pofilterTest + "' for msgid: " + ignoreTranslation.msgid);
            pofilterFailedTranslations.remove(ignoreTranslation);
        }
    }
    // for convenience reading the logs, log warnings for the failed pofilter test results (when some of the failed test are being ignored)
    if (!ignorableMsgIds.isEmpty())
        for (Translation pofilterFailedTranslation : pofilterFailedTranslations) {
            log.warning("Failed result of pofiliter test '" + pofilterTest + "' for translation: " + pofilterFailedTranslation);
        }
    // assert that there are no failed pofilter translation test results remaining after the ignorable pofilter test results have been plucked out
    Assert.assertEquals(pofilterFailedTranslations.size(), 0, "Discounting the ignored test results, the number of failed pofilter '" + pofilterTest + "' tests for translation file '" + translationFile + "'.");
}
Also used : Pattern(java.util.regex.Pattern) Translation(rhsm.data.Translation) Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) Stack(java.util.Stack) SSHCommandResult(com.redhat.qe.tools.SSHCommandResult) SkipException(org.testng.SkipException) File(java.io.File)

Example 10 with Translation

use of rhsm.data.Translation in project rhsm-qe by RedHatQE.

the class TranslationTests method testTranslationFileContainsAllMsgids.

@// update=true,	// uncomment to make TestDefinition changes update Polarion testcases through the polarize testcase importer
TestDefinition(projectID = { Project.RHEL6, Project.RedHatEnterpriseLinux7 }, testCaseID = { "RHEL6-25823", "RHEL7-68145" }, 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 = "Tier1")
@Test(description = "verify that only the expected rhsm.mo tranlation files are installed for each of the supported locales", groups = { "Tier1Tests", "blockedByBug-1057532", // [subscription-manager] Tier 0 Localization
"blockedByBug-1481232", // Zanata translations for subscription-manager 1.19 are not 100%
"blockedByBug-1441739", // Zanata translations for subscription-manager 1.18 are not 100%
"blockedByBug-1391681", // Zanata translations for subscription-manager 1.17 are not 100%
"blockedByBug-1340135", // Zanata 1.16.X NOT 100%		// see Skip on Known Issue
"blockedByBug-1303768", // Zanata 1.14.X NOT 100%		// see Skip on Known Issue
"blockedByBug-1195824", // Zanata 1.13.X NOT 100%		// see Skip on Known Issue
"blockedByBug-1166333", // Zanata 1.12.X NOT 100%		// see Skip on Known Issue
"blockedByBug-1118020", // Zanata 1.11.X NOT 100%		// see Skip on Known Issue
"blockedByBug-1093201", // Zanata 1.10.X NOT 100%
"blockedByBug-1020474", // Zanata 1.9.X NOT 100%
"blockedByBug-1003017", // Zanata 1.8.X NOT 100%
"blockedByBug-912460", // Zanata 1.1.X NOT 100%
"blockedByBug-871152" }, dataProvider = "getTranslationFileData", enabled = true)
public // @ImplementsNitrateTest(caseId=)
void testTranslationFileContainsAllMsgids(Object bugzilla, File translationFile) {
    List<Translation> translationList = translationFileMapForSubscriptionManager.get(translationFile);
    boolean translationFilePassed = true;
    for (String msgid : translationMsgidSetForSubscriptionManager) {
        int numMsgidOccurances = 0;
        for (Translation translation : translationList) {
            if (translation.msgid.equals(msgid))
                numMsgidOccurances++;
        }
        if (numMsgidOccurances != 1) {
            log.warning("Expected 1 occurance (actual='" + numMsgidOccurances + "') of the following msgid in translation file '" + translationFile + "':  msgid \"" + msgid + "\"");
            translationFilePassed = false;
        }
    }
    // Skip on Known Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1093201#c5
    if (translationFile.getPath().contains("/pa/") && clienttasks.isPackageVersion("subscription-manager", "==", "1.11")) {
        if (!translationFilePassed) {
            throw new SkipException("Missing translations for Punjabi /pa/ is a Known Issue for subscription-manager-1.11.  See https://bugzilla.redhat.com/show_bug.cgi?id=1093201#c5");
        }
    }
    // Skip on Known Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1118020#c3
    if (translationFile.getPath().contains("/pa/") && clienttasks.isPackageVersion("subscription-manager", "==", "1.12")) {
        if (!translationFilePassed) {
            throw new SkipException("Missing translations for Punjabi /pa/ is a Known Issue for subscription-manager-1.12.  See https://bugzilla.redhat.com/show_bug.cgi?id=1118020#c3");
        }
    }
    // Skip on Known Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1166333#c1
    if (translationFile.getPath().contains("/pa/") && clienttasks.isPackageVersion("subscription-manager", "==", "1.13")) {
        if (!translationFilePassed) {
            throw new SkipException("Missing translations for Punjabi /pa/ is a Known Issue for subscription-manager-1.13.  See https://bugzilla.redhat.com/show_bug.cgi?id=1166333#c1");
        }
    }
    if (translationFile.getPath().contains("/ko/") && clienttasks.isPackageVersion("subscription-manager", "==", "1.13")) {
        if (!translationFilePassed) {
            throw new SkipException("Missing translations for Korean /ko/ is a Known Issue for subscription-manager-1.13.  See https://bugzilla.redhat.com/show_bug.cgi?id=1166333#c1");
        }
    }
    if (translationFile.getPath().contains("/as/") && clienttasks.isPackageVersion("subscription-manager", "==", "1.13")) {
        if (!translationFilePassed) {
            throw new SkipException("Missing translations for Assamese /as/ is a Known Issue for subscription-manager-1.13.  See https://bugzilla.redhat.com/show_bug.cgi?id=1166333#c1");
        }
    }
    // Skip on Known Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1195824#c2 (reduction to supportedLocales10)
    if (!translationFilePassed && clienttasks.isPackageVersion("subscription-manager", ">=", "1.14")) {
        for (String unsupportedLocale : unsupportedLocales) {
            if (translationFile.getPath().contains("/" + unsupportedLocale + "/")) {
                throw new SkipException("Missing translations for '" + unsupportedLocale + "' in '" + translationFile.getPath() + "' is a Known Issue for subscription-manager-1.14+.  See https://bugzilla.redhat.com/show_bug.cgi?id=1195824#c2 stating the reduction in supported language translations.");
            }
        }
    }
    // TEMPORARY WORKAROUND FOR BUG:
    if (!translationFilePassed && clienttasks.isPackageVersion("subscription-manager", "==", "1.16")) {
        if (translationFile.getPath().contains("/it/")) {
            boolean invokeWorkaroundWhileBugIsOpen = true;
            // Bug 1318404 - [IT] Zanata translations for subscription-manager 1.16 are not 100%
            String bugId = "1318404";
            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) {
                throw new SkipException("Missing translations for Lang '" + translationFile.getPath() + "' is a Known Issue for subscription-manager-1.16.  Skipping test while bug '" + bugId + "' is open.");
            }
        }
    }
    // Skip on Known Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1441739#c1
    if (// skip this SkipException due to https://bugzilla.redhat.com/show_bug.cgi?id=1441739#c2
    false)
        if (!translationFile.getPath().contains("/ja/") && clienttasks.isPackageVersion("subscription-manager", "==", "1.19")) {
            if (!translationFilePassed) {
                throw new SkipException("Missing translations from " + translationFile + " is a Known Issue for subscription-manager-1.19.  New translations for RHEL7.4 are Japanese only.  See https://bugzilla.redhat.com/show_bug.cgi?id=1441739#c1 and https://bugzilla.redhat.com/show_bug.cgi?id=1449667");
            }
        }
    Assert.assertTrue(translationFilePassed, "Exactly 1 occurance of all the expected translation msgids (" + translationMsgidSetForSubscriptionManager.size() + ") were found in translation file '" + translationFile + "'.");
}
Also used : Translation(rhsm.data.Translation) SkipException(org.testng.SkipException) BugzillaAPIException(com.redhat.qe.auto.bugzilla.BugzillaAPIException) TestDefinition(com.github.redhatqe.polarize.metadata.TestDefinition) Test(org.testng.annotations.Test) ImplementsNitrateTest(com.redhat.qe.auto.tcms.ImplementsNitrateTest)

Aggregations

Translation (rhsm.data.Translation)12 ImplementsNitrateTest (com.redhat.qe.auto.tcms.ImplementsNitrateTest)7 Test (org.testng.annotations.Test)7 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)6 File (java.io.File)6 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)4 ArrayList (java.util.ArrayList)4 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)3 HashMap (java.util.HashMap)2 List (java.util.List)2 SkipException (org.testng.SkipException)2 Stack (java.util.Stack)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 BeforeClass (org.testng.annotations.BeforeClass)1