Package com.google.gwt.dev.util

Examples of com.google.gwt.dev.util.UnitTestTreeLogger


    loggerBuilder.setLowestLogLevel(TreeLogger.WARN);
    loggerBuilder.expectWarn(
        "Resource com/google/gwt/dev/resource/impl/testdata/outer/inner/"
        + "empty.txt is included by multiple modules (InnerDirModule, "
        + "InnerFileModule, OuterDirModule).", null);
    UnitTestTreeLogger logger = loggerBuilder.createLogger();
    ResourceOracleImpl resourceOracleImpl = new ResourceOracleImpl(logger,
        ResourceLoaders.wrap(Thread.currentThread().getContextClassLoader()));

    PathPrefixSet pathPrefixSet = new PathPrefixSet(false);
    // Include from an outer directory.
    pathPrefixSet.add(new PathPrefix("OuterDirModule",
        "com/google/gwt/dev/resource/impl/testdata/outer/",
        defaultFilters.customResourceFilter(new String[0], new String[0],
            new String[0], true, true), false, new String[0]));
    // Include on the inner directory.
    pathPrefixSet.add(
        new PathPrefix("InnerDirModule",
            "com/google/gwt/dev/resource/impl/testdata/outer/inner/",
            defaultFilters.customResourceFilter(new String[0], new String[0],
                new String[0], true, true), false, new String[0]));
    // Include a specific file in the inner directory.
    pathPrefixSet.add(new PathPrefix("InnerFileModule",
        "com/google/gwt/dev/resource/impl/testdata/",
        defaultFilters.customResourceFilter(new String[] {
            "com/google/gwt/dev/resource/impl/testdata/outer/inner/empty.txt"},
            new String[0], new String[0], true, true), false, new String[0]));

    resourceOracleImpl.setPathPrefixes(pathPrefixSet);
    resourceOracleImpl.scanResources(logger);
    resourceOracleImpl.printOverlappingModuleIncludeWarnings(logger);

    logger.assertCorrectLogEntries();
  }
View Full Code Here


  /**
   * Tests that it's an error to call the 2-argument version of GWT.runAsync
   * with anything but a class literal.
   */
  public void testNonLiteralInCall() {
    UnitTestTreeLogger logger;
    {
      UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
      builder.setLowestLogLevel(TreeLogger.ERROR);
      builder.expectError("Errors in 'test/EntryPoint.java'", null);
      builder.expectError(
          "Line 5: Only class literals may be used to name a call to GWT.runAsync()", null);
      logger = builder.createLogger();
      this.logger = logger;
    }

    addSnippetImport("com.google.gwt.core.client.GWT");
    try {
      JProgram program = compileSnippet("void", "GWT.runAsync((new Object()).getClass(), null);");
      ReplaceRunAsyncs.exec(logger, program);
      fail("Expected compilation to fail");
    } catch (UnableToCompleteException e) {
      // expected
    }

    logger.assertCorrectLogEntries();
  }
View Full Code Here

    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);
    URL url = new File("nonexistent.web.xml").toURI().toURL();
    builder.expectWarn("Unable to process '" + url.toExternalForm()
        + "' for servlet validation", IOException.class);
    UnitTestTreeLogger logger = builder.createLogger();
    ServletValidator validator = ServletValidator.create(logger, url);
    assertNull(validator);
    logger.assertCorrectLogEntries();
  }
View Full Code Here

    builder.setLowestLogLevel(TreeLogger.WARN);
    URL url = this.getClass().getResource("invalid.web.xml");
    assertNotNull(url);
    builder.expectWarn("Unable to process '" + url.toExternalForm()
        + "' for servlet validation", SAXParseException.class);
    UnitTestTreeLogger logger = builder.createLogger();
    ServletValidator validator = ServletValidator.create(logger, url);
    assertNull(validator);
    logger.assertCorrectLogEntries();
  }
View Full Code Here

    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);
    builder.expectWarn(ServletValidator.generateMissingMappingMessage(
        "org.test.NoMappings", "/no/mapping", "noMappings"), null);

    UnitTestTreeLogger logger = builder.createLogger();
    validator.validate(logger, "org.test.NoMappings", "/no/mapping");
    logger.assertCorrectLogEntries();
  }
View Full Code Here

    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);
    builder.expectWarn(ServletValidator.generateMissingServletMessage(
        "not.defined.Class", "/no/mapping"), null);

    UnitTestTreeLogger logger = builder.createLogger();
    validator.validate(logger, "not.defined.Class", "/no/mapping");
    logger.assertCorrectLogEntries();
  }
View Full Code Here

        "/no/mapping"));

    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);

    UnitTestTreeLogger logger = builder.createLogger();
    validator.validate(logger, "org.test.OneMapping", "/one/mapping");
    logger.assertCorrectLogEntries();
  }
View Full Code Here

        "/no/mapping"));

    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);

    UnitTestTreeLogger logger = builder.createLogger();
    validator.validate(logger, "org.test.TwoMappings", "/two/mappings1");
    validator.validate(logger, "org.test.TwoMappings", "/two/mappings2");
    logger.assertCorrectLogEntries();
  }
View Full Code Here

  }

  private ServletValidator createValidator() {
    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.setLowestLogLevel(TreeLogger.WARN);
    UnitTestTreeLogger logger = builder.createLogger();
    URL url = this.getClass().getResource("valid.web.xml");
    assertNotNull(url);
    ServletValidator validator = ServletValidator.create(logger, url);
    assertNotNull(validator);
    logger.assertCorrectLogEntries();
    return validator;
  }
View Full Code Here

    }
    for (Message message : messages) {
      final String fullMessage = "Line " + message.line + ": " + message.message;
      b.expect(message.logLevel, fullMessage, null);
    }
    UnitTestTreeLogger logger = b.createLogger();
    TypeOracle oracle = buildOracle(logger, buggyCode, extraCode);

    logger.assertCorrectLogEntries();
    String className = buggyCode.getTypeName();
    if (messages.length != 0 && logLevel == TreeLogger.ERROR) {
      assertNull("Buggy compilation unit not removed from type oracle",
          oracle.findType(className));
    } else {
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.util.UnitTestTreeLogger

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.