Examples of ODataService


Examples of org.apache.olingo.odata2.api.ODataService

    request = ODataRequest.fromRequest(request).method(method).build();

    ODataContextImpl context = new ODataContextImpl(request, serviceFactory);
    context.setParameter(ODataContext.HTTP_SERVLET_REQUEST_OBJECT, httpRequest);

    ODataService service = serviceFactory.createService(context);

    service.getProcessor().setContext(context);
    context.setService(service);

    ODataRequestHandler requestHandler = new ODataRequestHandler(serviceFactory, service, context);

    final ODataResponse odataResponse = requestHandler.handle(request);
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

          .body(req.getInputStream())
          .build();
      ODataContextImpl context = new ODataContextImpl(odataRequest, serviceFactory);
      context.setParameter(ODataContext.HTTP_SERVLET_REQUEST_OBJECT, req);

      ODataService service = serviceFactory.createService(context);
      context.setService(service);
      service.getProcessor().setContext(context);

      ODataRequestHandler requestHandler = new ODataRequestHandler(serviceFactory, service, context);
      final ODataResponse odataResponse = requestHandler.handle(odataRequest);
      createResponse(resp, odataResponse);
    } catch (ODataException e) {
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

    String tmp[] = host.split(":", 2);
    String port = (tmp.length == 2 && tmp[1] != null) ? tmp[1] : "80";

    // access and validation in synchronized block
    synchronized (PORT_2_SERVICE) {
      final ODataService service = PORT_2_SERVICE.get(port);
      if (service == null) {
        throw new IllegalArgumentException("no static service set for JUnit test");
      }
      return service;
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

          .body(req.getInputStream())
          .build();
      ODataContextImpl context = new ODataContextImpl(odataRequest, serviceFactory);
      context.setParameter(ODataContext.HTTP_SERVLET_REQUEST_OBJECT, req);

      ODataService service = serviceFactory.createService(context);
      context.setService(service);
      service.getProcessor().setContext(context);
     
      ODataRequestHandler requestHandler = new ODataRequestHandler(serviceFactory, service, context);
      final ODataResponse odataResponse = requestHandler.handle(odataRequest);
      createResponse(resp, odataResponse);
    } catch (ODataException e) {
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

    }
    return request;
  }

  private ODataService mockODataService(final ODataServiceFactory serviceFactory) throws ODataException {
    ODataService service = DispatcherTest.getMockService();
    when(service.getEntityDataModel()).thenReturn(edm);
    when(service.getProcessor()).thenReturn(mock(ODataProcessor.class));
    when(serviceFactory.createService(any(ODataContext.class))).thenReturn(service);

    when(service.getSupportedContentTypes(BatchProcessor.class)).thenReturn(
        Arrays.asList(HttpContentType.MULTIPART_MIXED));

    final List<String> jsonAndXml = Arrays.asList(
        HttpContentType.APPLICATION_JSON,
        HttpContentType.APPLICATION_JSON_VERBOSE,
        HttpContentType.APPLICATION_JSON_UTF8,
        HttpContentType.APPLICATION_JSON_UTF8_VERBOSE,
        HttpContentType.APPLICATION_XML_UTF8);
    List<String> atomEntryAndJsonAndXml = new ArrayList<String>();
    atomEntryAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_ENTRY_UTF8);
    atomEntryAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_UTF8);
    atomEntryAndJsonAndXml.addAll(jsonAndXml);
    when(service.getSupportedContentTypes(EntityProcessor.class)).thenReturn(atomEntryAndJsonAndXml);

    when(service.getSupportedContentTypes(FunctionImportProcessor.class)).thenReturn(jsonAndXml);
    when(service.getSupportedContentTypes(EntityLinkProcessor.class)).thenReturn(jsonAndXml);
    when(service.getSupportedContentTypes(EntityLinksProcessor.class)).thenReturn(jsonAndXml);
    when(service.getSupportedContentTypes(EntitySimplePropertyProcessor.class)).thenReturn(jsonAndXml);
    when(service.getSupportedContentTypes(EntityComplexPropertyProcessor.class)).thenReturn(jsonAndXml);

    final List<String> wildcard = Arrays.asList(HttpContentType.WILDCARD);
    when(service.getSupportedContentTypes(EntityMediaProcessor.class)).thenReturn(wildcard);
    when(service.getSupportedContentTypes(EntitySimplePropertyValueProcessor.class)).thenReturn(wildcard);
    when(service.getSupportedContentTypes(FunctionImportValueProcessor.class)).thenReturn(wildcard);

    List<String> atomFeedAndJsonAndXml = new ArrayList<String>();
    atomFeedAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_FEED_UTF8);
    atomFeedAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_XML_UTF8);
    atomFeedAndJsonAndXml.addAll(jsonAndXml);
    when(service.getSupportedContentTypes(EntitySetProcessor.class)).thenReturn(atomFeedAndJsonAndXml);

    when(service.getSupportedContentTypes(MetadataProcessor.class)).thenReturn(Arrays.asList(
        HttpContentType.APPLICATION_XML_UTF8));

    List<String> atomSvcAndJsonAndXml = new ArrayList<String>();
    atomSvcAndJsonAndXml.add(HttpContentType.APPLICATION_ATOM_SVC_UTF8);
    atomSvcAndJsonAndXml.addAll(jsonAndXml);
    when(service.getSupportedContentTypes(ServiceDocumentProcessor.class)).thenReturn(atomSvcAndJsonAndXml);

    return service;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

      final String httpHeaderName, final String httpHeaderValue,
      final String requestContentType,
      final HttpStatusCodes expectedStatusCode) throws ODataException {

    ODataServiceFactory serviceFactory = mock(ODataServiceFactory.class);
    final ODataService service = mockODataService(serviceFactory);
    when(serviceFactory.createService(any(ODataContext.class))).thenReturn(service);

    final ODataRequest request = mockODataRequest(method, pathSegments, queryParameters,
        httpHeaderName, httpHeaderValue, requestContentType);
    final ODataContextImpl context = new ODataContextImpl(request, serviceFactory);
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

    final HttpResponse response = executeGetRequest("$metadata");

    final ODataContext context = getService().getProcessor().getContext();
    assertNotNull(context);

    final ODataService service = context.getService();
    assertNotNull(service);

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

    assertEquals("$metadata", context.getPathInfo().getODataSegments().get(0).getPath());
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

    String tmp[] = host.split(":", 2);
    String port = (tmp.length == 2 && tmp[1] != null) ? tmp[1] : "80";

    // access and validation in synchronized block
    synchronized (PORT_2_SERVICE) {
      final ODataService service = PORT_2_SERVICE.get(port);
      if (service == null) {
        throw new IllegalArgumentException("no static service set for JUnit test");
      }
      return service;
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

  private Edm edmMock = null;
  public static final String SERVICE_ROOT = "http://apache.odata.org/OData.svc/";

  public ODataService mock() throws ODataException {
    ODataService odataService = EasyMock.createMock(ODataService.class);
    EasyMock.expect(odataService.getEntityDataModel()).andReturn(mockEdm());
    EasyMock.replay(odataService);
    return odataService;

  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.ODataService

    when(entityMedia.readEntityMedia(any(UriInfoImpl.class), anyString())).thenAnswer(getAnswer());
    when(entityMedia.deleteEntityMedia(any(UriInfoImpl.class), anyString())).thenAnswer(getAnswer());
    when(entityMedia.updateEntityMedia(any(UriInfoImpl.class), any(InputStream.class), anyString(), anyString()))
        .thenAnswer(getAnswer());

    ODataService service = mock(ODataService.class);
    when(service.getServiceDocumentProcessor()).thenReturn(serviceDocument);
    when(service.getEntitySetProcessor()).thenReturn(entitySet);
    when(service.getEntityProcessor()).thenReturn(entity);
    when(service.getEntityComplexPropertyProcessor()).thenReturn(entityComplexProperty);
    when(service.getEntitySimplePropertyProcessor()).thenReturn(entitySimpleProperty);
    when(service.getEntitySimplePropertyValueProcessor()).thenReturn(entitySimplePropertyValue);
    when(service.getEntityLinkProcessor()).thenReturn(entityLink);
    when(service.getEntityLinksProcessor()).thenReturn(entityLinks);
    when(service.getMetadataProcessor()).thenReturn(metadata);
    when(service.getBatchProcessor()).thenReturn(batch);
    when(service.getFunctionImportProcessor()).thenReturn(functionImport);
    when(service.getFunctionImportValueProcessor()).thenReturn(functionImportValue);
    when(service.getEntityMediaProcessor()).thenReturn(entityMedia);

    return service;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.