Package org.apache.clerezza.triaxrs.mock

Examples of org.apache.clerezza.triaxrs.mock.RequestURIImpl


 
  @Test
  public void testHeaderParamInjectionIntoMethod() throws Exception {
    JaxRsHandler handler = HandlerCreator.getHandler(TestResourceForDefaultValue.class);
    RequestImpl request = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/test-resource/addheader");
    String[] values = new String[1];
    values[0] = "6.10.2012";
    request.setHeader(HeaderName.LAST_MODIFIED, values);
    request.setRequestURI(uri);
    request.setMethod(Method.GET);
View Full Code Here


  @Test
  public void testInjectionIntoField() throws Exception {
    JaxRsHandler handler = HandlerCreator.getHandler(MyFieldRessource.class);
   
    RequestImpl request = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/field");
    uri.setQuery("wert=MyValue");
    request.setRequestURI(uri);
    request.setMethod(Method.GET);
    Response response = new ResponseImpl();
    handler.handle(request, response);
   
View Full Code Here

  @Test
  public void testInjectionIntoConstructor() throws Exception {
    JaxRsHandler handler = HandlerCreator.getHandler(MyConstructorRessource.class);

    RequestImpl request = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/constr");
     request.setRequestURI(uri);
    request.setMethod(Method.GET);
    String[] values = new String[1];
    values[0] = "http://example.com";
    request.setHeader(HeaderName.HOST, values);
View Full Code Here

    setup();
   
    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);
   
    RequestImpl request = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/");
    String[] headervalues = new String[1];
    headervalues[0] = "application/testobj";
    request.setHeader(HeaderName.CONTENT_TYPE, headervalues);

    JafSerializableObj testObj = new JafSerializableObj("foo", "bar");
View Full Code Here

  public void testJAFProviderBodyWriter() throws Exception {
   
    JaxRsHandler handler = HandlerCreator.getHandler(MyResource.class);

    RequestImpl request = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/");
    String[] headervalues = new String[1];
    headervalues[0] = "application/testobj";
    request.setHeader(HeaderName.ACCEPT, headervalues);
    request.setRequestURI(uri);
    request.setMethod(Method.GET);
View Full Code Here

    writerCalled = false;
    Object[] components = {new MultiFormatWriter(), new MyResource2()};
    JaxRsHandler handler = HandlerCreator.getHandler("", components);

    RequestImpl request = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/");
    String[] headervalues = new String[1];
    headervalues[0] = "test/string3";
    request.setHeader(HeaderName.ACCEPT, headervalues);
    request.setRequestURI(uri);
    request.setMethod(Method.GET);
View Full Code Here

    public void testGetMethodPathNotFound() throws Exception {
       
      JaxRsHandler handler = HandlerCreator.getHandler(TestResource.class,
        TestResourceWithTemplateInMethod.class);
        RequestImpl request = new RequestImpl();
        RequestURIImpl uri = new RequestURIImpl();
        uri.setPath("/test-resource/blabla");
        request.setRequestURI(uri);
        request.setMethod(Method.GET);
       
        ResponseImpl response = new ResponseImpl();
       
View Full Code Here

    public void testWithParameterNotFound() throws Exception {
       
      JaxRsHandler handler = HandlerCreator.getHandler(TestResource.class,
        TestResourceWithTemplateInMethod.class);
        RequestImpl request = new RequestImpl();
        RequestURIImpl uri = new RequestURIImpl();
        uri.setPath("/test-resource/postToMe");
        request.setRequestURI(uri);
        request.setMethod(Method.DELETE);
        ResponseImpl response = new ResponseImpl();
       
         boolean expThrown = false;
View Full Code Here

    Object[] components = { new MyMessageBodyWriter(), new MyResource() };
    JaxRsHandler handler = HandlerCreator.getHandler("", components);

    // Request of thread 1
    RequestImpl requestMock = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/");
    String queryString = "key=thread1";
    uri.setQuery(queryString);
    requestMock.setRequestURI(uri);
    requestMock.setMethod(Method.GET);

    // Request of thread 2
    RequestImpl requestMock2 = new RequestImpl();
    RequestURIImpl uri2 = new RequestURIImpl();
    uri2.setPath("/");
    String queryString2 = "key=thread2";
    uri2.setQuery(queryString2);
    requestMock2.setRequestURI(uri2);
    requestMock2.setMethod(Method.GET);

    long iterations = 100
    BodyCheckerThread thread1 = new BodyCheckerThread(handler, requestMock,
View Full Code Here

  public void testFieldInjectionIntoResourceField() throws Exception {
    Object[] components = { new MyResource2() };
    JaxRsHandler handler = HandlerCreator.getHandler("", components);

    RequestImpl requestMock = new RequestImpl();
    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/test");
    requestMock.setRequestURI(uri);
    requestMock.setMethod(Method.GET);

    ResponseImpl response = new ResponseImpl();
    handler.handle(requestMock, response);
View Full Code Here

TOP

Related Classes of org.apache.clerezza.triaxrs.mock.RequestURIImpl

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.