@Override public int hashCode() { return this.getName().hashCode(); } }
public void setPassword(String password) { this.password = password; this.handleEncryptedPassword(); }
@Test public void supports_unencryptedPassword() { try (SystemPropertyTempSetter ts = new SystemPropertyTempSetter()) { ts.setProperty("ju-util.propertyChain.encryption.password", "secretPassword"); ConnectionInfoImpl ci = new ConnectionInfoImpl(); ci.setPassword("cCULeUjKiLfBwEgCOKC1g3BasxVDF85c"); Assert.assertEquals("cCULeUjKiLfBwEgCOKC1g3BasxVDF85c", ci.getPassword()); } }
@Override public boolean equals(Object o) { return this.compareTo(JuObjectUtils.as(o, ConnectionInfo.class)) == 0; }
@Test public void supports_encryptedPassword() { try (SystemPropertyTempSetter ts = new SystemPropertyTempSetter()) { ts.setProperty("ju-util.propertyChain.encryption.password", "secretPassword"); ConnectionInfoImpl ci = new ConnectionInfoImpl(); ci.setPassword("ENC(cCULeUjKiLfBwEgCOKC1g3BasxVDF85c)"); Assert.assertEquals("secretVal", ci.getPassword()); } } }
@Override public String toString() { return JuStringUtils.toString(this, "name", this.getName()); }
/** * Creates a new connection info object. * @param name Name of the connection * @param connectionString Oracle specific connection string * @param userName User name * @param password Password * @param schema The DB schema to be used. This is not completely integrated in to MyTTS, it is rather a * workaround to be able to use a different DB user than the actual target Schema. * @param passwordProtected If true, all write operations will require the user to confirm the DB password * @param icon Icon representing the database connection * @param image Image representing the database connection */ public ConnectionInfoImpl(String name, String connectionString, String userName, String password, String schema, boolean passwordProtected, Icon icon, Image image) { this.name = name; this.connectionString = connectionString; this.userName = userName; this.password = password; this.schema = schema; this.icon = icon; this.image = image; this.handleEncryptedPassword(); }
@Override public int compareTo(ConnectionInfo o) { return ObjectUtils.compare(this.getName(), o == null ? null : o.getName()); }