Search in sources :

Example 1 with IStoreKey

use of org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey in project jbosstools-openshift by jbosstools.

the class SecureStorageTest method shouldRemoveNode.

@Test
public void shouldRemoveNode() throws SecureStoreException {
    // pre-condition
    IStoreKey key = new OpenShiftSecureStorageKey("org.jboss.tools.openshift.test", "localhost", "foobar");
    SecureStore store = new SecureStore(key);
    store.put("password", "chocolate");
    assertTrue(SecurePreferencesFactory.getDefault().nodeExists(key.getKey()));
    // operation
    store.removeNode();
    // verification
    assertFalse(SecurePreferencesFactory.getDefault().nodeExists(key.getKey()));
}
Also used : IStoreKey(org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey) OpenShiftSecureStorageKey(org.jboss.tools.openshift.internal.common.core.security.OpenShiftSecureStorageKey) SecureStore(org.jboss.tools.openshift.internal.common.core.security.SecureStore) Test(org.junit.Test)

Example 2 with IStoreKey

use of org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey in project jbosstools-openshift by jbosstools.

the class ConnectionTest method should_clear_secure_data_when_connection_deleted.

@Test
public void should_clear_secure_data_when_connection_deleted() throws MalformedURLException {
    // pre-conditions
    Connection connection = ConnectionTestUtils.createConnection("bdshadow", "13", "https://localhost.com");
    connection.connect();
    // when
    IStoreKey key = new OpenShiftSecureStorageKey(Connection.SECURE_STORAGE_BASEKEY, connection.getHost(), connection.getUsername());
    assertTrue(SecurePreferencesFactory.getDefault().nodeExists(key.getKey()));
    connection.removeSecureStoreData();
    // then
    assertFalse(SecurePreferencesFactory.getDefault().nodeExists(key.getKey()));
}
Also used : IStoreKey(org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey) OpenShiftSecureStorageKey(org.jboss.tools.openshift.internal.common.core.security.OpenShiftSecureStorageKey) Connection(org.jboss.tools.openshift.core.connection.Connection) Test(org.junit.Test)

Aggregations

OpenShiftSecureStorageKey (org.jboss.tools.openshift.internal.common.core.security.OpenShiftSecureStorageKey)2 IStoreKey (org.jboss.tools.openshift.internal.common.core.security.SecureStore.IStoreKey)2 Test (org.junit.Test)2 Connection (org.jboss.tools.openshift.core.connection.Connection)1 SecureStore (org.jboss.tools.openshift.internal.common.core.security.SecureStore)1