TSK-511 Add transaction slicing to job runner

This commit is contained in:
BerndBreier 2018-06-07 14:52:42 +02:00 committed by Holger Hagen
parent ae9f00ddc4
commit 169ad0d718
4 changed files with 30 additions and 3 deletions

View File

@ -7,6 +7,7 @@ package pro.taskana;
* @param <T>
* the type of the returned objects.
*/
@FunctionalInterface
public interface TaskanaTransactionProvider<T> {
T executeInTransaction(TaskanaCallable<T> action);

View File

@ -105,6 +105,9 @@ public class Job {
public void setErrors(String errors) {
this.errors = errors;
if (this.errors != null && this.errors.length() > 4096) {
this.errors = errors.substring(0, 4095);
}
}
@Override

View File

@ -8,5 +8,5 @@ taskana.domains= Domain_A , DOMAIN_B
taskana.classification.types= TASK , document
taskana.classification.categories= EXTERNAL , manual, autoMAtic ,Process
taskana.job.max.task.updates.per.transaction=5
taskana.job.max.task.updates.per.transaction=50
taskana.job.max.retries.for.failed.task.updates=3

View File

@ -13,14 +13,17 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.SQLException;
import java.util.Collections;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.PagedResources;
@ -40,15 +43,31 @@ import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import pro.taskana.exceptions.SystemException;
import pro.taskana.rest.resource.TaskSummaryResource;
import pro.taskana.sampledata.SampleDataGenerator;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"devMode=true"})
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"devMode=true"})
public class TaskControllerIntTest {
@LocalServerPort
int port;
@Autowired
private DataSource dataSource;
public void resetDb() {
SampleDataGenerator sampleDataGenerator;
try {
sampleDataGenerator = new SampleDataGenerator(dataSource);
sampleDataGenerator.generateSampleData();
} catch (SQLException e) {
throw new SystemException("tried to reset DB and caught Exception " + e, e);
}
}
@Test
public void testGetAllTasks() {
RestTemplate template = getRestTemplate();
@ -194,6 +213,8 @@ public class TaskControllerIntTest {
@Test
public void testGetLastPageSortedByDueWithHiddenTasksRemovedFromResult() {
resetDb(); // required because ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
// tasks and this test depends on the tasks as they are in sampledata
RestTemplate template = getRestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
@ -232,6 +253,8 @@ public class TaskControllerIntTest {
@Test
public void testGetQueryByPorSecondPageSortedByType() {
resetDb(); // required because ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
// tasks and this test depends on the tasks as they are in sampledata
RestTemplate template = getRestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");