@Test @DatabaseSetup("classpath:dbunit/empty_dataset.xml") public void testFindTenantAdmins() { UUID tenantId = Uuids.timeBased(); UUID customerId = Uuids.timeBased(); create30Adminsand60Users(tenantId, customerId); PageLink pageLink = new PageLink(20); PageData<User> tenantAdmins1 = userDao.findTenantAdmins(tenantId, pageLink); assertEquals(20, tenantAdmins1.getData().size()); pageLink = pageLink.nextPageLink(); PageData<User> tenantAdmins2 = userDao.findTenantAdmins(tenantId, pageLink); assertEquals(10, tenantAdmins2.getData().size()); pageLink = pageLink.nextPageLink(); PageData<User> tenantAdmins3 = userDao.findTenantAdmins(tenantId, pageLink); assertEquals(0, tenantAdmins3.getData().size()); }
@Override public PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData( userRepository .findUsersByAuthority( tenantId, NULL_UUID, Objects.toString(pageLink.getTextSearch(), ""), Authority.TENANT_ADMIN, DaoUtil.toPageable(pageLink))); }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData( userRepository .findUsersByAuthority( tenantId, NULL_UUID, Objects.toString(pageLink.getTextSearch(), ""), Authority.TENANT_ADMIN, DaoUtil.toPageable(pageLink))); } }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData( userRepository .findUsersByAuthority( tenantId, NULL_UUID, Objects.toString(pageLink.getTextSearch(), ""), Authority.TENANT_ADMIN, DaoUtil.toPageable(pageLink))); }  }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData( userRepository .findUsersByAuthority( tenantId, NULL_UUID, Objects.toString(pageLink.getTextSearch(), ""), Authority.TENANT_ADMIN, DaoUtil.toPageable(pageLink))); }  @Override User findByEmail(TenantId tenantId, String email); @Override PageData<User> findByTenantId(UUID tenantId, PageLink pageLink); @Override PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink); @Override PageData<User> findCustomerUsers(UUID tenantId, UUID customerId, PageLink pageLink); }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData( userRepository .findUsersByAuthority( tenantId, NULL_UUID, Objects.toString(pageLink.getTextSearch(), ""), Authority.TENANT_ADMIN, DaoUtil.toPageable(pageLink))); }  @Override User findByEmail(TenantId tenantId, String email); @Override PageData<User> findByTenantId(UUID tenantId, PageLink pageLink); @Override PageData<User> findTenantAdmins(UUID tenantId, PageLink pageLink); @Override PageData<User> findCustomerUsers(UUID tenantId, UUID customerId, PageLink pageLink);  }