Package org.apache.aries.jpa.container.context

Examples of org.apache.aries.jpa.container.context.PersistenceContextProvider


      fail("No context should exist");
    } catch (RuntimeException re) {
      //Expected
    }
   
    PersistenceContextProvider provider = getOsgiService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))", DEFAULT_TIMEOUT);
   
View Full Code Here


    assertEquals("blue", list.get(1).getColour());
    assertEquals("A1AAA", list.get(1).getNumberPlate());
  }
 
  private void registerClient(String name) {
    PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext(name, bundleContext.getBundle(), props);
  }
View Full Code Here

 
  @Test
  public void testSimpleContextQuiesce() throws Exception {

    //Get a managed context registered
    PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))");
   
View Full Code Here

  public void testComplexContextQuiesce() throws Exception {
    //This is load bearing. we have to wait to create the EntityManager until the DataSource is available
    context().getService(DataSource.class);
   
    // Get a managed context registered
    PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))");
   
View Full Code Here

  @Test
  public void testContextRuntimeQuiesce() throws Exception {
    //This is load bearing. we have to wait to create the EntityManager until the DataSource is available
    context().getService(DataSource.class);
   
    PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))");
   
View Full Code Here

    //This is load bearing. we have to wait to create the EntityManager until the DataSource is available
    context().getService(DataSource.class);
   
    // Get a managed context registered
    PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))");
   
View Full Code Here

  public void testComplexQuiesceInteraction2() throws Exception {
    //This is load bearing. we have to wait to create the EntityManager until the DataSource is available
    context().getService(DataSource.class);
   
    // Get a managed context registered
    PersistenceContextProvider provider = context().getService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))");
   
View Full Code Here

 
  @Test
  public void testSimpleContextQuiesce() throws Exception {

    //Get a managed context registered
    PersistenceContextProvider provider = getOsgiService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))", DEFAULT_TIMEOUT);
   
View Full Code Here

  public void testComplexContextQuiesce() throws Exception {
    //This is load bearing. we have to wait to create the EntityManager until the DataSource is available
    getOsgiService(DataSource.class);
   
    // Get a managed context registered
    PersistenceContextProvider provider = getOsgiService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))", DEFAULT_TIMEOUT);
   
View Full Code Here

  @Test
  public void testContextRuntimeQuiesce() throws Exception {
    //This is load bearing. we have to wait to create the EntityManager until the DataSource is available
    getOsgiService(DataSource.class);
   
    PersistenceContextProvider provider = getOsgiService(PersistenceContextProvider.class);
   
    HashMap<String, Object> props = new HashMap<String, Object>();
    props.put(PersistenceContextProvider.PERSISTENCE_CONTEXT_TYPE, PersistenceContextType.TRANSACTION);
    provider.registerContext("test-unit", bundleContext.getBundle(), props);
   
    EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)("
          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))", DEFAULT_TIMEOUT);
   
View Full Code Here

TOP

Related Classes of org.apache.aries.jpa.container.context.PersistenceContextProvider

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.