Package com.eclipsesource.restfuse.annotation

Examples of com.eclipsesource.restfuse.annotation.HttpTest


    this.method = method;
    this.target = target;
  }

  public InternalRequest createRequest() {
    HttpTest call = method.getAnnotation( HttpTest.class );
    InternalRequest request = new InternalRequest( combineUrlAndPath( baseUrl, call.path() ) );
    addAuthentication( call, request );
    addContentType( call, request );
    addHeader( call, request );
    addBody( call, request );
    return request;
View Full Code Here


    this.method = method;
    this.target = target;
  }

  public InternalRequest createRequest( RequestContext context ) {
    HttpTest call = method.getAnnotation( HttpTest.class );
    InternalRequest request = new InternalRequest( combineUrlAndPath( baseUrl, call.path() ) );
    addAuthentication( call, request);
    addContentType( call, request);
    addHeader( call, request, context );
    addBody( call, request);
    return request;
View Full Code Here

public class HttpOrderComparator implements Comparator<FrameworkMethod> {

  @Override
  public int compare( FrameworkMethod method1, FrameworkMethod method2 ) {
    HttpTest annotation1 = method1.getAnnotation( HttpTest.class );
    HttpTest annotation2 = method2.getAnnotation( HttpTest.class );
    if( annotation1 != null && annotation2 != null ) {
      return Integer.valueOf( annotation1.order() )
        .compareTo( Integer.valueOf( annotation2.order() ) );
    }
    return 0;
  }
View Full Code Here

    this.description = description;
    this.target = target;
  }

  public InternalRequest createRequest( RequestContext context ) {
    HttpTest call = description.getAnnotation( HttpTest.class );
    String rawPath = combineUrlAndPath( baseUrl, call.path() );
    InternalRequest request = new InternalRequest( substituePathSegments( rawPath, context ) );
    addAuthentication( call, request );
    addContentType( call, request );
    addHeader( call, request, context );
    addBody( call, request );
View Full Code Here

  }

  @Test
  public void testPathWithSegments() {
    Description description = mock( Description.class );
    HttpTest annotation = createAnnotation( "/people/{id}/{name}" );
    when( description.getAnnotation( HttpTest.class ) ).thenReturn( annotation );
    RequestConfiguration config = new RequestConfiguration( "http://www.fake.com",
                                                            description,
                                                            new Object() );
    RequestContext context = new RequestContext();
View Full Code Here

  }
 
  @Test( expected = IllegalStateException.class )
  public void testPathWithNonExistingSegments() {
    Description method = mock( Description.class );
    HttpTest annotation = createAnnotation( "/people/{invalid}/name" );
    when( method.getAnnotation( HttpTest.class ) ).thenReturn( annotation );
    RequestConfiguration config = new RequestConfiguration( "http://www.fake.com",
                                                            method,
                                                            new Object() );
    RequestContext context = new RequestContext();
View Full Code Here

    context.addPathSegment( "id", "12345" );
    config.createRequest( context );
  }

  private HttpTest createAnnotation(final String path) {
    HttpTest annotation = new HttpTest() {

      @Override
      public Class<? extends Annotation> annotationType() {
        return null;
      }
View Full Code Here

 
  @Test
  public void testRemovesProxyProperties() throws Throwable {
    Statement base = mock( Statement.class );
    Description description = mock( Description.class );
    HttpTest annotation = createAnnotation();
    when( description.getAnnotation( HttpTest.class ) ).thenReturn( annotation );
    Object target = new Object();
    HttpTestStatement statement
      = new HttpTestStatement( base, description, target, "http://localhost", "http://proxy.com", 8080, null );
   
View Full Code Here

    assertNull( System.getProperty( HttpTestStatement.HTTP_PROXY_HOST ) );
    assertNull( System.getProperty( HttpTestStatement.HTTP_PROXY_PORT ) );
  }
 
  private HttpTest createAnnotation() {
    HttpTest annotation = new HttpTest() {
     
      @Override
      public Class<? extends Annotation> annotationType() {
        return null;
      }
View Full Code Here

TOP

Related Classes of com.eclipsesource.restfuse.annotation.HttpTest

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.