@Test public void testConversion() { DatabaseServerV4Request request = new DatabaseServerV4Request(); request.setName("myserver"); request.setDescription("mine not yours"); request.setHost("myserver.db.example.com"); request.setPort(5432); request.setDatabaseVendor("postgres"); request.setConnectionUserName("root"); request.setConnectionPassword("cloudera"); request.setConnectionDriver("org.postgresql.Driver"); request.setEnvironmentCrn("myenvironment"); DatabaseServerConfig server = converter.convert(request); assertEquals(request.getName(), server.getName()); assertEquals(request.getDescription(), server.getDescription()); assertEquals(request.getHost(), server.getHost()); assertEquals(request.getPort(), server.getPort()); assertEquals(request.getDatabaseVendor(), server.getDatabaseVendor().databaseType()); assertEquals(request.getConnectionUserName(), server.getConnectionUserName()); assertEquals(request.getConnectionPassword(), server.getConnectionPassword()); assertEquals(request.getConnectionDriver(), server.getConnectionDriver()); assertEquals(request.getEnvironmentCrn(), server.getEnvironmentId()); assertEquals(ResourceStatus.USER_MANAGED, server.getResourceStatus()); }
@Override public DatabaseServerConfig convert(DatabaseServerV4Request source) { DatabaseServerConfig server = new DatabaseServerConfig(); server.setName(source.getName()); server.setDescription(source.getDescription()); server.setHost(source.getHost()); server.setPort(source.getPort()); DatabaseVendor databaseVendor = DatabaseVendor.fromValue(source.getDatabaseVendor()); server.setDatabaseVendor(databaseVendor); server.setConnectionDriver(source.getConnectionDriver()); server.setConnectionUserName(source.getConnectionUserName()); server.setConnectionPassword(source.getConnectionPassword()); server.setResourceStatus(ResourceStatus.USER_MANAGED); server.setArchived(false); server.setDeletionTimestamp(null); server.setEnvironmentId(source.getEnvironmentCrn()); return server; }
DatabaseServerV4RequestToDatabaseServerConfigConverter extends AbstractConversionServiceAwareConverter<DatabaseServerV4Request, DatabaseServerConfig> { @Override public DatabaseServerConfig convert(DatabaseServerV4Request source) { DatabaseServerConfig server = new DatabaseServerConfig(); server.setName(source.getName()); server.setDescription(source.getDescription()); server.setHost(source.getHost()); server.setPort(source.getPort()); DatabaseVendor databaseVendor = DatabaseVendor.fromValue(source.getDatabaseVendor()); server.setDatabaseVendor(databaseVendor); server.setConnectionDriver(source.getConnectionDriver()); server.setConnectionUserName(source.getConnectionUserName()); server.setConnectionPassword(source.getConnectionPassword()); server.setResourceStatus(ResourceStatus.USER_MANAGED); server.setArchived(false); server.setDeletionTimestamp(null); server.setEnvironmentId(source.getEnvironmentCrn()); return server; } }
DatabaseServerV4RequestToDatabaseServerConfigConverter extends AbstractConversionServiceAwareConverter<DatabaseServerV4Request, DatabaseServerConfig> { @Override public DatabaseServerConfig convert(DatabaseServerV4Request source) { DatabaseServerConfig server = new DatabaseServerConfig(); server.setName(source.getName()); server.setDescription(source.getDescription()); server.setHost(source.getHost()); server.setPort(source.getPort()); DatabaseVendor databaseVendor = DatabaseVendor.fromValue(source.getDatabaseVendor()); server.setDatabaseVendor(databaseVendor); server.setConnectionDriver(source.getConnectionDriver()); server.setConnectionUserName(source.getConnectionUserName()); server.setConnectionPassword(source.getConnectionPassword()); server.setResourceStatus(ResourceStatus.USER_MANAGED); server.setArchived(false); server.setDeletionTimestamp(null); server.setEnvironmentId(source.getEnvironmentCrn()); return server; }  }
DatabaseServerV4RequestToDatabaseServerConfigConverter extends AbstractConversionServiceAwareConverter<DatabaseServerV4Request, DatabaseServerConfig> { @Override public DatabaseServerConfig convert(DatabaseServerV4Request source) { DatabaseServerConfig server = new DatabaseServerConfig(); server.setName(source.getName()); server.setDescription(source.getDescription()); server.setHost(source.getHost()); server.setPort(source.getPort()); DatabaseVendor databaseVendor = DatabaseVendor.fromValue(source.getDatabaseVendor()); server.setDatabaseVendor(databaseVendor); server.setConnectionDriver(source.getConnectionDriver()); server.setConnectionUserName(source.getConnectionUserName()); server.setConnectionPassword(source.getConnectionPassword()); server.setResourceStatus(ResourceStatus.USER_MANAGED); server.setArchived(false); server.setDeletionTimestamp(null); server.setEnvironmentId(source.getEnvironmentCrn()); return server; }  @Override DatabaseServerConfig convert(DatabaseServerV4Request source); }
DatabaseServerV4RequestToDatabaseServerConfigConverter extends AbstractConversionServiceAwareConverter<DatabaseServerV4Request, DatabaseServerConfig> { @Override public DatabaseServerConfig convert(DatabaseServerV4Request source) { DatabaseServerConfig server = new DatabaseServerConfig(); server.setName(source.getName()); server.setDescription(source.getDescription()); server.setHost(source.getHost()); server.setPort(source.getPort()); DatabaseVendor databaseVendor = DatabaseVendor.fromValue(source.getDatabaseVendor()); server.setDatabaseVendor(databaseVendor); server.setConnectionDriver(source.getConnectionDriver()); server.setConnectionUserName(source.getConnectionUserName()); server.setConnectionPassword(source.getConnectionPassword()); server.setResourceStatus(ResourceStatus.USER_MANAGED); server.setArchived(false); server.setDeletionTimestamp(null); server.setEnvironmentId(source.getEnvironmentCrn()); return server; }  @Override DatabaseServerConfig convert(DatabaseServerV4Request source);  }