<commit_before>package org.jboss.hal.testsuite.page.config;

import org.jboss.arquillian.graphene.Graphene;
import org.jboss.arquillian.graphene.findby.ByJQuery;
import org.jboss.hal.testsuite.cli.Library;
import org.jboss.hal.testsuite.finder.Application;
import org.jboss.hal.testsuite.finder.FinderNames;
import org.jboss.hal.testsuite.finder.FinderNavigation;
import org.jboss.hal.testsuite.finder.Row;
import org.jboss.hal.testsuite.fragment.ConfigFragment;
import org.jboss.hal.testsuite.fragment.WindowFragment;
import org.jboss.hal.testsuite.fragment.config.messaging.MessagingConfigArea;
import org.jboss.hal.testsuite.fragment.config.resourceadapters.ConfigPropertiesFragment;
import org.jboss.hal.testsuite.fragment.config.resourceadapters.ConfigPropertyWizard;
import org.jboss.hal.testsuite.fragment.formeditor.Editor;
import org.jboss.hal.testsuite.fragment.shared.modal.ConfirmationWindow;
import org.jboss.hal.testsuite.fragment.shared.util.ResourceManager;
import org.jboss.hal.testsuite.page.ConfigPage;
import org.jboss.hal.testsuite.page.Navigatable;
import org.jboss.hal.testsuite.util.ConfigUtils;
import org.jboss.hal.testsuite.util.Console;
import org.jboss.hal.testsuite.util.PropUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;



/**
 * Created by pcyprian on 2.9.15.
 */
public class MessagingPage extends ConfigPage implements Navigatable {

    private static final String
        MESSAGING_PROVIDER_LABEL = "Messaging Provider",
        MESSAGING_SUBSYSTEM_LABEL = "Messaging",
        SETTINGS_LABEL = "Settings";
    private FinderNavigation navigation;

    public ConfigFragment getConfigFragment() {
        WebElement editPanel = browser.findElement(ByJQuery.selector(".master_detail-detail:visible"));
        return  Graphene.createPageFragment(ConfigFragment.class, editPanel);
    }

    public ConfigFragment getWindowFragment() {
        WebElement editPanel = browser.findElement(By.className("default-window-content"));
        return  Graphene.createPageFragment(ConfigFragment.class, editPanel);
    }

    public void navigateToMessagingProvider() {
        if (ConfigUtils.isDomain()) {
            navigation = new FinderNavigation(browser, DomainConfigEntryPoint.class)
                    .step(FinderNames.CONFIGURATION, FinderNames.PROFILES)
                    .step(FinderNames.PROFILE, ConfigUtils.getDefaultProfile());
        } else {
            navigation = new FinderNavigation(browser, StandaloneConfigEntryPoint.class)
                    .step(FinderNames.CONFIGURATION, FinderNames.SUBSYSTEMS);
        }
        navigation.step(FinderNames.SUBSYSTEM, MESSAGING_SUBSYSTEM_LABEL);
        navigation.step(SETTINGS_LABEL, MESSAGING_PROVIDER_LABEL);
    }

    public void selectProvider(String provider) {
        navigateToMessagingProvider();
        navigation.step(MESSAGING_PROVIDER_LABEL, provider);
    }

    public void navigateToMessaging() {
        selectProvider("default");
    }

    public void selectView(String view) {
        Row row = navigation.selectRow();
        Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent();
        row.invoke(view);
        Application.waitUntilVisible();
    }

    public void selectConnectionsView() {
        selectView("Connections");
    }

    public void selectQueuesAndTopics() {
        selectView("Queues/Topics");
    }

    public void makeNavigation() {
        navigation.selectRow();
        Library.letsSleep(1000);
    }

    public void createProvider(String name, boolean enabledSecurity, String secirityDomain, String clusterUser, String clusterPassword) {
        WebElement add = browser.findElement(ByJQuery.selector("div.btn,.primary"));
        add.click();
        getWindowFragment().getEditor().text("name", name);
        getWindowFragment().getEditor().checkbox("security-enabled", enabledSecurity);
        getWindowFragment().getEditor().text("security-domain", secirityDomain);
        getWindowFragment().getEditor().text("cluster-user", clusterUser);
        getWindowFragment().getEditor().text("cluster-password", clusterPassword);
        getWindowFragment().clickButton("Save");
    }

    public void removeProvider() {
        navigation.selectRow().invoke("Remove");
        getWindowFragment().clickButton("Confirm");
    }

    public void InvokeProviderSettings() {
        navigation.selectRow().invoke("Provider Settings");
        Library.letsSleep(1000);
    }

    public void switchToSecurityTab() {
        WebElement security = browser.findElement(ByJQuery.selector("div.gwt-Label:contains(Security)"));
        security.click();
    }

    public void switchToJournalTab() {
        WebElement security = browser.findElement(ByJQuery.selector("div.gwt-Label:contains(Journal)"));
        security.click();
    }

    public void switchToConnectionManagementTab() {
        WebElement security = browser.findElement(ByJQuery.selector("div.gwt-Label:contains(Connection Management)"));
        security.click();<commit_msg>Opening the visible 'Connection Management' tab not the new invisible one.<commit_after>package org.jboss.hal.testsuite.page.config;

import org.jboss.arquillian.graphene.Graphene;
import org.jboss.arquillian.graphene.findby.ByJQuery;
import org.jboss.hal.testsuite.cli.Library;
import org.jboss.hal.testsuite.finder.Application;
import org.jboss.hal.testsuite.finder.FinderNames;
import org.jboss.hal.testsuite.finder.FinderNavigation;
import org.jboss.hal.testsuite.finder.Row;
import org.jboss.hal.testsuite.fragment.ConfigFragment;
import org.jboss.hal.testsuite.fragment.WindowFragment;
import org.jboss.hal.testsuite.fragment.config.messaging.MessagingConfigArea;
import org.jboss.hal.testsuite.fragment.config.resourceadapters.ConfigPropertiesFragment;
import org.jboss.hal.testsuite.fragment.config.resourceadapters.ConfigPropertyWizard;
import org.jboss.hal.testsuite.fragment.formeditor.Editor;
import org.jboss.hal.testsuite.fragment.shared.modal.ConfirmationWindow;
import org.jboss.hal.testsuite.fragment.shared.util.ResourceManager;
import org.jboss.hal.testsuite.page.ConfigPage;
import org.jboss.hal.testsuite.page.Navigatable;
import org.jboss.hal.testsuite.util.ConfigUtils;
import org.jboss.hal.testsuite.util.Console;
import org.jboss.hal.testsuite.util.PropUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;



/**
 * Created by pcyprian on 2.9.15.
 */
public class MessagingPage extends ConfigPage implements Navigatable {

    private static final String
        MESSAGING_PROVIDER_LABEL = "Messaging Provider",
        MESSAGING_SUBSYSTEM_LABEL = "Messaging",
        SETTINGS_LABEL = "Settings";
    private FinderNavigation navigation;

    public ConfigFragment getConfigFragment() {
        WebElement editPanel = browser.findElement(ByJQuery.selector(".master_detail-detail:visible"));
        return  Graphene.createPageFragment(ConfigFragment.class, editPanel);
    }

    public ConfigFragment getWindowFragment() {
        WebElement editPanel = browser.findElement(By.className("default-window-content"));
        return  Graphene.createPageFragment(ConfigFragment.class, editPanel);
    }

    public void navigateToMessagingProvider() {
        if (ConfigUtils.isDomain()) {
            navigation = new FinderNavigation(browser, DomainConfigEntryPoint.class)
                    .step(FinderNames.CONFIGURATION, FinderNames.PROFILES)
                    .step(FinderNames.PROFILE, ConfigUtils.getDefaultProfile());
        } else {
            navigation = new FinderNavigation(browser, StandaloneConfigEntryPoint.class)
                    .step(FinderNames.CONFIGURATION, FinderNames.SUBSYSTEMS);
        }
        navigation.step(FinderNames.SUBSYSTEM, MESSAGING_SUBSYSTEM_LABEL);
        navigation.step(SETTINGS_LABEL, MESSAGING_PROVIDER_LABEL);
    }

    public void selectProvider(String provider) {
        navigateToMessagingProvider();
        navigation.step(MESSAGING_PROVIDER_LABEL, provider);
    }

    public void navigateToMessaging() {
        selectProvider("default");
    }

    public void selectView(String view) {
        Row row = navigation.selectRow();
        Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent();
        row.invoke(view);
        Application.waitUntilVisible();
    }

    public void selectConnectionsView() {
        selectView("Connections");
    }

    public void selectQueuesAndTopics() {
        selectView("Queues/Topics");
    }

    public void makeNavigation() {
        navigation.selectRow();
        Library.letsSleep(1000);
    }

    public void createProvider(String name, boolean enabledSecurity, String secirityDomain, String clusterUser, String clusterPassword) {
        WebElement add = browser.findElement(ByJQuery.selector("div.btn,.primary"));
        add.click();
        getWindowFragment().getEditor().text("name", name);
        getWindowFragment().getEditor().checkbox("security-enabled", enabledSecurity);
        getWindowFragment().getEditor().text("security-domain", secirityDomain);
        getWindowFragment().getEditor().text("cluster-user", clusterUser);
        getWindowFragment().getEditor().text("cluster-password", clusterPassword);
        getWindowFragment().clickButton("Save");
    }

    public void removeProvider() {
        navigation.selectRow().invoke("Remove");
        getWindowFragment().clickButton("Confirm");
    }

    public void InvokeProviderSettings() {
        navigation.selectRow().invoke("Provider Settings");
        Library.letsSleep(1000);
    }

    public void switchToSecurityTab() {
        WebElement security = browser.findElement(ByJQuery.selector("div.gwt-Label:contains(Security)"));
        security.click();
    }

    public void switchToJournalTab() {
        WebElement security = browser.findElement(ByJQuery.selector("div.gwt-Label:contains(Journal)"));
        security.click();
    }

    public void switchToConnectionManagementTab() {
        WebElement security = browser.findElement(ByJQuery.selector("div.gwt-Label:contains(Connection Management):visible"));
        security.click();
{'fraction_non_alphanumeric': 0.10892528345769939, 'fraction_numerical': 0.002325806764221339, 'mean_word_length': 3.9758919961427193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5938451', 'n_tokens_mistral': 2957, 'n_tokens_neox': 2850, 'n_words': 433}