Package edu.wpi.cs.wpisuitetng.network

Examples of edu.wpi.cs.wpisuitetng.network.Request


  }

  @Override
  public void actionPerformed(ActionEvent e) {
    // Send a request to the core to save this message
    final Request request = Network.getInstance().makeRequest("postboard/postboardmessage", HttpMethod.GET); // GET == read
    request.addObserver(new GetMessagesRequestObserver(this)); // add an observer to process the response
    request.send(); // send the request
  }
View Full Code Here


  }

  @Override
  public void responseSuccess(IRequest iReq) {
    // cast observable to a Request
    Request request = (Request) iReq;

    // get the response from the request
    ResponseModel response = request.getResponse();

    // print the body
    System.out.println("Received response: " + response.getBody()); //TODO change this to logger
    if (response.getStatusCode() == 200) {
      // parse the defect from the body
View Full Code Here

  }

  @Override
  public void responseSuccess(IRequest iReq) {
    // cast observable to a Request
    Request request = (Request) iReq;

    // get the response from the request
    ResponseModel response = request.getResponse();


    // print the body
    System.out.println("Received response: " + response.getBody()); //TODO change this to logger
View Full Code Here

   * Test that a NullPointerException is thrown when a null networkConfiguration is passed to the Request constructor.
   * @throws MalformedURLException
   */
  @Test(expected = NullPointerException.class)
  public void testRequestConstructorNullPointerException() throws MalformedURLException {
    new Request(null, null, null);
  }
View Full Code Here

   * Test that a NullPointerException is thrown when a null requestMethod is passed to the Request#setRequestMethod.
   * @throws MalformedURLException
   */
  @Test(expected = NullPointerException.class)
  public void testRequestSetRequestMethodNullPointerException() throws MalformedURLException {
    new Request(config, null, null);
  }
View Full Code Here

  /**
   * Test that a NullPointerException is thrown when a null body is passed to the Request#setRequestBody.
   */
  @Test(expected = NullPointerException.class)
  public void testRequestSetRequestBodyNullPointerException() {
    Request r = new Request(config, null, HttpMethod.POST);
    r.setBody(null);
  }
View Full Code Here

  /**
   * Test the addHeader method for an IllegalStateException.
   */
  @Test(expected = IllegalStateException.class)
  public void testAddHeaderIllegalStateException() {
    Request r = new Request(config, null, HttpMethod.GET);
    r.running = true;
    r.addHeader("key", "value");
  }
View Full Code Here

  /**
   * Test the addQueryData method for an IllegalStateException.
   */
  @Test(expected = IllegalStateException.class)
  public void testAddQueryDataIllegalStateException() {
    Request r = new Request(config, null, HttpMethod.GET);
    r.running = true;
    r.addQueryData("key", "value");
  }
View Full Code Here

  /**
   * Test the setAsynchronous and clearAsynchronous methods for an IllegalStateException.
   */
  @Test
  public void testSetClearAsynchronous() {
    Request r = new Request(config, null, HttpMethod.GET);
    assertTrue(r.isAsynchronous()); // should be asynchronous by default
    r.clearAsynchronous();
    assertFalse(r.isAsynchronous());
    r.setAsynchronous();
    assertTrue(r.isAsynchronous());
  }
View Full Code Here

  /**
   * Test the clearAsynchronous method for an IllegalStateException.
   */
  @Test(expected = IllegalStateException.class)
  public void testClearAsynchronousIllegalStateException() {
    Request r = new Request(config, null, HttpMethod.GET);
    r.running = true;
    r.clearAsynchronous();
  }
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.network.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.