public class ChunkingResponderTest {

  private final FitNesseContext context = FitNesseUtil.makeTestContext();

  private Exception exception;
  private ChunkingResponder responder =
      new ChunkingResponder() {
        @Override
        protected void doSending() throws Exception {
          throw exception;
        }
      };

  @Test
  public void testException() throws Exception {
    exception = new Exception("test exception");
    ChunkedResponse response = (ChunkedResponse) responder.makeResponse(context, new MockRequest());
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String responseSender = sender.sentData();
    assertSubString("test exception", responseSender);
  }

  @Test
  public void chunkingShouldBeTurnedOffIfnochunkParameterIsPresent() throws Exception {
    MockRequest request = new MockRequest();
    request.addInput("nochunk", "");
    ChunkedResponse response = (ChunkedResponse) responder.makeResponse(context, request);
    assertTrue(response.isChunkingTurnedOff());
  }
}
 @Before
 public void setUp() throws Exception {
   context = FitNesseUtil.makeTestContext();
   suite =
       WikiPageUtil.addPage(
           context.getRootPage(), PathParser.parse("SuitePage"), "This is the test suite\n");
 }
 public void setUp() throws Exception {
   seeker = new SimpleSocketSeeker();
   sender = new MockResponseSender();
   responder = new SocketCatchingResponder();
   context = FitNesseUtil.makeTestContext();
   dealer = context.socketDealer;
   request = new MockRequest();
 }
Пример #4
0
 @Before
 public void setUp() throws Exception {
   Properties properties = new Properties();
   properties.setProperty("Theme", "fitnesse_straight");
   FitNesseContext context = FitNesseUtil.makeTestContext(properties);
   page =
       new HtmlPage(context.pageFactory.getVelocityEngine(), "skeleton.vm", "fitnesse_theme", "/");
   html = page.html();
 }
  public void testHasEditLinkForWikiWords() throws Exception {
    MockRequest request = new MockRequest();
    request.setResource("PageOne.PageTwo");
    WikiPage root = InMemoryPage.makeRoot("RooT");

    Responder responder = new NotFoundResponder();
    SimpleResponse response =
        (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    assertHasRegexp("\"PageOne[.]PageTwo[?]edit\"", response.getContent());
  }
 @Before
 public void setup() throws Exception {
   resultsDirectory = new File("testHistoryDirectory");
   removeResultsDirectory();
   resultsDirectory.mkdir();
   history = new TestHistory();
   responder = new PurgeHistoryResponder();
   responder.setResultsDirectory(resultsDirectory);
   context = FitNesseUtil.makeTestContext();
   request = new MockRequest();
   request.setResource("TestPage");
 }
Пример #7
0
  @Before
  public void setUp() {
    context = FitNesseUtil.makeTestContext();
    WikiPage root = context.getRootPage();
    WikiPage frontpage = root.addChildPage("FrontPage");
    makeReadSecure(frontpage);
    authenticator = new SimpleAuthenticator();
    privilegedResponder = new DummySecureResponder();

    request = new MockRequest();
    request.setResource("FrontPage");
  }
Пример #8
0
  @Test
  public void testIsRunning() throws Exception {
    FitNesseContext context = FitNesseUtil.makeTestContext();
    FitNesse fitnesse = context.fitNesse.dontMakeDirs();

    assertFalse(fitnesse.isRunning());

    fitnesse.start();
    assertTrue(fitnesse.isRunning());

    fitnesse.stop();
    assertFalse(fitnesse.isRunning());
  }
Пример #9
0
 @Before
 public void setUp() throws Exception {
   suitePageName = "SuitePage";
   root = InMemoryPage.makeRoot("RooT");
   context = FitNesseUtil.makeTestContext(root);
   crawler = root.getPageCrawler();
   PageData data = root.getData();
   data.setContent(classpathWidgets());
   root.commit(data);
   suite = crawler.addPage(root, PathParser.parse(suitePageName), "This is the test suite\n");
   testPages = new LinkedList<WikiPage>();
   testPage = addTestPage(suite, "TestOne", "My test");
 }
Пример #10
0
 @Before
 public void setUp() throws Exception {
   clock = new DateAlteringClock(new Date()).freeze();
   FitNesseContext context = FitNesseUtil.makeTestContext();
   WikiPage root = InMemoryPage.makeRoot("RooT");
   CompositeExecutionLog log = new CompositeExecutionLog(root);
   formatter =
       new SuiteHtmlFormatter(context, root, log) {
         @Override
         protected void writeData(String output) {
           pageBuffer.append(output);
         }
       };
 }
  @Before
  public void setUp() throws Exception {
    fileSystem = new MemoryFileSystem();
    context = FitNesseUtil.makeTestContext(fileSystem);
    root = context.getRootPage(); // #  root
    pageOne = WikiPageUtil.addPage(root, PathParser.parse("PageOne"), ""); // #    |--PageOne
    WikiPageUtil.addPage(
        pageOne, PathParser.parse("ChildOne"), "ChildOne"); // #    |    `--ChildOne
    WikiPage pageTwo = WikiPageUtil.addPage(root, PathParser.parse("PageTwo"), "");
    childTwo =
        WikiPageUtil.addPage(pageTwo, PathParser.parse("ChildTwo"), ""); // #         |--ChildTwo
    WikiPageUtil.addPage(pageTwo, PathParser.parse("ChildThree"), ""); // #         `--ChildThree

    request = new MockRequest();
    request.setResource("PageOne");
    responder = new SymbolicLinkResponder(fileSystem);
  }
 public void setUp() {
   context = FitNesseUtil.makeTestContext();
 }
Пример #13
0
 @Before
 public void setUp() throws Exception {
   root = InMemoryPage.makeRoot("root");
   context = FitNesseUtil.makeTestContext(root);
 }
Пример #14
0
 @Before
 public void setup() throws Exception {
   WikiPage root = InMemoryPage.makeRoot("RooT");
   context = FitNesseUtil.makeTestContext(root);
 }