@Test public void testLoad() throws Exception { KeyStore keyStore = newKeyStoreWithData(); try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(keyStoreFile))) { keyStore.store(bos, STORE_PASSWORD); } assertThat(storage.modified(), is(true)); keyStore = newKeyStore(); storage.load(keyStore, STORE_PASSWORD); assertThat(keyStore.containsAlias(CERT_ALIAS), is(true)); assertThat(storage.modified(), is(false)); }
@Override public void load(final KeyStore keyStore, final char[] password) throws NoSuchAlgorithmException, CertificateException, IOException { long readStart = System.currentTimeMillis(); try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(keyStoreFile))) { keyStore.load(bis, password); } lastRead = readStart; }
FileKeyStoreStorage implements KeyStoreStorage { @Override public void load(final KeyStore keyStore, final char[] password) throws NoSuchAlgorithmException, CertificateException, IOException { long readStart = System.currentTimeMillis(); try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(keyStoreFile))) { keyStore.load(bis, password); } lastRead = readStart; } }
FileKeyStoreStorage implements KeyStoreStorage { @Override public void load(final KeyStore keyStore, final char[] password) throws NoSuchAlgorithmException, CertificateException, IOException { long readStart = System.currentTimeMillis(); try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(keyStoreFile))) { keyStore.load(bis, password); } lastRead = readStart; } FileKeyStoreStorage(final File keyStoreFile); }
FileKeyStoreStorage implements KeyStoreStorage { @Override public void load(final KeyStore keyStore, final char[] password) throws NoSuchAlgorithmException, CertificateException, IOException { long readStart = System.currentTimeMillis(); try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(keyStoreFile))) { keyStore.load(bis, password); } lastRead = readStart; } FileKeyStoreStorage(final File keyStoreFile); @VisibleForTesting File getKeyStoreFile(); @Override boolean exists(); @Override boolean modified(); @Override void load(final KeyStore keyStore, final char[] password); @Override void save(final KeyStore keyStore, final char[] password); @Override String toString(); }
FileKeyStoreStorage implements KeyStoreStorage { @Override public void load(final KeyStore keyStore, final char[] password) throws NoSuchAlgorithmException, CertificateException, IOException { long readStart = System.currentTimeMillis(); try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(keyStoreFile))) { keyStore.load(bis, password); } lastRead = readStart; } FileKeyStoreStorage(final File keyStoreFile); @VisibleForTesting File getKeyStoreFile(); @Override boolean exists(); @Override boolean modified(); @Override void load(final KeyStore keyStore, final char[] password); @Override void save(final KeyStore keyStore, final char[] password); @Override String toString();  }