Search in sources :

Example 1 with QueryNotFoundException

use of org.jbpm.services.api.query.QueryNotFoundException in project jbpm by kiegroup.

the class TaskQueryBuilderTest method cleanup.

@After
public void cleanup() {
    if (query != null) {
        try {
            queryService.unregisterQuery(query.getName());
        } catch (QueryNotFoundException e) {
        }
    }
    if (pids != null) {
        for (int i = 0; i < pids.length; ++i) {
            try {
                // let's abort process instance to leave the system in clear
                // state
                long pid = pids[i];
                processService.abortProcessInstance(pid);
                ProcessInstance pi = processService.getProcessInstance(pid);
                assertNull(pi);
            } catch (ProcessInstanceNotFoundException e) {
            // ignore it as it was already completed/aborted
            }
        }
        pids = null;
    }
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            try {
                deploymentService.undeploy(unit);
            } catch (Exception e) {
            // do nothing in case of some failed tests to avoid next
            // test to fail as well
            }
        }
        units.clear();
    }
    close();
}
Also used : QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) After(org.junit.After)

Example 2 with QueryNotFoundException

use of org.jbpm.services.api.query.QueryNotFoundException in project jbpm by kiegroup.

the class UserTaskInstanceWithPotOwnerTest method cleanup.

@After
public void cleanup() {
    System.clearProperty("org.jbpm.ht.callback");
    System.clearProperty("org.jbpm.ht.custom.callback");
    if (query != null) {
        try {
            queryService.unregisterQuery(query.getName());
        } catch (QueryNotFoundException e) {
        }
    }
    if (processInstanceId != null) {
        try {
            // let's abort process instance to leave the system in clear state
            processService.abortProcessInstance(processInstanceId);
            ProcessInstance pi = processService.getProcessInstance(processInstanceId);
            assertNull(pi);
        } catch (ProcessInstanceNotFoundException e) {
        // ignore it as it was already completed/aborted
        }
    }
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            try {
                deploymentService.undeploy(unit);
            } catch (Exception e) {
            // do nothing in case of some failed tests to avoid next test to fail as well
            }
        }
        units.clear();
    }
    close();
}
Also used : QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) After(org.junit.After)

Example 3 with QueryNotFoundException

use of org.jbpm.services.api.query.QueryNotFoundException in project jbpm by kiegroup.

the class QueryServiceEJBIntegrationTest method cleanup.

@After
public void cleanup() {
    if (query != null) {
        try {
            queryService.unregisterQuery(query.getName());
        } catch (QueryNotFoundException e) {
        }
    }
    if (processInstanceId != null) {
        // let's abort process instance to leave the system in clear state
        processService.abortProcessInstance(processInstanceId);
        ProcessInstance pi = processService.getProcessInstance(processInstanceId);
        assertNull(pi);
    }
    int deleted = 0;
    deleted += commandService.execute(new UpdateStringCommand("delete from  NodeInstanceLog nid"));
    deleted += commandService.execute(new UpdateStringCommand("delete from  ProcessInstanceLog pid"));
    deleted += commandService.execute(new UpdateStringCommand("delete from  VariableInstanceLog vsd"));
    deleted += commandService.execute(new UpdateStringCommand("delete from  AuditTaskImpl vsd"));
    deleted += commandService.execute(new UpdateStringCommand("delete from  TaskVariableImpl vsd"));
    System.out.println("Deleted " + deleted);
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            deploymentService.undeploy(unit);
        }
        units.clear();
    }
}
Also used : UpdateStringCommand(org.jbpm.shared.services.impl.commands.UpdateStringCommand) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) After(org.junit.After)

Example 4 with QueryNotFoundException

use of org.jbpm.services.api.query.QueryNotFoundException in project jbpm by kiegroup.

the class QueryServiceImplTest method cleanup.

@After
public void cleanup() {
    System.clearProperty("org.jbpm.ht.callback");
    System.clearProperty("org.jbpm.ht.custom.callback");
    if (query != null) {
        try {
            queryService.unregisterQuery(query.getName());
        } catch (QueryNotFoundException e) {
        }
    }
    if (processInstanceId != null) {
        try {
            // let's abort process instance to leave the system in clear state
            processService.abortProcessInstance(processInstanceId);
            ProcessInstance pi = processService.getProcessInstance(processInstanceId);
            assertNull(pi);
        } catch (ProcessInstanceNotFoundException e) {
        // ignore it as it was already completed/aborted
        }
    }
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            try {
                deploymentService.undeploy(unit);
            } catch (Exception e) {
            // do nothing in case of some failed tests to avoid next test to fail as well
            }
        }
        units.clear();
    }
    close();
}
Also used : QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) After(org.junit.After)

Example 5 with QueryNotFoundException

use of org.jbpm.services.api.query.QueryNotFoundException in project jbpm by kiegroup.

the class QueryServiceImpl method unregisterQuery.

@Override
public void unregisterQuery(final String uniqueQueryName) throws QueryNotFoundException {
    DataSetDef def = dataSetDefRegistry.removeDataSetDef(uniqueQueryName);
    if (def == null) {
        throw new QueryNotFoundException("Query " + uniqueQueryName + " not found");
    }
    logger.info("Unregistered {} query successfully", uniqueQueryName);
}
Also used : DataSetDef(org.dashbuilder.dataset.def.DataSetDef) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException)

Aggregations

QueryNotFoundException (org.jbpm.services.api.query.QueryNotFoundException)6 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)4 DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)4 After (org.junit.After)4 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)4 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)3 DataSet (org.dashbuilder.dataset.DataSet)1 DataSetDef (org.dashbuilder.dataset.def.DataSetDef)1 ColumnFilter (org.dashbuilder.dataset.filter.ColumnFilter)1 AbstractDataSetLookupBuilder (org.dashbuilder.dataset.impl.AbstractDataSetLookupBuilder)1 UpdateStringCommand (org.jbpm.shared.services.impl.commands.UpdateStringCommand)1 AdvancedQueryContext (org.kie.api.runtime.query.AdvancedQueryContext)1