use of org.kie.workbench.common.services.refactoring.service.impact.QueryOperationRequest in project kie-wb-common by kiegroup.
the class QueryOperationRequestTest method workingCodeTest.
// Tests ----------------------------------------------------------------------------------------------------------------------
@Test
public void workingCodeTest() throws Exception {
// Add test files
final Path path1 = basePath.resolve("drl1.drl");
final String drl1 = loadText("drl1.drl");
ioService().write(path1, drl1);
final Path path2 = basePath.resolve("drl2.drl");
final String drl2 = loadText("drl2.drl");
ioService().write(path2, drl2);
final Path path3 = basePath.resolve("drl3.drl");
final String drl3 = loadText("drl3.drl");
ioService().write(path3, drl3);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
{
QueryOperationRequest request = QueryOperationRequest.referencesSharedPart("myRuleFlowGroup", PartType.RULEFLOW_GROUP).inAllModules().onAllBranches();
try {
final List<RefactoringPageRow> response = service.queryToList(request);
assertNotNull(response);
assertEquals(2, response.size());
assertResponseContains(response, path1);
assertResponseContains(response, path3);
} catch (IllegalArgumentException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
{
QueryOperationRequest request = QueryOperationRequest.referencesSharedPart("*", PartType.RULEFLOW_GROUP, TermSearchType.WILDCARD).inAllModules().onAllBranches();
try {
final List<RefactoringPageRow> response = service.queryToList(request);
assertNotNull(response);
assertEquals(3, response.size());
assertResponseContains(response, path1);
assertResponseContains(response, path2);
assertResponseContains(response, path3);
} catch (IllegalArgumentException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
}
Aggregations