Package org.nutz.dao.test.meta

Examples of org.nutz.dao.test.meta.Platoon


        platoon = pojos.create4Platoon(Base.make("blue"), "seals");
    }

    @Override
    protected void after() {
        Platoon p = dao.fetch(Platoon.class, "seals");
        pojos.dropPlatoon(p.getId());
    }
View Full Code Here


    @Test
    public void fetch_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Platoon p = dao.fetchLinks(dao.fetch(Platoon.class), "leader");
                assertEquals("ZZH", p.getLeaderName());
                assertEquals("ZZH", p.getLeader().getName());
            }
        });
    }
View Full Code Here

    }

    @Test
    public void fetch_by_name_ignorecase() {
        pojos.initData();
        Platoon p = dao.fetch(Platoon.class, "sF");
        assertEquals("SF", p.getName());
    }
View Full Code Here

    }

    @Test
    public void update_with_null_links() {
        pojos.initData();
        Platoon p = dao.fetch(Platoon.class, "sF");
        p.setLeaderName("xyz");
        dao.updateWith(p, null);
        p = dao.fetch(Platoon.class, "sF");
        assertEquals("xyz", p.getLeaderName());
    }
View Full Code Here

    }

    @Test
    public void test_updateIgnoreNull() {
        pojos.initData();
        Platoon p = dao.fetch(Platoon.class, "sF");
        p.setLeaderName("xyz");
        dao.update(p);

        p = dao.fetch(Platoon.class, "sF");
        String name = p.getLeaderName(); // xyz
        assertNotNull(name);

        p.setLeaderName(null);
        int re = dao.updateIgnoreNull(p);
        assertEquals(1, re);

        p = dao.fetch(Platoon.class, "sF");
        assertEquals(name, p.getLeaderName());

        p.setLeaderName(null);
        dao.update(p);
        p = dao.fetch(Platoon.class, "sF");
        assertNull(p.getLeaderName());

        p.setLeaderName("ABC");
        dao.update(p);
        p = dao.fetch(Platoon.class, "sF");
        assertEquals("ABC", p.getLeaderName());

        FieldFilter.create(Platoon.class, true).run(new Atom() {

            public void run() {
                System.out.println(FieldFilter.get(Platoon.class));
                Platoon p = dao.fetch(Platoon.class, "sF");
                p.setLeaderName(null);
                dao.update(p);
            }
        });
        p = dao.fetch(Platoon.class, "sF");
        assertEquals("ABC", p.getLeaderName());
    }
View Full Code Here

    }

    @Test
    public void test_updateIgnoreNull_by_list() {
        pojos.initData();
        Platoon p = dao.fetch(Platoon.class, "sF");
        p.setLeaderName("xyz");
        dao.update(p);

        p = dao.fetch(Platoon.class, "sF");
        String name = p.getLeaderName(); // xyz
        assertNotNull(name);

        p.setLeaderName(null);
        int re = dao.updateIgnoreNull(Lang.list(p));
        assertEquals(1, re);

        p = dao.fetch(Platoon.class, "sF");
        assertEquals(name, p.getLeaderName());

        p.setLeaderName(null);
        dao.update(p);
        p = dao.fetch(Platoon.class, "sF");
        assertNull(p.getLeaderName());
    }
View Full Code Here

TOP

Related Classes of org.nutz.dao.test.meta.Platoon

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.