Examples of XhtmlApplicationState


Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

    mockBuilder = createMock(RequestBuilder.class);
    mockClient = createMock(XhtmlHttpClient.class);
    impl = new XhtmlNavigator(mockParser, mockBuilder, mockClient);
    doc = new Document();
    context = new URL("http://foo.example.com/");
    initState = new XhtmlApplicationState(context, null, doc);
    success = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
    newState = new XhtmlApplicationState(null, success, null);
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

      .andReturn(req);
    expect(mockClient.execute(req))
      .andReturn(newState);
   
    replayMocks();
    XhtmlApplicationState result = impl.followLink(initState, rel);
    verifyMocks();
    assertSame(newState, result);
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

      .andReturn(req);
    expect(mockClient.execute(req))
      .andReturn(newState);
   
    replayMocks();
    XhtmlApplicationState result = impl.followLink(initState, inner, rel);
    verifyMocks();
    assertSame(newState, result);
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

      .andReturn(req);
    expect(mockClient.execute(req))
      .andReturn(newState);
   
    replayMocks();
    XhtmlApplicationState result = impl.submitForm(initState, name, args);
    verifyMocks();
    assertSame(newState, result);
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

    byte[] bytes = xhtml.getBytes();
    MockHttpEntity entity = new MockHttpEntity(bytes);
    resp.setEntity(entity);
    resp.setHeader("Content-Length","" + bytes.length);
   
    XhtmlApplicationState result = impl.handleResponse(resp);
    Assert.assertNotNull(result);
    Assert.assertNotNull(result.getDocument());
    Assert.assertSame(resp, result.getHttpResponse());
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

    byte[] bytes = xhtml.getBytes();
    MockHttpEntity entity = new MockHttpEntity(bytes);
    resp.setEntity(entity);
    resp.setHeader("Content-Length","" + bytes.length);
   
    XhtmlApplicationState result = impl.handleResponse(resp);
    Assert.assertNotNull(result);
    Assert.assertNull(result.getDocument());
    Assert.assertSame(resp, result.getHttpResponse());
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

  @Test
  public void testReturnsNullDocumentWithNoBody() throws Exception {
    HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_TEMPORARY_REDIRECT, "Temporary Redirect");
    resp.setHeader("Location","http://www.example.com/foo");
   
    XhtmlApplicationState result = impl.handleResponse(resp);
    Assert.assertNotNull(result);
    Assert.assertNull(result.getDocument());
    Assert.assertSame(resp, result.getHttpResponse());
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

        "xml:lang=\"en\" lang=\"en\"><head/><body/></html>";
    byte[] bytes = xhtml.getBytes();
    resp.setEntity(new ByteArrayEntity(bytes));
    resp.setHeader("Content-Length", "" + bytes.length);
   
    XhtmlApplicationState result = impl.handleResponse(resp);
    Assert.assertSame(context, result.getContext());
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

    EasyMock.verify(mockFactory);
  }
 
  @Test
  public void testDelegatesRequestExecutionToHelpers() throws Exception {
    XhtmlApplicationState state = new XhtmlApplicationState(null,null,null);
    HttpGet get = new HttpGet("http://foo.example.com/");
   
    URL context = new URL("http://foo.example.com/");
    XhtmlResponseHandler rh = new XhtmlResponseHandler(context);
   
    EasyMock.expect(mockFactory.get(context)).andReturn(rh);
    EasyMock.expect(mockHttpClient.execute(get, rh))
      .andReturn(state);
   
    replayMocks();
    XhtmlApplicationState result = impl.execute(get);
    verifyMocks();
    Assert.assertSame(state, result);
  }
View Full Code Here

Examples of com.comcast.cim.rest.client.xhtml.XhtmlApplicationState

    Assert.assertSame(state, result);
  }
 
  @Test
  public void testSetsAcceptHeaderForXhtml() throws Exception {
    XhtmlApplicationState state = new XhtmlApplicationState(null,null,null);
    HttpGet get = new HttpGet("http://foo.example.com/");
    URL context = new URL("http://foo.example.com/");
    XhtmlResponseHandler rh = new XhtmlResponseHandler(context);
   
    Capture<HttpUriRequest> cap = new Capture<HttpUriRequest>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.