コード例 #1
0
  @Test
  public void addMessageLinkTest() {
    grou = new Grounding(topo);
    // test case
    // input: a messageLink will be added, it's portType will contains a new namespace.
    // expected: 1) the namespace is collected in the namespaceMap
    //           2) the messageLink is added to grounding
    //           3) if new prefix is created, the qName(portType) in the messageLink should be
    // updated.
    org.bpel4chor.model.topology.impl.MessageLink tMsgLink =
        new org.bpel4chor.model.topology.impl.MessageLink();
    tMsgLink.setName("eTicket");

    String ns = "www.wsdl.com";
    String localpart = "input";
    String prefix = "wsdl";
    QName portType = new QName(ns, localpart, prefix);

    MessageLink ml = new MessageLink(tMsgLink, portType, "sendTicket");

    // 1)
    String expectedString = ns;
    int expectedSize = grou.getNamespaceMap().size() + 1;
    grou.add(ml);
    String actualString = grou.getNamespaceMap().get(prefix);
    Assert.assertEquals(expectedString, actualString);

    // 2
    int actualSize = grou.getNamespaceMap().size();
    Assert.assertEquals(expectedSize, actualSize);

    // 3
    org.bpel4chor.model.topology.impl.MessageLink tMsgLink2 =
        new org.bpel4chor.model.topology.impl.MessageLink();
    tMsgLink2.setName("eTicket2");

    QName portType2 = new QName("http://www.example.com/receive", "localpart", "wsdl");
    MessageLink ml2 = new MessageLink(tMsgLink2, portType2, "receiveTicket");
    grou.add(ml2);
    String oldPrefix = "wsdl";
    String newPrefix = ml2.getPortType().getPrefix();
    Assert.assertFalse(newPrefix.equals(oldPrefix));
  }
コード例 #2
0
  /**
   * Read the MessageLink from the given {@link XMLStreamReader}
   *
   * @param r The {@link XMLStreamReader}
   * @param nsMap The {@link INamespaceMap} holding all data
   * @return The {@link MessageLink}
   * @throws MalformedTLGLSyntaxException
   */
  private static MessageLink readInMessageLinkTL(
      XMLStreamReader r, INamespaceMap<String, String> nsMap) throws MalformedTLGLSyntaxException {
    MessageLink messageLink = new MessageLink();

    Object temp = BPEL4ChorReader.getStrAttribute(r, "name", false);
    if (temp != null) {
      messageLink.setName(temp.toString());
    }
    temp = null;
    temp = BPEL4ChorReader.getStrAttribute(r, "sender", false);
    if (temp != null) {
      messageLink.setSender(temp.toString());
    }

    List<String> tempList = BPEL4ChorReader.getStrsAttribute(r, "senders", false);
    if (tempList != null) {
      messageLink.setSenders(tempList);
    }
    temp = null;
    temp = BPEL4ChorReader.getStrAttribute(r, "sendActivity", false);
    if (temp != null) {
      messageLink.setSendActivity(temp.toString());
    }

    messageLink.setReceiver(BPEL4ChorReader.getStrAttribute(r, "receiver", true).toString());
    temp = null;
    temp = BPEL4ChorReader.getStrAttribute(r, "receiveActivity", false);
    if (temp != null) {
      messageLink.setReceiveActivity(temp.toString());
    }
    temp = null;
    temp = BPEL4ChorReader.getStrAttribute(r, "bindSenderTo", false);
    if (temp != null) {
      messageLink.setBindSenderTo(temp.toString());
    }

    messageLink.setMessageName(BPEL4ChorReader.getStrAttribute(r, "messageName", true).toString());

    tempList = BPEL4ChorReader.getStrsAttribute(r, "participantRefs", false);
    if (tempList != null) {
      messageLink.setParticipantRefs(tempList);
    }

    tempList = BPEL4ChorReader.getStrsAttribute(r, "copyParticipantRefsTo", false);
    if (tempList != null) {
      messageLink.setCopyParticipantRefsTo(tempList);
    }
    return messageLink;
  }