Examples of AsyncComponent


Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    process.add(step1);
    process.add(step2);
    process.add(subProcess);
    process.add(step3);
    process.add(step4);
    AsyncComponent asyncProcess = new AsyncComponent(process);
    asyncProcess.start();

    TestUtil.wait(WAIT_FOR_ASYNC);
   
    assertTrue(asyncProcess.getState() == ProcessState.FAILED);
    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(step1.getState() == ProcessState.FAILED);
    assertTrue(step2.getState() == ProcessState.FAILED);
    assertTrue(subProcess.getState() == ProcessState.FAILED);
    assertTrue(subStep1.getState() == ProcessState.FAILED);
    assertTrue(subStep2.getState() == ProcessState.FAILED);
    assertTrue(step3.getState() == ProcessState.FAILED);
    assertTrue(step4.getState() == ProcessState.READY);

    // sync components (level-2 fail)
    subProcess = new SequentialProcess();
    subStep1 = new SucceedingProcessStep();
    subStep2 = new FailingProcessStep();
    ProcessStep subStep3 = new SucceedingProcessStep();
    subProcess.add(subStep1);
    subProcess.add(subStep2);
    subProcess.add(subStep3);

    process = new SequentialProcess();
    step1 = new SucceedingProcessStep();
    step2 = new SucceedingProcessStep();
    step3 = new SucceedingProcessStep();
    process.add(step1);
    process.add(step2);
    process.add(subProcess);
    process.add(step3);
    asyncProcess = new AsyncComponent(process);
    asyncProcess.start();
   
    TestUtil.wait(WAIT_FOR_ASYNC);

    assertTrue(asyncProcess.getState() == ProcessState.FAILED);
    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(step1.getState() == ProcessState.FAILED);
    assertTrue(step2.getState() == ProcessState.FAILED);
    assertTrue(subProcess.getState() == ProcessState.FAILED);
    assertTrue(subStep1.getState() == ProcessState.FAILED);
    assertTrue(subStep2.getState() == ProcessState.FAILED);
    assertTrue(subStep3.getState() == ProcessState.READY);
    assertTrue(step3.getState() == ProcessState.READY);

    // async components (level-1 fail)
    // sync step fails
    subProcess = new SequentialProcess();
    subStep1 = new SucceedingProcessStep();
    subStep2 = new SucceedingProcessStep();
    subProcess.add(subStep1);
    subProcess.add(subStep2);

    process = new SequentialProcess();
    step1 = new SucceedingProcessStep();
    step2 = new BusySucceedingStep(); // make sure rollback waits for all async components
    AsyncComponent asyncStep2 = new AsyncComponent(step2);
    step3 = new FailingProcessStep();
    step4 = new SucceedingProcessStep();
    process.add(step1);
    process.add(asyncStep2);
    process.add(subProcess);
    process.add(step3);
    process.add(step4);
    asyncProcess = new AsyncComponent(process);
    asyncProcess.start();
   
    TestUtil.wait(WAIT_FOR_ASYNC);

    assertTrue(asyncProcess.getState() == ProcessState.FAILED);
    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(step1.getState() == ProcessState.FAILED);
    assertTrue(asyncStep2.getState() == ProcessState.FAILED);
    assertTrue(asyncStep2.getState() == ProcessState.FAILED);
    assertTrue(subProcess.getState() == ProcessState.FAILED);
    assertTrue(subStep1.getState() == ProcessState.FAILED);
    assertTrue(subStep2.getState() == ProcessState.FAILED);
    assertTrue(step3.getState() == ProcessState.FAILED);
    assertTrue(step4.getState() == ProcessState.READY);

    // async step fails
    subProcess = new SequentialProcess();
    subStep1 = new SucceedingProcessStep();
    subStep2 = new SucceedingProcessStep();
    subProcess.add(subStep1);
    subProcess.add(subStep2);

    process = new SequentialProcess();
    step1 = new SucceedingProcessStep();
    step2 = new SucceedingProcessStep();
    step3 = new BusyFailingStep(); // make sure rollback waits for all async components
    AsyncComponent asyncStep3 = new AsyncComponent(step3);
    step4 = new SucceedingProcessStep();
    process.add(step1);
    process.add(step2);
    process.add(subProcess);
    process.add(asyncStep3);
    process.add(step4);
    asyncProcess = new AsyncComponent(process);
    asyncProcess.start();
   
    TestUtil.wait(WAIT_FOR_ASYNC);

    assertTrue(asyncProcess.getState() == ProcessState.FAILED);
    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(step1.getState() == ProcessState.FAILED);
    assertTrue(step2.getState() == ProcessState.FAILED);
    assertTrue(subProcess.getState() == ProcessState.FAILED);
    assertTrue(subStep1.getState() == ProcessState.FAILED);
    assertTrue(subStep2.getState() == ProcessState.FAILED);
    assertTrue(asyncStep3.getState() == ProcessState.FAILED);
    assertTrue(step3.getState() == ProcessState.FAILED);
    assertTrue(step4.getState() == ProcessState.READY || step4.getState() == ProcessState.FAILED);

    // async components (level-2 fail)
    subProcess = new SequentialProcess();
    subStep1 = new SucceedingProcessStep();
    subStep2 = new FailingProcessStep();
    subStep3 = new SucceedingProcessStep();
    subProcess.add(subStep1);
    subProcess.add(subStep2);
    subProcess.add(subStep3);
    AsyncComponent asyncSubProcess = new AsyncComponent(subProcess);

    process = new SequentialProcess();
    step1 = new SucceedingProcessStep();
    step2 = new SucceedingProcessStep();
    step3 = new SucceedingProcessStep();
    process.add(step1);
    process.add(step2);
    process.add(asyncSubProcess);
    process.add(step3);
    asyncProcess = new AsyncComponent(process);
    asyncProcess.start();
   
    TestUtil.wait(WAIT_FOR_ASYNC);

    assertTrue(asyncProcess.getState() == ProcessState.FAILED);
    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(step1.getState() == ProcessState.FAILED);
    assertTrue(step2.getState() == ProcessState.FAILED);
    assertTrue(asyncSubProcess.getState() == ProcessState.FAILED);
    assertTrue(subProcess.getState() == ProcessState.FAILED);
    assertTrue(subStep1.getState() == ProcessState.FAILED);
    assertTrue(subStep2.getState() == ProcessState.FAILED);
    assertTrue(subStep3.getState() == ProcessState.READY);
    assertTrue(step3.getState() == ProcessState.READY || step3.getState() == ProcessState.FAILED);
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    } else {
      // add single file
      addProcess = ProcessFactory.instance().createNewFileProcess(file, networkManager);
    }

    AsyncComponent asyncProcess = new AsyncComponent(addProcess);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

      throw new IllegalArgumentException("File is not in the Hive2Hive directory");
    }

    IProcessComponent updateProcess = ProcessFactory.instance().createUpdateFileProcess(file,
        networkManager);
    AsyncComponent asyncProcess = new AsyncComponent(updateProcess);

    submitProcess(asyncProcess);
    return asyncProcess;

  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    }

    IProcessComponent moveProcess = ProcessFactory.instance().createMoveFileProcess(source, destination,
        networkManager);

    AsyncComponent asyncProcess = new AsyncComponent(moveProcess);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    } else {
      // delete a single file
      deleteProcess = ProcessFactory.instance().createDeleteFileProcess(file, networkManager);
    }

    AsyncComponent asyncProcess = new AsyncComponent(deleteProcess);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    }

    IProcessComponent recoverProcess = ProcessFactory.instance().createRecoverFileProcess(file,
        versionSelector, networkManager);

    AsyncComponent asyncProcess = new AsyncComponent(recoverProcess);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

      throw new IllegalFileLocation("Root folder of the H2H directory can't be shared.");

    IProcessComponent shareProcess = ProcessFactory.instance().createShareProcess(folder,
        new UserPermission(userId, permission), networkManager);

    AsyncComponent asyncProcess = new AsyncComponent(shareProcess);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    ProcessComponent registerProcess = ProcessFactory.instance().createRegisterProcess(credentials, networkManager);

    CompletionHandleComponent eventComponent = new CompletionHandleComponent(registerProcess,
        createRegisterHandle(credentials));

    AsyncComponent asyncProcess = new AsyncComponent(eventComponent);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    IProcessComponent loginProcess = ProcessFactory.instance().createLoginProcess(credentials, params, networkManager);

    CompletionHandleComponent eventComponent = new CompletionHandleComponent(loginProcess, createLoginHandle(
        credentials, rootPath));

    AsyncComponent asyncProcess = new AsyncComponent(eventComponent);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.decorators.AsyncComponent

    IProcessComponent logoutProcess = ProcessFactory.instance().createLogoutProcess(networkManager);

    CompletionHandleComponent eventComponent = new CompletionHandleComponent(logoutProcess,
        createLogoutHandle(networkManager.getSession().getCredentials()));

    AsyncComponent asyncProcess = new AsyncComponent(eventComponent);

    submitProcess(asyncProcess);
    return asyncProcess;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.