Package fitnesse.http

Examples of fitnesse.http.SimpleResponse


  @Test
  public void testContentOfPage() throws Exception {
    request.setResource("Blah");
    Responder responder = new UnauthorizedResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    String content = response.getContent();

    assertSubString("Blah", content);
  }
View Full Code Here


  public static final String PAGE_TYPE = "pageType";
  public static final String PAGE_TYPES = "pageTypes";

  public Response makeResponse(FitNesseContext context, Request request) {

    SimpleResponse response = new SimpleResponse();
    response.setContent(doMakeHtml(context, request));
    return response;
  }
View Full Code Here

      pageType = "Default";
  }

  private Response createChildPageAndMakeResponse(FitNesseContext context) {
    createChildPage(context);
    SimpleResponse response = new SimpleResponse();
    WikiPagePath fullPathOfCurrentPage = currentPage.getPageCrawler().getFullPath();
    response.redirect(context.contextRoot, fullPathOfCurrentPage.toString());
    return response;
  }
View Full Code Here

  public MergeResponder(Request request) {
    this.request = request;
  }

  public Response makeResponse(FitNesseContext context, Request request) {
    SimpleResponse response = new SimpleResponse();
    resource = this.request.getResource();
    WikiPagePath path = PathParser.parse(resource);
    WikiPage page = context.root.getPageCrawler().getPage(path);
    existingContent = page.getData().getContent();
    newContent = (String) this.request.getInput(EditResponder.CONTENT_INPUT_NAME);

    response.setContent(makePageHtml(context));

    return response;
  }
View Full Code Here

  }

  @Test
  public void testLoggingDataCreation() {
    MockRequest request = new MockRequest();
    SimpleResponse response = new SimpleResponse(200);
    MockSocket socket = new MockSocket("something");

    socket.setHost("1.2.3.4");
    request.setRequestLine("GET / HTTP/1.1");
    response.setContent("abc");
    request.setCredentials("billy", "bob");

    LogData data = FitNesseExpediter.makeLogData(socket, request, response);

    assertEquals("1.2.3.4", data.host);
View Full Code Here

import java.util.List;

public class SavePropertiesResponder implements SecureResponder {
  @Override
  public Response makeResponse(FitNesseContext context, Request request) {
    SimpleResponse response = new SimpleResponse();
    String resource = request.getResource();
    WikiPagePath path = PathParser.parse(resource);
    WikiPage page = context.root.getPageCrawler().getPage(path);
    if (page == null)
      return new NotFoundResponder().makeResponse(context, request);
    PageData data = page.getData();
    saveAttributes(request, data);
    VersionInfo commitRecord = page.commit(data);
    if (commitRecord != null) {
      response.addHeader("Current-Version", commitRecord.getName());
    }
    context.recentChanges.updateRecentChanges(page);
    response.redirect(context.contextRoot, resource);

    return response;
  }
View Full Code Here

  public void negotiationErrorScreenForFailureToComplete() throws Exception {
    WikiPage root = InMemoryPage.makeRoot("RooT");
    FitNesseContext context = FitNesseUtil.makeTestContext(root);
    Responder responder = new NegotiateAuthenticator.UnauthenticatedNegotiateResponder("token");
    Request request = new MockRequest();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals("Negotiate token", response.getHeader("WWW-Authenticate"));
    String content = response.getContent();
    assertSubString("Negotiated authentication required", content);
    assertSubString("Your client failed to complete required authentication", content);
  }
View Full Code Here

  @Test
  public void negotiationErrorScreenForNeedingAuthentication() throws Exception {
    WikiPage root = InMemoryPage.makeRoot("RooT");
    FitNesseContext context = FitNesseUtil.makeTestContext(root);
    Responder responder = new NegotiateAuthenticator.UnauthenticatedNegotiateResponder("token");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, null);
    String content = response.getContent();
    assertSubString("This request requires authentication", content);
  }
View Full Code Here

      parseThread.start();

      waitForRequest(request);
      if (!hasError) {
        if (context.contextRoot.equals(request.getRequestUri() + "/")) {
          response = new SimpleResponse();
          response.redirect(context.contextRoot, "");
        } else {
          response = createGoodResponse(request);
        }
      }
View Full Code Here

      return new NotFoundResponder().makeResponse(context, request);

    String fullPathName = PathParser.render(page.getPageCrawler().getFullPath());
    HtmlPage html = makeHtml(fullPathName, page, context, request);

    SimpleResponse response = new SimpleResponse();
    response.setContent(html.html());

    return response;
  }
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.