@Before
 public void setUp() throws Exception {
   context = FitNesseUtil.makeTestContext();
   suite =
       WikiPageUtil.addPage(
           context.getRootPage(), PathParser.parse("SuitePage"), "This is the test suite\n");
 }
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());
  }
}
 public void setUp() throws Exception {
   seeker = new SimpleSocketSeeker();
   sender = new MockResponseSender();
   responder = new SocketCatchingResponder();
   context = FitNesseUtil.makeTestContext();
   dealer = context.socketDealer;
   request = new MockRequest();
 }
Exemplo n.º 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();
 }
  @Before
  public void setUp() throws Exception {
    testData = new WikiImporterTest();
    testData.createRemoteRoot(new OneUserAuthenticator("joe", "blow"));
    testData.createLocalRoot();

    FitNesseUtil.startFitnesseWithContext(testData.remoteContext);
    baseUrl = FitNesseUtil.URL;

    createResponder();
  }
  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");
 }
Exemplo n.º 8
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");
  }
Exemplo n.º 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");
 }
Exemplo n.º 10
0
  public void setUp() throws Exception {
    createRemoteRoot();
    createLocalRoot();

    FitNesseUtil.startFitnesse(remoteRoot);

    importer = new WikiImporter();
    importer.setWikiImporterClient(this);
    importer.parseUrl("http://localhost:" + FitNesseUtil.port);

    imports = new LinkedList<WikiPage>();
    errors = new LinkedList<Exception>();
  }
Exemplo n.º 11
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());
  }
Exemplo n.º 12
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);
  }
 @After
 public void tearDown() throws Exception {
   FitNesseUtil.stopFitnesse();
 }
Exemplo n.º 15
0
 @Before
 public void setup() throws Exception {
   WikiPage root = InMemoryPage.makeRoot("RooT");
   context = FitNesseUtil.makeTestContext(root);
 }
Exemplo n.º 16
0
 public void setUp() {
   context = FitNesseUtil.makeTestContext();
 }
Exemplo n.º 17
0
 @Before
 public void setUp() throws Exception {
   root = InMemoryPage.makeRoot("root");
   context = FitNesseUtil.makeTestContext(root);
 }
 @After
 public void tearDown() throws Exception {
   FitNesseUtil.destroyTestContext(context);
 }