@Test(expected = IllegalStateException.class) public void invalid_columns() { Mock mock = new Mock(String.class, "testing", NullSupport.class, "TESTING", null, "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 condition = getCondition(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); 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()); if (JdbcDescriptionUtil.isEmpty(condition) == false) { configuration.put(JdbcProcess.CONDITION.key(), condition); } 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(condition); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }
JdbcImporterDescription extends WindGateImporterDescription { @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 condition = getCondition(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); 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()); if (JdbcDescriptionUtil.isEmpty(condition) == false) { configuration.put(JdbcProcess.CONDITION.key(), condition); } 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(condition); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); } }
JdbcImporterDescription extends WindGateImporterDescription { @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 condition = getCondition(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); 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()); if (JdbcDescriptionUtil.isEmpty(condition) == false) { configuration.put(JdbcProcess.CONDITION.key(), condition); } 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(condition); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }  }
JdbcImporterDescription extends WindGateImporterDescription { @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 condition = getCondition(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); 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()); if (JdbcDescriptionUtil.isEmpty(condition) == false) { configuration.put(JdbcProcess.CONDITION.key(), condition); } 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(condition); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }  abstract Class<? extends DataModelJdbcSupport<?>> getJdbcSupport(); abstract String getTableName(); abstract List<String> getColumnNames(); String getCondition(); Collection<? extends JdbcAttribute> getOptions(); @Override final DriverScript getDriverScript(); }
JdbcImporterDescription extends WindGateImporterDescription { @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 condition = getCondition(); Collection<? extends JdbcAttribute> options = getOptions(); JdbcDescriptionUtil.checkCommonConfig(descriptionClass, modelType, supportClass, table, columns, options); 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()); if (JdbcDescriptionUtil.isEmpty(condition) == false) { configuration.put(JdbcProcess.CONDITION.key(), condition); } 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(condition); return new DriverScript(Constants.JDBC_RESOURCE_NAME, configuration, parameters); }  abstract Class<? extends DataModelJdbcSupport<?>> getJdbcSupport(); abstract String getTableName(); abstract List<String> getColumnNames(); String getCondition(); Collection<? extends JdbcAttribute> getOptions(); @Override final DriverScript getDriverScript();  }