Package fitnesse.http

Examples of fitnesse.http.SimpleResponse


    String convertedDate = RssResponder.RecentChangesPageEntry.convertDateFormat(inDate);
    assertEquals(convertedDate, inDate);
  }

  private void buildRssChannel() throws Exception {
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    rssDoc = XmlUtil.newDocument(response.getContent());
    rssElement = rssDoc.getDocumentElement();
    channelElement = XmlUtil.getElementByTagName(rssElement, "channel");
  }
View Full Code Here


  }

  private void assertPageWithTableResponseWith(String table, String expected) throws Exception {
    WikiPageUtil.addPage(root, PathParser.parse("TablePage"), table);
    request.setResource("TablePage");
    SimpleResponse response = makeResponse();
    assertResponseContentEquals(expected, response);
  }
View Full Code Here

  }

  @Test
  public void noSuchPage() throws Exception {
    request.setResource("NoSuchPage");
    SimpleResponse response = makeResponse();
    assertEquals(404, response.getStatus());
  }
View Full Code Here

  @Test
  public void pageWithNoTables() throws Exception {
    WikiPageUtil.addPage(root, PathParser.parse("SimplePage"), "simple content");
    request.setResource("SimplePage");
    SimpleResponse response = makeResponse();
    assertEquals(200, response.getStatus());
    assertEquals("{\"tables\": []}", response.getContent());
  }
View Full Code Here

  @Test
  public void canNotDeleteFileOutsideFilesSection() throws Exception {
    DeleteFileResponder responder = new DeleteFileResponder();
    request.addInput("filename", "../../dir");
    request.setResource("files/");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: dir"));
  }
View Full Code Here

  @Test
  public void canNotDeleteFileOutsideFilesSectionWithInvalidResource() throws Exception {
    DeleteFileResponder responder = new DeleteFileResponder();
    request.addInput("filename", "dir");
    request.setResource("files/../../");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: dir"));
  }
View Full Code Here

    return getObject(root, request);
  }

  private Object getObject(WikiPage root, MockRequest request) throws Exception {
    Responder responder = new SerializedPageResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(response.getContentBytes()));
    return ois.readObject();
  }
View Full Code Here

    WikiPageUtil.addPage(root, PathParser.parse("PageTwo"), "");

    request.setResource("root");
    request.addInput("type", "pages");
    Responder responder = new SerializedPageResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    String xml = response.getContent();

    assertEquals("text/xml", response.getContentType());
    assertSubString("<name>PageOne</name>", xml);
    assertSubString("<name>PageTwo</name>", xml);
    assertSubString("<name>ChildOne</name>", xml);
  }
View Full Code Here

    pageOne.commit(data);

    request.setResource("root");
    request.addInput("type", "pages");
    Responder responder = new SerializedPageResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    String xml = response.getContent();

    assertEquals("text/xml", response.getContentType());
    assertSubString("<name>PageOne</name>", xml);
    assertSubString("<name>PageTwo</name>", xml);
    assertSubString("<name>ChildOne</name>", xml);
    assertNotSubString("SymPage", xml);
  }
View Full Code Here

    WikiPageUtil.addPage(root, PathParser.parse("TestPageOne"), "test page");

    request.setResource("TestPageOne");
    request.addInput("type", "data");
    Responder responder = new SerializedPageResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    String xml = response.getContent();

    assertEquals("text/xml", response.getContentType());
    assertSubString("test page", xml);
    assertSubString("<Test", xml);
  }
View Full Code Here

TOP

Related Classes of fitnesse.http.SimpleResponse

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.