Search in sources :

Example 1 with ValueFullFileNameIndexTerm

use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueFullFileNameIndexTerm in project kie-wb-common by kiegroup.

the class ListAssetsTest method listFilesShouldNotHaveDuplicatesFromLibraryIndexer.

@Test
public void listFilesShouldNotHaveDuplicatesFromLibraryIndexer() throws IOException, InterruptedException {
    // Add test files
    addTestFile(TEST_MODULE_ROOT, "rule1.rule");
    addTestFile(TEST_MODULE_ROOT, "rule2.rule");
    addTestFile(TEST_MODULE_ROOT, "rule3.rule");
    // wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
    Thread.sleep(5000);
    {
        final RefactoringPageRequest request = new RefactoringPageRequest(TestFindFilesQuery.NAME, new HashSet<ValueIndexTerm>() {

            {
                add(new ValueFullFileNameIndexTerm("*.rule", ValueIndexTerm.TermSearchType.WILDCARD));
            }
        }, 0, 10);
        try {
            final PageResponse<RefactoringPageRow> response = service.query(request);
            assertNotNull(response);
            for (RefactoringPageRow refactoringPageRow : response.getPageRowList()) {
                System.out.println(refactoringPageRow.getValue());
            }
            assertEquals(3, response.getPageRowList().size());
        } catch (IllegalArgumentException e) {
            fail("Exception thrown: " + e.getMessage());
        }
    }
}
Also used : RefactoringPageRequest(org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRequest) PageResponse(org.uberfire.paging.PageResponse) RefactoringPageRow(org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow) ValueFullFileNameIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueFullFileNameIndexTerm) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

HashSet (java.util.HashSet)1 Test (org.junit.Test)1 ValueFullFileNameIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueFullFileNameIndexTerm)1 RefactoringPageRequest (org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRequest)1 RefactoringPageRow (org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow)1 PageResponse (org.uberfire.paging.PageResponse)1