Package com.google.gxp.compiler.alerts.common

Examples of com.google.gxp.compiler.alerts.common.InvalidMessageError


            "foo <gxp:ph name='x'/>bar<gxp:eph/> baz",
            "</gxp:msg>",
            "<gxp:msg>",
            "foo <gxp:ph name='x'/>quux<gxp:eph/> baz",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(5, 1), "Cannot merge messages with different content."));
    assertNoUnexpectedAlerts();
  }
View Full Code Here


            "foo <gxp:ph name='x'/>bar<gxp:eph/> baz",
            "</gxp:msg>",
            "<gxp:msg name='MSG_B'>",
            "foo <gxp:ph name='x'/>quux<gxp:eph/> baz",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(5, 1), "Cannot merge messages with different content."));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    // static content differs
    compile("<gxp:msg>",
            "<gxp:ph name='x'/>foo<gxp:eph/>",
            "<gxp:ph name='x'/>bar<gxp:eph/>",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
                    pos(4, 1), "Conflicting declarations of X within message"));
    assertNoUnexpectedAlerts();

    // static the same
    compile("<gxp:msg>",
            "<gxp:ph name='x'/>foo<gxp:eph/>",
            "<gxp:ph name='x'/>foo<gxp:eph/>",
            "</gxp:msg>");
    assertNoUnexpectedAlerts();

    // dynamic content differs (even if they look the same, NativeExpressions
    // potentially eveluate to different values, so are considered "different")
    compile("<gxp:msg>",
            "<gxp:ph name='x' example='5'/><gxp:eval expr='x.getY()'/><gxp:eph/>",
            "<gxp:ph name='x' example='5'/><gxp:eval expr='x.getY()'/><gxp:eph/>",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
                    pos(4, 1), "Conflicting declarations of X within message"));
    assertNoUnexpectedAlerts();

    // Simple evaluations of a single variable are OK.
    compile("<gxp:msg>",
View Full Code Here

    assertNoUnexpectedAlerts();
  }

  public void testPlaceholderStart_invalidName() throws Exception {
    compile("<gxp:msg><gxp:ph name='ham on rye'/>x<gxp:eph/></gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(2, 10), "Invalid placeholder specification: only caps, digits,"
                    + " and underscores allowed in presentation"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

  public void testPlaceholder_transconsoleError() throws Exception {
    compile("<gxp:msg>",
            "<gxp:ph name='cola'/>coke<gxp:eph/>",
            "<gxp:ph name='cola'/>pepsi<gxp:eph/>",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(4, 1), "Conflicting declarations of COLA within message"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    assertNoUnexpectedAlerts();
  }

  public void testPlaceholder_conflictsWithMessageContent() throws Exception {
    compile("<gxp:msg>Your SSN is: <gxp:ph name='ssn'/>123<gxp:eph/></gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(2, 1), "Placeholder name (SSN) duplicated in message content."));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

      // TODO(laurence): create a better stand-in
      return new StringConstant(msg, msg.getSchema(), "");
    }

    private void recordInvalidMessageException(Node node, InvalidMessageException imx) {
      alertSink.add(new InvalidMessageError(node.getSourcePosition(), imx));
      invalid = true;
    }
View Full Code Here

    MessageBundle messageBundle = new MessageBundle(PROJECT_ID, LANGUAGE_ID);
    for (ExtractedMessage msg : messages) {
      try {
        messageBundle.addMessage(msg.getTcMessage());
      } catch (InvalidMessageBundleException e) {
        alertSink.add(new InvalidMessageError(msg.getSourcePosition(), e.getCause()));
      }
    }
    return messageBundle;
  }
View Full Code Here

            "foo <gxp:ph name='x'/>bar<gxp:eph/> baz",
            "</gxp:msg>",
            "<gxp:msg>",
            "foo <gxp:ph name='x'/>quux<gxp:eph/> baz",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(5, 1), "Cannot merge messages with different content."));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

            "foo <gxp:ph name='x'/>bar<gxp:eph/> baz",
            "</gxp:msg>",
            "<gxp:msg name='MSG_B'>",
            "foo <gxp:ph name='x'/>quux<gxp:eph/> baz",
            "</gxp:msg>");
    assertAlert(new InvalidMessageError(
        pos(5, 1), "Cannot merge messages with different content."));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.alerts.common.InvalidMessageError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.