/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.test.api.task;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.UserGroupLookupProxy;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.history.HistoryLevel;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.activiti.engine.impl.persistence.entity.VariableInstanceEntity;
import org.activiti.engine.impl.test.PluggableActivitiTestCase;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.DelegationState;
import org.activiti.engine.task.IdentityLinkType;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import org.activiti.engine.test.Deployment;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.mockito.Mockito;
/**
*/
public class TaskQueryTest extends PluggableActivitiTestCase {
private List<String> taskIds;
private static final String KERMIT = "kermit";
private static final List<String> KERMITSGROUPS = Arrays.asList("management","accountancy");
private static final String GONZO = "gonzo";
private static final List<String> GONZOSGROUPS = Arrays.asList();
private static final String FOZZIE = "fozzie";
private static final List<String> FOZZIESGROUPS = Arrays.asList("management");
private UserGroupLookupProxy userGroupLookupProxy = Mockito.mock(UserGroupLookupProxy.class);
public void setUp() throws Exception {
ProcessEngineConfigurationImpl engineConfiguration = (ProcessEngineConfigurationImpl)cachedProcessEngine.getProcessEngineConfiguration();
engineConfiguration.setUserGroupLookupProxy(userGroupLookupProxy);
taskIds = generateTestTasks();
}
public void tearDown() throws Exception {
taskService.deleteTasks(taskIds, true);
}
public void testBasicTaskPropertiesNotNull() {
Task task = taskService.createTaskQuery().taskId(taskIds.get(0)).singleResult();
assertNotNull(task.getDescription());
assertNotNull(task.getId());
assertNotNull(task.getName());
assertNotNull(task.getCreateTime());
}
public void testQueryNoCriteria() {
TaskQuery query = taskService.createTaskQuery();
assertEquals(12, query.count());
assertEquals(12, query.list().size());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
public void testQueryByTaskId() {
TaskQuery query = taskService.createTaskQuery().taskId(taskIds.get(0));
assertNotNull(query.singleResult());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
public void testQueryByTaskIdOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId(taskIds.get(0)).taskName("INVALID NAME").endOr();
assertNotNull(query.singleResult());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
public void testQueryByInvalidTaskId() {
TaskQuery query = taskService.createTaskQuery().taskId("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().taskId(null);
fail("expected exception");
} catch (ActivitiIllegalArgumentException e) {
// OK
}
}
public void testQueryByInvalidTaskIdOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskName("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().taskId(null);
fail("expected exception");
} catch (ActivitiIllegalArgumentException e) {
// OK
}
}
public void testQueryByName() {
TaskQuery query = taskService.createTaskQuery().taskName("testTask");
assertEquals(6, query.list().size());
assertEquals(6, query.count());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
public void testQueryByNameOr() {
TaskQuery query = taskService.createTaskQuery().or().taskName("testTask").taskId("invalid");
assertEquals(6, query.list().size());
assertEquals(6, query.count());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
public void testQueryByInvalidName() {
TaskQuery query = taskService.createTaskQuery().taskName("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().or().taskId("invalid").taskName(null).singleResult();
fail("expected exception");
} catch (ActivitiIllegalArgumentException e) {
// OK
}
}
public void testQueryByInvalidNameOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskName("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().or().taskId("invalid").taskName(null).singleResult();
fail("expected exception");
} catch (ActivitiIllegalArgumentException e) {
// OK
}
}
public void testQueryByNameIn() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("testTask");
taskNameList.add("gonzoTask");
TaskQuery query = taskService.createTaskQuery().taskNameIn(taskNameList);
assertEquals(7, query.list().size());
assertEquals(7, query.count());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
public void testQueryByNameInIgnoreCase() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("testtask");
taskNameList.add("gonzotask");
TaskQuery query = taskService.createTaskQuery().taskNameInIgnoreCase(taskNameList);
assertEquals(7, query.list().size());
assertEquals(7, query.count());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
public void testQueryByNameInOr() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("testTask");
taskNameList.add("gonzoTask");
TaskQuery query = taskService.createTaskQuery().or().taskNameIn(taskNameList).taskId("invalid");
assertEquals(7, query.list().size());
assertEquals(7, query.count());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
public void testQueryByNameInIgnoreCaseOr() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("testtask");
taskNameList.add("gonzotask");
TaskQuery query = taskService.createTaskQuery().or().taskNameInIgnoreCase(taskNameList).taskId("invalid");
assertEquals(7, query.list().size());
assertEquals(7, query.count());
try {
query.singleResult();
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Activiti是一个轻量级的工作流程,面向商务人士,开发人员和系统管理员的业务流程管理(BPM)平台。其核心是用于Java的超快速且坚如磐石的BPMN 2流程引擎。它是开源的,并在Apache许可证下分发。 Activiti可以在任何Java应用程序,服务器,集群或... http://www.activiti.org上运行
资源推荐
资源详情
资源评论
收起资源包目录
Activiti2017最新版本示例(Activiti BPMN 2.0 Platform) (3855个子文件)
testInvoiceProcessSignavio.bpmn 33KB
othertoolimport.bpmn 18KB
testInvoiceProcessFromBusinessProcessIncubator.bpmn 14KB
completemodel.bpmn 13KB
TerminateEndEventTest.testTerminateInSubProcessSequentialConcurrentMultiInstance.bpmn 10KB
TerminateEndEventTest.testTerminateInSubProcessConcurrentMultiInstance.bpmn 10KB
TerminateEndEventTest.testTerminateInSubProcessWithBoundary.bpmn 9KB
TerminateEndEventTest.testTerminateInSubProcessConcurrent.bpmn 9KB
scopedmodel.bpmn 8KB
notexecutablemodel.bpmn 8KB
simplemodel.bpmn 8KB
valueddataobjectmodel.bpmn 7KB
testProcessFromIboPrometheus.bpmn 7KB
subprocessmodel_with_extensions.bpmn 7KB
TerminateEndEventTest.testTerminateWithSubProcess.bpmn 7KB
parsing_error_on_extension_elements.bpmn 7KB
subprocessmodel.bpmn 6KB
TerminateEndEventTest.testTerminateInSubProcessMultiInstance.bpmn 6KB
valueddataobjectmodel_with_extensions.bpmn 6KB
TerminateEndEventTest.testTerminateInSubProcess.bpmn 6KB
act1623-processTwo.bpmn 6KB
dataobjectmodel.bpmn 6KB
testProcessFromAdonis.bpmn 6KB
subprocessmultidiagrammodel.bpmn 6KB
customextensionsmodel.bpmn 6KB
formPropertiesProcess.bpmn 5KB
TerminateEndEventTest.testTerminateInCallActivityMulitInstance.bpmn 5KB
TerminateEndEventTest.testTerminateInCallActivityConcurrentMulitInstance.bpmn 5KB
TerminateEndEventTest.testTerminateWithCallActivity.bpmn 5KB
TerminateEndEventTest.testCancelActivity.bpmn 5KB
TerminateEndEventTest.testProcessTerminate.bpmn 5KB
TerminateEndEventTest.testTerminateInCallActivityConcurrent.bpmn 5KB
TerminateEndEventTest.testTerminateInCallActivity.bpmn 5KB
subprocessmodel_autolayout.bpmn 5KB
testProcessWithTask.bpmn 5KB
RepositoryServiceTest.testGetBpmnModel.bpmn 5KB
usertaskmodel.bpmn 5KB
TerminateEndEventTest.testTerminateInCallActivityConcurrentCallActivity.bpmn 4KB
TerminateEndEventTest.subProcessConcurrentTerminate.bpmn 4KB
testProcessFromYaoqiang.bpmn 4KB
signaltest.bpmn 4KB
TerminateEndEventTest.testTerminateInExclusiveGatewayWithMultiInstanceSubProcess.bpmn 4KB
pools.bpmn 4KB
act1623-processOne.bpmn 3KB
servicetaskmodel.bpmn 3KB
subprocessmodel-noDI.bpmn 3KB
testSequenceFlowOutOfBounds.bpmn 3KB
TerminateEndEventTest.testTerminateInExclusiveGatewayWithCallActivity.bpmn 3KB
testStartAndEndEventWithNegativeCoordinates.bpmn 3KB
testProcessFromCamundaFoxDesigner.bpmn 3KB
callactivity.bpmn 3KB
eventgatewaymodel.bpmn 3KB
subprocessmultidiagrammodel-noDI.bpmn 3KB
chinese.bpmn 3KB
chinese.bpmn 3KB
TerminateEndEventTest.subProcessNoTerminate.bpmn 2KB
AsyncErrorProcess.bpmn 2KB
RollbackProcess.bpmn 2KB
BpmnParseTest.testParseCollaborationPlane.bpmn 2KB
TerminateEndEventTest.testTerminateInParentProcess.bpmn 2KB
datastore.bpmn 2KB
TerminateEndEventTest.subProcessTerminate.bpmn 2KB
mapExceptionModel.bpmn 2KB
messageflow.bpmn 2KB
testStartEventWithNegativeCoordinates.bpmn 2KB
SimpleProcess.bpmn 2KB
customnamespaceattributemodel.bpmn 1KB
timerCalendarDefinition.bpmn 1KB
mapExceptionInvalidHasChildrenModel.bpmn 1KB
mapExceptionNoExceptionClass.bpmn 1KB
mapExceptionNoErrorCode.bpmn 1KB
asyncendeventmodel.bpmn 1KB
TerminateEndEventTest.testTerminateAfterUserTask.bpmn 1KB
incompletesignalmodel.bpmn 858B
encoding.bpmn 848B
message.bpmn 773B
empty.bpmn 0B
simpleRule1.drl 359B
request.form 1KB
adjustRequest.form 1KB
approve.form 492B
task.form 38B
start.form 18B
.gitignore 189B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
.gitignore 158B
共 3855 条
- 1
- 2
- 3
- 4
- 5
- 6
- 39
资源评论
- dirk9172017-11-22请问从哪可以运行?
- playboxer2018-01-16很好。入门用
atgoingguoat
- 粉丝: 6
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功