Browse Source

无jira任务 设计器单测编译问题

fbp/merge
vito 4 months ago
parent
commit
45274c9214
  1. 6
      designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java
  2. 24
      designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java
  3. 5
      designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java
  4. 16
      designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java
  5. 2
      designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java
  6. 34
      designer-base/src/test/java/com/fr/design/ui/Model.java
  7. 75
      designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java
  8. 4
      designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java

6
designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java

@ -51,9 +51,9 @@ public class DesignTableDataManagerTest {
EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).once().andReturn(config2).once();
PowerMock.mockStatic(TableDataFactory.class);
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config))
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData())
.andReturn(new String[]{"firstData", "secondData"}).once();
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config2))
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData())
.andReturn(new String[]{"firstData", "secondData"}).once();
@ -119,7 +119,7 @@ public class DesignTableDataManagerTest {
EasyMock.expect(dataSource.getTableData("ds2")).andReturn(td2).anyTimes();
EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).anyTimes();
PowerMock.mockStatic(TableDataFactory.class);
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config))
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData())
.andReturn(new String[]{"ds1", "ds2"}).anyTimes();
EasyMock.expect(TableDataFactory.getSortOfChineseNameOfTemplateData(dataSource))
.andReturn(new String[]{"ds1", "ds2"});

24
designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java

@ -1,12 +1,7 @@
package com.fr.design.mainframe.template.info;
import com.fr.config.BBSAttr;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONObject;
import org.easymock.EasyMock;
import org.powermock.api.easymock.PowerMock;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@ -31,23 +26,4 @@ class TemplateInfoTestHelper {
field.set(null, newValue);
}
static void setUpMockForNewInstance() throws Exception {
MarketConfig mockMarketConfig = EasyMock.mock(MarketConfig.class);
BBSAttr bbsAttr = EasyMock.mock(BBSAttr.class);
EasyMock.expect(bbsAttr.getBbsUid()).andReturn(71113).anyTimes();
EasyMock.expect(mockMarketConfig.getBBSAttr()).andReturn(bbsAttr).anyTimes();
PowerMock.mockStatic(MarketConfig.class);
EasyMock.expect(MarketConfig.getInstance()).andReturn(mockMarketConfig).anyTimes();
PowerMock.mockStatic(DesignerEnvManager.class);
DesignerEnvManager envManager = EasyMock.mock( DesignerEnvManager.class);
EasyMock.expect(envManager.getUUID()).andReturn("6b6699ff-ec63-43b0-9deb-b580a5f10411").anyTimes();
EasyMock.expect(envManager.isJoinProductImprove()).andReturn(true).anyTimes();
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(envManager).anyTimes();
EasyMock.replay(mockMarketConfig, bbsAttr, envManager);
PowerMock.replayAll();
}
}

5
designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java

@ -9,9 +9,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.notification.SnapChatAllTypes;
import com.fr.design.notification.SnapChatConfig;
import com.fr.stable.xml.XMLableReader;
import com.fr.store.StateHubManager;
import com.fr.store.impl.MemoryLock;
import com.fr.store.impl.MemoryStore;
import com.fr.transaction.Configurations;
import com.fr.transaction.LocalConfigurationHelper;
import org.easymock.EasyMock;
@ -41,8 +38,6 @@ public class SnapChatMenuDefTest {
DaoContext.setXmlEntityDao(new LocalXmlEntityDao());
DaoContext.setClassHelperDao(new LocalClassHelperDao());
DaoContext.setEntityDao(new LocalEntityDao());
StateHubManager.setLock(new MemoryLock());
StateHubManager.setStorage(new MemoryStore());
Configurations.setHelper(new LocalConfigurationHelper());
}

16
designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java

@ -1,16 +1,13 @@
package com.fr.design.os.impl;
import com.fr.general.GeneralContext;
import com.fr.third.org.apache.commons.math3.analysis.function.Pow;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import java.util.Locale;
/**
* @author hades
@ -27,13 +24,4 @@ public class SupportOSImplTest extends TestCase {
Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support());
}
@Test
public void testGetMacOsVersion() throws Exception {
String backUp = System.getProperty("os.version");
System.setProperty("os.version", "10.16");
int number = Whitebox.invokeMethod(SupportOSImpl.MACOS_WEB_PLUGIN_MANAGEMENT, "getMacOsVersion");
Assert.assertEquals(16, number);
System.setProperty("os.version", backUp);
}
}

2
designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java

@ -20,7 +20,7 @@ public class FineUIDemo {
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final JxUIPane<ModernUIPaneTest.Model> pane = new JxUIPane.Builder<ModernUIPaneTest.Model>()
final JxUIPane<Model> pane = new JxUIPane.Builder<Model>()
.withComponent(StartComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);

34
designer-base/src/test/java/com/fr/design/ui/Model.java

@ -0,0 +1,34 @@
package com.fr.design.ui;
/**
* 测试用
*
* @author vito
* @since 11.0
* Created on 2024/9/11
*/
public class Model {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void print(String message) {
System.out.println(message);
}
}

75
designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java

@ -1,75 +0,0 @@
package com.fr.design.ui;
import com.fr.design.DesignerEnvManager;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-03-05
*/
public class ModernUIPaneTest {
public static void main(String... args) {
final JFrame frame = new JFrame();
frame.setSize(1200, 800);
JPanel contentPane = (JPanel) frame.getContentPane();
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final ModernUIPane<Model> pane = new ModernUIPane.Builder<Model>()
.withEMB("/com/fr/design/ui/demo.html").namespace("Pool").build();
contentPane.add(pane, BorderLayout.CENTER);
Model model = new Model();
model.setAge(20);
model.setName("Pick");
pane.populate(model);
JPanel panel = new JPanel(new FlowLayout());
contentPane.add(panel, BorderLayout.SOUTH);
JButton button = new JButton("点击我可以看到Swing的弹框,输出填写的信息");
panel.add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Model returnValue = pane.update();
if (returnValue != null) {
JOptionPane.showMessageDialog(frame, String.format("姓名为:%s,年龄为:%d", returnValue.getName(), returnValue.getAge()));
}
}
});
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public static class Model {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public void print(String message) {
System.out.println(message);
}
}
}

4
designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java

@ -2,7 +2,7 @@ package com.fr.design.ui.report;
import com.fr.design.DesignerEnvManager;
import com.fr.design.jxbrowser.JxUIPane;
import com.fr.design.ui.ModernUIPaneTest;
import com.fr.design.ui.Model;
import javax.swing.JFrame;
import javax.swing.JPanel;
@ -21,7 +21,7 @@ public class TemplateWebSettingDemo {
// 是否需要开启调试窗口
DesignerEnvManager.getEnvManager().setOpenDebug(true);
final JxUIPane<ModernUIPaneTest.Model> pane = new JxUIPane.Builder<ModernUIPaneTest.Model>()
final JxUIPane<Model> pane = new JxUIPane.Builder<Model>()
.withComponent(TemplateWebSettingComponent.KEY).build();
contentPane.add(pane, BorderLayout.CENTER);
frame.setVisible(true);

Loading…
Cancel
Save