Package org.apache.openejb.assembler.classic

Examples of org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory$JMXReloadableEntityManagerFactory


    @PersistenceUnit
    private EntityManagerFactory emf;

    @Test
    public void check() throws Exception {
        final ReloadableEntityManagerFactory remf = ((ReloadableEntityManagerFactory) emf);
        assertEquals(1, remf.getManagedClasses().size());
        assertEquals(SomeSimpleEntity.class.getName(), remf.getManagedClasses().iterator().next());
        assertEquals(true, remf.getExcludeUnlistedClasses());
    }
View Full Code Here


    @PersistenceUnit
    private EntityManagerFactory emf;

    @Test
    public void check() throws Exception {
        final ReloadableEntityManagerFactory remf = ((ReloadableEntityManagerFactory) emf);
        assertEquals(0, remf.getManagedClasses().size());
    }
View Full Code Here

                // create EMF included in this webapp when nested in an ear
                for (final PersistenceUnitInfo unitInfo : contextInfo.appInfo.persistenceUnits) {
                    if (unitInfo.webappName != null && unitInfo.webappName.equals(webAppInfo.moduleId)) {
                        try {
                            final ReloadableEntityManagerFactory remf =
                                    (ReloadableEntityManagerFactory) SystemInstance.get().getComponent(ContainerSystem.class)
                                            .getJNDIContext().lookup(Assembler.PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
                            remf.overrideClassLoader(classLoader);
                            remf.createDelegate();
                        } catch (final NameNotFoundException nnfe) {
                            logger.warning("Can't find " + unitInfo.id + " persistence unit");
                        }
                    }
                }
View Full Code Here

        return p;
    }

    @Test
    public void reload() {
        final ReloadableEntityManagerFactory remft = (ReloadableEntityManagerFactory) emf;
        final EntityManagerFactory originalEmf = remft.getDelegate();
        assertEquals("false", emf.getProperties().get("openjpa.DataCache"));
        select();

        remft.setProperty("openjpa.DataCache", "true(Types=" + MyEntity.class.getName() + ")");
        remft.reload();
        select();
        assertEquals("true(Types=" + MyEntity.class.getName() + ")", emf.getProperties().get("openjpa.DataCache"));

        final EntityManagerFactory reloadedEmf = remft.getDelegate();
        assertNotSame(originalEmf, reloadedEmf);
    }
View Full Code Here

                // create EMF included in this webapp when nested in an ear
                for (final PersistenceUnitInfo unitInfo : contextInfo.appInfo.persistenceUnits) {
                    if (unitInfo.webappName != null && unitInfo.webappName.equals(webAppInfo.moduleId)) {
                        try {
                            final ReloadableEntityManagerFactory remf =
                                    (ReloadableEntityManagerFactory) SystemInstance.get().getComponent(ContainerSystem.class)
                                            .getJNDIContext().lookup(Assembler.PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
                            remf.overrideClassLoader(classLoader);
                            remf.createDelegate();
                        } catch (final NameNotFoundException nnfe) {
                            logger.warning("Can't find " + unitInfo.id + " persistence unit");
                        }
                    }
                }
View Full Code Here

                // create EMF included in this webapp when nested in an ear
                for (final PersistenceUnitInfo unitInfo : contextInfo.appInfo.persistenceUnits) {
                    if (unitInfo.webappName != null && unitInfo.webappName.equals(webAppInfo.moduleId)) {
                        try {
                            final ReloadableEntityManagerFactory remf =
                                    (ReloadableEntityManagerFactory) SystemInstance.get().getComponent(ContainerSystem.class)
                                            .getJNDIContext().lookup(Assembler.PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
                            remf.overrideClassLoader(classLoader);
                            remf.createDelegate();
                        } catch (final NameNotFoundException nnfe) {
                            logger.warning("Can't find " + unitInfo.id + " persistence unit");
                        }
                    }
                }
View Full Code Here

                // create EMF included in this webapp when nested in an ear
                for (PersistenceUnitInfo unitInfo : contextInfo.appInfo.persistenceUnits) {
                    if (unitInfo.webappName != null && unitInfo.webappName.equals(webAppInfo.moduleId)) {
                        try {
                            final ReloadableEntityManagerFactory remf =
                                (ReloadableEntityManagerFactory) SystemInstance.get().getComponent(ContainerSystem.class)
                                        .getJNDIContext().lookup(Assembler.PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
                            remf.overrideClassLoader(classLoader);
                            remf.createDelegate();
                        } catch (NameNotFoundException nnfe) {
                            logger.warning("Can't find " + unitInfo.id + " persistence unit");
                        }
                    }
                }
View Full Code Here

    @PersistenceUnit
    private EntityManagerFactory emf;

    @Test
    public void check() throws Exception {
        final ReloadableEntityManagerFactory remf = ((ReloadableEntityManagerFactory) emf);
        assertEquals(1, remf.getManagedClasses().size());
        assertEquals(SomeSimpleEntity.class.getName(), remf.getManagedClasses().iterator().next());
        assertEquals(true, remf.getExcludeUnlistedClasses());
    }
View Full Code Here

        return p;
    }

    @Test
    public void reload() {
        final ReloadableEntityManagerFactory remft = (ReloadableEntityManagerFactory) emf;
        final EntityManagerFactory originalEmf = remft.getDelegate();
        assertEquals("false", emf.getProperties().get("openjpa.DataCache"));
        select();

        remft.setProperty("openjpa.DataCache", "true(Types=" + MyEntity.class.getName() + ")");
        remft.reload();
        select();
        assertEquals("true(Types=" + MyEntity.class.getName() + ")", emf.getProperties().get("openjpa.DataCache"));

        final EntityManagerFactory reloadedEmf = remft.getDelegate();
        assertNotSame(originalEmf, reloadedEmf);
    }
View Full Code Here

    @PersistenceUnit
    private EntityManagerFactory emf;

    @Test
    public void check() throws Exception {
        final ReloadableEntityManagerFactory remf = ((ReloadableEntityManagerFactory) emf);
        assertEquals(0, remf.getManagedClasses().size());
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory$JMXReloadableEntityManagerFactory

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.