Package org.nutz.dao.test.meta

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


        assertEquals(6, b.getPlatoons().size());
    }

    @Test
    public void update_with() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "blue"), "platoons");
        b.setLevel(45);
        for (Iterator<Platoon> it = b.getPlatoons().values().iterator(); it.hasNext();) {
            it.next().setBaseName("red");
        }
        dao.updateWith(b, "platoons");
        b = dao.fetch(Base.class, "blue");
        assertEquals(45, b.getLevel());
        b = dao.fetchLinks(dao.fetch(Base.class, "red"), "platoons");
        assertEquals(6, b.getPlatoons().size());
    }
View Full Code Here


    @Override
    protected void after() {}

    @Test
    public void fetch_links() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
        assertEquals("China", b.getCountry().getName());
    }
View Full Code Here

        assertEquals("China", b.get(0).getCountry().getName());
    }

    @Test
    public void delete_links() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
        dao.deleteLinks(b, "country");
        assertEquals(1, dao.count(Country.class));
    }
View Full Code Here

        assertEquals(1, dao.count(Country.class));
    }

    @Test
    public void delete_with() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
        dao.deleteWith(b, "country");
        assertEquals(1, dao.count(Country.class));
        assertEquals(1, dao.count(Base.class));
    }
View Full Code Here

        assertEquals(1, dao.count(Base.class));
    }

    @Test
    public void clear_links() {
        Base b = dao.fetch(Base.class, "red");
        dao.clearLinks(b, "country");
        assertEquals(1, dao.count(Country.class));
    }
View Full Code Here

        assertEquals(1, dao.count(Country.class));
    }

    @Test
    public void update_links() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
        int lv = b.getLevel();
        b.setLevel(45);
        b.getCountry().setName("ABC");
        dao.updateLinks(b, "country");
        b = dao.fetch(Base.class, "red");
        assertEquals(lv, b.getLevel());
        Country c = dao.fetch(Country.class, b.getCountryId());
        assertEquals("ABC", c.getName());
    }
View Full Code Here

        assertEquals("ABC", c.getName());
    }

    @Test
    public void update_with() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
        b.setLevel(6);
        b.getCountry().setName("ABC");
        dao.updateWith(b, "country");
        b = dao.fetch(Base.class, b.getName());
        assertEquals(6, b.getLevel());
        Country c = dao.fetch(Country.class, b.getCountryId());
        assertEquals("ABC", c.getName());
    }
View Full Code Here

public class LinksGeneralTest extends DaoCase {

    @Test
    public void fetch_all_links() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), null);
        assertEquals("red", b.getName());
        assertEquals("China", b.getCountry().getName());
        assertEquals(6, b.getFighters().size());
        assertEquals(3, b.getPlatoons().size());
    }
View Full Code Here

        assertEquals(3, b.getPlatoons().size());
    }

    @Test(expected=Exception.class)
    public void insert_links_with_exception() {
        Base b = Base.make("Red");
        dao.insert(b);
        b.setCountry(Country.make(Strings.dup('C', 52)));
        dao.insertLinks(b, "country");
    }
View Full Code Here

        dao.insertLinks(b, "country");
    }

    @Test
    public void test_fetchLinks_cnd() {
        Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "wavebands", Cnd.where("value", ">", -1).asc("name"));
        assertNotNull(b);
       
        Base b2 = dao.fetchLinks(dao.fetch(Base.class, "red"), "platoons", Cnd.where("id", ">", 0).limit(1, 20).asc("name"));
        assertNotNull(b2);
       
    }
View Full Code Here

TOP

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

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.