use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class OneTest method delete_with.
@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));
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class OneTest method update_links_as_list.
@Test
public void update_links_as_list() {
List<Base> b = dao.fetchLinks(Lang.list(dao.fetch(Base.class, "red")), "country");
int lv = b.get(0).getLevel();
b.get(0).setLevel(45);
b.get(0).getCountry().setName("ABC");
dao.updateLinks(b, "country");
b = Lang.list(dao.fetch(Base.class, "red"));
assertEquals(lv, b.get(0).getLevel());
Country c = dao.fetch(Country.class, b.get(0).getCountryId());
assertEquals("ABC", c.getName());
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class OneTest method fetch_links.
@Test
public void fetch_links() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "country");
assertEquals("China", b.getCountry().getName());
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class LinksGeneralTest method fetch_all_links.
@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());
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class ManyManyTest method delete_with_partly.
@Test
public void delete_with_partly() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "fighters");
b.getFighters().remove(0);
b.getFighters().remove(0);
dao.deleteWith(b, "fighters");
assertEquals(9, dao.count(Fighter.class));
assertEquals(1, dao.count(Base.class));
}