Package org.nutz.dao.test.meta

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


    platoon = pojos.create4Platoon(Base.make("blue"), "seals");
  }

  @Override
  protected void after() {
    Platoon p = dao.fetch(Platoon.class, "seals");
    pojos.dropPlatoon(p.getId());
  }
View Full Code Here


  @Test
  public void fetch_links() {
    TableName.run(platoon, new Atom() {
      public void run() {
        Platoon p = dao.fetchLinks(dao.fetch(Platoon.class), "leader");
        assertEquals("ZZH", p.getLeaderName());
        assertEquals("ZZH", p.getLeader().getName());
      }
    });
  }
View Full Code Here

    assertEquals(13, dao.count("dao_m_base_fighter", Cnd.where("bname", "=", "blue")));
  }

  @Test
  public void fetch_by_name_ignorecase() {
    Platoon p = dao.fetch(Platoon.class, "sF");
    assertEquals("SF", p.getName());
  }
View Full Code Here

    assertEquals(88, p.getNumber());
  }

  @Test
  public void update_with_null_links() {
    Platoon p = dao.fetch(Platoon.class, "sF");
    p.setLeaderName("xyz");
    dao.updateWith(p, null);
    p = dao.fetch(Platoon.class, "sF");
    assertEquals("xyz", p.getLeaderName());
  }
View Full Code Here

    assertEquals("xyz", p.getLeaderName());
  }

  @Test
  public void test_updateIgnoreNull() {
    Platoon p = dao.fetch(Platoon.class, "sF");
    p.setLeaderName("xyz");
    dao.update(p);

    p = dao.fetch(Platoon.class, "sF");
    String name = p.getLeaderName(); // xyz
    assertNotNull(name);

    p.setLeaderName(null);
    int re = dao.updateIgnoreNull(p);
    assertEquals(1, re);

    p = dao.fetch(Platoon.class, "sF");
    assertEquals(name, p.getLeaderName());

    p.setLeaderName(null);
    dao.update(p);
    p = dao.fetch(Platoon.class, "sF");
    assertNull(p.getLeaderName());
  }
View Full Code Here

    assertNull(p.getLeaderName());
  }

  @Test
  public void test_updateIgnoreNull_by_list() {
    Platoon p = dao.fetch(Platoon.class, "sF");
    p.setLeaderName("xyz");
    dao.update(p);

    p = dao.fetch(Platoon.class, "sF");
    String name = p.getLeaderName(); // xyz
    assertNotNull(name);

    p.setLeaderName(null);
    int re = dao.updateIgnoreNull(Lang.list(p));
    assertEquals(1, re);

    p = dao.fetch(Platoon.class, "sF");
    assertEquals(name, p.getLeaderName());

    p.setLeaderName(null);
    dao.update(p);
    p = dao.fetch(Platoon.class, "sF");
    assertNull(p.getLeaderName());
  }
View Full Code Here

  }

  @Test
  public void test_dynamic_query() {
    pojos.init();
    Platoon p = pojos.create4Platoon(Base.make("xyz"), "GG");
    Sql sql = dao.sqls().create("tank.query").setEntity(dao.getEntity(Tank.class));
    sql.vars().set("id", p.getId());
    sql.setCallback(Sqls.callback.entities());
    dao.execute(sql);
    assertEquals(2, sql.getList(Tank.class).size());

    pojos.dropPlatoon(p.getId());
  }
View Full Code Here

    platoon = pojos.create4Platoon(Base.make("blue"), "seals");
  }

  @Override
  protected void after() {
    Platoon p = dao.fetch(Platoon.class, "seals");
    pojos.dropPlatoon(p.getId());
  }
View Full Code Here

    platoon = pojos.create4Platoon(Base.make("blue"), "seals");
  }

  @Override
  protected void after() {
    Platoon p = dao.fetch(Platoon.class, "seals");
    pojos.dropPlatoon(p.getId());
  }
View Full Code Here

  @Test
  public void fetch_null_field_links() {
    TableName.run(platoon, new Atom() {
      public void run() {
        Platoon p = dao.fetchLinks(dao.fetch(Platoon.class), "tanks|soliders");
        assertEquals(2, p.getTanks().size());
        assertEquals(5, p.getSoliders().size());
      }
    });
  }
View Full Code Here

TOP

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

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.