Java源码示例:io.codearte.jfairy.Fairy
示例1
@Override
public List<? extends AbstractDataObject> retrieveData() throws Exception {
List<AbstractDataObject> result = new ArrayList<>(helper.getCount());
try {
for (int i = 0; i < helper.getCount(); i++) {
Locale locale = DemoSuiteDataGeneratorUtil.LocaleClasses.getRandom();
helper.setLocale(locale);
Fairy fairy = Fairy.create(locale);
Object o = null;
if (helper.getReturnObjectClass().equals(DemoDataParty.class)) {
o = fairy.person();
} else if (helper.getReturnObjectClass().equals(DemoDataProduct.class)) {
throw new UnsupportedOperationException("Product demo data is not supported");
} else if (helper.getReturnObjectClass().equals(DemoDataOrder.class)) {
throw new UnsupportedOperationException("Order demo data is not supported");
}
if (UtilValidate.isNotEmpty(o)) {
result.add(handleData(o));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return result;
}
示例2
@Override
public void open(Map<String, Object> config, SourceContext sourceContext) throws Exception {
this.fairy = Fairy.create();
}
示例3
@Override
public void open(Map<String, Object> config, SourceContext sourceContext) {
this.fairy = Fairy.create();
this.sourceContext = sourceContext;
}