Search in sources :

Example 1 with StoragePreferencePage

use of org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage in project jbosstools-openshift by jbosstools.

the class StoreConnectionTest method cleanUp.

@AfterClass
public static void cleanUp() {
    WorkbenchPreferenceDialog preferences = new WorkbenchPreferenceDialog();
    preferences.open();
    StoragePreferencePage storagePreferencePage = new StoragePreferencePage(preferences);
    preferences.select(storagePreferencePage);
    storagePreferencePage.selectPasswordsTab();
    List<PasswordProvider> masterPasswordProviders = storagePreferencePage.getMasterPasswordProviders();
    for (PasswordProvider tableItem : masterPasswordProviders) {
        tableItem.setEnabled(true);
    }
    preferences.ok();
}
Also used : WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) PasswordProvider(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.PasswordProvider) StoragePreferencePage(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage) AfterClass(org.junit.AfterClass)

Example 2 with StoragePreferencePage

use of org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage in project jbosstools-openshift by jbosstools.

the class StoreConnectionTest method setupClass.

@BeforeClass
public static void setupClass() {
    WorkbenchPreferenceDialog preferences = new WorkbenchPreferenceDialog();
    preferences.open();
    StoragePreferencePage storagePreferencePage = new StoragePreferencePage(preferences);
    preferences.select(storagePreferencePage);
    storagePreferencePage.selectPasswordsTab();
    List<PasswordProvider> masterPasswordProviders = storagePreferencePage.getMasterPasswordProviders();
    for (PasswordProvider tableItem : masterPasswordProviders) {
        // The second part of this if is because https://issues.jboss.org/browse/JBIDE-24567
        if (tableItem.getDescription().contains("UI Prompt") || tableItem.getDescription().contains("secureStorageProvider.name")) {
            tableItem.setEnabled(true);
        } else {
            tableItem.setEnabled(false);
        }
    }
    preferences.ok();
}
Also used : WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) PasswordProvider(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.PasswordProvider) StoragePreferencePage(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage) BeforeClass(org.junit.BeforeClass)

Example 3 with StoragePreferencePage

use of org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage in project jbosstools-openshift by jbosstools.

the class DisableSecureStorageRequirement method setSecureStorageMasterPasswords.

private void setSecureStorageMasterPasswords(boolean checked) {
    WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog();
    StoragePreferencePage storagePage = new StoragePreferencePage(preferenceDialog);
    preferenceDialog.open();
    preferenceDialog.select(storagePage);
    try {
        new WaitUntil(new WidgetIsFound(org.eclipse.swt.custom.CLabel.class, new WithMnemonicTextMatcher("Secure Storage")), TimePeriod.DEFAULT);
        log.info("Getting master password providers");
        List<PasswordProvider> items = storagePage.getMasterPasswordProviders();
        for (PasswordProvider item : items) {
            log.info("Uncheking table item: " + item.getDescription());
            item.setEnabled(checked);
        }
        new WaitUntil(new JobIsRunning(), TimePeriod.DEFAULT, false);
        storagePage.apply();
    } catch (WaitTimeoutExpiredException exc) {
        log.error("Secure Storage preferences page has timed out");
        log.error(exc.getMessage());
    } finally {
        preferenceDialog.ok();
    }
}
Also used : WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PasswordProvider(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.PasswordProvider) StoragePreferencePage(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage)

Example 4 with StoragePreferencePage

use of org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage in project jbosstools-openshift by jbosstools.

the class SecureStorage method verifySecureStorageOfPassword.

/**
 * Verifies whether state of password storage for specified user is in correct
 * state.
 *
 * @param username
 * @param server
 *            URL of OpenShift server without https prefix
 * @param shouldExist
 *            if true, password should be present in secure storage, if false,
 *            there should be no password in secure storage for specified
 *            connection
 * @param serverType
 *            OpenShift v2 or v3 server
 */
public static void verifySecureStorageOfPassword(String username, String server, boolean shouldExist) {
    WorkbenchPreferenceDialog workbenchPreferenceDialog = new WorkbenchPreferenceDialog();
    StoragePreferencePage secureStoragePreferencePage = new StoragePreferencePage(workbenchPreferenceDialog);
    new WorkbenchShell().setFocus();
    workbenchPreferenceDialog.open();
    new WorkbenchPreferenceDialog().select(secureStoragePreferencePage);
    secureStoragePreferencePage.selectContentTab();
    boolean exists = secureStoragePreferencePage.passwordExists("[Default Secure Storage]", getPluginId(), server, username);
    workbenchPreferenceDialog.ok();
    assertTrue(shouldExist ? "Password wasn't present in secure storage while it should." : "Password was present in secure storage but it shouldn't.", shouldExist == exists);
}
Also used : WorkbenchShell(org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) StoragePreferencePage(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage)

Example 5 with StoragePreferencePage

use of org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage in project jbosstools-openshift by jbosstools.

the class GetOpenShiftIOTokenTest method checkPluginInSecureStorage.

private void checkPluginInSecureStorage() {
    WorkbenchPreferenceDialog preferences = new WorkbenchPreferenceDialog();
    preferences.open();
    StoragePreferencePage storagePreferencePage = new StoragePreferencePage(preferences);
    preferences.select(storagePreferencePage);
    storagePreferencePage.selectContentTab();
    DefaultTreeItem account = new DefaultTreeItem(new DefaultTree(storagePreferencePage, 1), "[Default Secure Storage]", "org.jboss.tools.openshift.io.core", "accounts", "OpenShift.io", DatastoreOS3.OPENSHIFT_IO_USERNAME);
    account.select();
    assertNotNull("Account does not exists in secure storage", account);
    preferences.ok();
}
Also used : DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) StoragePreferencePage(org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage)

Aggregations

StoragePreferencePage (org.eclipse.reddeer.eclipse.equinox.security.ui.storage.StoragePreferencePage)5 WorkbenchPreferenceDialog (org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog)5 PasswordProvider (org.eclipse.reddeer.eclipse.equinox.security.ui.storage.PasswordProvider)3 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)1 WithMnemonicTextMatcher (org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher)1 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)1 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)1 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)1 WorkbenchShell (org.eclipse.reddeer.workbench.impl.shell.WorkbenchShell)1 AfterClass (org.junit.AfterClass)1 BeforeClass (org.junit.BeforeClass)1