Package org.apache.olingo.odata2.api.processor

Examples of org.apache.olingo.odata2.api.processor.ODataRequest$ODataRequestBuilder


    EasyMock.replay(objODataJPAContext);
    return objODataJPAContext;
  }

  private ODataContext getLocalODataContext() {
    ODataContext objODataContext = EasyMock.createMock(ODataContext.class);
    try {
      EasyMock.expect(objODataContext.getPathInfo()).andStubReturn(getLocalPathInfo());
    } catch (ODataException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.replay(objODataContext);
    return objODataContext;
View Full Code Here


    final HttpGet get = new HttpGet(URI.create(server.getEndpoint().toString() + "/$metadata"));
    final HttpResponse response = httpClient.execute(get);

    assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);

    assertTrue(ctx.getPathInfo().getPrecedingSegments().isEmpty());
    assertEquals("$metadata", ctx.getPathInfo().getODataSegments().get(0).getPath());
  }
View Full Code Here

    final HttpGet get = new HttpGet(URI.create(server.getEndpoint().toString() + "/aaa/$metadata"));
    final HttpResponse response = httpClient.execute(get);

    assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);

    assertEquals("aaa", ctx.getPathInfo().getPrecedingSegments().get(0).getPath());
    assertEquals("$metadata", ctx.getPathInfo().getODataSegments().get(0).getPath());
  }
View Full Code Here

    final HttpGet get = new HttpGet(URI.create(server.getEndpoint().toString() + "/aaa/bbb/$metadata"));
    final HttpResponse response = httpClient.execute(get);

    assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);

    assertEquals("aaa", ctx.getPathInfo().getPrecedingSegments().get(0).getPath());
    assertEquals("bbb", ctx.getPathInfo().getPrecedingSegments().get(1).getPath());
    assertEquals("$metadata", ctx.getPathInfo().getODataSegments().get(0).getPath());
  }
View Full Code Here

    final HttpGet get = new HttpGet(URI.create(server.getEndpoint().toString() + "/aaa/"));
    final HttpResponse response = httpClient.execute(get);

    assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);

    assertEquals("", ctx.getPathInfo().getODataSegments().get(0).getPath());
    assertEquals("aaa", ctx.getPathInfo().getPrecedingSegments().get(0).getPath());
  }
View Full Code Here

    final HttpGet get = new HttpGet(URI.create(server.getEndpoint().toString() + "aaa;n=2/"));
    final HttpResponse response = httpClient.execute(get);

    assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);

    assertEquals("", ctx.getPathInfo().getODataSegments().get(0).getPath());
    assertEquals("aaa", ctx.getPathInfo().getPrecedingSegments().get(0).getPath());

    assertNotNull(ctx.getPathInfo().getPrecedingSegments().get(0).getMatrixParameters());

    String key, value;
    key = ctx.getPathInfo().getPrecedingSegments().get(0).getMatrixParameters().keySet().iterator().next();
    assertEquals("n", key);
    value = ctx.getPathInfo().getPrecedingSegments().get(0).getMatrixParameters().get(key).get(0);
    assertEquals("2", value);
  }
View Full Code Here

    assertNull(contentType);
  }

  @Test(expected = IllegalArgumentException.class)
  public void invalidContentNegotiatorCreationNullUri() throws ODataException {
    ODataRequest request = Mockito.mock(ODataRequest.class);
    final ContentType contentType =
        new ContentNegotiator().doContentNegotiation(request, null, new ArrayList<String>());
    assertNull(contentType);
  }
View Full Code Here

    }
  }

  @Override
  public String getRequestHeader(final String name) {
    ODataRequest request = (ODataRequest) parameterTable.get(ODATA_REQUEST);
    return request.getRequestHeaderValue(name);
  }
View Full Code Here

    assertNull(contentType);
  }

  @Test(expected = IllegalArgumentException.class)
  public void invalidContentNegotiatorCreationNullSupported() throws ODataException {
    ODataRequest request = Mockito.mock(ODataRequest.class);
    UriInfoImpl uriInfo = Mockito.mock(UriInfoImpl.class);
    final ContentType contentType = new ContentNegotiator().doContentNegotiation(request, uriInfo, null);
    assertNull(contentType);
  }
View Full Code Here

    }

    List<String> acceptedContentTypes = Arrays.asList(requestType);
    List<String> supportedContentTypes = Arrays.asList(supportedType);

    ODataRequest request = Mockito.mock(ODataRequest.class);
    Mockito.when(request.getMethod()).thenReturn(ODataHttpMethod.GET);
    Mockito.when(request.getRequestHeaderValue(HttpHeaders.ACCEPT)).thenReturn(requestType);
    Mockito.when(request.getAcceptHeaders()).thenReturn(acceptedContentTypes);

    // perform
    ContentNegotiator negotiator = new ContentNegotiator();
    String negotiatedContentType =
        negotiator.doContentNegotiation(request, uriInfo, supportedContentTypes).toContentTypeString();
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.processor.ODataRequest$ODataRequestBuilder

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.