Source:
public void testFormsIndexing() throws Exception { List<Path> pathList = new ArrayList<>(); for (int i = 0; i < FORMS.length; ++i) { String formFile = FORMS[i]; if (formFile.endsWith("frm")) { Path path = basePath.resolve(formFile); pathList.add(path); String formContent = loadText(formFile); ioService().write(path, formContent); } } Path[] paths = pathList.toArray(new Path[pathList.size()]); { PageResponse<RefactoringPageRow> response = null; try { for (int i = 0; i < MAX_WAIT_TIMES; i++) { Thread.sleep(WAIT_TIME_MILLIS); response = getFormResources(); if (response != null && response.getPageRowList() != null && response.getPageRowList().size() >= paths.length) { break; } } } catch (IllegalArgumentException e) { fail("Exception thrown: " + e.getMessage()); } assertNotNull(response); assertEquals(paths.length, response.getPageRowList().size()); } { final Set<ValueIndexTerm> queryTerms = new HashSet<ValueIndexTerm>() {{ add(new ValueResourceIndexTerm("*", ResourceType.FORM, ValueIndexTerm.TermSearchType.WILDCARD)); }}; try { List<RefactoringPageRow> response = service.query( FindFormDefinitionIdsQuery.NAME, queryTerms); assertNotNull(response); assertEquals(paths.length, response.size()); for (String expectedId : FORMS) { boolean foundId = false; for (RefactoringPageRow row : response) { Map<String, org.uberfire.backend.vfs.Path> mapRow = (Map<String, org.uberfire.backend.vfs.Path>) row.getValue(); for (String rKey : mapRow.keySet()) { assertTrue(Arrays.asList(FORMS).contains(rKey)); foundId = true; } } if (!foundId) { fail("FormDefinition with ID <" + expectedId + " not found in results for " + FindFormDefinitionIdsQuery.NAME); } } } catch (IllegalArgumentException e) { fail("Exception thrown: " + e.getMessage()); } } }

Target:
public void testFormsIndexing() throws Exception { List<Path> pathList = new ArrayList<>(); for (String formFile : FORMS) { Path path = basePath.resolve(formFile); pathList.add(path); String formContent = loadText(formFile); ioService().write(path, formContent); } Path[] paths = pathList.toArray(new Path[pathList.size()]); { PageResponse<RefactoringPageRow> response = null; try { for (int i = 0; i < MAX_WAIT_TIMES; i++) { Thread.sleep(WAIT_TIME_MILLIS); response = getFormResources(); if (response != null && response.getPageRowList() != null && response.getPageRowList().size() >= paths.length) { break; } } } catch (IllegalArgumentException e) { fail("Exception thrown: " + e.getMessage()); } assertNotNull(response); assertEquals(paths.length, response.getPageRowList().size()); } { final Set<ValueIndexTerm> queryTerms = new HashSet<ValueIndexTerm>() {{ add(new ValueResourceIndexTerm("*", ResourceType.FORM, ValueIndexTerm.TermSearchType.WILDCARD)); }}; try { List<RefactoringPageRow> response = service.query( FindFormDefinitionIdsQuery.NAME, queryTerms); assertNotNull(response); assertEquals(paths.length, response.size()); for (String expectedId : FORMS) { boolean foundId = false; for (RefactoringPageRow row : response) { Map<String, org.uberfire.backend.vfs.Path> mapRow = (Map<String, org.uberfire.backend.vfs.Path>) row.getValue(); for (String rKey : mapRow.keySet()) { assertTrue(Arrays.asList(FORMS).contains(rKey)); foundId = true; } } if (!foundId) { fail("FormDefinition with ID <" + expectedId + " not found in results for " + FindFormDefinitionIdsQuery.NAME); } } } catch (IllegalArgumentException e) { fail("Exception thrown: " + e.getMessage()); } } }