Package fitnesse.util

Examples of fitnesse.util.MockSocket


      }
    };
    startThread.start();
    assertFalse(client.isSuccessfullyStarted());

    client.acceptSocket(new MockSocket(""));
    assertTrue(client.isSuccessfullyStarted());

    startThread.interrupt();
  }
View Full Code Here


  @Test
  public void shouldPassIncomingConnectionToSocketAccepter() throws IOException, InterruptedException {
    SocketAccepter accepter = mock(SocketAccepter.class);
    SocketServer server = new SocketCatcher(accepter, 1);
    MockSocket socket = new MockSocket("GET /?responder=socketCatcher&ticket=1 HTTP/1.1\r\n\r\n");

    server.serve(socket);

    verify(accepter).acceptSocket(socket);
  }
View Full Code Here

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptAnythingButSocketCatcherResponder() throws IOException, InterruptedException {
    SocketAccepter accepter = mock(SocketAccepter.class);
    SocketServer server = new SocketCatcher(accepter, 1);
    MockSocket socket = new MockSocket("GET /?responder=fake&ticket=1 HTTP/1.1\r\n\r\n");

    server.serve(socket);
  }
View Full Code Here

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptAnythingButValidTicketNumber() throws IOException, InterruptedException {
    SocketAccepter accepter = mock(SocketAccepter.class);
    SocketServer server = new SocketCatcher(accepter, 1234);
    MockSocket socket = new MockSocket("GET /?responder=fake&ticket=1234 HTTP/1.1\r\n\r\n");

    server.serve(socket);
  }
View Full Code Here

    request.addInput(EditResponder.TICKET_ID, "321");
    request.addInput("pageContent", contents);
    request.parseRequestUri("/" + pageName);
    WikiPagePath path = PathParser.parse(request.getResource()); // uri;
    FitnesseFixtureContext.page = FitnesseFixtureContext.root.getPageCrawler().getPage(path);
    FitNesseExpediter expediter = new FitNesseExpediter(new MockSocket(""), FitnesseFixtureContext.context);
    FitnesseFixtureContext.response = expediter.createGoodResponse(request);
    FitnesseFixtureContext.sender = new MockResponseSender();
    FitnesseFixtureContext.sender.doSending(FitnesseFixtureContext.response);
    return FitnesseFixtureContext.response.getStatus();
  }
View Full Code Here

      request.setCredentials(username, password);

    request.parseRequestUri("/" + uri);
    WikiPagePath path = PathParser.parse(request.getResource()); // uri;
    FitnesseFixtureContext.page = FitnesseFixtureContext.root.getPageCrawler().getPage(path);
    FitNesseExpediter expediter = new FitNesseExpediter(new MockSocket(""), FitnesseFixtureContext.context);
    FitnesseFixtureContext.response = expediter.createGoodResponse(request);
    FitnesseFixtureContext.sender = new MockResponseSender();
    FitnesseFixtureContext.sender.doSending(FitnesseFixtureContext.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);
View Full Code Here

    assertEquals(3, data.size);
    assertEquals("billy", data.username);
  }

  private String getSocketOutput(String requestLine, WikiPage page) throws Exception {
    MockSocket s = new MockSocket(requestLine);
    FitNesseServer server = new FitNesseServer(context);
    server.serve(s, 1000);
    String output = s.getOutput();
    return output;
  }
View Full Code Here

  @Before
  public void setUp() throws Exception {
    WikiPage root = InMemoryPage.makeRoot("RooT");
    root.addChildPage("FrontPage");
    socket = new MockSocket();
    context = FitNesseUtil.makeTestContext(root);
    expediter = new FitNesseExpediter(socket, context);
  }
View Full Code Here

  private FitNesseExpediter preparePipedFitNesseExpediter() throws Exception {
    PipedInputStream socketInput = new PipedInputStream();
    clientOutput = new PipedOutputStream(socketInput);
    clientInput = new PipedInputStream();
    PipedOutputStream socketOutput = new PipedOutputStream(clientInput);
    MockSocket socket = new MockSocket(socketInput, socketOutput);
    final FitNesseExpediter sender = new FitNesseExpediter(socket, context);
    sender.requestParsingTimeLimit = 200;
    return sender;
  }
View Full Code Here

TOP

Related Classes of fitnesse.util.MockSocket

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.