@Test(expected = IOException.class) public void testGetBase64KeystoreTooBigFile() throws IOException { final File temp = File.createTempFile("keystore", ""); final StringBuilder builder = new StringBuilder(); for (int i = 0; i < 1000; i++) { builder.append("way too long...\n"); } FileUtils.writeStringToFile(temp, builder.toString()); try { ConfigurationServerImpl.getBase64Keystore(temp.getPath()); } finally { temp.delete(); } }
static String getBase64Keystore(final String keystorePath) throws IOException { final byte[] storeBytes = FileUtils.readFileToByteArray(new File(keystorePath)); if (storeBytes.length > 3000) { throw new IOException("KeyStore is too big for database! Length " + storeBytes.length); } return new String(Base64.encodeBase64(storeBytes)); }
ConfigurationServerImpl extends ManagerBase implements ConfigurationServer { static String getBase64Keystore(final String keystorePath) throws IOException { final byte[] storeBytes = FileUtils.readFileToByteArray(new File(keystorePath)); if (storeBytes.length > 3000) { throw new IOException("KeyStore is too big for database! Length " + storeBytes.length); } return new String(Base64.encodeBase64(storeBytes)); } }
ConfigurationServerImpl extends ManagerBase implements ConfigurationServer { static String getBase64Keystore(final String keystorePath) throws IOException { final byte[] storeBytes = FileUtils.readFileToByteArray(new File(keystorePath)); if (storeBytes.length > 3000) { throw new IOException("KeyStore is too big for database! Length " + storeBytes.length); } return new String(Base64.encodeBase64(storeBytes)); } ConfigurationServerImpl(); }
ConfigurationServerImpl extends ManagerBase implements ConfigurationServer { static String getBase64Keystore(final String keystorePath) throws IOException { final byte[] storeBytes = FileUtils.readFileToByteArray(new File(keystorePath)); if (storeBytes.length > 3000) { throw new IOException("KeyStore is too big for database! Length " + storeBytes.length); } return new String(Base64.encodeBase64(storeBytes)); } ConfigurationServerImpl(); @Override boolean configure(final String name, final Map<String, Object> params); @Override void persistDefaultValues(); @DB void saveUser(); @DB void updateResourceCount(); Map<String, String> getServicesAndProvidersForNetwork(final long networkOfferingId); @Override @DB void updateKeyPairs(); @Override List<ConfigurationVO> getConfigListByScope(final String scope, final Long resourceId); }
ConfigurationServerImpl extends ManagerBase implements ConfigurationServer { static String getBase64Keystore(final String keystorePath) throws IOException { final byte[] storeBytes = FileUtils.readFileToByteArray(new File(keystorePath)); if (storeBytes.length > 3000) { throw new IOException("KeyStore is too big for database! Length " + storeBytes.length); } return new String(Base64.encodeBase64(storeBytes)); } ConfigurationServerImpl(); @Override boolean configure(final String name, final Map<String, Object> params); @Override void persistDefaultValues(); @DB void saveUser(); @DB void updateResourceCount(); Map<String, String> getServicesAndProvidersForNetwork(final long networkOfferingId); @Override @DB void updateKeyPairs(); @Override List<ConfigurationVO> getConfigListByScope(final String scope, final Long resourceId); static final Logger s_logger; }