예제 #1
0
  private void setupCommonMock(boolean glusterEnabled) throws Exception {
    mockHostValidator();
    when(commandMock.canDoAction()).thenCallRealMethod();
    when(commandMock.canConnect(any(VDS.class))).thenCallRealMethod();
    when(commandMock.getParameters()).thenReturn(parameters);

    when(commandMock.isGlusterSupportEnabled()).thenReturn(glusterEnabled);
    when(commandMock.getVdsGroupDao()).thenReturn(groupDaoMock);
    when(commandMock.getClusterUtils()).thenReturn(clusterUtils);

    when(vdsDaoMock.get(vdsId)).thenReturn(null);
    when(commandMock.getVdsDao()).thenReturn(vdsDaoMock);
    when(commandMock.validateVdsGroup()).thenReturn(true);
    when(commandMock.isPowerManagementLegal(
            any(Boolean.class), anyListOf(FenceAgent.class), any(String.class)))
        .thenReturn(true);
    when(commandMock.getSSHClient()).thenReturn(sshClient);
    Version version = new Version("1.2.3");
    VDSGroup vdsGroup = new VDSGroup();
    vdsGroup.setCompatibilityVersion(version);
    when(commandMock.getVdsGroup()).thenReturn(vdsGroup);
    when(commandMock.isPowerManagementLegal(
            parameters.getVdsStaticData().isPmEnabled(),
            parameters.getFenceAgents(),
            new Version("1.2.3").toString()))
        .thenReturn(true);
    doNothing().when(sshClient).connect();
    doNothing().when(sshClient).authenticate();
  }
예제 #2
0
 @Before
 public void createParameters() {
   parameters = new AddVdsActionParameters();
   parameters.setPassword("secret");
   VDS newVds = makeTestVds(vdsId);
   parameters.setvds(newVds);
 }