use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder 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);
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexGuidedDecisionTableBRLFragmentConditionsTest method testIndexGuidedDecisionTableBRLFragmentConditions.
@Test
public void testIndexGuidedDecisionTableBRLFragmentConditions() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("dtable1.gdst");
final GuidedDecisionTable52 model = GuidedDecisionTableFactory.makeTableWithBRLFragmentConditionCol("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"));
add(new Import("org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Mortgage"));
}
}, "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(7500);
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);
}
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Mortgage", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexGuidedDecisionTableConditionsTest method testIndexGuidedDecisionTableConditions.
@Test
public void testIndexGuidedDecisionTableConditions() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("dtable1.gdst");
final GuidedDecisionTable52 model = GuidedDecisionTableFactory.makeTableWithConditionCol("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"));
add(new Import("org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Mortgage"));
}
}, "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);
}
{
final Query query = new SingleTermQueryBuilder(new ValueReferenceIndexTerm("org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Mortgage", ResourceType.JAVA)).build();
searchFor(index, query, 1, path);
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder in project drools-wb by kiegroup.
the class IndexGuidedDecisionTableGraphFileTest method testIndexGuidedDecisionTableGraphEntries.
@Test
public void testIndexGuidedDecisionTableGraphEntries() throws IOException, InterruptedException {
// Add test files
final Path path = basePath.resolve("dtable-graph1.gdst-set");
final Path dtable1Path = basePath.resolve("dtable1.gdst");
final Path dtable2Path = basePath.resolve("dtable2.gdst");
final org.uberfire.backend.vfs.Path vfsDtable1Path = Paths.convert(dtable1Path);
final org.uberfire.backend.vfs.Path vfsDtable2Path = Paths.convert(dtable2Path);
final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel();
model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable1Path, vfsDtable1Path));
model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(vfsDtable2Path, vfsDtable2Path));
final String xml = GuidedDTGraphXMLPersistence.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 ValueSharedPartIndexTerm(vfsDtable1Path.toURI(), PartType.PATH)).build();
searchFor(index, query, 1, path);
}
{
final Query query = new SingleTermQueryBuilder(new ValueSharedPartIndexTerm(vfsDtable2Path.toURI(), PartType.PATH)).build();
searchFor(index, query, 1, path);
}
}
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.tdrl");
final String drl = loadText("drl1.tdrl");
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