コード例 #1
0
 @Test
 public void testCountVmsOnHost() throws Throwable {
   HostEntity hostEntity = new HostEntity();
   hostEntity.setAddress(vm.host);
   hostEntity.setId(hostId);
   int countOfVmsOnHost = vmDcpBackend.countVmsOnHost(hostEntity);
   assertThat(countOfVmsOnHost, is(1));
 }
  @BeforeMethod
  public void setUp() {
    taskCommand = mock(TaskCommand.class);
    stepBackend = mock(StepBackend.class);
    hostBackend = mock(HostBackend.class);
    deployerClient = mock(DeployerClient.class);

    hostEntity = new HostEntity();
    hostEntity.setId("host-1");
    hostEntity.setUsername("username");
    hostEntity.setPassword("password");
    hostEntity.setAddress("192.168.0.1");
    hostEntity.setUsageTags(UsageTag.MGMT.toString());

    step = new StepEntity();
    step.setId("step-1");
    step.addResource(hostEntity);

    command = new HostEnterSuspendedModeStepCmd(taskCommand, stepBackend, step, hostBackend);
    when(taskCommand.getDeployerClient()).thenReturn(deployerClient);
  }