帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
1.6 KiB

package com.fr.design.env;
import com.fr.base.operator.common.CommonOperator;
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(EasyMock.eq(CommonOperator.class), EasyMock.anyObject())).andReturn(operator);
EasyMock.expect(operator.isWarDeploy()).andReturn(true).once();
EasyMock.replay(workspace, operator);
PowerMock.replayAll();
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey", true);
RemoteWorkspace remoteWorkspace= new RemoteWorkspace(null, info);
Assert.assertTrue(remoteWorkspace.isWarDeploy());
EasyMock.verify(workspace, operator);
PowerMock.verifyAll();
}
}