Package fitnesse.http

Examples of fitnesse.http.Request


  @Test public void aCommandWithoutASlashShouldGenerateARequestResourceWithoutASlash() {
    assertThat(requestFrom("myCommand").getResource(), is("myCommand"));
  }
   
  @Test public void aCommandShouldBeCorrectlyDeducedWhenCredentialsAreSpecified() {
    Request request = requestFrom("user:pass:/myCommand");
    assertThat(request.getResource(), is("myCommand"));
  }
View Full Code Here


    Request request = requestFrom("user:pass:/myCommand");
    assertThat(request.getResource(), is("myCommand"));
  }
 
  @Test public void requestAuthenticationShouldBeCorrectlySetWhenCredentialsAreSpecified() {
    Request request = requestFrom("user:pass:/myCommand");
    assertThat(request.getAuthorizationUsername(), is("user"));
    assertThat(request.getAuthorizationPassword(), is("pass"));
  }
View Full Code Here

  @Override
  public void serve(Socket s) throws IOException {
    InputStream input = s.getInputStream();

    Request request = new Request(input);
    try {
      request.parse();
    } catch (HttpException e) {
      LOG.log(Level.INFO, e.getMessage());
      return;
    }

    if (!"socketCatcher".equals(request.getInput("responder"))) {
      throw new IllegalArgumentException("Not a valid responder: " + request.getInput("responder"));
    }

    if (!Integer.toString(ticketNumber).equals(request.getInput("ticket"))) {
      throw new IllegalArgumentException("Not a valid ticket: " + request.getInput("ticket"));
    }

    try {
      accepter.acceptSocket(s);
    } catch (InterruptedException e) {
View Full Code Here

  @Test
  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

    requestParsingTimeLimit = 10000;
  }

  public void start() {
    try {
      Request request = makeRequest();
      makeResponse(request);
      sendResponse();
    }
    catch (SocketException se) {
      // can be thrown by makeResponse or sendResponse.
View Full Code Here

  public Socket getSocket() {
    return socket;
  }

  public Request makeRequest() {
    request = new Request(input);
    request.setContextRoot(context.contextRoot);
    return request;
  }
View Full Code Here

  public boolean isRunning() {
    return theService != null;
  }

  public void executeSingleCommand(String command, OutputStream out) throws Exception {
    Request request = new MockRequestBuilder(command).noChunk().build();
    FitNesseExpediter expediter = new FitNesseExpediter(new MockSocket(), context);
    Response response = expediter.createGoodResponse(request);
    response.withoutHttpHeaders();
    MockResponseSender sender = new MockResponseSender.OutputStreamSender(out);
    sender.doSending(response);
View Full Code Here

    public static void main(String... args) throws Exception {
        ResponderFactory rFac = new ResponderFactory(SRC);
        ComponentFactory componentFactory = new ComponentFactory();
        WikiPageFactory pFac = new WikiPageFactory();
        WikiPage root = pFac.makeRootPage(SRC, FITNESSE_ROOT_PAGE, componentFactory);
        Request request = mock(Request.class);
        when(request.getResource()).thenReturn(SUITE_ROOT);
        when(request.getQueryString()).thenReturn("suite&format=xml");
        verifyNoMoreInteractions(request);
        Responder responder = rFac.makeResponder(request, root);
        FitNesseContext context = new FitNesseContext(root);
        context.rootDirectoryName = FITNESSE_ROOT_PAGE;
        context.rootPath = SRC;
View Full Code Here

TOP

Related Classes of fitnesse.http.Request

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.