|
|
|
@ -5,9 +5,12 @@ import com.fr.plugin.context.PluginMarker;
|
|
|
|
|
import com.fr.plugin.context.PluginMarkerAdapter; |
|
|
|
|
import com.fr.stable.TemplateIOErrorContextHolder; |
|
|
|
|
import com.fr.third.guava.collect.Multimap; |
|
|
|
|
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.modules.junit4.PowerMockRunner; |
|
|
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
@ -20,6 +23,7 @@ import java.util.HashSet;
|
|
|
|
|
* Created by vito on 2021/5/31 |
|
|
|
|
*/ |
|
|
|
|
@RunWith(PowerMockRunner.class) |
|
|
|
|
@PrepareForTest(PluginRemote.class) |
|
|
|
|
public class DesignerAppUtilsTest { |
|
|
|
|
@Test |
|
|
|
|
public void testDealWithErrorDetailMultiLineAndCache() { |
|
|
|
@ -57,17 +61,17 @@ public class DesignerAppUtilsTest {
|
|
|
|
|
@Test |
|
|
|
|
public void testRearrange() { |
|
|
|
|
// 远程插件模拟注册
|
|
|
|
|
// PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class);
|
|
|
|
|
// EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap<String, PluginRemoteSync.PluginStatus>(){{
|
|
|
|
|
// put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get());
|
|
|
|
|
// put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get());
|
|
|
|
|
// put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get());
|
|
|
|
|
// put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get());
|
|
|
|
|
// }}).anyTimes();
|
|
|
|
|
// EasyMock.replay(pluginRemoteSync);
|
|
|
|
|
// PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance");
|
|
|
|
|
// EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes();
|
|
|
|
|
// PowerMock.replay(PluginRemoteSync.class);
|
|
|
|
|
PluginRemote pluginRemote = EasyMock.createMock(PluginRemote.class); |
|
|
|
|
EasyMock.expect(pluginRemote.getPluginRemoteStatus()).andReturn(new HashMap<String, PluginRemote.PluginStatus>() {{ |
|
|
|
|
put("com.fr.plugin1", Reflect.on(PluginRemote.PluginStatus.class).call("create", "com.fr.plugin1", "1", true).get()); |
|
|
|
|
put("com.fr.plugin2", Reflect.on(PluginRemote.PluginStatus.class).call("create", "com.fr.plugin2", "1", true).get()); |
|
|
|
|
put("com.fr.plugin3", Reflect.on(PluginRemote.PluginStatus.class).call("create", "com.fr.plugin3", "1", false).get()); |
|
|
|
|
put("com.fr.plugin4", Reflect.on(PluginRemote.PluginStatus.class).call("create", "com.fr.plugin4", "1", false).get()); |
|
|
|
|
}}).anyTimes(); |
|
|
|
|
EasyMock.replay(pluginRemote); |
|
|
|
|
PowerMock.mockStatic(PluginRemote.class); |
|
|
|
|
EasyMock.expect(PluginRemote.getInstance()).andReturn(pluginRemote).anyTimes(); |
|
|
|
|
PowerMock.replay(PluginRemote.class); |
|
|
|
|
|
|
|
|
|
// 本地插件模拟检查
|
|
|
|
|
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{ |
|
|
|
|