@Test public void testConvert() { DatabaseConfig databaseConfig = new DatabaseConfig(); databaseConfig.setName(NAME); databaseConfig.setResourceCrn(CRN); databaseConfig.setDescription(DESCRIPTION); databaseConfig.setCreationDate(CREATION_DATE); databaseConfig.setConnectionDriver(CONNECTION_DRIVER); databaseConfig.setConnectionUserName("userName"); databaseConfig.setConnectionPassword("password"); databaseConfig.setConnectionURL(CONNECTION_URL); databaseConfig.setDatabaseVendor(DatabaseVendor.MYSQL); databaseConfig.setType(TYPE); databaseConfig.setEnvironmentId(ENVIRONMENT_CRN); databaseConfig.setStatus(ResourceStatus.SERVICE_MANAGED); DatabaseV4Response response = underTest.convert(databaseConfig); assertEquals(NAME, response.getName()); assertEquals(CRN.toString(), response.getCrn()); assertEquals(DESCRIPTION, response.getDescription()); assertEquals(CREATION_DATE, response.getCreationDate().longValue()); assertEquals(CONNECTION_DRIVER, response.getConnectionDriver()); assertNotNull(response.getConnectionPassword()); assertNotNull(response.getConnectionUserName()); assertEquals(CONNECTION_URL, response.getConnectionURL()); assertEquals(DatabaseVendor.MYSQL.name(), response.getDatabaseEngine()); assertEquals(TYPE, response.getType()); assertEquals(ENVIRONMENT_CRN, response.getEnvironmentCrn()); assertEquals(ResourceStatus.SERVICE_MANAGED, response.getResourceStatus()); }
@Override public DatabaseV4Response convert(DatabaseConfig source) { DatabaseV4Response json = new DatabaseV4Response(); json.setName(source.getName()); json.setCrn(source.getResourceCrn().toString()); json.setDescription(source.getDescription()); json.setConnectionURL(source.getConnectionURL()); json.setDatabaseEngine(source.getDatabaseVendor().name()); json.setConnectionDriver(source.getConnectionDriver()); json.setConnectionUserName(getConversionService().convert(source.getConnectionUserName().getSecret(), SecretResponse.class)); json.setConnectionPassword(getConversionService().convert(source.getConnectionPassword().getSecret(), SecretResponse.class)); json.setDatabaseEngineDisplayName(source.getDatabaseVendor().displayName()); json.setCreationDate(source.getCreationDate()); json.setEnvironmentCrn(source.getEnvironmentId()); json.setType(source.getType()); json.setResourceStatus(source.getStatus()); return json; }
DatabaseConfigToDatabaseV4ResponseConverter extends AbstractConversionServiceAwareConverter<DatabaseConfig, DatabaseV4Response> { @Override public DatabaseV4Response convert(DatabaseConfig source) { DatabaseV4Response json = new DatabaseV4Response(); json.setName(source.getName()); json.setCrn(source.getResourceCrn().toString()); json.setDescription(source.getDescription()); json.setConnectionURL(source.getConnectionURL()); json.setDatabaseEngine(source.getDatabaseVendor().name()); json.setConnectionDriver(source.getConnectionDriver()); json.setConnectionUserName(getConversionService().convert(source.getConnectionUserName().getSecret(), SecretResponse.class)); json.setConnectionPassword(getConversionService().convert(source.getConnectionPassword().getSecret(), SecretResponse.class)); json.setDatabaseEngineDisplayName(source.getDatabaseVendor().displayName()); json.setCreationDate(source.getCreationDate()); json.setEnvironmentCrn(source.getEnvironmentId()); json.setType(source.getType()); json.setResourceStatus(source.getStatus()); return json; } }
DatabaseConfigToDatabaseV4ResponseConverter extends AbstractConversionServiceAwareConverter<DatabaseConfig, DatabaseV4Response> { @Override public DatabaseV4Response convert(DatabaseConfig source) { DatabaseV4Response json = new DatabaseV4Response(); json.setName(source.getName()); json.setCrn(source.getResourceCrn().toString()); json.setDescription(source.getDescription()); json.setConnectionURL(source.getConnectionURL()); json.setDatabaseEngine(source.getDatabaseVendor().name()); json.setConnectionDriver(source.getConnectionDriver()); json.setConnectionUserName(getConversionService().convert(source.getConnectionUserName().getSecret(), SecretResponse.class)); json.setConnectionPassword(getConversionService().convert(source.getConnectionPassword().getSecret(), SecretResponse.class)); json.setDatabaseEngineDisplayName(source.getDatabaseVendor().displayName()); json.setCreationDate(source.getCreationDate()); json.setEnvironmentCrn(source.getEnvironmentId()); json.setType(source.getType()); json.setResourceStatus(source.getStatus()); return json; }  }
DatabaseConfigToDatabaseV4ResponseConverter extends AbstractConversionServiceAwareConverter<DatabaseConfig, DatabaseV4Response> { @Override public DatabaseV4Response convert(DatabaseConfig source) { DatabaseV4Response json = new DatabaseV4Response(); json.setName(source.getName()); json.setCrn(source.getResourceCrn().toString()); json.setDescription(source.getDescription()); json.setConnectionURL(source.getConnectionURL()); json.setDatabaseEngine(source.getDatabaseVendor().name()); json.setConnectionDriver(source.getConnectionDriver()); json.setConnectionUserName(getConversionService().convert(source.getConnectionUserName().getSecret(), SecretResponse.class)); json.setConnectionPassword(getConversionService().convert(source.getConnectionPassword().getSecret(), SecretResponse.class)); json.setDatabaseEngineDisplayName(source.getDatabaseVendor().displayName()); json.setCreationDate(source.getCreationDate()); json.setEnvironmentCrn(source.getEnvironmentId()); json.setType(source.getType()); json.setResourceStatus(source.getStatus()); return json; }  @Override DatabaseV4Response convert(DatabaseConfig source); }
DatabaseConfigToDatabaseV4ResponseConverter extends AbstractConversionServiceAwareConverter<DatabaseConfig, DatabaseV4Response> { @Override public DatabaseV4Response convert(DatabaseConfig source) { DatabaseV4Response json = new DatabaseV4Response(); json.setName(source.getName()); json.setCrn(source.getResourceCrn().toString()); json.setDescription(source.getDescription()); json.setConnectionURL(source.getConnectionURL()); json.setDatabaseEngine(source.getDatabaseVendor().name()); json.setConnectionDriver(source.getConnectionDriver()); json.setConnectionUserName(getConversionService().convert(source.getConnectionUserName().getSecret(), SecretResponse.class)); json.setConnectionPassword(getConversionService().convert(source.getConnectionPassword().getSecret(), SecretResponse.class)); json.setDatabaseEngineDisplayName(source.getDatabaseVendor().displayName()); json.setCreationDate(source.getCreationDate()); json.setEnvironmentCrn(source.getEnvironmentId()); json.setType(source.getType()); json.setResourceStatus(source.getStatus()); return json; }  @Override DatabaseV4Response convert(DatabaseConfig source);  }