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

Examples of org.apache.olingo.odata2.api.processor.ODataErrorContext


    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

    final HttpGet get = new HttpGet(URI.create(endpoint + "aaa/bbb;n=2,3;m=1/ccc/"));
    final HttpResponse response = httpClient.execute(get);

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

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);
    assertEquals(endpoint + "aaa/bbb;n=2,3;m=1/ccc/", ctx.getPathInfo().getServiceRoot().toASCIIString());
  }
View Full Code Here

    final HttpGet get = new HttpGet(URI.create(endpoint + "aaa/bbb;n=2,3;m=1/ccc/$metadata"));
    final HttpResponse response = httpClient.execute(get);

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

    final ODataContext ctx = service.getProcessor().getContext();
    assertNotNull(ctx);
    assertEquals(endpoint + "aaa/bbb;n=2,3;m=1/ccc/", ctx.getPathInfo().getServiceRoot().toASCIIString());
    assertEquals("$metadata", ctx.getPathInfo().getODataSegments().get(0).getPath());
  }
View Full Code Here

    final HttpGet get = new HttpGet(uri);
    final HttpResponse response = httpClient.execute(get);

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

    final ODataContext context = service.getProcessor().getContext();
    assertNotNull(context);
    assertEquals(server.getEndpoint() + "aaa/%C3%A4%D0%B4%D0%B5%D1%80%D0%B6b;n=2,%203;m=1/c%20c/", context
        .getPathInfo().getServiceRoot().toASCIIString());
  }
View Full Code Here

  private XmlErrorDocumentConsumer xedc = new XmlErrorDocumentConsumer();

  @Test
  public void simpleErrorDocument() throws Exception {
    InputStream in = StringHelper.encapsulate(XML_ERROR_DOCUMENT_SIMPLE);
    ODataErrorContext error = xedc.readError(in);

    assertEquals("Wrong content type", "application/xml", error.getContentType());
    assertEquals("Wrong message", "Message", error.getMessage());
    assertEquals("Wrong error code", "ErrorCode", error.getErrorCode());
    assertEquals("Wrong locale for lang", Locale.US, error.getLocale());
  }
View Full Code Here

  @Test
  public void emptyMessage() throws EntityProviderException {
    InputStream in = StringHelper.encapsulate(XML_ERROR_DOCUMENT_EMPTY_MESSAGE);

    ODataErrorContext error = xedc.readError(in);

    assertEquals("Wrong content type", "application/xml", error.getContentType());
    assertEquals("Wrong message", "", error.getMessage());
    assertEquals("Wrong error code", "ErrorCode", error.getErrorCode());
    assertEquals("Wrong locale for lang", Locale.US, error.getLocale());
  }
View Full Code Here

  }

  @Test
  public void localeNull() throws Exception {
    InputStream in = StringHelper.encapsulate(XML_ERROR_DOCUMENT_NULL_LOCALE);
    ODataErrorContext error = xedc.readError(in);

    assertEquals("Wrong content type", "application/xml", error.getContentType());
    assertEquals("Wrong message", "Message", error.getMessage());
    assertEquals("Wrong error code", "ErrorCode", error.getErrorCode());
    assertNull("Expected NULL for locale", error.getLocale());
  }
View Full Code Here

  }

  @Test
  public void innerError() throws Exception {
    InputStream in = StringHelper.encapsulate(XML_ERROR_DOCUMENT_INNER_ERROR);
    ODataErrorContext error = xedc.readError(in);

    assertEquals("Wrong content type", "application/xml", error.getContentType());
    assertEquals("Wrong message", "Message", error.getMessage());
    assertEquals("Wrong error code", "ErrorCode", error.getErrorCode());
    assertEquals("Wrong inner error", "Some InnerError", error.getInnerError());
  }
View Full Code Here

  }

  @Test
  public void innerErrorComplex() throws Exception {
    InputStream in = StringHelper.encapsulate(XML_ERROR_DOCUMENT_INNER_ERROR_COMPLEX);
    ODataErrorContext error = xedc.readError(in);

    assertEquals("Wrong content type", "application/xml", error.getContentType());
    assertEquals("Wrong message", "Message", error.getMessage());
    assertEquals("Wrong error code", "ErrorCode", error.getErrorCode());
    assertEquals("Wrong inner error", "<moreInner>More Inner Error</moreInner>", error.getInnerError());
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.processor.ODataErrorContext

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.