Package com.google.jstestdriver

Examples of com.google.jstestdriver.FileInfo


* @author corbinrsmith@gmail.com (Cory Smith)
*/
public class CoverageInstrumentingProcessorTest extends TestCase {

  public void testInstrument() throws Exception {
    FileInfo fileInfo = new FileInfo("foo.js", 0, -1, true, false, "var a = 1;", "foo.js");
    String expected = "decorated";
    Code code = new Code(fileInfo.getFilePath(), fileInfo.getData());
    CoverageAccumulator accumulator = new CoverageAccumulator();
    final Instant instant = new Instant(System.currentTimeMillis());
    FileInfo decorated =
        new CoverageInstrumentingProcessor(new DecoratorStub(expected, code),
            Collections.<String>emptySet(), accumulator, new Time() {
              public Instant now() {
                return instant;
              }
            }).process(fileInfo);
    assertEquals(expected, decorated.getData());
    assertEquals(fileInfo.getFilePath(), decorated.getFilePath());
    assertEquals(instant.getMillis(), decorated.getTimestamp());
    assertEquals(fileInfo.isServeOnly(), decorated.isServeOnly());
  }
View Full Code Here


    assertEquals(instant.getMillis(), decorated.getTimestamp());
    assertEquals(fileInfo.isServeOnly(), decorated.isServeOnly());
  }

  public void testSkipInstrument() throws Exception {
    FileInfo lcov = new FileInfo("LCOV.js", 0, -1, true, false, "var a = 1;", "LCOV.js");
    FileInfo serveOnly = new FileInfo("someData.dat", 0, -1, true, true, "scally{wag}", "someData.dat");
    FileInfo excluded = new FileInfo("excluded.dat", 0, -1, true, false, "not{me}", "excluded.dat");
    FileInfo remote = new FileInfo("https://foobar", 0, -1, true, false, null, "https://foobar");
    FileInfo empty = new FileInfo("foobar.js", 0, -1, true, false, "\n", "foobar.js");
    CoverageInstrumentingProcessor processor =
        new CoverageInstrumentingProcessor(null,
            Sets.<String>newHashSet(excluded.getFilePath()),
            null, null);
    assertSame(lcov, processor.process(lcov));
View Full Code Here

    Set<FileInfo> fileInfos = slave.getFileSet();

    assertEquals(3, fileInfos.size());
    Iterator<FileInfo> iterator = fileInfos.iterator();

    FileInfo info1 = iterator.next();

    assertEquals("filename1.js", info1.getFilePath());
    assertEquals(123, info1.getTimestamp());

    FileInfo info2 = iterator.next();

    assertEquals("filename2.js", info2.getFilePath());
    assertEquals(456, info2.getTimestamp());

    FileInfo info3 = iterator.next();

    assertEquals("filename3.js", info3.getFilePath());
    assertEquals(789, info3.getTimestamp());
  }
View Full Code Here

    browsers.addSlave(slave);
    BrowserQueryResponseHandler handler =
        new BrowserQueryResponseHandler(null, null, browsers, streamedResponses);

    slave.addFiles(Lists.newArrayList(new FileInfo()), new LoadedFiles());
    Response response = new Response();
    response.setType(ResponseType.RESET_RESULT.name());
    response.setResponse(new Gson().toJson(new LoadedFiles()));
    response.setBrowser(new BrowserInfo());
View Full Code Here

    }
  }

  public void testAggregateresponses() throws Exception {
    FileInfo one = new FileInfo("one", -1, -1, false, false, null, "one");
    ResponseStream streamOne = new NoopStream();
    ResponseStream streamTwo = new NoopStream();
    final RunData runDataOne = new RunData(Lists
        .newArrayList(streamOne), Collections.<JstdTestCase> emptyList(), null);
    final RunData runDataTwo = new RunData(Lists
View Full Code Here

        streamOne, streamTwo), Collections.<JstdTestCase> emptyList(), null),
        runDataOne.aggregateResponses(runDataTwo));
  }

  public void testRecordResponse() throws Exception {
    FileInfo one = new FileInfo("one", -1, -1, false, false, null, "one");
    ResponseStream streamOne = new NoopStream();
    ResponseStream streamTwo = new NoopStream();
    final RunData runDataOne = new RunData(Lists
        .newArrayList(streamOne), Collections.<JstdTestCase> emptyList(), null);
View Full Code Here

        runDataOne.recordResponse(streamTwo));
  }

  public void testUpdateFileSet() throws Exception {
    ResponseStream streamOne = new NoopStream();
    FileInfo one = new FileInfo("one", -1, -1, false, false, null, "one");
    FileInfo two = new FileInfo("two", -1, -1, false, false, null, "two");
   
    final JstdTestCaseFactory testCaseFactory =
        new JstdTestCaseFactory(
            Sets.<JstdTestCaseProcessor>newHashSet(),
            Collections.<ResourceDependencyResolver>emptySet(), new NullStopWatch());
View Full Code Here

*/
public class JstdTestCaseFactoryTest extends TestCase {

  public void testCreateWithTests() throws Exception {
    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

    assertEquals(Lists.newArrayList(files), jstdTestCase.getDependencies());
  }

  public void testCreateWithOutTests() throws Exception {
    List<FileInfo> fileSet = 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");
    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");
    fileSet.add(one);
    fileSet.add(two);
    fileSet.add(three);
    fileSet.add(testOne);
    fileSet.add(testTwo);
View Full Code Here

    assertEquals(Lists.newArrayList(fileSet), jstdTestCase.getDependencies());
  }

  public void testCreateWithOutTestsAndDeps() throws Exception {
    List<FileInfo> fileSet = 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");
    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");
    fileSet.add(one);
    fileSet.add(two);
    fileSet.add(three);
    fileSet.add(testOne);
    fileSet.add(testTwo);
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.