81 Star 642 Fork 210

GVPcanonical-entropy / nop-entropy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
TestReportSpeed.java 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
canonical-entropy 提交于 2024-03-10 09:29 . 更新版权声明
/**
* Copyright (c) 2017-2024 Nop Platform. All rights reserved.
* Author: canonical_entropy@163.com
* Blog: https://www.zhihu.com/people/canonical-entropy
* Gitee: https://gitee.com/canonical-entropy/nop-entropy
* Github: https://github.com/entropy-cloud/nop-entropy
*/
package io.nop.report.demo;
import io.nop.api.core.annotations.autotest.NopTestConfig;
import io.nop.autotest.junit.JunitBaseTestCase;
import io.nop.core.lang.eval.IEvalScope;
import io.nop.core.resource.IResource;
import io.nop.core.resource.tpl.ITemplateOutput;
import io.nop.core.resource.tpl.ITextTemplateOutput;
import io.nop.report.core.XptConstants;
import io.nop.report.core.engine.IReportEngine;
import io.nop.xlang.api.XLang;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import jakarta.inject.Inject;
@Disabled
@NopTestConfig(localDb = true)
public class TestReportSpeed extends JunitBaseTestCase {
@Inject
IReportEngine reportEngine;
@Test
public void testRenderHtml() {
String path = "/nop/report/demo/performance/测试同比环比.xpt.xlsx";
ITextTemplateOutput output = reportEngine.getHtmlRenderer(path);
IEvalScope scope = XLang.newEvalScope();
IResource resource = getTargetResource("/test-speed-result.xpt.html");
System.out.println("output path:" + resource.toFile());
for (int i = 0; i < 100; i++) {
System.out.println("i="+i);
output.generateToResource(resource, scope);
}
}
@Test
public void testRenderXlsx() {
// 生成的Excel中包含12000条结果记录。报表展开时执行大量分组、汇总、比较的计算。
String path = "/nop/report/demo/performance/测试同比环比.xpt.xlsx";
ITemplateOutput output = reportEngine.getRenderer(path, XptConstants.RENDER_TYPE_XLSX);
IEvalScope scope = XLang.newEvalScope();
IResource resource = getTargetResource("/test-speed-result.xlsx");
System.out.println("output path:" + resource.toFile());
for (int i = 0; i < 100; i++) {
output.generateToResource(resource, scope);
}
}
}
Java
1
https://gitee.com/canonical-entropy/nop-entropy.git
git@gitee.com:canonical-entropy/nop-entropy.git
canonical-entropy
nop-entropy
nop-entropy
master

搜索帮助