use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm 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.rdrl");
final String drl1 = loadText("drl3.rdrl");
ioService().write(path1, drl1);
final Path path2 = basePath.resolve("drl4.rdrl");
final String drl2 = loadText("drl4.rdrl");
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.rule.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.rule.backend.server.indexing.classes.Mortgage", ResourceType.JAVA)).build();
searchFor(index, query, 1, path2);
}
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm 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.rdrl");
final String drl1 = loadText("drl1.rdrl");
ioService().write(path1, drl1);
final Path path2 = basePath.resolve("drl2.rdrl");
final String drl2 = loadText("drl2.rdrl");
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.rule.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.model.index.terms.valueterms.ValueReferenceIndexTerm in project drools-wb by kiegroup.
the class IndexGuidedRuleTemplateActionsTest method testIndexGuidedRuleTemplateActions.
@Test
public void testIndexGuidedRuleTemplateActions() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("template1.template");
final TemplateModel model = GuidedRuleTemplateFactory.makeModelWithActions("org.drools.workbench.screens.guided.template.server.indexing", new ArrayList<Import>() {
{
add(new Import("org.drools.workbench.screens.guided.template.server.indexing.classes.Applicant"));
add(new Import("org.drools.workbench.screens.guided.template.server.indexing.classes.Mortgage"));
}
}, "template1");
final String xml = RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
ioService().write(path, xml);
// 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.template.server.indexing.classes.Applicant", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.template.server.indexing.classes.Mortgage", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm in project drools-wb by kiegroup.
the class IndexGuidedRuleTemplateConditionsTest method testIndexGuidedRuleTemplateConditions.
@Test
public void testIndexGuidedRuleTemplateConditions() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("template1.template");
final TemplateModel model = GuidedRuleTemplateFactory.makeModelWithConditions("org.drools.workbench.screens.guided.template.server.indexing", new ArrayList<Import>() {
{
add(new Import("org.drools.workbench.screens.guided.template.server.indexing.classes.Applicant"));
add(new Import("org.drools.workbench.screens.guided.template.server.indexing.classes.Mortgage"));
}
}, "template1");
final String xml = RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
ioService().write(path, xml);
// 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.template.server.indexing.classes.Applicant", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.template.server.indexing.classes.Mortgage", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm in project drools-wb by kiegroup.
the class IndexGuidedDecisionTableActionsTest method testIndexGuidedDecisionTableActions.
@Test
public void testIndexGuidedDecisionTableActions() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("dtable1.gdst");
final GuidedDecisionTable52 model = GuidedDecisionTableFactory.makeTableWithActionCol("org.drools.workbench.screens.guided.dtable.backend.server.indexing", new ArrayList<Import>() {
{
add(new Import("org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Applicant"));
}
}, "dtable1");
final String xml = GuidedDTXMLPersistence.getInstance().marshal(model);
ioService().write(path, xml);
// 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.dtable.backend.server.indexing.classes.Applicant", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
}
Aggregations