JpaBaseComponentDescriptorDao extends JpaAbstractSearchTextDao<ComponentDescriptorEntity, ComponentDescriptor> implements ComponentDescriptorDao { @Override public List<ComponentDescriptor> findByScopeAndTypeAndPageLink(ComponentScope scope, ComponentType type, TextPageLink pageLink) { return DaoUtil.convertDataList(componentDescriptorRepository .findByScopeAndType( type, scope, Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  @Override Optional<ComponentDescriptor> saveIfNotExist(ComponentDescriptor component); @Override ComponentDescriptor findById(ComponentDescriptorId componentId); @Override ComponentDescriptor findByClazz(String clazz); @Override List<ComponentDescriptor> findByTypeAndPageLink(ComponentType type, TextPageLink pageLink); @Override List<ComponentDescriptor> findByScopeAndTypeAndPageLink(ComponentScope scope, ComponentType type, TextPageLink pageLink); @Override @Transactional void deleteById(ComponentDescriptorId componentId); @Override @Transactional void deleteByClazz(String clazz);  }
@Test public void findByTypeAndSocpe() { for (int i = 0; i < 20; i++) { createComponentDescriptor(ComponentType.ENRICHMENT, ComponentScope.SYSTEM, i); createComponentDescriptor(ComponentType.ACTION, ComponentScope.TENANT, i + 20); createComponentDescriptor(ComponentType.FILTER, ComponentScope.SYSTEM, i + 40); } TextPageLink pageLink1 = new TextPageLink(15, "COMPONENT_"); List<ComponentDescriptor> components1 = componentDescriptorDao.findByScopeAndTypeAndPageLink( ComponentScope.SYSTEM, ComponentType.FILTER, pageLink1); assertEquals(15, components1.size()); TextPageLink pageLink2 = new TextPageLink(15, "COMPONENT_", components1.get(14).getId().getId(), null); List<ComponentDescriptor> components2 = componentDescriptorDao.findByScopeAndTypeAndPageLink( ComponentScope.SYSTEM, ComponentType.FILTER, pageLink2); assertEquals(5, components2.size()); }