|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|