Esempio n. 1
0
  public ActivityUnit createTestActivityUnit(
      String id, String convId, String endpointId, long baseTime) {
    ActivityUnit act = new ActivityUnit();

    act.setId(id);

    Origin origin = new Origin();
    origin.setHost("MyHost");
    origin.setNode("MyNode");
    origin.setPrincipal("Me");
    origin.setThread("MyThread");
    act.setOrigin(origin);

    RequestSent me1 = new RequestSent();
    me1.setUnitId(id);
    me1.setUnitIndex(0);

    me1.setTimestamp(baseTime + 1000);
    me1.setContent("<tns:Order xmlns:tns=\"http://www.savara.org\" amount=\"100\" />");
    me1.setMessageType("{http://message}Order");
    me1.setOperation("myOp");
    me1.setServiceType("{http://service}OrderService");
    me1.setMessageId("corr1");
    me1.getProperties().put("customer", "Fred");
    me1.getProperties().put("trader", "Joe");

    Context c1 = new Context();
    c1.setType(Context.Type.Conversation);
    c1.setValue(convId);
    me1.getContext().add(c1);

    act.getActivityTypes().add(me1);

    ResponseReceived me2 = new ResponseReceived();
    me2.setUnitId(id);
    me2.setUnitIndex(1);

    me2.setTimestamp(baseTime + 2000);
    me2.setContent("<tns:Confirmation xmlns:tns=\"http://www.savara.org\" amount=\"100\" />");
    me2.setFault("MyFault");
    me2.setMessageType("{http://message}Confirmation");
    me2.setOperation("myOp");
    me2.setServiceType("{http://service}OrderService");
    me2.setMessageId("corr2");
    me2.setReplyToId("corr1");
    me2.getProperties().put("customer", "Fred");
    me2.getProperties().put("manager", "Jane");

    Context c2 = new Context();
    c2.setType(Context.Type.Endpoint);
    c2.setValue(endpointId);
    me2.getContext().add(c2);

    act.getActivityTypes().add(me2);

    return (act);
  }