Package com.google.gxp.compiler.alerts

Examples of com.google.gxp.compiler.alerts.Alert


    return parser.parse(fileRef);
  }

  public void testEmpty() throws Exception {
    ParseTree tree = parse("");
    Alert alert = Iterables.getOnlyElement(tree.getAlerts());
    assertTrue(alert instanceof SaxAlert);
  }
View Full Code Here


  public void testUnknownElementNamespace() throws Exception {
    ParseTree tree = parse(
        "<gxp:template "
        + "xmlns:gxp='http://google.com/i/dont/really/exist'/>");
    Alert alert = Iterables.getOnlyElement(tree.getAlerts());
    assertTrue(alert instanceof UnknownNamespaceError);
  }
View Full Code Here

  }

  public void testUnknownElement() throws Exception {
    ParseTree tree = parse(
        "<gxp:idontexist xmlns:gxp='http://google.com/2001/gxp'/>");
    Alert alert = Iterables.getOnlyElement(tree.getAlerts());
    assertTrue(alert instanceof UnknownElementError);
  }
View Full Code Here

    assertTrue(alert instanceof UnknownElementError);
  }

  public void testNoNamespaceElement() throws Exception {
    ParseTree tree = parse("<idonthaveanamespace/>");
    Alert alert = Iterables.getOnlyElement(tree.getAlerts());
    assertTrue(alert instanceof NoNamespaceError);
  }
View Full Code Here

        "<!DOCTYPE gxp:template SYSTEM "
        + "\"http://gxp.googlecode.com/svn/trunk/resources/xhtml.ent\">\n"
        + "<gxp:template "
        + "xmlns:gxp='http://google.com/2001/gxp'/>");
    assertEquals(1, tree.getAlerts().size());
    Alert alert = Iterables.getOnlyElement(tree.getAlerts());
    assertEquals(
        "Resolved entity `http://gxp.googlecode.com/svn/trunk/resources/xhtml.ent`"
        + " to `/com/google/gxp/compiler/parser/xhtml.ent`",
        alert.getMessage());
  }
View Full Code Here

        + "  &foo;"
        + "  &bar;"
        + "</gxp:template>");

    Iterator<Alert> alerts = tree.getAlerts().iterator();
    Alert alert1 = alerts.next();
    assertEquals(
        "Resolved entity `//foo` to `/foo`", alert1.getMessage());
    Alert alert2 = alerts.next();
    assertFalse(alerts.hasNext());
    assertEquals(
        "Resolved entity `//bar` to `/bar`", alert2.getMessage());

    Node textElement = tree.getChildren().get(0).getChildren().get(0);
    assertEquals("  [file /foo]  [file /bar]",
                 ((TextElement) textElement).getText());
  }
View Full Code Here

        + "  &baz;\n"
        + "  end\n"
        + "</gxp:template>");

    assertEquals(1, tree.getAlerts().size());
    Alert alert = Iterables.getOnlyElement(tree.getAlerts());
    assertEquals(SAXParseException.class.getName()
                 + ": The entity \"baz\" was referenced, but not declared.",
                 alert.getMessage());
    // TODO(laurence): Figure out why this is a SAXException and not an
    // UnresolvedEntityError.
    assertEquals("/com/google/gxp/compiler/parser/testUndeclaredEntityResolution.gxp:7:3:7:3",
                 alert.getSourcePosition().toString());
  }
View Full Code Here

  public void testFailedMapping() throws Exception {
    AlertSetBuilder alertSetBuilder = new AlertSetBuilder();
    nsSet.get(alertSetBuilder, new SourcePosition("<test>"),
              "http://google.com/i/dont/exist");
    Alert alert = Iterables.getOnlyElement(alertSetBuilder.buildAndClear());
    assertTrue(alert instanceof UnknownNamespaceError);
  }
View Full Code Here

    ReparentedTree output = reparent(input);
    assertTrue(output.getRoot() instanceof NullRoot);
  }

  public void testWithAlerts() throws Exception {
    Alert parseWarning = new WarningAlert(new SourcePosition("baz", 1, 2),
                                          "test warning"){};
    parseAlerts.add(parseWarning);
    expectedAlerts.add(parseWarning);

    ReparentedTree output = reparent(tree());
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.alerts.Alert

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.