use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueSharedPartIndexTerm in project drools-wb by kiegroup.
the class IndexDecisionTableXLSAttributeNameAndValueTest method testIndexDecisionTableXLSAttributeNameAndValue.
@Test
public void testIndexDecisionTableXLSAttributeNameAndValue() throws IOException, InterruptedException {
// Add test files
final Path path1 = loadXLSFile(basePath, "dtable1.xls");
final Path path2 = loadXLSFile(basePath, "dtable2.xls");
// 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());
// This simply checks whether there is a Rule Attribute "ruleflow-group" with a Rule Attribute Value "myRuleflowGroup"
{
final BooleanQuery.Builder query = new BooleanQuery.Builder();
ValueIndexTerm valTerm = new ValueSharedPartIndexTerm("myruleflowgroup", PartType.RULEFLOW_GROUP);
query.add(new TermQuery(new Term(valTerm.getTerm(), valTerm.getValue())), BooleanClause.Occur.MUST);
searchFor(index, query.build(), 1, path1);
}
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueSharedPartIndexTerm in project drools-wb by kiegroup.
the class IndexDecisionTableXLSAttributeNameTest method testIndexDecisionTableXLSAttributeName.
@Test
public void testIndexDecisionTableXLSAttributeName() throws IOException, InterruptedException {
// Add test files
final Path path1 = loadXLSFile(basePath, "dtable1.xls");
final Path path2 = loadXLSFile(basePath, "dtable2.xls");
// 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, path1);
}
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueSharedPartIndexTerm in project drools-wb by kiegroup.
the class IndexDecisionTableXLSInvalidDrlTest method testIndexDecisionTableXLSInvalidDrl.
@Test
public void testIndexDecisionTableXLSInvalidDrl() 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 files
loadXLSFile(basePath, "bz1269366.xls");
// 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("myRuleFlowGroup", PartType.RULEFLOW_GROUP)).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");
}
}));
}
}
Aggregations