Package com.google.gxp.compiler

Examples of com.google.gxp.compiler.Configuration


                                      AlertPolicy alertPolicy)
      throws GxpCompilationException {

    String javaFile = javaBase + compilationVersion + ".java";

    Configuration configuration = new RuntimeConfiguration(systemFS, outFs, srcGxps, srcSchemas,
                                                           srcPaths, javaFile, compilationVersion,
                                                           alertPolicy);
    try {
      // Perform GXP Compilation
      AlertSet alertSet = new Compiler(configuration).call();
View Full Code Here


        }
      };

  public void testGetSourceFiles() throws Exception {
    // No sources specified.
    Configuration config = createConfig();
    assertTrue(config.getSourceFiles().isEmpty());

    // Sources specified, but no source path.
    String[] sources = new String[] {
      "com" + SLASH + "google" + SLASH + "foo" + SLASH + "ford.gxp",
      "com" + SLASH + "google" + SLASH + "foo" + SLASH + "zaphod.gxp",
      "com" + SLASH + "google" + SLASH + "bar" + SLASH + "trillian.gxp"
    };
    config = createConfig(getCwd(), sources);
    assertContentsAnyOrder(Iterables.transform(config.getSourceFiles(),
                                               GET_NAME),
                           "/com/google/foo/ford.gxp",
                           "/com/google/foo/zaphod.gxp",
                           "/com/google/bar/trillian.gxp");

    // Same as above, but with different defaultDir.
    config = createConfig(getCwd().join("com/google"), sources);

    assertContentsAnyOrder(Iterables.transform(config.getSourceFiles(),
                                               GET_NAME),
                           "/foo/ford.gxp",
                           "/foo/zaphod.gxp",
                           "/bar/trillian.gxp");

    // Sources specified, with source path.
    config = createConfig(
        "--source", "src_dir_1" + COLON + "src_dir_2",
        "src_dir_1" + SLASH + "ford.gxp",
        "src_dir_1" + SLASH + "zaphod.gxp",
        "src_dir_2" + SLASH + "trillian.gxp");
    assertContentsAnyOrder(Iterables.transform(config.getSourceFiles(),
                                               GET_NAME),
                           "/ford.gxp",
                           "/zaphod.gxp",
                           "/trillian.gxp");

    // Sources specified, with "overlapping" dirs in source path.
    config = createConfig(
        "--source",
        "foo" + SLASH + "bar" + SLASH + "baz"
          + COLON
          + "foo" + SLASH + "bar",
        "foo" + SLASH + "bar" + SLASH + "baz" + SLASH + "quux.gxp",
        "foo" + SLASH + "bar" + SLASH + "zip" + SLASH + "zap.gxp"
        );
    assertContentsAnyOrder(
        Iterables.transform(config.getSourceFiles(), GET_NAME),
        "/quux.gxp",
        "/zip/zap.gxp");

    // Try the opposite order of items in the source path -- we should get the
    // same result.
    config = createConfig(
        "--source",
        "foo" + SLASH + "bar"
          + COLON
          + "foo" + SLASH + "bar" + SLASH + "baz",
        "foo" + SLASH + "bar" + SLASH + "baz" + SLASH + "quux.gxp",
        "foo" + SLASH + "bar" + SLASH + "zip" + SLASH + "zap.gxp"
        );
    assertContentsAnyOrder(
        Iterables.transform(config.getSourceFiles(), GET_NAME),
        "/quux.gxp",
        "/zip/zap.gxp");
  }
View Full Code Here

        "/quux.gxp",
        "/zip/zap.gxp");
  }

  public void testGetOutputLanguages() throws Exception {
    Configuration config = createConfig();
    assertContentsAnyOrder(config.getOutputLanguages());

    config = createConfig("--output_language", "java");
    assertContentsAnyOrder(config.getOutputLanguages(),
                           OutputLanguage.JAVA);

    config = createConfig("--output_language", "java",
                          "--output_language", "xmb");
    assertContentsAnyOrder(config.getOutputLanguages(),
                           OutputLanguage.JAVA, OutputLanguage.XMB);
  }
View Full Code Here

    assertContentsAnyOrder(config.getOutputLanguages(),
                           OutputLanguage.JAVA, OutputLanguage.XMB);
  }

  public void testGetAllowedOutputFilenames() throws Exception {
    Configuration config = createConfig();
    assertTrue(config.getAllowedOutputFiles().isEmpty());
    FileSystem fs;

    config = createConfig(
        getCwd(),
        "--output", "my_out_dir/ford.java",
        "--output", "my_out_dir/zaphod.java");
    assertContentsAnyOrder(
        Iterables.transform(config.getAllowedOutputFiles(), GET_NAME),
        "/my_out_dir/ford.java",
        "/my_out_dir/zaphod.java");

    // Same as above, but with different defaultDir.
    config = createConfig(
        getCwd().join("my_out_dir"),
        "--output", "my_out_dir/ford.java",
        "--output", "my_out_dir/zaphod.java");
    assertContentsAnyOrder(
        Iterables.transform(config.getAllowedOutputFiles(), GET_NAME),
        "/ford.java",
        "/zaphod.java");

    // The --dir flag "re-bases" the location of output files.
    config = createConfig(
        "--dir", "my_out_dir",
        "--output", "my_out_dir/ford.java",
        "--output", "my_out_dir/zaphod.java");
    assertContentsAnyOrder(
        Iterables.transform(config.getAllowedOutputFiles(), GET_NAME),
        "/ford.java",
        "/zaphod.java");
  }
View Full Code Here

        "/ford.java",
        "/zaphod.java");
  }

  public void testGetDotPhases() throws Exception {
    Configuration config;

    // Base case.
    config = createConfig();
    assertTrue(config.getDotPhases().isEmpty());

    // One phase.
    config = createConfig("--dot", "reparented");
    assertContentsAnyOrder(config.getDotPhases(),
        Phase.REPARENTED);

    // A few phases.
    config = createConfig("--dot", "reparented",
                          "--dot", "space-collapsed",
                          "--dot", "placeholder-pivoted");
    assertContentsInOrder(config.getDotPhases(),
        Phase.REPARENTED,
        Phase.SPACE_COLLAPSED,
        Phase.PLACEHOLDER_PIVOTED);

    // A few phases, different order (should be sorted).
    config = createConfig("--dot", "placeholder-pivoted",
                          "--dot", "space-collapsed",
                          "--dot", "reparented");
    assertContentsInOrder(config.getDotPhases(),
        Phase.REPARENTED,
        Phase.SPACE_COLLAPSED,
        Phase.PLACEHOLDER_PIVOTED);

    // Wildcard.
    config = createConfig("--dot", "*");
    assertContentsAnyOrder(config.getDotPhases(),
        (Object[]) Phase.values());
  }
View Full Code Here

    assertContentsAnyOrder(config.getDotPhases(),
        (Object[]) Phase.values());
  }

  public void testGetNamespaces() throws Exception {
    Configuration config = createConfig();
    // TODO(harryh): test creation of non-standard namespaces
    // assertSame(namespaces, config.getNamespaces());
  }
View Full Code Here

    // TODO(harryh): test creation of non-standard namespaces
    // assertSame(namespaces, config.getNamespaces());
  }

  public void testGetCodeGeneratorFactory() throws Exception {
    Configuration config = createConfig();
    assertMessageSourceEquals(null, config);
    assertDynamicModeEnabledEquals(false, config);

    config = createConfig("--message_source", "com.google.message.source");
    assertMessageSourceEquals("com.google.message.source", config);
View Full Code Here

        (DefaultCodeGeneratorFactory) config.getCodeGeneratorFactory();
    assertEquals(expected, codeGenFactory.isDynamicModeEnabled());
  }

  public void testGetDependencyFile() throws Exception {
    Configuration config = createConfig();
    assertNull(config.getDependencyFile());

    config = createConfig(
        "--depend", "foobar.gxd");
    assertEquals(getCwd().join("foobar.gxd"),
                 config.getDependencyFile());

    // location of depend file should not be affected by --dir flag
    config = createConfig(
        "--dir", "my_out_dir",
        "--depend", "foobar.gxd");
    assertEquals(getCwd().join("foobar.gxd"),
                 config.getDependencyFile());
  }
View Full Code Here

    assertEquals(getCwd().join("foobar.gxd"),
                 config.getDependencyFile());
  }

  public void testGetPropertiesFile() throws Exception {
    Configuration config = createConfig();
    assertNull(config.getPropertiesFile());

    config = createConfig(
        "--output_properties",
        "--message_source", "com.google.message.source");
    assertEquals(getCwd().join("com/google/message/source_en.properties"),
                 config.getPropertiesFile());

    // location of properties file should be affected by --dir flat
    config = createConfig(
        "--dir", "/outdir",
        "--output_properties",
        "--message_source", "com.google.message.source");
    assertEquals(sysFs.parseFilename("/outdir/com/google/message/source_en.properties"),
                 config.getPropertiesFile());
  }
View Full Code Here

    config = createConfig("--verbose");
    assertTrue(config.isVerboseEnabled());
  }

  public void testIsDebugEnabled() throws Exception {
    Configuration config = createConfig();
    assertFalse(config.isDebugEnabled());

    config = createConfig("--g");
    assertTrue(config.isDebugEnabled());
  }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.Configuration

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.