Package com.google.jstestdriver

Examples of com.google.jstestdriver.FileInfo


          Collections.<FileInfo>emptyList());
    assertEquals(0, testCases.size());
  }
 
  public void testUpdateTestCasesFromRunData() throws Exception {
    FileInfo plugin = new FileInfo("plugin.js", 1234, -1, false, false, null, "plugin.js");
    List<FileInfo> files = Lists.newArrayList();
    FileInfo one = new FileInfo("one.js", 1234, -1, false, false, null, "one.js");
    FileInfo two = new FileInfo("two.js", 1234, -1, false, false, null, "two.js");
    FileInfo three = new FileInfo("three.js", 1234, -1, false, false, null, "three.js");
    files.add(one);
    files.add(two);
    files.add(three);

    FileInfo testOne = new FileInfo("oneTest.js", 1234, -1, false, false, null, "oneTest.js");
    FileInfo testTwo = new FileInfo("twoTest.js", 1234, -1, false, false, null, "twoTest.js");
    FileInfo testThree = new FileInfo("threeTest.js", 1234, -1, false, false, null, "threeTest.js");
    List<FileInfo> tests = Lists.newArrayList(testOne, testTwo, testThree);
    final JstdTestCaseFactory testCaseFactory = new JstdTestCaseFactory(
        Collections.<JstdTestCaseProcessor> emptySet(),
        Collections.<ResourceDependencyResolver>emptySet(), new NullStopWatch());
View Full Code Here


* @author corbinrsmith@gmail.com (Cory Smith)
*
*/
public class RunDataFactoryTest extends TestCase {
  public void testPreProcessFileSet() throws Exception {
    final FileInfo info = new FileInfo("foo.js", 12434, -1, false, false, null, "foo.js");
    final FileInfo addedInfo = new FileInfo("addedfoo.js", 12434, -1, false, false, null, "addedfoo.js");

    ResourcePreProcessor preProcessor = new ResourcePreProcessor(){
      public List<FileInfo> processDependencies(List<FileInfo> files) {
        files.add(addedInfo);
        return new LinkedList<FileInfo>(files);
      }

      public List<FileInfo> processPlugins(List<FileInfo> plugins) {
        return plugins;
      }

      public List<FileInfo> processTests(List<FileInfo> tests) {
        return tests;
      }
    };

    final Set<FileInfo> fileSet = Sets.newLinkedHashSet();
    fileSet.add(info);
    final RunDataFactory factory = new RunDataFactory(
      fileSet,
      Collections.<FileInfo> emptyList(),
      Sets.newHashSet(preProcessor),
      Collections.<FileInfo>emptyList(), new JstdTestCaseFactory(
          Collections.<JstdTestCaseProcessor> emptySet(),
          Collections.<ResourceDependencyResolver>emptySet(), new NullStopWatch()), new NullStopWatch());
   
    final List<FileInfo> actual = Lists.newArrayList(factory.get().getFileSet());

    assertEquals(info.getFilePath(), actual.get(0).getFilePath());
    assertEquals(info.getTimestamp(), actual.get(0).getTimestamp());
    assertEquals(info.isServeOnly(), actual.get(0).isServeOnly());

    assertEquals(addedInfo.getFilePath(), actual.get(1).getFilePath());
    assertEquals(addedInfo.getTimestamp(), actual.get(1).getTimestamp());
    assertEquals(addedInfo.isServeOnly(), actual.get(1).isServeOnly());
  }
View Full Code Here

* @author corysmith@google.com (Cory Smith)
*
*/
public class JstdTestCaseTest extends TestCase {
  public void testApplyDelta() throws Exception {
    FileInfo fileInfoOld = new FileInfo("foo.js", 1, -1, false, false, "", "foo.js");
    FileInfo fileInfoNew = new FileInfo("foo.js", 2, -1, false, false, "", "foo.js");
    JstdTestCaseDelta delta =
        new JstdTestCaseDelta(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(),
            Lists.newArrayList(fileInfoNew));
    JstdTestCase testCase =
        new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(),
View Full Code Here

    assertEquals(new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(),
        Lists.newArrayList(fileInfoNew), null), testCase.applyDelta(delta));
  }

  public void testApplyDeltaWrongId() throws Exception {
    FileInfo fileInfoOld = new FileInfo("foo.js", 1, -1, false, false, "", "foo.js");
    FileInfo fileInfoNew = new FileInfo("foo.js", 2, -1, false, false, "", "foo.js");
    JstdTestCaseDelta delta =
      new JstdTestCaseDelta(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(),
          Lists.newArrayList(fileInfoNew));
    JstdTestCase testCase =
      new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(),
View Full Code Here

    assertEquals(new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(),
        Lists.newArrayList(fileInfoNew), null), testCase.applyDelta(delta));
  }

  public void testApplyDeltaMerge() throws Exception {
    FileInfo plugin = new FileInfo("plugin.js", -1, -1, false, false, "", "plugin.js");
    FileInfo dep = new FileInfo("dep.js", -1, -1, false, false, "", "dep.js");
    FileInfo test = new FileInfo("test.js", -1, -1, false, false, "", "test.js");
    FileInfo testOld = new FileInfo("testone.js", -1, -1, false, false, "", "testone.js");
    FileInfo testNew = new FileInfo("testone.js", 1, -1, false, false, "", "testone.js");
    JstdTestCaseDelta delta =
        new JstdTestCaseDelta(Lists.<FileInfo>newArrayList(),
            Lists.<FileInfo>newArrayList(testNew), Lists.<FileInfo>newArrayList());
    JstdTestCase testCase =
        new JstdTestCase(Lists.<FileInfo>newArrayList(dep), Lists.<FileInfo>newArrayList(test,
View Full Code Here

* @author corysmith@google.com (Cory Smith)
*
*/
public class JstdTestCaseStoreTest extends TestCase {
  public void testAddTestCase() throws Exception {
    FileInfo one = new FileInfo("foo.js", 10, -1, false, false, null, "foo.js");
    JstdTestCaseStore store = new JstdTestCaseStore();
    JstdTestCase testCase =
        new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(one),
            Lists.<FileInfo>newArrayList(), "1");
    store.addCase(testCase);
View Full Code Here

  public void testAddTestCasesWithSharedFiles() throws Exception {
    String testCaseIdOne = "1";
    String testCaseIdTwo = "2";
    String testCaseIdThree = "3";
    FileInfo one = new FileInfo("foo.js", 1, -1, false, false, null, "foo.js");
    FileInfo two = new FileInfo("foo.js", 1, -1, false, false, "foo2", "foo.js");
    JstdTestCaseStore store = new JstdTestCaseStore();
    JstdTestCase testCaseOne =
        new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(one),
            Lists.<FileInfo>newArrayList(), testCaseIdOne);
    JstdTestCase testCaseTwo =
        new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(two),
            Lists.<FileInfo>newArrayList(), testCaseIdTwo);
    JstdTestCase testCaseThree =
        new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(one),
            Lists.<FileInfo>newArrayList(), testCaseIdThree);
    store.addCase(testCaseOne);
    assertTrue(store.getCases().contains(testCaseOne));
    store.addCase(testCaseTwo);
    assertTrue(store.getCases().contains(testCaseTwo));
    store.addCase(testCaseOne);
    store.addCase(testCaseThree);
    assertEquals("The data will be updated for test case one", two.getData(),
        store.getCase(testCaseIdOne).getTests().get(0).getData());
    assertEquals("The data will be updated for test case three", two.getData(),
        store.getCase(testCaseIdThree).getTests().get(0).getData());
  }
View Full Code Here

  }
 
  public void testApplyDelta() throws Exception {
    String contents = "foo";
    String testCaseIdOne = "1";
    FileInfo one = new FileInfo("foo.js", 1, -1, false, false, null, "foo.js");
    JstdTestCaseStore store = new JstdTestCaseStore();
    JstdTestCase testCaseOne =
      new JstdTestCase(Lists.<FileInfo>newArrayList(), Lists.<FileInfo>newArrayList(one),
          Lists.<FileInfo>newArrayList(), testCaseIdOne);
    JstdTestCaseDelta unloadedDelta = store.addCase(testCaseOne);

    store.applyDelta(new JstdTestCaseDelta(
        Lists.<FileInfo>newArrayList(),
        Lists.<FileInfo>newArrayList(one.load(contents, 1)),
        Lists.<FileInfo>newArrayList()));

    assertEquals("The data will be updated for test case one", contents,
        store.getCase(testCaseIdOne).getTests().get(0).getData());
   
View Full Code Here

*/
public class StandaloneRunnerHandlerTest extends TestCase {

  public void testCaptureAddFilesToLoadAndRun() throws Exception {
    List<FileInfo> fileList = Lists.newArrayList(
      new FileInfo("file1.js", 30, -1, false, false, "content1", "file1.js"),
      new FileInfo("file2.js", 5, -1, false, false, "content2", "file2.js"),
      new FileInfo("file3.js", 53, -1, false, false, "content3", "file3.js"),
      new FileInfo("file4.js", 1, -1, false, false, "content4", "file4.js")
      );
    List<FileSource> fileSources = Lists.newArrayList();
    final Map<String, FileInfo> files = new LinkedHashMap<String, FileInfo>();
    for (FileInfo file : fileList) {
      fileSources.add(file.toFileSource(new NullPathPrefix(), Collections.<FileInfoScheme>emptySet()));
View Full Code Here

    LinkedList<FileInfo> files = new LinkedList<FileInfo>();
    String lcovSource = "lcov";
    List<FileInfo> processed = new CoverageJsAdder(
        new FileLoaderStub(lcovSource),
        new CoverageNameMapper()).processPlugins(files);
    FileInfo lcov = processed.get(0);
    assertEquals(
        new LoadedFileInfo(CoverageJsAdder.LCOV_JS, -1, false, false, lcovSource),
        lcov);
    assertEquals(lcovSource, lcov.getData());
    assertFalse(lcov.canLoad());
  }
View Full Code Here

TOP

Related Classes of com.google.jstestdriver.FileInfo

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.