use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class ManyTest method fetch_links.
@Test
public void fetch_links() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "platoons");
assertEquals(3, b.getPlatoons().size());
assertEquals(b.getName(), b.getPlatoons().get("C").getBaseName());
assertEquals(b.getName(), b.getPlatoons().get("ES").getBaseName());
assertEquals(b.getName(), b.getPlatoons().get("DT").getBaseName());
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class ManyTest method update_with.
@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());
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class ManyTest method delete_links_partly.
@Test
public void delete_links_partly() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "platoons");
b.getPlatoons().remove("C");
dao.deleteLinks(b, "platoons");
assertEquals(4, dao.count(Platoon.class));
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class OneTest method update_with.
@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());
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class OneTest method update_links.
@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());
}