@Test(expected = IllegalStateException.class) public void empty_table() { Mock mock = new Mock(String.class, "testing", StringSupport.class, "", "VALUE"); DriverScript script = mock.getDriverScript(); assertThat(script.getResourceName(), is(Constants.JDBC_RESOURCE_NAME)); script.getConfiguration(); }
@Override public final DriverScript getDriverScript() { String descriptionClass = getClass().getName(); Class<?> modelType = getModelType(); Class<? extends DataModelJdbcSupport<?>> supportClass = getJdbcSupport(); String table = getTableName(); List<String> columns = getColumnNames(); String customTruncate = getCustomTruncate(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); if (customTruncate != null && customTruncate.trim().isEmpty()) { throw new IllegalStateException(MessageFormat.format( Messages.getString("JdbcExporterDescription.errorEmptyStringProperty"), customTruncate, "getCustomTruncate()")); } Map<String, String> configuration = new HashMap<>(); configuration.put(JdbcProcess.TABLE.key(), table); configuration.put(JdbcProcess.COLUMNS.key(), JdbcDescriptionUtil.join(columns)); configuration.put(JdbcProcess.JDBC_SUPPORT.key(), supportClass.getName()); configuration.put(JdbcProcess.OPERATION.key(), JdbcProcess.OperationKind.INSERT_AFTER_TRUNCATE.value()); if (customTruncate != null) { configuration.put(JdbcProcess.CUSTOM_TRUNCATE.key(), customTruncate); } if (options != null && options.isEmpty() == false) { configuration.put(JdbcProcess.OPTIONS.key(), JdbcDescriptionUtil.join(options.stream() .map(JdbcAttribute::getSymbol) .collect(Collectors.toList()))); } Set<String> parameters = VariableTable.collectVariableNames(customTruncate); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }
JdbcExporterDescription extends WindGateExporterDescription { @Override public final DriverScript getDriverScript() { String descriptionClass = getClass().getName(); Class<?> modelType = getModelType(); Class<? extends DataModelJdbcSupport<?>> supportClass = getJdbcSupport(); String table = getTableName(); List<String> columns = getColumnNames(); String customTruncate = getCustomTruncate(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); if (customTruncate != null && customTruncate.trim().isEmpty()) { throw new IllegalStateException(MessageFormat.format( Messages.getString("JdbcExporterDescription.errorEmptyStringProperty"), customTruncate, "getCustomTruncate()")); } Map<String, String> configuration = new HashMap<>(); configuration.put(JdbcProcess.TABLE.key(), table); configuration.put(JdbcProcess.COLUMNS.key(), JdbcDescriptionUtil.join(columns)); configuration.put(JdbcProcess.JDBC_SUPPORT.key(), supportClass.getName()); configuration.put(JdbcProcess.OPERATION.key(), JdbcProcess.OperationKind.INSERT_AFTER_TRUNCATE.value()); if (customTruncate != null) { configuration.put(JdbcProcess.CUSTOM_TRUNCATE.key(), customTruncate); } if (options != null && options.isEmpty() == false) { configuration.put(JdbcProcess.OPTIONS.key(), JdbcDescriptionUtil.join(options.stream() .map(JdbcAttribute::getSymbol) .collect(Collectors.toList()))); } Set<String> parameters = VariableTable.collectVariableNames(customTruncate); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); } }
JdbcExporterDescription extends WindGateExporterDescription { @Override public final DriverScript getDriverScript() { String descriptionClass = getClass().getName(); Class<?> modelType = getModelType(); Class<? extends DataModelJdbcSupport<?>> supportClass = getJdbcSupport(); String table = getTableName(); List<String> columns = getColumnNames(); String customTruncate = getCustomTruncate(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); if (customTruncate != null && customTruncate.trim().isEmpty()) { throw new IllegalStateException(MessageFormat.format( Messages.getString("JdbcExporterDescription.errorEmptyStringProperty"), customTruncate, "getCustomTruncate()")); } Map<String, String> configuration = new HashMap<>(); configuration.put(JdbcProcess.TABLE.key(), table); configuration.put(JdbcProcess.COLUMNS.key(), JdbcDescriptionUtil.join(columns)); configuration.put(JdbcProcess.JDBC_SUPPORT.key(), supportClass.getName()); configuration.put(JdbcProcess.OPERATION.key(), JdbcProcess.OperationKind.INSERT_AFTER_TRUNCATE.value()); if (customTruncate != null) { configuration.put(JdbcProcess.CUSTOM_TRUNCATE.key(), customTruncate); } if (options != null && options.isEmpty() == false) { configuration.put(JdbcProcess.OPTIONS.key(), JdbcDescriptionUtil.join(options.stream() .map(JdbcAttribute::getSymbol) .collect(Collectors.toList()))); } Set<String> parameters = VariableTable.collectVariableNames(customTruncate); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }  }
JdbcExporterDescription extends WindGateExporterDescription { @Override public final DriverScript getDriverScript() { String descriptionClass = getClass().getName(); Class<?> modelType = getModelType(); Class<? extends DataModelJdbcSupport<?>> supportClass = getJdbcSupport(); String table = getTableName(); List<String> columns = getColumnNames(); String customTruncate = getCustomTruncate(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); if (customTruncate != null && customTruncate.trim().isEmpty()) { throw new IllegalStateException(MessageFormat.format( Messages.getString("JdbcExporterDescription.errorEmptyStringProperty"), customTruncate, "getCustomTruncate()")); } Map<String, String> configuration = new HashMap<>(); configuration.put(JdbcProcess.TABLE.key(), table); configuration.put(JdbcProcess.COLUMNS.key(), JdbcDescriptionUtil.join(columns)); configuration.put(JdbcProcess.JDBC_SUPPORT.key(), supportClass.getName()); configuration.put(JdbcProcess.OPERATION.key(), JdbcProcess.OperationKind.INSERT_AFTER_TRUNCATE.value()); if (customTruncate != null) { configuration.put(JdbcProcess.CUSTOM_TRUNCATE.key(), customTruncate); } if (options != null && options.isEmpty() == false) { configuration.put(JdbcProcess.OPTIONS.key(), JdbcDescriptionUtil.join(options.stream() .map(JdbcAttribute::getSymbol) .collect(Collectors.toList()))); } Set<String> parameters = VariableTable.collectVariableNames(customTruncate); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }  abstract Class<? extends DataModelJdbcSupport<?>> getJdbcSupport(); abstract String getTableName(); abstract List<String> getColumnNames(); String getCustomTruncate(); Collection<? extends JdbcAttribute> getOptions(); @Override final DriverScript getDriverScript(); }
JdbcExporterDescription extends WindGateExporterDescription { @Override public final DriverScript getDriverScript() { String descriptionClass = getClass().getName(); Class<?> modelType = getModelType(); Class<? extends DataModelJdbcSupport<?>> supportClass = getJdbcSupport(); String table = getTableName(); List<String> columns = getColumnNames(); String customTruncate = getCustomTruncate(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); if (customTruncate != null && customTruncate.trim().isEmpty()) { throw new IllegalStateException(MessageFormat.format( Messages.getString("JdbcExporterDescription.errorEmptyStringProperty"), customTruncate, "getCustomTruncate()")); } Map<String, String> configuration = new HashMap<>(); configuration.put(JdbcProcess.TABLE.key(), table); configuration.put(JdbcProcess.COLUMNS.key(), JdbcDescriptionUtil.join(columns)); configuration.put(JdbcProcess.JDBC_SUPPORT.key(), supportClass.getName()); configuration.put(JdbcProcess.OPERATION.key(), JdbcProcess.OperationKind.INSERT_AFTER_TRUNCATE.value()); if (customTruncate != null) { configuration.put(JdbcProcess.CUSTOM_TRUNCATE.key(), customTruncate); } if (options != null && options.isEmpty() == false) { configuration.put(JdbcProcess.OPTIONS.key(), JdbcDescriptionUtil.join(options.stream() .map(JdbcAttribute::getSymbol) .collect(Collectors.toList()))); } Set<String> parameters = VariableTable.collectVariableNames(customTruncate); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }  abstract Class<? extends DataModelJdbcSupport<?>> getJdbcSupport(); abstract String getTableName(); abstract List<String> getColumnNames(); String getCustomTruncate(); Collection<? extends JdbcAttribute> getOptions(); @Override final DriverScript getDriverScript();  }