protected Handler getHandler(BpelProcessDefinition process) {
   return process.getGlobalScope().getCompensationHandler();
 }
Exemplo n.º 2
0
  protected void setUp() throws Exception {
    // set up db stuff
    super.setUp();

    // create bpel definition
    BpelProcessDefinition processDefinition =
        new BpelProcessDefinition("testProcess", BpelConstants.NS_EXAMPLES);

    definition =
        WsdlUtil.getFactory().newWSDLReader().readWSDL("", WsdlConverterTest.transform(WSDL_TEXT));
    ImportDefinition importDefinition = processDefinition.getImportDefinition();
    importDefinition.addImport(WsdlUtil.createImport(definition));
    new BpelReader().registerPropertyAliases(importDefinition);

    // partner link type
    PartnerLinkType partnerLinkType =
        importDefinition.getPartnerLinkType(new QName(BpelConstants.NS_EXAMPLES, "plt"));

    // rpc partner link
    PartnerLinkDefinition rpcPartnerLink = new PartnerLinkDefinition();
    rpcPartnerLink.setName("rpcPl");
    rpcPartnerLink.setPartnerLinkType(partnerLinkType);
    rpcPartnerLink.setMyRole(partnerLinkType.getFirstRole());

    // doc partner link
    PartnerLinkDefinition docPartnerLink = new PartnerLinkDefinition();
    docPartnerLink.setName("docPl");
    docPartnerLink.setPartnerLinkType(partnerLinkType);
    docPartnerLink.setMyRole(partnerLinkType.getSecondRole());

    // global scope
    Scope globalScope = processDefinition.getGlobalScope();
    globalScope.addPartnerLink(rpcPartnerLink);
    globalScope.addPartnerLink(docPartnerLink);
    globalScope.setActivity(new Empty());

    // deploy process definition
    bpelGraphSession.deployProcessDefinition(processDefinition);
    // save generated plink id
    rpcPartnerLinkId = rpcPartnerLink.getId();
    docPartnerLinkId = docPartnerLink.getId();

    // create application descriptor
    DeploymentDescriptor deploymentDescriptor = new DeploymentDescriptor();
    deploymentDescriptor.setName(processDefinition.getName());

    InitialContext initialContext = new InitialContext();
    try {
      // link jms administered objects
      initialContext.rebind(
          IntegrationControl.CONNECTION_FACTORY_NAME, new LinkRef("ConnectionFactory"));
      initialContext.rebind("rpcPl", new LinkRef("queue/testQueue"));
      initialContext.rebind("docPl", new LinkRef("queue/testQueue"));

      // configure relation context
      integrationControl =
          JmsIntegrationServiceFactory.getConfigurationInstance(jbpmConfiguration)
              .getIntegrationControl(processDefinition);
      integrationControl.setDeploymentDescriptor(deploymentDescriptor);
      // bind port entries and lookup destinations
      IntegrationControlHelper.setUp(integrationControl, jbpmContext);

      // unlink jms administered objects
      initialContext.unbind(IntegrationControl.CONNECTION_FACTORY_NAME);
      initialContext.unbind("rpcPl");
      initialContext.unbind("docPl");
    } finally {
      initialContext.close();
    }
  }
 protected Handler createHandler(BpelProcessDefinition process) {
   Handler handler = new Handler();
   process.getGlobalScope().setCompensationHandler(handler);
   return handler;
 }