Beispiel #1
0
 public FunctionalTestNotification(UMOEventContext context, Object replyMessage, int action)
     throws TransformerException {
   super(context.getTransformedMessage(), action);
   resourceIdentifier = context.getComponentDescriptor().getName();
   this.replyMessage = replyMessage;
   this.eventContext = context;
 }
Beispiel #2
0
  public Object onCall(UMOEventContext context) throws Exception {
    String contents = context.getTransformedMessageAsString();
    String msg =
        StringMessageUtils.getBoilerPlate(
            "Message Received in component: "
                + context.getComponentDescriptor().getName()
                + ". Content is: "
                + StringMessageUtils.truncate(contents, 100, true),
            '*',
            80);

    logger.info(msg);

    if (eventCallback != null) {
      eventCallback.eventReceived(context, this);
    }

    Object replyMessage;
    if (returnMessage != null) {
      replyMessage = returnMessage;
    } else {
      replyMessage =
          contents
              + " Received"
              + (appendComponentName ? " " + context.getComponentDescriptor().getName() : "");
    }

    MuleManager.getInstance()
        .fireNotification(
            new FunctionalTestNotification(
                context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED));

    if (throwException) {
      throw new MuleException(Message.createStaticMessage("Functional Test Component Exception"));
    }

    return replyMessage;
  }
Beispiel #3
0
  public Object onCall(UMOEventContext context) throws Exception {
    String contents = context.getMessageAsString();
    String msg = null;
    msg =
        StringMessageHelper.getBoilerPlate(
            "Message Received in component: "
                + context.getComponentDescriptor().getName()
                + ". Content is: "
                + StringMessageHelper.truncate(contents, 100, true),
            '*',
            80);
    logger.info(msg);

    if (eventCallback != null) {
      eventCallback.eventReceived(context, this);
    }
    if (returnMessage != null) {
      return returnMessage;
    } else {
      contents += " Received";
      return contents;
    }
  }