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.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() {
    pojos.initData();
    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

  @Test
  public void insert_links_with_exception() {
    try {
      pojos.init();
      Base b = Base.make("Red");
      dao.insert(b);
      b.setCountry(Country.make(Strings.dup('C', 52)));
      dao.insertLinks(b, "country");
      fail();
    }
    catch (Exception e) {
      assertTrue(true);
View Full Code Here

        assertNull(x.type);
    }

    @Test
    public void test_output_not_quote_name() {
        Base b = Base.make("Red");
        String json = Json.toJson(b, JsonFormat.compact().setQuoteName(false));
        Base b2 = Json.fromJson(Base.class, json);
        assertEquals(b.getCountryId(), b2.getCountryId());
        assertEquals(b.getLevel(), b2.getLevel());
        assertEquals(b.getName(), b2.getName());
    }
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.