private IDataSet decorateDataSetIfNeeded(IDataSet dataSet, Class<? extends DataSetDecorator>[] decorators) { if (decorators == null || decorators.length == 0) return dataSet; ReplacementDataSet decoratedSet = new ReplacementDataSet(dataSet); for (Class<? extends DataSetDecorator> decoratorClass : decorators) { try { DataSetDecorator decorator = decoratorClass.newInstance(); decoratedSet.addReplacementSubstring(decorator.getStringToReplace(), decorator.getStringReplacement()); } catch (InstantiationException e) { LOGGER.error("Could not instantiate DataSetDecorator {}" + decoratorClass, e); } catch (IllegalAccessException e) { LOGGER.error("Could not instantiate DataSetDecorator {}" + decoratorClass, e); } } return decoratedSet; }
private void replaceDays(Date currentDate, ReplacementDataSet replacementDataSet) { for (DayReplacerType type : DayReplacerType.values()) { Date calculatedDate = addDays(currentDate, type.getDays()); replacementDataSet.addReplacementSubstring(getPlaceholderPattern(type), format.format(calculatedDate)); } }
private void replaceSeconds(Date currentDate, ReplacementDataSet replacementDataSet) { for (SecondReplacerType type : SecondReplacerType.values()) { Date calculatedDate = addSeconds(currentDate, type.getSeconds()); replacementDataSet.addReplacementSubstring(getPlaceholderPattern(type), format.format(calculatedDate)); } }
private void replaceHours(Date currentDate, ReplacementDataSet replacementDataSet) { for (HourReplacerType type : HourReplacerType.values()) { Date calculatedDate = addHours(currentDate, type.getHours()); replacementDataSet.addReplacementSubstring(getPlaceholderPattern(type), format.format(calculatedDate)); } }
public void prepare(DBUnitProvider provider) { if (dataSet == null) return; if (provider.isReplaceNull()) { dataSet.addReplacementObject("[NULL]", null); } if (provider.getBinaryDir() != null) { dataSet.addReplacementSubstring("[BINARY_DIR]", provider .getBinaryDirFullpath().toString()); } }
private void replaceMinutes(Date currentDate, ReplacementDataSet replacementDataSet) { for (MinuteReplacerType type : MinuteReplacerType.values()) { Date calculatedDate = addMinutes(currentDate, type.getMinutes()); replacementDataSet.addReplacementSubstring(getPlaceholderPattern(type), format.format(calculatedDate)); } }
public void prepare(DBUnitSeamTest test) { if (dataSet == null) return; log.debug("Preparing DataSetOperation replacement values"); if (test.isReplaceNull()) { log.debug("Replacing [NULL] placeholder with real null value"); dataSet.addReplacementObject("[NULL]", null); } if (test.getBinaryDir() != null) { log.debug("Replacing [BINARY_DIR] placeholder with path: " + test.getBinaryDirFullpath().toString()); dataSet.addReplacementSubstring("[BINARY_DIR]", test.getBinaryDirFullpath().toString()); } }
public void prepare(DBJUnitSeamTest test) { if (dataSet == null) return; log.debug("Preparing DataSetOperation replacement values"); if (test.isReplaceNull()) { log.debug("Replacing [NULL] placeholder with real null value"); dataSet.addReplacementObject("[NULL]", null); } if (test.getBinaryDir() != null) { log.debug("Replacing [BINARY_DIR] placeholder with path: " + test.getBinaryDirFullpath().toString()); dataSet.addReplacementSubstring("[BINARY_DIR]", test.getBinaryDirFullpath().toString()); } }