@Test public void testConversion() { DatabaseServerConfig server = new DatabaseServerConfig(); server.setName("myserver"); server.setDescription("mine not yours"); server.setHost("myserver.db.example.com"); server.setPort(5432); server.setDatabaseVendor(DatabaseVendor.POSTGRES); server.setConnectionUserName("root"); server.setConnectionPassword("cloudera"); server.setEnvironmentId("myenvironment"); DatabaseServerV4Request request = converter.convert(server); assertEquals(server.getName(), request.getName()); assertEquals(server.getDescription(), request.getDescription()); assertEquals(server.getHost(), request.getHost()); assertEquals(server.getPort(), request.getPort()); assertEquals(server.getDatabaseVendor().databaseType(), request.getDatabaseVendor()); assertNotEquals(server.getConnectionUserName(), request.getConnectionUserName()); assertNotEquals(server.getConnectionPassword(), request.getConnectionPassword()); assertEquals(server.getEnvironmentId(), request.getEnvironmentCrn()); }
@Override public DatabaseServerV4Request convert(DatabaseServerConfig source) { DatabaseServerV4Request request = new DatabaseServerV4Request(); request.setName(source.getName()); request.setDescription(source.getDescription()); request.setHost(source.getHost()); request.setPort(source.getPort()); request.setDatabaseVendor(source.getDatabaseVendor().databaseType()); request.setConnectionUserName("REDACTED"); request.setConnectionPassword("REDACTED"); request.setEnvironmentCrn(source.getEnvironmentId()); return request; }
DatabaseServerConfigToDatabaseServerV4RequestConverter extends AbstractConversionServiceAwareConverter<DatabaseServerConfig, DatabaseServerV4Request> { @Override public DatabaseServerV4Request convert(DatabaseServerConfig source) { DatabaseServerV4Request request = new DatabaseServerV4Request(); request.setName(source.getName()); request.setDescription(source.getDescription()); request.setHost(source.getHost()); request.setPort(source.getPort()); request.setDatabaseVendor(source.getDatabaseVendor().databaseType()); request.setConnectionUserName("REDACTED"); request.setConnectionPassword("REDACTED"); request.setEnvironmentCrn(source.getEnvironmentId()); return request; } }
DatabaseServerConfigToDatabaseServerV4RequestConverter extends AbstractConversionServiceAwareConverter<DatabaseServerConfig, DatabaseServerV4Request> { @Override public DatabaseServerV4Request convert(DatabaseServerConfig source) { DatabaseServerV4Request request = new DatabaseServerV4Request(); request.setName(source.getName()); request.setDescription(source.getDescription()); request.setHost(source.getHost()); request.setPort(source.getPort()); request.setDatabaseVendor(source.getDatabaseVendor().databaseType()); request.setConnectionUserName("REDACTED"); request.setConnectionPassword("REDACTED"); request.setEnvironmentCrn(source.getEnvironmentId()); return request; }  }
DatabaseServerConfigToDatabaseServerV4RequestConverter extends AbstractConversionServiceAwareConverter<DatabaseServerConfig, DatabaseServerV4Request> { @Override public DatabaseServerV4Request convert(DatabaseServerConfig source) { DatabaseServerV4Request request = new DatabaseServerV4Request(); request.setName(source.getName()); request.setDescription(source.getDescription()); request.setHost(source.getHost()); request.setPort(source.getPort()); request.setDatabaseVendor(source.getDatabaseVendor().databaseType()); request.setConnectionUserName("REDACTED"); request.setConnectionPassword("REDACTED"); request.setEnvironmentCrn(source.getEnvironmentId()); return request; }  @Override DatabaseServerV4Request convert(DatabaseServerConfig source); }
DatabaseServerConfigToDatabaseServerV4RequestConverter extends AbstractConversionServiceAwareConverter<DatabaseServerConfig, DatabaseServerV4Request> { @Override public DatabaseServerV4Request convert(DatabaseServerConfig source) { DatabaseServerV4Request request = new DatabaseServerV4Request(); request.setName(source.getName()); request.setDescription(source.getDescription()); request.setHost(source.getHost()); request.setPort(source.getPort()); request.setDatabaseVendor(source.getDatabaseVendor().databaseType()); request.setConnectionUserName("REDACTED"); request.setConnectionPassword("REDACTED"); request.setEnvironmentCrn(source.getEnvironmentId()); return request; }  @Override DatabaseServerV4Request convert(DatabaseServerConfig source);  }