From 45274c9214b984b268d250006244fd73b02f364b Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 11 Sep 2024 15:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=8D=95=E6=B5=8B=E7=BC=96=E8=AF=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/DesignTableDataManagerTest.java | 6 +- .../template/info/TemplateInfoTestHelper.java | 24 ------ .../fr/design/menu/SnapChatMenuDefTest.java | 5 -- .../fr/design/os/impl/SupportOSImplTest.java | 16 +--- .../java/com/fr/design/ui/FineUIDemo.java | 2 +- .../src/test/java/com/fr/design/ui/Model.java | 34 +++++++++ .../com/fr/design/ui/ModernUIPaneTest.java | 75 ------------------- .../ui/report/TemplateWebSettingDemo.java | 4 +- 8 files changed, 42 insertions(+), 124 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/ui/Model.java delete mode 100644 designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java diff --git a/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java b/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java index 3b3f8cad8e..83edd79c16 100644 --- a/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java +++ b/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"}); diff --git a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java index 8ba0278729..c812a0e971 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTestHelper.java +++ b/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(); - } } diff --git a/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java b/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java index 277e7101bc..81984c7304 100644 --- a/designer-base/src/test/java/com/fr/design/menu/SnapChatMenuDefTest.java +++ b/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()); } diff --git a/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java b/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java index d49ab5e073..e78e7812e1 100644 --- a/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java +++ b/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); - } - } \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java b/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java index 23ac04a05c..e124b3eded 100644 --- a/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java +++ b/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java @@ -20,7 +20,7 @@ public class FineUIDemo { // 是否需要开启调试窗口 DesignerEnvManager.getEnvManager().setOpenDebug(true); - final JxUIPane pane = new JxUIPane.Builder() + final JxUIPane pane = new JxUIPane.Builder() .withComponent(StartComponent.KEY).build(); contentPane.add(pane, BorderLayout.CENTER); frame.setVisible(true); diff --git a/designer-base/src/test/java/com/fr/design/ui/Model.java b/designer-base/src/test/java/com/fr/design/ui/Model.java new file mode 100644 index 0000000000..7ea42d830b --- /dev/null +++ b/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); + } + +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java b/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java deleted file mode 100644 index 9676ee998a..0000000000 --- a/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java +++ /dev/null @@ -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 pane = new ModernUIPane.Builder() - .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); - } - - } - -} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java b/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java index d1067c4e79..6a77c98f77 100644 --- a/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java +++ b/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 pane = new JxUIPane.Builder() + final JxUIPane pane = new JxUIPane.Builder() .withComponent(TemplateWebSettingComponent.KEY).build(); contentPane.add(pane, BorderLayout.CENTER); frame.setVisible(true);