package org.jbpm.test.performance.scenario;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import org.jbpm.test.performance.jbpm.constant.UserStorage;
import org.jbpm.services.task.impl.factories.TaskFactory;
import org.kie.api.task.TaskService;
import org.kie.api.task.model.Task;

public class PrepareEngine {

    public static List<Long> createNewTasks(boolean start, int count, TaskService taskService) {
        String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
        str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('" + UserStorage.PerfUser.getUserId()
                + "')], businessAdministrators = [ new User('Administrator') ], }),";
        str += "names = [ new I18NText( 'en-UK', 'perf-sample-task')] })";
        List<Long> taskIds = new ArrayList<Long>();
        while (count > 0) {
            Task task = TaskFactory.evalTask(new StringReader(str));
            long taskId = taskService.addTask(task, null);
            taskIds.add(taskId);
            if (start) {
                taskService.start(taskId, UserStorage.PerfUser.getUserId());
            }
            count--;
        }
        return taskIds;
    }

}

package org.jbpm.test.performance.scenario;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

import org.jbpm.test.performance.jbpm.constant.UserStorage;
import org.jbpm.services.task.impl.factories.TaskFactory;
import org.kie.api.task.TaskService;
import org.kie.api.task.model.Task;

public class PrepareEngine {

    public static List<Long> createNewTasks(boolean start, int count, TaskService taskService) {
        String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { deploymentId = 'default-singleton' } ), ";
        str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('" + UserStorage.PerfUser.getUserId()
                + "')], businessAdministrators = [ new User('Administrator') ], }),";
        str += "names = [ new I18NText( 'en-UK', 'perf-sample-task')] })";
        List<Long> taskIds = new ArrayList<Long>();
        while (count > 0) {
            Task task = TaskFactory.evalTask(new StringReader(str));
            long taskId = taskService.addTask(task, null);
            taskIds.add(taskId);
            if (start) {
                taskService.start(taskId, UserStorage.PerfUser.getUserId());
            }
            count--;
        }
        return taskIds;
    }

}

Add deploymentId to task