use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexRuleMultipleTypesTest method testIndexDrlRuleMultipleTypes.
@Test
public void testIndexDrlRuleMultipleTypes() throws IOException, InterruptedException {
// Add test files
final Path path1 = basePath.resolve("drl3.tdrl");
final String drl1 = loadText("drl3.tdrl");
ioService().write(path1, drl1);
final Path path2 = basePath.resolve("drl4.tdrl");
final String drl2 = loadText("drl4.tdrl");
ioService().write(path2, drl2);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
List<String> index = Arrays.asList(KObjectUtil.toKCluster(basePath.getFileSystem()).getClusterId());
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.dtree.backend.server.indexing.classes.Applicant", ResourceType.JAVA)).build();
searchFor(index, query, 2, path1, path2);
}
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.dtree.backend.server.indexing.classes.Mortgage", ResourceType.JAVA)).build();
searchFor(index, query, 1, path2);
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexRuleTypeTest method testIndexRuleTypes.
@Test
public void testIndexRuleTypes() throws IOException, InterruptedException {
// Add test files
final Path path1 = basePath.resolve("drl1.tdrl");
final String drl1 = loadText("drl1.tdrl");
ioService().write(path1, drl1);
final Path path2 = basePath.resolve("drl2.tdrl");
final String drl2 = loadText("drl2.tdrl");
ioService().write(path2, drl2);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
List<String> index = Arrays.asList(KObjectUtil.toKCluster(basePath.getFileSystem()).getClusterId());
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.dtree.backend.server.indexing.classes.Applicant", ResourceType.JAVA)).build();
searchFor(index, query, 2);
}
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("*.Applicant", ResourceType.JAVA, TermSearchType.WILDCARD)).build();
searchFor(index, query, 2);
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexRuleAttributeNameTest method testIndexDrlRuleAttributeNames.
@Test
public void testIndexDrlRuleAttributeNames() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("drl1.rdrl");
final String drl = loadText("drl1.rdrl");
ioService().write(path, drl);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
List<String> index = Arrays.asList(KObjectUtil.toKCluster(basePath.getFileSystem()).getClusterId());
{
final Query query = new SingleTermQueryBuilder(new ValueSharedPartIndexTerm("*", PartType.RULEFLOW_GROUP, TermSearchType.WILDCARD)).build();
searchFor(index, query, 1);
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexRuleInvalidDrlTest method testIndexRuleInvalidDrl.
@Test
public void testIndexRuleInvalidDrl() throws IOException, InterruptedException {
// Setup logging
final Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
final Appender<ILoggingEvent> mockAppender = mock(Appender.class);
when(mockAppender.getName()).thenReturn("MOCK");
root.addAppender(mockAppender);
// Add test file
final Path path = basePath.resolve("bz1269366.rdrl");
final String drl = loadText("bz1269366.rdrl");
ioService().write(path, drl);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
List<String> index = Arrays.asList(KObjectUtil.toKCluster(basePath.getFileSystem()).getClusterId());
{
final Query query = new SingleTermQueryBuilder(new ValueResourceIndexTerm("*myRule", ResourceType.RULE, TermSearchType.WILDCARD)).build();
searchFor(index, query, 0);
verify(mockAppender).doAppend(argThat(new ArgumentMatcher<ILoggingEvent>() {
@Override
public boolean matches(final Object argument) {
return ((ILoggingEvent) argument).getMessage().startsWith("Unable to parse DRL");
}
}));
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexRuleTest method testIndexDrlRules.
@Test
public void testIndexDrlRules() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("drl1.rdrl");
final String drl = loadText("drl1.rdrl");
ioService().write(path, drl);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
List<String> index = Arrays.asList(KObjectUtil.toKCluster(basePath.getFileSystem()).getClusterId());
{
final Query query = new SingleTermQueryBuilder(new ValueResourceIndexTerm("*myRule", ResourceType.RULE, TermSearchType.WILDCARD)).build();
searchFor(index, query, 1);
}
}
Aggregations