public void testPartnerLink() {
    // prepare persistent objects
    // partner link
    PartnerLinkDefinition partnerLink = new PartnerLinkDefinition();
    partnerLink.setName("pl");
    // process
    process.getGlobalScope().addPartnerLink(partnerLink);
    // replier
    replier.setPartnerLink(partnerLink);

    // save objects and load them back
    process = saveAndReload(process);
    replier = getReplier(process);

    // verify the retrieved objects
    assertEquals("pl", replier.getPartnerLink().getName());
  }
 protected void setUp() throws Exception {
   /* the bpel definition uses the jbpm configuration, so create a context before the definition
    * to avoid loading another configuration from the default resource */
   jbpmContext = jbpmConfiguration.createJbpmContext();
   // process and token
   BpelDefinition pd = new BpelDefinition();
   token = new ProcessInstance(pd).getRootToken();
   Scope scope = pd.getGlobalScope();
   // port type 1
   PortType portType1 = new PortTypeImpl();
   portType1.setQName(new QName("pt1"));
   // port type 2
   PortType portType2 = new PortTypeImpl();
   portType2.setQName(new QName("pt2"));
   // partner link type
   PartnerLinkType partnerLinkType = new PartnerLinkTypeImpl();
   partnerLinkType.setQName(new QName("plt"));
   // role 1
   Role role1 = partnerLinkType.createRole();
   role1.setName("r1");
   role1.setPortType(portType1);
   partnerLinkType.setFirstRole(role1);
   // role 2
   Role role2 = partnerLinkType.createRole();
   role2.setName("r2");
   role2.setPortType(portType2);
   partnerLinkType.setSecondRole(role2);
   // partner link
   PartnerLinkDefinition partnerLink = new PartnerLinkDefinition();
   partnerLink.setName("pl1");
   partnerLink.setPartnerLinkType(partnerLinkType);
   partnerLink.setMyRole(role1);
   partnerLink.setPartnerRole(role2);
   scope.addPartnerLink(partnerLink);
   // from
   from.setPartnerLink(partnerLink);
   // initialize scope
   scope.initScopeData(token);
   // provide a way to the partner link definition
   Empty activity = new Empty();
   scope.addNode(activity);
   token.setNode(activity);
 }
  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();
    }
  }