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

Examples of org.apache.olingo.odata2.processor.api.jpa.factory.ODataJPAAccessFactory


                    changeSetParts.clear();
                    contentIdMap.clear();
                }

                // add to request parts
                final UriInfoImpl uriInfo = parseUri(edm, batchPart.getResourcePath(), null);
                parts.add(createBatchQueryPart(uriInfo, (Olingo2BatchQueryRequest) batchPart));

            } else {

                // add to change set parts
View Full Code Here


        // is it a referenced entity?
        if (resourcePath.startsWith("$")) {
            resourcePath = replaceContentId(edm, resourcePath, contentIdMap);
        }

        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);

        // serialize data into ODataResponse object, if set in request and this is not a DELETE request
        final Map<String, String> headers = new HashMap<String, String>();
        byte[] body = null;
View Full Code Here

            resolvedResourcePath = resourceLocation != null
                ? resourceLocation.substring(serviceUri.length()) : resourcePath;
        }
        final Map<String, String> resolvedQueryParams = request instanceof Olingo2BatchQueryRequest
            ? ((Olingo2BatchQueryRequest) request).getQueryParams() : null;
        final UriInfoImpl uriInfo = parseUri(edm, resolvedResourcePath, resolvedQueryParams);

        // resolve response content
        final Object resolvedContent = content != null ? readContent(uriInfo, content) : null;

        return new Olingo2BatchResponse(statusCode, statusInfo, response.getContentId(), response.getHeaders(),
View Full Code Here

        }
        return absolutUri.toString();
    }

    private static UriInfoImpl parseUri(Edm edm, String resourcePath, Map<String, String> queryParams) {
        UriInfoImpl result;
        try {
            final List<PathSegment> pathSegments = new ArrayList<PathSegment>();
            final String[] segments = new URI(resourcePath).getPath().split(SEPARATOR);
            if (queryParams == null) {
                queryParams = Collections.emptyMap();
View Full Code Here

   * This Unit is supposed to test the building of Entity Provider Properties for query with $expand
   */
  @Test
  public void testGetEntityProviderPropertiesQuery() {
    GetEntitySetUriInfo getEntitySetUriInfo = mockEntitySetUriInfoForExpand();
    ODataJPAContext oDataJPAContext = getODataJPAContext();
    // Building the edm entity
    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
    Map<String, Object> edmEntity = new HashMap<String, Object>();
    edmEntity.put("ID", 1);
    edmEntityList.add(edmEntity);
View Full Code Here

  @Test
  public void testGetEntityProviderPropertiesRead() {

    // Getting the EntityUriInfo
    GetEntityUriInfo getEntityUriInfo = mockEntityUriInfoForExpand();
    ODataJPAContext oDataJPAContext = getODataJPAContext();
    Class<?> clazz = ODataJPAResponseBuilderDefault.class;
    Object[] actualParameters = { oDataJPAContext, getEntityUriInfo };
    Class<?>[] formalParameters = { ODataJPAContext.class, GetEntityUriInfo.class };
    EntityProviderWriteProperties providerProperties = null;
    try {
View Full Code Here

    }
    assertNotNull(objODataResponse);
  }

  private ODataJPAContext getODataJPAContext() {
    ODataJPAContext objODataJPAContext = EasyMock.createMock(ODataJPAContext.class);
    EasyMock.expect(objODataJPAContext.getODataContext()).andStubReturn(getLocalODataContext());
    EasyMock.expect(objODataJPAContext.getPageSize()).andReturn(10);
    EasyMock.expect(objODataJPAContext.getPaging()).andReturn(mockJPAPaging()).anyTimes();
    EasyMock.replay(objODataJPAContext);
    return objODataJPAContext;
  }
View Full Code Here

    EasyMock.replay(objODataContext);
    return objODataContext;
  }

  private JPAPaging mockJPAPaging() {
    JPAPaging paging = new JPAPaging() {

      @Override
      public int getStartPage() {
        return 0;
      }
View Full Code Here

  @Test
  public void testOdataJpaAccessFactory() {

    ODataJPAFactoryImpl oDataJPAFactoryImpl = new ODataJPAFactoryImpl();
    ODataJPAAccessFactory jpaAccessFactory = oDataJPAFactoryImpl.getODataJPAAccessFactory();
    ODataJPAContextImpl oDataJPAContextImpl = new ODataJPAContextImpl();

    EntityManagerFactory emf = new EntityManagerFactory() {

      @Override
      public boolean isOpen() {
        // TODO Auto-generated method stub
        return false;
      }

      @Override
      public Map<String, Object> getProperties() {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      public PersistenceUnitUtil getPersistenceUnitUtil() {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      public Metamodel getMetamodel() {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      public CriteriaBuilder getCriteriaBuilder() {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      public Cache getCache() {
        // TODO Auto-generated method stub
        return null;
      }

      @SuppressWarnings("rawtypes")
      @Override
      public EntityManager createEntityManager(final Map arg0) {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      public EntityManager createEntityManager() {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      public void close() {
        // TODO Auto-generated method stub

      }
    };
    oDataJPAContextImpl.setEntityManagerFactory(emf);
    oDataJPAContextImpl.setPersistenceUnitName("pUnit");

    assertNotNull(jpaAccessFactory.getODataJPAMessageService(new Locale("en")));
    assertNotNull(jpaAccessFactory.createODataJPAContext());
    assertNotNull(jpaAccessFactory.createJPAEdmProvider(oDataJPAContextImpl));
    assertNotNull(jpaAccessFactory.createODataProcessor(oDataJPAContextImpl));

  }
View Full Code Here

    oDataJPAContext = initializeODataJPAContext();

    validatePreConditions();

    ODataJPAFactory factory = ODataJPAFactory.createFactory();
    ODataJPAAccessFactory accessFactory = factory.getODataJPAAccessFactory();

    // OData JPA Processor
    if (oDataJPAContext.getODataContext() == null) {
      oDataJPAContext.setODataContext(ctx);
    }

    ODataSingleProcessor odataJPAProcessor = accessFactory.createODataProcessor(oDataJPAContext);

    // OData Entity Data Model Provider based on JPA
    EdmProvider edmProvider = accessFactory.createJPAEdmProvider(oDataJPAContext);

    return createODataSingleProcessorService(edmProvider, odataJPAProcessor);
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.processor.api.jpa.factory.ODataJPAAccessFactory

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.