public static ProcessDefinition createMilestoneProcessDefinition() {
    ProcessDefinition pd =
        new ProcessDefinition(
            new String[] {
              "start-state start",
              "fork fork",
              "state b",
              "milestone-node m",
              "state c",
              "state d",
              "join join",
              "end-state end"
            },
            new String[] {
              "start --> fork",
              "fork --m--> b",
              "fork --d--> d",
              "b --> m",
              "m --> c",
              "c --> join",
              "d --> join",
              "join --> end"
            });

    Node d = pd.getNode("d");

    Delegation instantiatableDelegate = new Delegation(new MilestoneEvent("m", "../m"));
    Event event = new Event(Event.EVENTTYPE_NODE_LEAVE);
    d.addEvent(event);
    event.addAction(new Action(instantiatableDelegate));

    pd.addDefinition(new ContextDefinition());

    return pd;
  }
示例#2
0
  public void testBasicNode() {
    Node node;

    node = new Node("n");
    assertEquals("node-", node.getClass().getSimpleName().compareTo("Node"), 0);
    assertEquals("name_", node.name_, "n");
    assertEquals("nextNode_", node.nextNode_, null);
    node.nextNode_ = node;
    assertEquals("nextNode_ (after setting)", node.nextNode_, node);
  }
  public void testFeatures() {
    assertEquals("nb features", 2, factory.getFeatures().size());

    Node node;

    node = factory.getFeatures().get("test.main(java.lang.String[])");
    assertNotNull("feature test.main(java.lang.String[]) missing", node);
    assertTrue("feature test.main(java.lang.String[]) not concrete", node.isConfirmed());

    node = factory.getFeatures().get("test.test()");
    assertNotNull("feature test.test() missing", node);
    assertTrue("feature test.test() not concrete", node.isConfirmed());
  }
  public void testClasses() {
    assertEquals("nb classes", 3, factory.getClasses().size());

    Node node;

    node = factory.getClasses().get("test");
    assertNotNull("class test missing", node);
    assertTrue("class test not concrete", node.isConfirmed());

    node = factory.getClasses().get("java.io.PrintStream");
    assertNotNull("class java.io.PrintStream missing", node);
    assertFalse("class java.io.PrintStream is concrete", node.isConfirmed());

    node = factory.getClasses().get("java.util.Set");
    assertNotNull("class java.util.Set missing", node);
    assertFalse("class java.util.Set is concrete", node.isConfirmed());
  }
  public void testPackages() {
    assertEquals("nb packages", 3, factory.getPackages().size());

    Node node;

    node = factory.getPackages().get("");
    assertNotNull("default package missing", node);
    assertTrue("default package not concrete", node.isConfirmed());

    node = factory.getPackages().get("java.io");
    assertNotNull("package java.io missing", node);
    assertFalse("package java.io is concrete", node.isConfirmed());

    node = factory.getPackages().get("java.util");
    assertNotNull("package java.util missing", node);
    assertFalse("package java.util is concrete", node.isConfirmed());
  }
示例#6
0
 public void testXML() throws Exception {
   QueryElement q1 = new QueryElement("a", "1");
   Document doc = XML.createDocument();
   Node root = q1.toXML(doc);
   assertEquals("queryElement", root.getNodeName());
   NodeList children = root.getChildNodes();
   for (int i = 0; i < children.getLength(); ++i) {
     Node child = children.item(i);
     if ("tokenRole".equals(child.getNodeName())) {
       assertEquals("a", XML.text(child));
     } else if ("tokenValue".equals(child.getNodeName())) {
       assertEquals("1", XML.text(child));
     } else fail("Unknown node \"" + child.getNodeName() + "\" in XML result");
   }
   QueryElement q2 = new QueryElement(root);
   assertEquals(q1, q2);
 }