Search in sources :

Example 1 with FindBpmnProcessIdsQuery

use of org.kie.workbench.common.stunner.bpmn.backend.query.FindBpmnProcessIdsQuery in project kie-wb-common by kiegroup.

the class BpmnFileIndexerTest method getQueries.

protected Set<NamedQuery> getQueries() {
    return new HashSet<NamedQuery>() {

        {
            add(new FindResourcesQuery() {

                @Override
                public ResponseBuilder getResponseBuilder() {
                    return new DefaultResponseBuilder(ioService());
                }
            });
            add(new FindAllChangeImpactQuery() {

                @Override
                public ResponseBuilder getResponseBuilder() {
                    return new DefaultResponseBuilder(ioService());
                }
            });
            add(new FindBpmnProcessIdsQuery() {

                @Override
                public ResponseBuilder getResponseBuilder() {
                    return new FindBpmnProcessIdsQuery.BpmnProcessIdsResponseBuilder(ioService());
                }
            });
        }
    };
}
Also used : FindAllChangeImpactQuery(org.kie.workbench.common.services.refactoring.backend.server.query.standard.FindAllChangeImpactQuery) DefaultResponseBuilder(org.kie.workbench.common.services.refactoring.backend.server.query.response.DefaultResponseBuilder) ResponseBuilder(org.kie.workbench.common.services.refactoring.backend.server.query.response.ResponseBuilder) DefaultResponseBuilder(org.kie.workbench.common.services.refactoring.backend.server.query.response.DefaultResponseBuilder) FindResourcesQuery(org.kie.workbench.common.services.refactoring.backend.server.query.standard.FindResourcesQuery) HashSet(java.util.HashSet) FindBpmnProcessIdsQuery(org.kie.workbench.common.stunner.bpmn.backend.query.FindBpmnProcessIdsQuery)

Example 2 with FindBpmnProcessIdsQuery

use of org.kie.workbench.common.stunner.bpmn.backend.query.FindBpmnProcessIdsQuery in project kie-wb-common by kiegroup.

the class FindBpmnProcessIdsQueryTest method findBpmnProcessIdsQueryTermsTest.

@Test
public void findBpmnProcessIdsQueryTermsTest() {
    FindBpmnProcessIdsQuery query = new FindBpmnProcessIdsQuery();
    Set<ValueIndexTerm> queryTerms = new HashSet<>();
    try {
        query.validateTerms(queryTerms);
        fail("The required resources term is missing, but no exception was thrown.");
    } catch (IllegalArgumentException iae) {
        assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains("Expected 'ValueResourceIndexTerm' term was not found."));
    }
    queryTerms = new HashSet<>();
    queryTerms.add(new ValueResourceIndexTerm("not-bpmn2-resources", ResourceType.JAVA));
    try {
        query.validateTerms(queryTerms);
        fail("The required resources term is missing, but no exception was thrown.");
    } catch (IllegalArgumentException iae) {
        assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains(ERROR_MSG));
    }
    queryTerms = new HashSet<>();
    queryTerms.add(new ValueResourceIndexTerm("*", ResourceType.BPMN2, ValueIndexTerm.TermSearchType.WILDCARD));
    try {
        query.validateTerms(queryTerms);
    } catch (IllegalArgumentException iae) {
        fail("The activation term is acceptable here, but an exception was thrown.");
    }
}
Also used : ValueResourceIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueResourceIndexTerm) ValueIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm) FindBpmnProcessIdsQuery(org.kie.workbench.common.stunner.bpmn.backend.query.FindBpmnProcessIdsQuery) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

HashSet (java.util.HashSet)2 FindBpmnProcessIdsQuery (org.kie.workbench.common.stunner.bpmn.backend.query.FindBpmnProcessIdsQuery)2 Test (org.junit.Test)1 DefaultResponseBuilder (org.kie.workbench.common.services.refactoring.backend.server.query.response.DefaultResponseBuilder)1 ResponseBuilder (org.kie.workbench.common.services.refactoring.backend.server.query.response.ResponseBuilder)1 FindAllChangeImpactQuery (org.kie.workbench.common.services.refactoring.backend.server.query.standard.FindAllChangeImpactQuery)1 FindResourcesQuery (org.kie.workbench.common.services.refactoring.backend.server.query.standard.FindResourcesQuery)1 ValueIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm)1 ValueResourceIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueResourceIndexTerm)1