@Test
  public void testTestingClient() throws Exception {
    final TestingClient testingClient;
    testingClient =
        new TestingClient(
            runner, context, new ClassPathResolver(Thread.currentThread().getContextClassLoader()));

    final String baseDirectory = System.getProperty("user.dir");
    final FileSet tests = new FileSet();

    tests.setDirectory(baseDirectory + "/src/test/resources/org/moyrax/");
    tests.addInclude("**/*.html");

    context.setFiles(
        tests.getDirectory(),
        fileSetManager.getIncludedFiles(tests),
        fileSetManager.getExcludedFiles(tests));

    context.setLookupPackages(new String[] {"classpath:/org/moyrax/javascript/common/**"});

    context.setClassLoader(new ContextClassLoader(Thread.currentThread().getContextClassLoader()));

    Shell.setResolver("lib", new LibraryResolver("/org/moyrax/javascript/lib"));
    Shell.setResolver(
        "classpath", new ClassPathResolver(Thread.currentThread().getContextClassLoader()));

    loadContextResources(testingClient);

    testingClient.runTests();
  }
예제 #2
0
  protected List<SourceBundleFile> getSourceBundleFiles(BundleSet bundleSet) {
    List<SourceBundleFile> bundleFiles = new LinkedList<SourceBundleFile>();

    FileSetManager fsm = new FileSetManager(getLog());
    File baseDir = project.getBasedir();
    ResourceType type = bundleSet.getType();
    FileSet fs = bundleSet.getSourceFiles();
    File fsBaseDir = new File(baseDir, fs.getDirectory());
    String[] relPathes = fsm.getIncludedFiles(fs);
    for (String relPath : relPathes) {
      File bundleFile = new File(fsBaseDir, relPath);
      bundleFiles.add(
          new SourceBundleFile(type, pathToBundleId(type, relPath), bundleFile, relPath));
    }
    return bundleFiles;
  }