use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class OneTest method update_with_as_list.
@Test
public void update_with_as_list() {
List<Base> b = dao.fetchLinks(Lang.list(dao.fetch(Base.class, "red")), "country");
b.get(0).setLevel(45);
b.get(0).getCountry().setName("ABC");
dao.updateWith(b, "country");
b = Lang.list(dao.fetch(Base.class, b.get(0).getName()));
assertEquals(45, 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 clear_links.
@Test
public void clear_links() {
Base b = dao.fetch(Base.class, "red");
dao.clearLinks(b, "country");
assertEquals(1, dao.count(Country.class));
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class LinksGeneralTest method test_fetchLinks_cnd.
@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);
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class LinksGeneralTest method insert_links_with_exception.
@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', 300)));
dao.insertLinks(b, "country");
}
use of org.nutz.dao.test.meta.Base in project nutz by nutzam.
the class ManyManyTest method fetch_links.
@Test
public void fetch_links() {
Base b = dao.fetchLinks(dao.fetch(Base.class, "red"), "fighters");
assertEquals(6, b.getFighters().size());
assertEquals(1, b.countFighter(Fighter.TYPE.SU_35));
}