Browse Source
* commit 'dfe37ca4a3c8b9d6b64d6cf6c8bdadba016d9756': CHART-9783 地图相关操作慢 REPORT-18570 fr连接bi 数据分析预览单元格没有过滤设置 限制文件大小 REPORT-19059 环境切换同名程序数据集还是使用上一个环境的sql 换个名字 REPORT-18855 加下单元测试 REPORT-19058 环境切换暂存文件为保存提示 REPORT-18855 & REPORT-18857 jpg图片持久化遗漏了一些场景 CHART-9576 远程设计 设计器中用实时的 内存配置推荐:设计器安装插件随lic显示状态不对 REPORT-18955 填报属性配置,提交条件的删除按钮没有灰色化 update KERNEL-582 国际化定制的地方会越来越多,想办法去掉这种if else写法 && REPORT-18522 将所有海外版设计器的信息回传功能阉割 将所有海外版设计器的信息回传功能阉割 处理乱码和入库重复问题 没有用户名时用uuid作为用户名final/10.0
Kara
5 years ago
25 changed files with 446 additions and 103 deletions
@ -0,0 +1,31 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Hades |
||||
* @date 2019/6/24 |
||||
*/ |
||||
public class ProductImproveMark implements LocaleMark<Boolean> { |
||||
|
||||
private Map<Locale, Boolean> map = new HashMap<>(); |
||||
|
||||
public ProductImproveMark() { |
||||
map.put(Locale.CHINA, true); |
||||
map.put(Locale.TAIWAN, false); |
||||
map.put(Locale.US, false); |
||||
map.put(Locale.KOREA, false); |
||||
map.put(Locale.JAPAN, false); |
||||
} |
||||
|
||||
@Override |
||||
public Boolean getValue() { |
||||
Boolean result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? false : result; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Hades |
||||
* @date 2019/6/24 |
||||
*/ |
||||
public class SplashMark implements LocaleMark<String> { |
||||
|
||||
private Map<Locale, String> map = new HashMap<Locale, String>(); |
||||
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; |
||||
private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.gif"; |
||||
private static final String SPLASH_JP_PATH = "/com/fr/design/images/splash_10_jp.gif"; |
||||
|
||||
public SplashMark() { |
||||
map.put(Locale.CHINA, SPLASH_PATH); |
||||
map.put(Locale.KOREA, SPLASH_EN_PATH); |
||||
map.put(Locale.JAPAN, SPLASH_JP_PATH); |
||||
map.put(Locale.US, SPLASH_EN_PATH); |
||||
map.put(Locale.TAIWAN, SPLASH_EN_PATH); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(DesignerEnvManager.getEnvManager().getLanguage()); |
||||
return result == null ? SPLASH_EN_PATH : result; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.locale.SupportLocale; |
||||
|
||||
import java.util.HashSet; |
||||
import java.util.Locale; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* 某些国际化环境支持的操作 |
||||
* 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码 |
||||
* 后续有新的不同语言下的差异操作 添加新的枚举 |
||||
* @author Hades |
||||
* @date 2019/6/24 |
||||
*/ |
||||
public enum SupportLocaleImpl implements SupportLocale { |
||||
|
||||
/** |
||||
* 社区菜单支持的国际化环境 |
||||
*/ |
||||
COMMUNITY { |
||||
@Override |
||||
public Set<Locale> support() { |
||||
Set<Locale> set = new HashSet<Locale>(); |
||||
set.add(Locale.CHINA); |
||||
set.add(Locale.TAIWAN); |
||||
return set; |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* Facebook支持的国际化环境 |
||||
*/ |
||||
FACEBOOK { |
||||
@Override |
||||
public Set<Locale> support() { |
||||
Set<Locale> set = new HashSet<Locale>(); |
||||
set.add(Locale.TAIWAN); |
||||
return set; |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Hades |
||||
* @date 2019/6/24 |
||||
*/ |
||||
public class UserInfoMark implements LocaleMark<String> { |
||||
|
||||
private Map<Locale, String> map = new HashMap<>(); |
||||
private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); |
||||
private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); |
||||
private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); |
||||
private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); |
||||
|
||||
public UserInfoMark() { |
||||
map.put(Locale.CHINA, CN_LOGIN_HTML); |
||||
map.put(Locale.KOREA, EN_LOGIN_HTML); |
||||
map.put(Locale.JAPAN, JP_LOGIN_HTML); |
||||
map.put(Locale.US, EN_LOGIN_HTML); |
||||
map.put(Locale.TAIWAN, TW_LOGIN_HTML); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? EN_LOGIN_HTML : result; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Hades |
||||
* @date 2019/6/24 |
||||
*/ |
||||
public class VideoMark implements LocaleMark<String> { |
||||
|
||||
private Map<Locale, String> map = new HashMap<>(); |
||||
private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); |
||||
private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); |
||||
private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw"); |
||||
|
||||
public VideoMark() { |
||||
map.put(Locale.CHINA, VIDEO_CN); |
||||
map.put(Locale.KOREA, VIDEO_EN); |
||||
map.put(Locale.JAPAN, VIDEO_EN); |
||||
map.put(Locale.US, VIDEO_EN); |
||||
map.put(Locale.TAIWAN, VIDEO_TW); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(GeneralContext.getLocale()); |
||||
return result == null ? VIDEO_EN : result; |
||||
} |
||||
} |
@ -0,0 +1,102 @@
|
||||
package com.fr.design.data; |
||||
|
||||
import com.fr.base.TableData; |
||||
import com.fr.data.impl.storeproc.StoreProcedure; |
||||
import com.fr.design.data.tabledata.wrapper.TableDataFactory; |
||||
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
||||
import com.fr.file.ProcedureConfig; |
||||
import com.fr.file.TableDataConfig; |
||||
import org.easymock.EasyMock; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@RunWith(PowerMockRunner.class) |
||||
@PrepareForTest({TableDataFactory.class, StoreProcedure.class, TableDataConfig.class, ProcedureConfig.class}) |
||||
@SuppressStaticInitializationFor({"com.fr.design.data.tabledata.wrapper.TableDataFactory"}) |
||||
public class DesignTableDataManagerTest { |
||||
|
||||
@Test |
||||
public void testFireDataChange() { |
||||
|
||||
DesignTableDataManager.envChange(); |
||||
|
||||
|
||||
PowerMock.mockStatic(TableDataConfig.class); |
||||
|
||||
TableDataConfig config = EasyMock.mock(TableDataConfig.class); |
||||
TableDataConfig config2 = EasyMock.mock(TableDataConfig.class); |
||||
|
||||
TableData td1 = EasyMock.mock(TableData.class); |
||||
TableData td2 = EasyMock.mock(TableData.class); |
||||
TableData td3 = EasyMock.mock(TableData.class); |
||||
TableData td4 = EasyMock.mock(TableData.class); |
||||
EasyMock.expect(config.getTableData("firstData")).andReturn(td1).once(); |
||||
EasyMock.expect(config.getTableData("secondData")).andReturn(td2).once(); |
||||
EasyMock.expect(config2.getTableData("firstData")).andReturn(td3).once(); |
||||
EasyMock.expect(config2.getTableData("secondData")).andReturn(td4).once(); |
||||
|
||||
EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).once().andReturn(config2).once(); |
||||
|
||||
PowerMock.mockStatic(TableDataFactory.class); |
||||
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config)) |
||||
.andReturn(new String[]{"firstData", "secondData"}).once(); |
||||
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config2)) |
||||
.andReturn(new String[]{"firstData", "secondData"}).once(); |
||||
|
||||
|
||||
ProcedureConfig proConfig = EasyMock.mock(ProcedureConfig.class); |
||||
StoreProcedure pc1 = PowerMock.createMock(StoreProcedure.class); |
||||
StoreProcedure pc2 = PowerMock.createMock(StoreProcedure.class); |
||||
ProcedureConfig proConfig2 = EasyMock.mock(ProcedureConfig.class); |
||||
StoreProcedure pc3 = PowerMock.createMock(StoreProcedure.class); |
||||
StoreProcedure pc4 = PowerMock.createMock(StoreProcedure.class); |
||||
|
||||
Map<String, StoreProcedure> procedureMap = new HashMap<>(); |
||||
procedureMap.put("firstPRO", pc1); |
||||
procedureMap.put("secondPRO", pc2); |
||||
EasyMock.expect(proConfig.getProcedure("firstPRO")).andReturn(pc1).once(); |
||||
EasyMock.expect(proConfig.getProcedure("secondPRO")).andReturn(pc2).once(); |
||||
|
||||
Map<String, StoreProcedure> procedureMap2 = new HashMap<>(); |
||||
procedureMap2.put("firstPRO", pc3); |
||||
procedureMap2.put("secondPRO", pc4); |
||||
EasyMock.expect(proConfig2.getProcedure("firstPRO")).andReturn(pc3).once(); |
||||
EasyMock.expect(proConfig2.getProcedure("secondPRO")).andReturn(pc4).once(); |
||||
|
||||
EasyMock.expect(proConfig.getProcedures()).andReturn(procedureMap).once(); |
||||
EasyMock.expect(proConfig2.getProcedures()).andReturn(procedureMap2).once(); |
||||
|
||||
PowerMock.mockStatic(ProcedureConfig.class); |
||||
EasyMock.expect(ProcedureConfig.getInstance()).andReturn(proConfig).once().andReturn(proConfig2).once(); |
||||
|
||||
EasyMock.replay(proConfig, config, config2, proConfig2); |
||||
PowerMock.replay(TableDataFactory.class, TableDataConfig.class, ProcedureConfig.class); |
||||
|
||||
|
||||
Map<String, TableDataWrapper> map = DesignTableDataManager.getAllEditingDataSet(null); |
||||
Assert.assertEquals(4, map.size()); |
||||
Assert.assertSame(pc1, map.get("firstPRO").getTableData()); |
||||
Assert.assertSame(pc2, map.get("secondPRO").getTableData()); |
||||
Assert.assertSame(td1, map.get("firstData").getTableData()); |
||||
Assert.assertSame(td2, map.get("secondData").getTableData()); |
||||
|
||||
DesignTableDataManager.fireDSChanged(new HashMap<String, String>()); |
||||
|
||||
Map<String, TableDataWrapper> map2 = DesignTableDataManager.getAllEditingDataSet(null); |
||||
Assert.assertEquals(4, map2.size()); |
||||
Assert.assertSame(pc3, map2.get("firstPRO").getTableData()); |
||||
Assert.assertSame(pc4, map2.get("secondPRO").getTableData()); |
||||
Assert.assertSame(td3, map2.get("firstData").getTableData()); |
||||
Assert.assertSame(td4, map2.get("secondData").getTableData()); |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.file; |
||||
|
||||
import org.easymock.EasyMock; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
public class StashedFILETest { |
||||
|
||||
/** |
||||
* 用于测试暂存文件未保存时的提示 |
||||
*/ |
||||
@Test |
||||
public void testToString() { |
||||
FILE file = EasyMock.mock(FILE.class); |
||||
String name = "getA.cpt"; |
||||
EasyMock.expect(file.getName()).andReturn(name).once(); |
||||
EasyMock.replay(file); |
||||
FILE stashedFILE = new StashedFILE(file, new byte[0]); |
||||
String expectString = FILEFactory.MEM_PREFIX + name; |
||||
Assert.assertEquals(expectString, stashedFILE + ""); |
||||
EasyMock.verify(file); |
||||
} |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.design.mainframe; |
||||
|
||||
import com.fr.config.dao.DaoContext; |
||||
import com.fr.config.dao.impl.LocalClassHelperDao; |
||||
import com.fr.config.dao.impl.LocalEntityDao; |
||||
import com.fr.config.dao.impl.LocalXmlEntityDao; |
||||
import com.fr.form.main.Form; |
||||
import com.fr.form.ui.ElementCaseEditor; |
||||
import com.fr.general.ImageWithSuffix; |
||||
import com.fr.general.ModuleContext; |
||||
import com.fr.main.impl.WorkBook; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.cell.cellattr.CellImage; |
||||
import com.fr.report.restriction.CellCountRestriction; |
||||
import com.fr.report.restriction.ReportRestrictionScene; |
||||
import com.fr.report.worksheet.FormElementCase; |
||||
import com.fr.report.worksheet.WorkSheet; |
||||
import com.fr.restriction.Restrictions; |
||||
import com.fr.stable.module.Module; |
||||
import com.fr.start.Designer; |
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
|
||||
import java.awt.image.BufferedImage; |
||||
|
||||
public class JFileTest extends TestCase { |
||||
@Override |
||||
protected void setUp() throws Exception { |
||||
DaoContext.setEntityDao(new LocalEntityDao()); |
||||
DaoContext.setClassHelperDao(new LocalClassHelperDao()); |
||||
DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); |
||||
Restrictions.register(ReportRestrictionScene.CELL_COUNT, new CellCountRestriction()); |
||||
ModuleContext.startModule(Module.PAGE_MODULE); |
||||
ModuleContext.startModule(Module.VIEW_MODULE); |
||||
Designer designer = new Designer(new String[0]); |
||||
} |
||||
|
||||
public void testJWorkBookSetPicture() { |
||||
WorkBook workBook = new WorkBook(); |
||||
WorkSheet workSheet = new WorkSheet(); |
||||
workBook.addReport("sheet1", workSheet); |
||||
TemplateCellElement cellElement = new DefaultTemplateCellElement(); |
||||
workSheet.addCellElement(cellElement); |
||||
ImageWithSuffix imageWithSuffix = ImageWithSuffix.build(new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB), "jpg"); |
||||
CellImage cellImage = new CellImage(); |
||||
cellImage.setImage(imageWithSuffix); |
||||
JWorkBook jWorkBook = new JWorkBook(workBook, "text"); |
||||
jWorkBook.setPictureElem(cellElement, cellImage); |
||||
Assert.assertEquals(imageWithSuffix, cellElement.getValue()); |
||||
} |
||||
|
||||
public void testJFormSetPicture() { |
||||
Form form = new Form(); |
||||
ElementCaseEditor editor = new ElementCaseEditor(); |
||||
FormElementCase elementCase = new FormElementCase(); |
||||
TemplateCellElement cellElement = new DefaultTemplateCellElement(); |
||||
elementCase.addCellElement(cellElement); |
||||
editor.setElementCase(elementCase); |
||||
form.getContainer().addWidget(editor); |
||||
ImageWithSuffix imageWithSuffix = ImageWithSuffix.build(new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB), "jpg"); |
||||
CellImage cellImage = new CellImage(); |
||||
cellImage.setImage(imageWithSuffix); |
||||
JForm jForm = new JForm(); |
||||
jForm.setTarget(form); |
||||
jForm.setPictureElem(cellElement, cellImage); |
||||
Assert.assertEquals(imageWithSuffix, cellElement.getValue()); |
||||
} |
||||
} |
Loading…
Reference in new issue