-
Notifications
You must be signed in to change notification settings - Fork 75
/
IncomesTest.java
39 lines (32 loc) · 1.39 KB
/
IncomesTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package sample.incomes;
import com.haulmont.yarg.formatters.factory.DefaultFormatterFactory;
import com.haulmont.yarg.loaders.factory.DefaultLoaderFactory;
import com.haulmont.yarg.loaders.impl.GroovyDataLoader;
import com.haulmont.yarg.reporting.ReportOutputDocument;
import com.haulmont.yarg.reporting.Reporting;
import com.haulmont.yarg.reporting.RunParams;
import com.haulmont.yarg.structure.Report;
import com.haulmont.yarg.structure.xml.impl.DefaultXmlReader;
import com.haulmont.yarg.util.groovy.DefaultScriptingImpl;
import org.junit.Test;
import java.io.File;
import java.io.FileOutputStream;
import static org.apache.commons.io.FileUtils.readFileToString;
/**
* @author degtyarjov
* @version $Id$
*/
public class IncomesTest {
@Test
public void testIncomesReport() throws Exception {
Report report = new DefaultXmlReader()
.parseXml(readFileToString(new File("./test/sample/incomes/incomes.xml")));
Reporting reporting = new Reporting();
reporting.setFormatterFactory(new DefaultFormatterFactory());
reporting.setLoaderFactory(
new DefaultLoaderFactory()
.setGroovyDataLoader(new GroovyDataLoader(new DefaultScriptingImpl())));
ReportOutputDocument reportOutputDocument = reporting.runReport(
new RunParams(report), new FileOutputStream("./result/sample/incomes.xlsx"));
}
}