Package org.crank.crud.test.model

Examples of org.crank.crud.test.model.Department


    this.departmentDao = departmentDao;
    this.employeeDao = employeeDao;
  }

  public void setupEmployeeData() {
    Department engineeringDept = departmentDao.read(1L);
    Department itDept = departmentDao.read(2L);
    Department hrDept = departmentDao.read(3L);

    Employee[] employees = {
      new Employee("Rick", "Hightower", engineeringDept, true, 40, 1, "333333331"),
      new Employee("Chris", null, engineeringDept, true, 40, 1, "333333332"),
      new Employee("Scott", null, engineeringDept, true, 40, 1, "333333333"),
View Full Code Here


  @Test (groups="reads", dependsOnGroups="createsObjectInDB")
  public void testLazy() {
    List<Department> departments = departmentDao.find();
    assert departments.size() > 0;
    Department department = departments.get(0);
    assert department != null;
    List<Employee> employees = department.getEmployees();
    assert employees.size() > 0;
  }
View Full Code Here

        string);

    Employee employee = new Employee();
    employee.setFirstName("Ric");
    employee.setAge(0);
    Department department = new Department();
    department.setName("Eng");
    employee.setDepartment(department);
    group = like(employee).excludeProperty("employees").excludeProperty(
        "numberOfPromotions");
    string = CriteriaUtils.constructWhereClauseString(group, false);
    AssertJUnit
View Full Code Here

    employee.setFirstName("Ric%");
    employee.setLastName("High%");
    employee.setAge(40);
    employee.setActive(true);
    employee.setNumberOfPromotions(1);
    Department department = new Department();
    department.setName("Eng%");
    employee.setDepartment(department);
    employeeDao.find(like(employee)
        .excludeProperty("employees").excludeProperty("tasks"));
//    AssertJUnit.assertTrue(employees.size() > 0);
View Full Code Here

  public void testReadFully() {
   
    Employee employee = employeeDao.readPopulated(testEmployees.get(0).getId());
    AssertJUnit.assertNotNull(employee);

    Department dept = (Department) departmentDao.readPopulated(1L);
    AssertJUnit.assertNotNull(dept);
  }
View Full Code Here

  }

  @Test (groups="reads", dependsOnGroups="createsObjectInDB")
    public void testEntityEquals () {
        Department department = departmentDao.merge(new Department("r&d"));
        department = departmentDao.read(department.getId());
        Employee employee = new Employee("Rick", "Hightower");
        employee.setDepartment(department);
        department.getEmployees().add(employee);
        departmentDao.merge(department);
        List<Employee> find = employeeDao.find(eq("department", department));
        String firstname = find.get(0).getFirstName();
        AssertJUnit.assertEquals("Rick", firstname);
    }
View Full Code Here

TOP

Related Classes of org.crank.crud.test.model.Department

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.