org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider Java Examples

The following examples show how to use org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ODataHandlerImplTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void uriParserExceptionResultsInRightResponseEdmCause() throws Exception {
  final OData odata = OData.newInstance();
  final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
      new CsdlAbstractEdmProvider() {
        @Override
        public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
            throws ODataException {
          throw new ODataException("msg");
        }
      },
      Collections.<EdmxReference> emptyList());

  ODataRequest request = new ODataRequest();
  request.setMethod(HttpMethod.GET);
  request.setRawODataPath("EdmException");

  final ODataResponse response =
      new ODataHandlerImpl(odata, serviceMetadata, new ServerCoreDebugger(odata)).process(request);
  assertNotNull(response);
  assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
}
 
Example #2
Source File: ODataHandlerImplTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void handlerExtTest() throws Exception {
  final OData odata = OData.newInstance();
  final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
      new CsdlAbstractEdmProvider() {
        @Override
        public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
            throws ODataException {
          throw new ODataException("msg");
        }
      },
      Collections.<EdmxReference> emptyList());

  ODataRequest request = new ODataRequest();
  request.setMethod(HttpMethod.GET);
  request.setRawODataPath("EdmException");
  ODataHandlerImpl handler =  new ODataHandlerImpl(odata, serviceMetadata, new ServerCoreDebugger(odata));
  Processor extension =  new TechnicalActionProcessor(null, serviceMetadata);
  handler.register(extension);
  assertNull(handler.getLastThrownException());
  assertNull(handler.getUriInfo());
}