Browse Source

Merge pull request #1468 in DESIGN/design from ~LUCIAN.CHEN/design:release/10.0 to release/10.0

* commit '138114a6644091542708b044b3eeeaf8788bfd9b':
  REPORT-25688 远程连接war包部署的服务器,连接时不会提示war包部署
feature/big-screen
Lucian.Chen 5 years ago
parent
commit
873e9e9f8b
  1. 5
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 8
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  3. 54
      designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java

5
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -131,6 +131,11 @@ public class EnvChangeEntrance {
}
}
});
// REPORT-25688如果是war包部署的服务器,给与提示
if (WorkContext.getCurrent().isWarDeploy()) {
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_War_Deploy_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
//REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {

8
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -2,6 +2,9 @@ package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.i18n.Toolkit;
import com.fr.invoke.ReflectException;
import com.fr.log.FineLoggerFactory;
import com.fr.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
@ -49,8 +52,13 @@ public class RemoteWorkspace implements Workspace {
@Override
public boolean isWarDeploy() {
try {
return WorkContext.getCurrent().get(CommonOperator.class).isWarDeploy();
} catch (ReflectException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
@Override
public boolean isLocal() {

54
designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java vendored

@ -0,0 +1,54 @@
package com.fr.design.env;
import com.fr.base.operator.common.CommonOperator;
import com.fr.invoke.ReflectException;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
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;
/**
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2020/1/2
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({WorkContext.class})
public class RemoteWorkspaceTest {
@Test
public void testIsWarDeploy() {
Workspace workspace = EasyMock.mock(Workspace.class);
PowerMock.mockStatic(WorkContext.class);
EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes();
CommonOperator operator = EasyMock.createMock(CommonOperator.class);
EasyMock.expect(workspace.get(CommonOperator.class)).andReturn(operator).anyTimes();
EasyMock.expect(operator.isWarDeploy()).andReturn(true).once();
EasyMock.expect(operator.isWarDeploy()).andReturn(false).once();
EasyMock.expect(operator.isWarDeploy()).andThrow(new ReflectException()).once();
EasyMock.replay(workspace, operator);
PowerMock.replayAll();
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey");
RemoteWorkspace remoteWorkspace= new RemoteWorkspace(null, info);
Assert.assertTrue(remoteWorkspace.isWarDeploy());
Assert.assertFalse(remoteWorkspace.isWarDeploy());
Assert.assertFalse(remoteWorkspace.isWarDeploy());
EasyMock.verify(workspace, operator);
PowerMock.verifyAll();
}
}
Loading…
Cancel
Save