Package test.po

Examples of test.po.Master


    Pet pet = new Pet();
    pet.setPetId(211);
    pet.setAge(8);
    pet.setName("test");
    pet.setType("fuck");
    Master master = new Master();
    master.setId(180);
    pet.setMaster(master);
    DAOFactory.getCascadeDAO().update(pet, "master");
  }
View Full Code Here


    pet.setMaster(master);
    DAOFactory.getCascadeDAO().update(pet, "master");
  }

  public static void testManyInsert() {
    Master master = new Master();
    master.setName("小日主人1");
    master.setGender("boy");
    Integer id = (Integer) DAOFactory.getInsertDAO().insert(master);
    master.setId(id);
    Pet pet = new Pet();
    pet.setName("小日1");
    pet.setType("dog");
    master.getPets().add(pet);

    pet = new Pet();
    pet.setName("小日2");
    pet.setType("cat");
    master.getPets().add(pet);

    DAOFactory.getCascadeDAO().insert(master);
  }
View Full Code Here

  public void testUpdate() {
    pet.setPetId(5);
    pet.setName("小黑");
    pet.setType("dog");
    pet.setAge(1111);
    Master master = new Master();
    master.setId(9);
    pet.setMaster(master);
    String sql = update.update()[0];
    Assert.assertEquals(
        "UPDATE t_pet SET name = '小黑',age = '1111',type = 'dog',master_id = '9' WHERE id = '5' ;",
        sql);
View Full Code Here

  @Test
  public <T> void testUpdateByField() {
    pet.setName("xiaohuang");
    pet.setAge(3);
    pet.setPetId(12);
    Master master = new Master();
    master.setId(5);
    pet.setMaster(master);
    String[] fields = { "name", "age", "master" };
    String sql = update.update(fields)[0];
    Assert.assertEquals(
        "UPDATE t_pet SET name = 'xiaohuang', age = '3', master_id = '5' WHERE id = '12' ;",
View Full Code Here

    //
    // pet.getMasters().add(master);
    // boolean flag = DAOFactory.getCascadeDAO().insert(pet);
    // System.out.println(flag);

    Master master = new Master();
    // master.setId(36);
    master.setName("日本人");
    master.setGender("boy");
    Pet pet = new Pet();
    pet.setName("小日1");
    pet.setType("dog");
    pet.setPetId(6490);
    master.getPets().add(pet);

    pet = new Pet();
    pet.setName("小日2");
    pet.setType("cat");
    master.getPets().add(pet);

    DAOFactory.getCascadeDAO().insert(master);
  }
View Full Code Here

    // TestCascadeDAO.testManyManyInsert();
    // TestCascadeDAO.testManyManySelect();
    // TestCascadeDAO.testManyManyDelete();
    // TestCascadeDAO.testManyManyUpdate();
    EWeb4JConfig.start("start.eweb.xml");
    Master master = new Master();
    master.setId(10);

    Pet pet = new Pet();
    pet.setPetId(5);
    master.getPets().add(pet);
    pet = new Pet();
    pet.setPetId(6);
    master.getPets().add(pet);

    DAOFactory.getCascadeDAO().insert(master, "pets");

  }
View Full Code Here

    if (err != null){
      System.out.println(">>>EWeb4J Start Error --> " + err);
      System.exit(-1);
    }
    pet = new Pet();
    master = new Master();
    master.setId(5);
    pet.setMaster(master);
    pet.setName("xiaobai");
    select = SqlFactory.getSelectSql(pet, "mysql");
    fieldAdd = "+0";
View Full Code Here

  @Test
  public void testDivPageByFieldIsValueByPOJO() {
    String[] fields = new String[] { "name", "age", "master" };
    pet.setName("小白");
    pet.setAge(19);
    Master master = new Master();
    master.setId(8);
    pet.setMaster(master);
    String sql = select.selectWhere(fields, "age+0", 1, 2, 5);
    Assert.assertEquals(
        "SELECT * FROM t_pet  WHERE name  =  '小白'  AND age  =  '19'  AND master_id  =  '8'  ORDER BY age"
            + fieldAdd + " ASC LIMIT 5, 5 ;", sql);
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testInsertWithOneRel() throws Exception {
    Master master = new Master();
    master.setId(5);
    pet.setName("xiaohei");
    pet.setAge(2);
    pet.setMaster(master);
    String[] fields = { "name", "age", "master" };
    String sql = insert.createByFields(fields)[0];
View Full Code Here

    }
  }

  @Test
  public void testOneRel() throws Exception {
    Master master = new Master();
    master.setId(1);

    master.getPets().add(new Pet());
    master.getPets().add(new Pet());
    master.getPets().add(new Pet());

    //DAOFactory.getCascadeDAO().insert(master, "pets");
    Assert.assertEquals(true, true);
  }
View Full Code Here

TOP

Related Classes of test.po.Master

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.