コード例 #1
0
 private VmDiskOpStepCmd getVmDiskOpStepCmd(Operation operation) {
   step = new StepEntity();
   step.setId(stepId);
   step.setTask(task);
   step.setSequence(0);
   step.setState(StepEntity.State.QUEUED);
   step.addResource(vm);
   step.addResource(disk1);
   step.addResource(disk2);
   step.setOperation(operation);
   VmDiskOpStepCmd cmd =
       new VmDiskOpStepCmd(taskCommand, stepBackend, step, diskBackend, attachedDiskBackend);
   return spy(cmd);
 }
  public void setUpCommon() {
    deployerClient = mock(DeployerClient.class);
    taskCommand = mock(TaskCommand.class);
    when(taskCommand.getDeployerXenonClient()).thenReturn(deployerClient);

    stepBackend = mock(StepBackend.class);
    deploymentBackend = mock(DeploymentXenonBackend.class);
    taskBackend = mock(TaskBackend.class);

    when(deploymentBackend.getDeployerClient()).thenReturn(deployerClient);

    entity = new DeploymentEntity();
    currentStep = new StepEntity();
    currentStep.setId("id");
    currentStep.addResource(entity);

    taskEntity = new TaskEntity();
    taskEntity.setSteps(ImmutableList.of(currentStep));
    when(taskCommand.getTask()).thenReturn(taskEntity);

    poller =
        new DeploymentFinalizeMigrationStatusStepCmd.DeploymentFinalizeMigrationStatusStepPoller(
            taskCommand, taskBackend, deploymentBackend);
    command =
        spy(
            new DeploymentFinalizeMigrationStatusStepCmd(
                taskCommand, stepBackend, currentStep, poller));

    serviceDocument = new FinalizeDeploymentMigrationWorkflowService.State();
    serviceDocument.taskState = new FinalizeDeploymentMigrationWorkflowService.TaskState();
    serviceDocument.taskState.stage =
        FinalizeDeploymentMigrationWorkflowService.TaskState.TaskStage.STARTED;
    remoteTaskLink =
        "http://deployer"
            + FinalizeDeploymentMigrationWorkflowFactoryService.SELF_LINK
            + "/00000000-0000-0000-0000-000000000001";
    serviceDocument.documentSelfLink = remoteTaskLink;
    entity.setOperationId(remoteTaskLink);
  }