@Inject public DerbyMetadataStorage(MetadataStorageConnectorConfig config) { try { this.server = new NetworkServerControl(InetAddress.getByName(config.getHost()), config.getPort()); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public int hashCode() { int result = (isCreateTables() ? 1 : 0); result = 31 * result + (getHost() != null ? getHost().hashCode() : 0); result = 31 * result + getPort(); result = 31 * result + (getConnectURI() != null ? getConnectURI().hashCode() : 0); result = 31 * result + (getUser() != null ? getUser().hashCode() : 0); result = 31 * result + (passwordProvider != null ? passwordProvider.hashCode() : 0); result = 31 * result + (dbcpProperties != null ? dbcpProperties.hashCode() : 0); return result; } }
); Assert.assertEquals(host, config.getHost()); Assert.assertEquals(port, config.getPort()); Assert.assertEquals(connectURI, config.getConnectURI());
private void testMetadataStorageConnectionConfig( boolean createTables, String host, int port, String connectURI, String user, String pwdString, String pwd ) throws Exception { MetadataStorageConnectorConfig config = jsonMapper.readValue( "{" + "\"createTables\": \"" + createTables + "\"," + "\"host\": \"" + host + "\"," + "\"port\": \"" + port + "\"," + "\"connectURI\": \"" + connectURI + "\"," + "\"user\": \"" + user + "\"," + "\"password\": " + pwdString + "}", MetadataStorageConnectorConfig.class ); Assert.assertEquals(host, config.getHost()); Assert.assertEquals(port, config.getPort()); Assert.assertEquals(connectURI, config.getConnectURI()); Assert.assertEquals(user, config.getUser()); Assert.assertEquals(pwd, config.getPassword()); Assert.assertNull(config.getDbcpProperties()); }
@Inject public DerbyMetadataStorage(MetadataStorageConnectorConfig config) { try { this.server = new NetworkServerControl(InetAddress.getByName(config.getHost()), config.getPort()); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public int hashCode() { int result = (isCreateTables() ? 1 : 0); result = 31 * result + (getHost() != null ? getHost().hashCode() : 0); result = 31 * result + getPort(); result = 31 * result + (getConnectURI() != null ? getConnectURI().hashCode() : 0); result = 31 * result + (getUser() != null ? getUser().hashCode() : 0); result = 31 * result + (passwordProvider != null ? passwordProvider.hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MetadataStorageConnectorConfig)) { return false; } MetadataStorageConnectorConfig that = (MetadataStorageConnectorConfig) o; if (isCreateTables() != that.isCreateTables()) { return false; } if (getPort() != that.getPort()) { return false; } if (getHost() != null ? !getHost().equals(that.getHost()) : that.getHost() != null) { return false; } if (getConnectURI() != null ? !getConnectURI().equals(that.getConnectURI()) : that.getConnectURI() != null) { return false; } if (getUser() != null ? !getUser().equals(that.getUser()) : that.getUser() != null) { return false; } return passwordProvider != null ? passwordProvider.equals(that.passwordProvider) : that.passwordProvider == null; }