Search in sources :

Example 26 with EmployeeDao

use of org.seasar.doma.it.dao.EmployeeDao in project doma by domaframework.

the class ExternalDomainTest method testSelectByExternalDomainList.

@Test
public void testSelectByExternalDomainList(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    Hiredate date = new HiredateImpl(Date.valueOf("1980-12-17"));
    List<Employee> employee = dao.selectByHiredates(Arrays.asList(date));
    assertEquals(1, employee.size());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) Hiredate(org.seasar.doma.it.domain.Hiredate) HiredateImpl(org.seasar.doma.it.domain.HiredateImpl) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 27 with EmployeeDao

use of org.seasar.doma.it.dao.EmployeeDao in project doma by domaframework.

the class ExternalDomainTest method testSelectBySingleExternalDomain.

@Test
public void testSelectBySingleExternalDomain(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    List<Employee> employee = dao.selectByHiredate(new HiredateImpl(Date.valueOf("1980-12-17")));
    assertEquals(1, employee.size());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) HiredateImpl(org.seasar.doma.it.domain.HiredateImpl) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 28 with EmployeeDao

use of org.seasar.doma.it.dao.EmployeeDao in project doma by domaframework.

the class SqlFileBatchDeleteTest method test.

@Test
public void test(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    Employee employee = new Employee();
    employee.setEmployeeId(1);
    employee.setVersion(1);
    Employee employee2 = new Employee();
    employee2.setEmployeeId(2);
    employee2.setVersion(1);
    int[] result = dao.deleteBySqlFile(Arrays.asList(employee, employee2));
    assertEquals(2, result.length);
    assertEquals(1, result[0]);
    assertEquals(1, result[1]);
    employee = dao.selectById(1);
    assertNull(employee);
    employee = dao.selectById(2);
    assertNull(employee);
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 29 with EmployeeDao

use of org.seasar.doma.it.dao.EmployeeDao in project doma by domaframework.

the class SqlFileSelectPagingTest method testNoPaging.

@Test
public void testNoPaging(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    List<Employee> employees = dao.selectAll();
    assertEquals(14, employees.size());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Example 30 with EmployeeDao

use of org.seasar.doma.it.dao.EmployeeDao in project doma by domaframework.

the class SqlFileSelectPagingTest method testLimitOffset.

@Test
public void testLimitOffset(Config config) throws Exception {
    EmployeeDao dao = new EmployeeDaoImpl(config);
    List<Employee> employees = dao.selectAll(SelectOptions.get().limit(5).offset(3));
    assertEquals(5, employees.size());
    assertEquals(Integer.valueOf(4), employees.get(0).getEmployeeId());
    assertEquals(Integer.valueOf(5), employees.get(1).getEmployeeId());
    assertEquals(Integer.valueOf(6), employees.get(2).getEmployeeId());
    assertEquals(Integer.valueOf(7), employees.get(3).getEmployeeId());
    assertEquals(Integer.valueOf(8), employees.get(4).getEmployeeId());
}
Also used : EmployeeDao(org.seasar.doma.it.dao.EmployeeDao) Employee(org.seasar.doma.it.entity.Employee) EmployeeDaoImpl(org.seasar.doma.it.dao.EmployeeDaoImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)54 EmployeeDao (org.seasar.doma.it.dao.EmployeeDao)54 EmployeeDaoImpl (org.seasar.doma.it.dao.EmployeeDaoImpl)54 Employee (org.seasar.doma.it.entity.Employee)43 Run (org.seasar.doma.it.Run)8 CompKeyEmployeeDao (org.seasar.doma.it.dao.CompKeyEmployeeDao)8 CompKeyEmployeeDaoImpl (org.seasar.doma.it.dao.CompKeyEmployeeDaoImpl)8 CompKeyEmployee (org.seasar.doma.it.entity.CompKeyEmployee)8 SelectOptions (org.seasar.doma.jdbc.SelectOptions)8 BigDecimal (java.math.BigDecimal)6 Objects (java.util.Objects)4 Stream (java.util.stream.Stream)4 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)4 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)4 IntegrationTestEnvironment (org.seasar.doma.it.IntegrationTestEnvironment)4 Config (org.seasar.doma.jdbc.Config)4 HiredateImpl (org.seasar.doma.it.domain.HiredateImpl)2 OptimisticLockException (org.seasar.doma.jdbc.OptimisticLockException)2 List (java.util.List)1