Examples of ODataJPAContextImpl


Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

  @Test
  public void testBuildJPAEdmComplexPropertyView() {
    JPAEdmComplexPropertyView complexPropertyView = EasyMock.createMock(JPAEdmComplexPropertyView.class);
    ComplexProperty complexProperty = new ComplexProperty();
    EasyMock.expect(complexPropertyView.getEdmComplexProperty()).andStubReturn(complexProperty);
    ODataJPAContextImpl oDataJPAContext = new ODataJPAContextImpl();
    JPAEdmMappingModelService mappingModelService = new JPAEdmMappingModelService(oDataJPAContext);
    EasyMock.expect(complexPropertyView.getJPAEdmMappingModelAccess()).andStubReturn(mappingModelService);

    // Mocking EDMProperty
    JPAEdmPropertyView propertyView = EasyMock.createMock(JPAEdmPropertyView.class);
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

  @Test
  public void testBuildJPAEdmComplexPropertyViewWithNoDefaultNaming() {
    JPAEdmComplexPropertyView complexPropertyView = EasyMock.createMock(JPAEdmComplexPropertyView.class);
    ComplexProperty complexProperty = new ComplexProperty();
    EasyMock.expect(complexPropertyView.getEdmComplexProperty()).andStubReturn(complexProperty);
    ODataJPAContextImpl oDataJPAContext = new ODataJPAContextImpl();
    JPAEdmMappingModelService mappingModelService = new JPAEdmMappingModelService(oDataJPAContext);
    EasyMock.expect(complexPropertyView.getJPAEdmMappingModelAccess()).andStubReturn(mappingModelService);

    // Mocking EDMProperty
    JPAEdmPropertyView propertyView = EasyMock.createMock(JPAEdmPropertyView.class);
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

      return new ODataJPAEdmProvider(oDataJPAContext);
    }

    @Override
    public ODataJPAContext createODataJPAContext() {
      return new ODataJPAContextImpl();
    }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

  @Test
  public void testJPAAccessFactory() {
    ODataJPAFactoryImpl oDataJPAFactoryImpl = new ODataJPAFactoryImpl();
    JPAAccessFactory jpaAccessFactory = oDataJPAFactoryImpl.getJPAAccessFactory();
    ODataJPAContextImpl oDataJPAContextImpl = new ODataJPAContextImpl();
    Class<?> clazz = oDataJPAContextImpl.getClass();
    try {
      Field field = clazz.getDeclaredField("em");
      field.setAccessible(true);
      field.set(oDataJPAContextImpl, new JPAProcessorImplTest().getLocalEntityManager());
    } catch (SecurityException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (NoSuchFieldException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (IllegalArgumentException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (IllegalAccessException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EntityManagerFactory emf = new EntityManagerFactory() {

      @Override
      public boolean isOpen() {
        return false;
      }

      @Override
      public Map<String, Object> getProperties() {
        return null;
      }

      @Override
      public PersistenceUnitUtil getPersistenceUnitUtil() {
        return null;
      }

      @Override
      public Metamodel getMetamodel() {
        return null;
      }

      @Override
      public CriteriaBuilder getCriteriaBuilder() {
        return null;
      }

      @Override
      public Cache getCache() {
        return null;
      }

      @SuppressWarnings("rawtypes")
      @Override
      public EntityManager createEntityManager(final Map arg0) {
        return null;
      }

      @Override
      public EntityManager createEntityManager() {
        return null;
      }

      @Override
      public void close() {}
    };
    oDataJPAContextImpl.setEntityManagerFactory(emf);
    oDataJPAContextImpl.setPersistenceUnitName("pUnit");

    assertNotNull(jpaAccessFactory.getJPAProcessor(oDataJPAContextImpl));
    assertNotNull(jpaAccessFactory.getJPAEdmModelView(oDataJPAContextImpl));

  }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

  @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

Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

  @Test
  public void testBuildJPAEdmComplexPropertyView() {
    JPAEdmComplexPropertyView complexPropertyView = EasyMock.createMock(JPAEdmComplexPropertyView.class);
    ComplexProperty complexProperty = new ComplexProperty();
    EasyMock.expect(complexPropertyView.getEdmComplexProperty()).andStubReturn(complexProperty);
    ODataJPAContextImpl oDataJPAContext = new ODataJPAContextImpl();
    JPAEdmMappingModelService mappingModelService = new JPAEdmMappingModelService(oDataJPAContext);
    EasyMock.expect(complexPropertyView.getJPAEdmMappingModelAccess()).andStubReturn(mappingModelService);

    // Mocking EDMProperty
    JPAEdmPropertyView propertyView = EasyMock.createMock(JPAEdmPropertyView.class);
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl

  @Test
  public void testBuildJPAEdmComplexPropertyViewWithNoDefaultNaming() {
    JPAEdmComplexPropertyView complexPropertyView = EasyMock.createMock(JPAEdmComplexPropertyView.class);
    ComplexProperty complexProperty = new ComplexProperty();
    EasyMock.expect(complexPropertyView.getEdmComplexProperty()).andStubReturn(complexProperty);
    ODataJPAContextImpl oDataJPAContext = new ODataJPAContextImpl();
    JPAEdmMappingModelService mappingModelService = new JPAEdmMappingModelService(oDataJPAContext);
    EasyMock.expect(complexPropertyView.getJPAEdmMappingModelAccess()).andStubReturn(mappingModelService);

    // Mocking EDMProperty
    JPAEdmPropertyView propertyView = EasyMock.createMock(JPAEdmPropertyView.class);
View Full Code Here

Examples of org.apache.olingo.odata2.processor.core.jpa.ODataJPAContextImpl

  @Test
  public void testJPAAccessFactory() {
    ODataJPAFactoryImpl oDataJPAFactoryImpl = new ODataJPAFactoryImpl();
    JPAAccessFactory jpaAccessFactory = oDataJPAFactoryImpl.getJPAAccessFactory();
    ODataJPAContextImpl oDataJPAContextImpl = new ODataJPAContextImpl();
    Class<?> clazz = oDataJPAContextImpl.getClass();
    try {
      Field field = clazz.getDeclaredField("em");
      field.setAccessible(true);
      field.set(oDataJPAContextImpl, new JPAProcessorImplTest().getLocalEntityManager());
    } catch (SecurityException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (NoSuchFieldException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (IllegalArgumentException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    } catch (IllegalAccessException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EntityManagerFactory emf = new EntityManagerFactory() {

      @Override
      public boolean isOpen() {
        return false;
      }

      @Override
      public Map<String, Object> getProperties() {
        return null;
      }

      @Override
      public PersistenceUnitUtil getPersistenceUnitUtil() {
        return null;
      }

      @Override
      public Metamodel getMetamodel() {
        return null;
      }

      @Override
      public CriteriaBuilder getCriteriaBuilder() {
        return null;
      }

      @Override
      public Cache getCache() {
        return null;
      }

      @SuppressWarnings("rawtypes")
      @Override
      public EntityManager createEntityManager(final Map arg0) {
        return null;
      }

      @Override
      public EntityManager createEntityManager() {
        return null;
      }

      @Override
      public void close() {}
    };
    oDataJPAContextImpl.setEntityManagerFactory(emf);
    oDataJPAContextImpl.setPersistenceUnitName("pUnit");

    assertNotNull(jpaAccessFactory.getJPAProcessor(oDataJPAContextImpl));
    assertNotNull(jpaAccessFactory.getJPAEdmModelView(oDataJPAContextImpl));

  }
View Full Code Here

Examples of org.apache.olingo.odata2.processor.core.jpa.ODataJPAContextImpl

  @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

Examples of org.apache.olingo.odata2.processor.core.jpa.ODataJPAContextImpl

  @Test
  public void testBuildJPAEdmComplexPropertyViewJPAEdmPropertyView() {
    JPAEdmComplexPropertyView complexPropertyView = EasyMock.createMock(JPAEdmComplexPropertyView.class);
    ComplexProperty complexProperty = new ComplexProperty();
    EasyMock.expect(complexPropertyView.getEdmComplexProperty()).andStubReturn(complexProperty);
    ODataJPAContextImpl oDataJPAContext = new ODataJPAContextImpl();
    JPAEdmMappingModelService mappingModelService = new JPAEdmMappingModelService(oDataJPAContext);
    EasyMock.expect(complexPropertyView.getJPAEdmMappingModelAccess()).andStubReturn(mappingModelService);

    // Mocking EDMProperty
    JPAEdmPropertyView propertyView = EasyMock.createMock(JPAEdmPropertyView.class);
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.