Package com.google.gxp.compiler.fs

Examples of com.google.gxp.compiler.fs.FileRef


/**
* Error tests related to instantiable GXPs.
*/
public class InstantiableErrorTest extends BaseTestCase {
  public void testCallConstructor_missingAttribute() throws Exception {
    FileRef callee = createFile("callee",
                                "<gxp:constructor>",
                                "  <gxp:param name='s1' type='String' />",
                                "</gxp:constructor>",
                                "<gxp:param name='s2' type='String' />");
    FileRef caller = createFile("caller", "<call:callee/>");
    compileFiles(callee, caller);

    assertAlert(new MissingAttributeError(pos(2,1), "<call:callee>", "s1"));
    assertAlert(new MissingAttributeError(pos(2,1), "<call:callee>", "s2"));
    assertNoUnexpectedAlerts();
View Full Code Here


    assertEquals(Severity.ERROR, alertPolicy.getSeverity(I18N_ALERT));
  }

  public void testParameterFile() throws Exception {
    InMemoryFileSystem inMemory = new InMemoryFileSystem();
    FileRef parameterFile = inMemory.parseFilename("/here/params");
    Writer out = parameterFile.openWriter();
    out.write("--help");
    out.close();
    GxpcFlags flags = new GxpcFlags(inMemory, inMemory.parseFilename("/here"), "@params");
    assertTrue(flags.showHelp());
  }
View Full Code Here

    assertTrue(flags.showHelp());
  }

  public void testParameterFileIsUtf8() throws Exception {
    InMemoryFileSystem inMemory = new InMemoryFileSystem();
    FileRef parameterFile = inMemory.parseFilename("/here/params");
    Writer out = parameterFile.openWriter(Charsets.UTF_8);
    out.write("--output /here/\u00F6"); // An oe umlaut.
    out.close();
    GxpcFlags flags = new GxpcFlags(inMemory, inMemory.parseFilename("/here"), "@params");
    assertEquals("/here/\u00F6", flags.getAllowedOutputFiles().iterator().next().toFilename());
  }
View Full Code Here

      // If the public id starts with // treat it as a path relative to
      // the build system / project root.
      String relPath = publicId.substring(SOURCE_ROOT_PUBLIC_ID_PREFIX.length());
      if (!"".equals(relPath) && !relPath.startsWith("/")) {
        // convert URI path to local file system conventions
        FileRef file = fileSystem.getRoot().join(relPath);
        alertSink.add(new EntityResolvedNotification(pos, publicId, file.toFilename()));
        return file.openInputStream();
      }
    }

    throw unresolved(pos, publicId, systemId, null);
  }
View Full Code Here

   * Delete the gxp file with the given name
   */
  protected final boolean deleteFile(String name) {
    String pkgDir = getPackage().replace('.', '/');
    String sourceName = "/" + pkgDir + "/" + name + ".gxp";
    FileRef fileRef = fs.parseFilename(sourceName);

    return fileRef.delete();
  }
View Full Code Here

  protected final void compileNoHeader(String... lines) throws Exception {
    compileNoHeader(Joiner.on("\n").join(lines));
  }

  protected final void compileNoHeader(String contents) throws Exception {
    FileRef gxpFile = createFileNoHeader(getTemplateBaseName(), contents);
    compileFiles(gxpFile);
  }
View Full Code Here

   * declarations on the first line, and will end with the corresponding close
   * tag. There will also be an xmlns declaration, "my", for the call namespace
   * of the generated template.
   */
  protected final void compile(String snippet) throws Exception {
    FileRef gxpFile = createFile(getTemplateBaseName(), snippet);
    compileFiles(gxpFile);
  }
View Full Code Here

    FileRef gxpFile = createFile(getTemplateBaseName(), snippet);
    compileFiles(gxpFile);
  }

  protected final void compileInterface(String snippet) throws Exception {
    FileRef gxpFile = createInterfaceFile(getTemplateBaseName(), snippet);
    compileFiles(gxpFile);
  }
View Full Code Here

            "</gxp:abbr>");
    assertNoUnexpectedAlerts();
  }

  public void testInCallAttrCss_text() throws Exception {
    FileRef callee = createFile("callee", "<gxp:param name='x' content-type='text/css' />");
    FileRef caller = createFile("caller",
                                "<call:callee>",
                                "  <gxp:attr name='x'>",
                                "    color: blue;",
                                "  </gxp:attr>",
                                "</call:callee>");
View Full Code Here

                                               "'cpp:delimiter' attribute"));
    assertNoUnexpectedAlerts();
  }

  public void testCall_NullAndLanguageAttribute() throws Exception {
    FileRef callee = createFile("callee", "<gxp:param name='s' type='String' />");
    FileRef caller = createFile("caller", "<call:callee s='foo' java:s='bar' />");
    compileFiles(callee, caller);
    assertAlert(new MultiValueAttributeError(pos(2,1), "<call:callee>", "'java:s' attribute"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.fs.FileRef

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.