Package jodd.db.oom.tst

Examples of jodd.db.oom.tst.BadBoy


    st = sql("$T{b}").use("b", new Boy());
    assertEquals("BOY", st.generateQuery());
    st = sql("$T{b b}").use("b", new Boy());
    assertEquals("BOY b", st.generateQuery());

    st = sql("$T{b}").use("b", new BadBoy());
    assertEquals("BOY", st.generateQuery());

    // 3
    st = sql("$T{b}").use("b", Boy.class);
    assertEquals("BOY", st.generateQuery());
View Full Code Here


    assertEquals("BOY b | b.ID", st.generateQuery());

    st = sql("$T{b bb} | $C{bb.id} | $C{bb.*}").use("b", new Boy());
    assertEquals("BOY bb | bb.ID | bb.GIRL_ID, bb.ID, bb.NAME", st.generateQuery());

    st = sql("$T{b bb} | $C{bb.ajdi} | $C{bb.*} | $C{bb.+}").use("b", new BadBoy());
    assertEquals("BOY bb | bb.ID | bb.ID, bb.GIRL_ID, bb.NAME | bb.ID", st.generateQuery());

    // 3
    st = sql("$T{b b} | $C{b.id}").use("b", Boy.class);
    assertEquals("BOY b | b.ID", st.generateQuery());
View Full Code Here

    map = st.getQueryParameters();
    assertEquals(2, map.size());
    assertEquals(Integer.valueOf(4), map.get("boy.id").getValue());
    assertEquals(Integer.valueOf(1), map.get("boy.girlId").getValue());

    BadBoy badBoy = new BadBoy();
    st = sql("$T{boy b} where $M{b=boy}").use("boy", badBoy);
    assertEquals("BOY b where (1=1)", st.generateQuery());
    map = st.getQueryParameters();
    assertNull(map);
View Full Code Here

    dbc = sql().setAll("b", b).table("Boy", "b");
    assertEquals("set GIRL_ID=:boy.girlId, ID=:boy.id, NAME=:boy.name BOY b", dbc.generateQuery());
    assertEquals(3, dbc.getQueryParameters().size());

    BadBoy bb = new BadBoy();

    dbc = sql().set("b", bb).table("BadBoy", "b");
    assertEquals("set BOY b", dbc.generateQuery());

    dbc = sql().set("BadBoy", bb).table("BadBoy", null);
View Full Code Here

      assertEquals("(BOY.GIRL_ID=:boy.girlId and BOY.ID=:boy.id) BOY", dbc.generateQuery());
      dbc = sql().match("b", b)._(" ").table(b, "b");
      assertEquals("(b.GIRL_ID=:boy.girlId and b.ID=:boy.id) BOY b", dbc.generateQuery());
    }
    {
      BadBoy bb = new BadBoy();
      DbSqlBuilder dbc = sql().match("BadBoy", bb).table(bb, null);
      assertEquals("(1=1) BOY", dbc.generateQuery());
      dbc = sql().match("b", bb).table(bb, "b");
      assertEquals("(1=1) BOY b", dbc.generateQuery());
    }
    {
      BadBoy bb = new BadBoy();
      DbSqlBuilder dbc = sql()._("where ").match("BadBoy", bb)._(" ").table(bb, null);
      assertEquals("where (1=1) BOY", dbc.generateQuery());
      dbc = sql()._("where")._().match("b", bb)._(" ").table(bb, "b");
      assertEquals("where (1=1) BOY b", dbc.generateQuery());
View Full Code Here

    }
  }

  @Test
  public void testCriteria() {
    BadBoy bb = new BadBoy();
    BadGirl bg = new BadGirl();

    DbSqlBuilder dbc = sql()._("select").
        columnsAll("bb").columnsIds("bg")._(" from").
        table(bb, "bb").table(bg, "bg")._().
View Full Code Here

public class JointHintResolverTest {

  @Test
  public void testHints() {
    Girl girl = new Girl();
    BadBoy badBoy = new BadBoy();
    Object[] data = new Object[]{girl, badBoy};

    JoinHintResolver jhr = new JoinHintResolver();
    Object[] result = jhr.join(data, "girl, boy");
    assertEquals(2, result.length);
    assertTrue(result[0] instanceof Girl);
    assertTrue(result[1] instanceof BadBoy);
    badBoy = (BadBoy) result[1];
    assertNull(badBoy.girl);

    jhr = new JoinHintResolver();
    result = jhr.join(data, "boy.girl, boy");
    assertEquals(1, result.length);
    assertTrue(result[0] instanceof BadBoy);
    badBoy = (BadBoy) result[0];
    assertEquals(girl, badBoy.girl);

    girl = new Girl();
    badBoy = new BadBoy();
    data = new Object[]{girl, badBoy, Integer.valueOf(7)};
    jhr = new JoinHintResolver();
    result = jhr.join(data, "boy.girl, boy, boy.girlId");
    assertEquals(1, result.length);
    assertTrue(result[0] instanceof BadBoy);
    badBoy = (BadBoy) result[0];
    assertEquals(girl, badBoy.girl);
    assertEquals(7, badBoy.girlId.intValue());

    girl = new Girl();
    badBoy = new BadBoy();
    data = new Object[]{girl, badBoy, Integer.valueOf(7)};
    jhr = new JoinHintResolver();
    result = jhr.join(data, "boy.girl, boy, girlId");
    assertEquals(2, result.length);
    assertTrue(result[0] instanceof BadBoy);
View Full Code Here

TOP

Related Classes of jodd.db.oom.tst.BadBoy

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.