< prev index next >
application/tests/org.openjdk.jmc.ui.common.test/src/test/java/org/openjdk/jmc/ui/common/security/SecureStoreTest.java
Print this page
*** 52,66 ****
import org.openjdk.jmc.ui.common.util.Environment;
@SuppressWarnings("nls")
public class SecureStoreTest {
! private final String pwd = "test"; //$NON-NLS-1$
! private final String family = "family"; //$NON-NLS-1$
! private final String family2 = "family2"; //$NON-NLS-1$
! private final String value1 = "1"; //$NON-NLS-1$
! private final String value2 = "2"; //$NON-NLS-1$
@BeforeClass
public static void beforeClass() {
Assume.assumeFalse("Skipping testing on Linux due to possible lack of entropy",
Environment.getOSType() == Environment.OSType.LINUX);
--- 52,66 ----
import org.openjdk.jmc.ui.common.util.Environment;
@SuppressWarnings("nls")
public class SecureStoreTest {
! private final String pwd = "test";
! private final String family = "family";
! private final String family2 = "family2";
! private final String value1 = "1";
! private final String value2 = "2";
@BeforeClass
public static void beforeClass() {
Assume.assumeFalse("Skipping testing on Linux due to possible lack of entropy",
Environment.getOSType() == Environment.OSType.LINUX);
*** 87,97 ****
public void testInvalidCipher() throws Exception {
Preferences prefs = new DummyPreferences();
SecureStore store = new SecureStore(prefs);
store.initialize();
store.setPassword(pwd);
! store.setEncryptionCipher("UnknownCipher"); //$NON-NLS-1$
}
@Test
public void testInsert() throws Exception {
Preferences prefs = new DummyPreferences();
--- 87,97 ----
public void testInvalidCipher() throws Exception {
Preferences prefs = new DummyPreferences();
SecureStore store = new SecureStore(prefs);
store.initialize();
store.setPassword(pwd);
! store.setEncryptionCipher("UnknownCipher");
}
@Test
public void testInsert() throws Exception {
Preferences prefs = new DummyPreferences();
*** 134,144 ****
store.initialize();
store.setPassword(pwd);
store.insert(null, true, value1);
store = new SecureStore(prefs);
try {
! store.initialize("other"); //$NON-NLS-1$
fail();
} catch (Exception e) {
}
}
--- 134,144 ----
store.initialize();
store.setPassword(pwd);
store.insert(null, true, value1);
store = new SecureStore(prefs);
try {
! store.initialize("other");
fail();
} catch (Exception e) {
}
}
*** 153,163 ****
store.setEncryptionCipher(cipher);
store = new SecureStore(prefs);
store.initialize(pwd);
assertEquals(cipher, store.getEncryptionCipher());
assertEquals(value1, store.get(key));
! System.out.println(cipher + " tested ok"); //$NON-NLS-1$
}
}
@Test
public void testChangePassword() throws Exception {
--- 153,163 ----
store.setEncryptionCipher(cipher);
store = new SecureStore(prefs);
store.initialize(pwd);
assertEquals(cipher, store.getEncryptionCipher());
assertEquals(value1, store.get(key));
! System.out.println(cipher + " tested ok");
}
}
@Test
public void testChangePassword() throws Exception {
*** 166,178 ****
store.initialize();
store.setPassword(pwd);
String key = store.insert(null, true, value1);
store = new SecureStore(prefs);
store.initialize(pwd);
! store.setPassword("newPwd"); //$NON-NLS-1$
store = new SecureStore(prefs);
! store.initialize("newPwd"); //$NON-NLS-1$
assertEquals(value1, store.get(key));
}
@Test
public void testClearFamily() throws Exception {
--- 166,178 ----
store.initialize();
store.setPassword(pwd);
String key = store.insert(null, true, value1);
store = new SecureStore(prefs);
store.initialize(pwd);
! store.setPassword("newPwd");
store = new SecureStore(prefs);
! store.initialize("newPwd");
assertEquals(value1, store.get(key));
}
@Test
public void testClearFamily() throws Exception {
< prev index next >