Examples of BufferedLogFactory


Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Properties props = new Properties();
        props.setProperty("openjpa.MaxxFetchDepth", "1");

        OpenJPAConfiguration config = new OpenJPAConfigurationImpl();
        // track the messages
        BufferedLogFactory log = new BufferedLogFactory();
        config.setLogFactory(log);

        config.fromProperties(props);

        // make sure we got a warning that contains the string with the
        // bad property name and a hint for the valid property name.
        log.assertLogMessage("*\"openjpa.MaxxFetchDepth\"*");
        log.assertLogMessage("*\"openjpa.MaxFetchDepth\"*");

        log.clear();

        // now make sure we do *not* try to validate sub-configurations (such
        // as openjpa.jdbc.Foo).
        props.clear();
        props.setProperty("openjpa.jdbc.Foo", "XXX");
        props.setProperty("oponjpa", "XXX");
        config.fromProperties(props);
        log.assertNoLogMessage("*\"openjpa.jdbc.Foo\"*");
        log.assertNoLogMessage("*\"oponjpa\"*");
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Properties props = new Properties();
        props.setProperty("openjpa.MaxxFetchDepth", "1");

        OpenJPAConfiguration config = new OpenJPAConfigurationImpl();
        // track the messages
        BufferedLogFactory log = new BufferedLogFactory();
        config.setLogFactory(log);

        config.fromProperties(props);

        // make sure we got a warning that contains the string with the
        // bad property name and a hint for the valid property name.
        log.assertLogMessage("*\"openjpa.MaxxFetchDepth\"*");
        log.assertLogMessage("*\"openjpa.MaxFetchDepth\"*");

        log.clear();

        // now make sure we do *not* try to validate sub-configurations (such
        // as openjpa.jdbc.Foo).
        props.clear();
        props.setProperty("openjpa.jdbc.Foo", "XXX");
        props.setProperty("oponjpa", "XXX");
        config.fromProperties(props);
        log.assertNoLogMessage("*\"openjpa.jdbc.Foo\"*");
        log.assertNoLogMessage("*\"oponjpa\"*");
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Map map = getOrphanedKeyConfiguration("log(Level=FATAL)");

        OpenJPAEntityManagerFactory pmf = getEmf(map);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        logFactory.assertNoLogMessage("*orphan*");
        assertNull(pc.getSelfOneOne());
        logFactory.assertLogMessage("*orphan*");
        endEm(pm);
        pmf.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Map map = getOrphanedKeyConfiguration("exception");
        OpenJPAEntityManagerFactory pmf = getEmf(map);

        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        try {
            pc.getSelfOneOne();
            fail("Did not throw expected exception for orphaned key.");
        } catch (EntityNotFoundException onfe) {
            logFactory.assertNoLogMessage("*orphan*");
        } catch (OpenJPAException ke) {
            bug(1138, ke, "Wrong exception type.");
        }
        endEm(pm);
        pmf.close();
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

    public void testNone() {
        Map map = getOrphanedKeyConfiguration("none");
        OpenJPAEntityManagerFactory pmf = getEmf(map);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        assertNull(pc.getSelfOneOne());
        logFactory.assertNoLogMessage("*orphan*");
        endEm(pm);
        pmf.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Properties props = new Properties();
        props.setProperty("openjpa.MaxxFetchDepth", "1");

        OpenJPAConfiguration config = new OpenJPAConfigurationImpl();
        // track the messages
        BufferedLogFactory log = new BufferedLogFactory();
        config.setLogFactory(log);

        config.fromProperties(props);

        // make sure we got a warning that contains the string with the
        // bad property name and a hint for the valid property name.
        log.assertLogMessage("*\"openjpa.MaxxFetchDepth\"*");
        log.assertLogMessage("*\"openjpa.MaxFetchDepth\"*");

        log.clear();

        // now make sure we do *not* try to validate sub-configurations (such
        // as kodo.jdbc.Foo).
        props.clear();
        props.setProperty("openjpa.jdbc.Foo", "XXX");
        props.setProperty("oponjpa", "XXX");
        config.fromProperties(props);
        log.assertNoLogMessage("*\"openjpa.jdbc.Foo\"*");
        log.assertNoLogMessage("*\"oponjpa\"*");
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Map map = getOrphanedKeyConfiguration("log(Level=FATAL)");

        OpenJPAEntityManagerFactory pmf = getEmf(map);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        logFactory.assertNoLogMessage("*orphan*");
        assertNull(pc.getSelfOneOne());
        logFactory.assertLogMessage("*orphan*");
        endEm(pm);
        pmf.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Map map = getOrphanedKeyConfiguration("exception");
        OpenJPAEntityManagerFactory pmf = getEmf(map);

        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        try {
            pc.getSelfOneOne();
            fail("Did not throw expected exception for orphaned key.");
        } catch (EntityNotFoundException onfe) {
            logFactory.assertNoLogMessage("*orphan*");
        } catch (OpenJPAException ke) {
            bug(1138, ke, "Wrong exception type.");
        }
        endEm(pm);
        pmf.close();
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

    public void testNone() {
        Map map = getOrphanedKeyConfiguration("none");
        OpenJPAEntityManagerFactory pmf = getEmf(map);
        OpenJPAEntityManager pm = pmf.createEntityManager();

        BufferedLogFactory logFactory = (BufferedLogFactory)
            ((OpenJPAEntityManagerSPI) pm).getConfiguration().getLogFactory();
        logFactory.clear();

        RuntimeTest1 pc = (RuntimeTest1) pm.find(RuntimeTest1.class, _oid);
        assertNull(pc.getSelfOneOne());
        logFactory.assertNoLogMessage("*orphan*");
        endEm(pm);
        pmf.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.common.utils.BufferedLogFactory

        Properties props = new Properties();
        props.setProperty("openjpa.MaxxFetchDepth", "1");

        OpenJPAConfiguration config = new OpenJPAConfigurationImpl();
        // track the messages
        BufferedLogFactory log = new BufferedLogFactory();
        config.setLogFactory(log);

        config.fromProperties(props);

        // make sure we got a warning that contains the string with the
        // bad property name and a hint for the valid property name.
        log.assertLogMessage("*\"openjpa.MaxxFetchDepth\"*");
        log.assertLogMessage("*\"openjpa.MaxFetchDepth\"*");

        log.clear();

        // now make sure we do *not* try to validate sub-configurations (such
        // as openjpa.jdbc.Foo).
        props.clear();
        props.setProperty("openjpa.jdbc.Foo", "XXX");
        props.setProperty("oponjpa", "XXX");
        config.fromProperties(props);
        log.assertNoLogMessage("*\"openjpa.jdbc.Foo\"*");
        log.assertNoLogMessage("*\"oponjpa\"*");
    }
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.