TSK-1407: taskana-simplehistory-rest-spring now using provided test util classes from taskana-common-test

This commit is contained in:
Mustapha Zorgati 2020-10-11 16:29:56 +02:00
parent 49c0751e8b
commit 3a6f3dea87
19 changed files with 187 additions and 481 deletions

View File

@ -18,7 +18,6 @@ import java.util.stream.Stream;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.ibatis.jdbc.RuntimeSqlException; import org.apache.ibatis.jdbc.RuntimeSqlException;
import org.apache.ibatis.jdbc.ScriptRunner; import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.jdbc.SqlRunner;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -29,17 +28,14 @@ public class SampleDataGenerator {
private static final String CACHED_TEST = "TEST"; private static final String CACHED_TEST = "TEST";
private static final String CACHED_SAMPLE = "SAMPLE"; private static final String CACHED_SAMPLE = "SAMPLE";
private static final String CACHED_EVENTSAMPLE = "EVENTSAMPLE";
private static final String CACHED_MONITOR = "MONITOR"; private static final String CACHED_MONITOR = "MONITOR";
private static final String CACHED_CLEARDB = "CLEARDB"; private static final String CACHED_CLEAR_DB = "CLEARDB";
private static final String CACHED_DROPDB = "DROPDB"; private static final String CACHED_DROP_DB = "DROP_DB";
private static HashMap<String, List<String>> cachedScripts = new HashMap<>(); private static final HashMap<String, List<String>> CACHED_SCRIPTS = new HashMap<>();
private final DataSource dataSource; private final DataSource dataSource;
private final ZonedDateTime now; private final ZonedDateTime now;
/** // This value cannot be automatically obtained by connection.getSchema(), because setting not yet
* This value cannot be automatically obtained by connection.getSchema(), because setting not yet // existing schema will result into an SQL Exception.
* existing schema will result into an SQL Exception.
*/
private final String schema; private final String schema;
public SampleDataGenerator(DataSource dataSource, String schema) { public SampleDataGenerator(DataSource dataSource, String schema) {
@ -54,21 +50,9 @@ public class SampleDataGenerator {
public void generateSampleData() { public void generateSampleData() {
LOGGER.debug("entry to generateSampleData()"); LOGGER.debug("entry to generateSampleData()");
runScripts( clearDb();
(runner) -> { Stream<String> scripts = SampleDataProvider.getSampleDataCreationScripts();
clearDb(); executeAndCacheScripts(scripts, CACHED_SAMPLE);
Stream<String> scripts;
String cacheKey;
// dbtable constants?
if (tableExists("TASK_HISTORY_EVENT")) {
scripts = SampleDataProvider.getScriptsWithEvents();
cacheKey = CACHED_EVENTSAMPLE;
} else {
scripts = SampleDataProvider.getSampleDataCreationScripts();
cacheKey = CACHED_SAMPLE;
}
executeAndCacheScripts(scripts, cacheKey);
});
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("exit from generateSampleData()"); LOGGER.debug("exit from generateSampleData()");
} }
@ -93,30 +77,17 @@ public class SampleDataGenerator {
public void clearDb() { public void clearDb() {
LOGGER.debug("entry to clearDb()"); LOGGER.debug("entry to clearDb()");
Stream<String> scripts = SampleDataProvider.getScriptsToClearDatabase(); Stream<String> scripts = SampleDataProvider.getScriptsToClearDatabase();
executeAndCacheScripts(scripts, CACHED_CLEARDB); executeAndCacheScripts(scripts, CACHED_CLEAR_DB);
LOGGER.debug("exit from clearDb()"); LOGGER.debug("exit from clearDb()");
} }
public void dropDb() { public void dropDb() {
LOGGER.debug("entry to dropDb()"); LOGGER.debug("entry to dropDb()");
Stream<String> scripts = SampleDataProvider.getScriptsToDropDatabase(); Stream<String> scripts = SampleDataProvider.getScriptsToDropDatabase();
executeAndCacheScripts(scripts, CACHED_DROPDB); executeAndCacheScripts(scripts, CACHED_DROP_DB);
LOGGER.debug("exit from dropDb()"); LOGGER.debug("exit from dropDb()");
} }
boolean tableExists(String table) {
try (Connection connection = dataSource.getConnection()) {
connection.setSchema(schema);
SqlRunner runner = new SqlRunner(connection);
String tableSafe = SqlReplacer.getSanitizedTableName(table);
String query = "SELECT 1 FROM " + tableSafe + " LIMIT 1;";
runner.run(query);
return true;
} catch (RuntimeSqlException | SQLException e) {
return false;
}
}
private List<String> parseScripts(Stream<String> scripts) { private List<String> parseScripts(Stream<String> scripts) {
try (Connection connection = dataSource.getConnection()) { try (Connection connection = dataSource.getConnection()) {
String dbProductName = connection.getMetaData().getDatabaseProductName(); String dbProductName = connection.getMetaData().getDatabaseProductName();
@ -156,7 +127,7 @@ public class SampleDataGenerator {
LOGGER.debug("entry to executeAndCacheScripts(scripts = {}, cacheKey = {})", scripts, cacheKey); LOGGER.debug("entry to executeAndCacheScripts(scripts = {}, cacheKey = {})", scripts, cacheKey);
runScripts( runScripts(
runner -> runner ->
cachedScripts.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream() CACHED_SCRIPTS.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream()
.map(s -> s.getBytes(StandardCharsets.UTF_8)) .map(s -> s.getBytes(StandardCharsets.UTF_8))
.map(ByteArrayInputStream::new) .map(ByteArrayInputStream::new)
.map(s -> new InputStreamReader(s, StandardCharsets.UTF_8)) .map(s -> new InputStreamReader(s, StandardCharsets.UTF_8))
@ -174,6 +145,7 @@ public class SampleDataGenerator {
connection.setSchema(schema); connection.setSchema(schema);
runner.setLogWriter(logWriter); runner.setLogWriter(logWriter);
runner.setErrorLogWriter(errorLogWriter); runner.setErrorLogWriter(errorLogWriter);
runner.setStopOnError(true);
return runner; return runner;
} }
} }

View File

@ -43,11 +43,8 @@ public final class SampleDataProvider {
SAMPLE_TASK_COMMENT, SAMPLE_TASK_COMMENT,
SAMPLE_ATTACHMENT, SAMPLE_ATTACHMENT,
SAMPLE_WORKBASKET_ACCESS_LIST, SAMPLE_WORKBASKET_ACCESS_LIST,
SAMPLE_OBJECT_REFERENCE); SAMPLE_OBJECT_REFERENCE,
} SAMPLE_TASK_HISTORY_EVENT);
static Stream<String> getScriptsWithEvents() {
return Stream.concat(getSampleDataCreationScripts(), Stream.of(SAMPLE_TASK_HISTORY_EVENT));
} }
static Stream<String> getScriptsToClearDatabase() { static Stream<String> getScriptsToClearDatabase() {

View File

@ -24,10 +24,6 @@ final class SqlReplacer {
return parseAndReplace(getScriptBufferedStream(scriptPath), now, dbProductName); return parseAndReplace(getScriptBufferedStream(scriptPath), now, dbProductName);
} }
static boolean isPostgreSql(String databaseProductName) {
return "PostgreSQL".equals(databaseProductName);
}
static boolean isDb2(String dbProductName) { static boolean isDb2(String dbProductName) {
return dbProductName != null && dbProductName.contains("DB2"); return dbProductName != null && dbProductName.contains("DB2");
} }

View File

@ -1,47 +1,46 @@
INSERT INTO TASK_HISTORY_EVENT (ID, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS) VALUES -- TASK_HISTORY_EVENT TABLE (ID , BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID , EVENT_TYPE, CREATED , USER_ID , DOMAIN , WORKBASKET_KEY , POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 , DETAILS );
-- BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY , POR_SYSTEM, POR_INSTANCE , POR_TYPE , POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY , ATTACHMENT_CLASSIFICATION_KEY , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4 INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000000', 'BPI:01' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', 'L140101' , 'TASK' , '' , 'old_val12', 'new_val12', 'custom1', 'custom2', 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000000', 'BPI:01' ,'', 'TKI:000000000000000000000000000000000000', 'CREATED', RELATIVE_DATE(0) , 'USER-2-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' ,' L140101' , 'TASK' ,'' ,'old_val12' ,'new_val12' ,'custom1' ,'custom2' , 'custom3' ,'custom4', 'some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000001', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-2), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000001', 'BPI:02' ,'', 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000002', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000002', 'BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000003', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000003', 'BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000004', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000004', 'BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000005', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000005', 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000006', 'BPI:06' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000006', 'BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000007', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000007', 'BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000008', 'BPI:04' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000008', 'BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000009', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000009','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000010', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000010','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000011', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000011','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000012', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000012','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000013', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000013','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000014', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000014','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000015', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000015','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000016', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000016','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000017', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000017','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000018', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000018','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000019', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000019','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000020', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000020','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000021', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000021','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000022', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000022','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000023', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000023','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000024', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000024','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000025', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000025','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000026', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000026','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000027', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000027','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000028', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000028','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000029', 'BPI:03' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000029','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000030', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000030','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000031', 'BPI:05' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000031','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000032', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000032','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000033', 'BPI:06' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000033','BPI:06' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000034', 'BPI:02' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'CREATED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000034','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000035', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000035','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000036', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000036','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000037', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000037','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000038', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000038','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000039', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000039','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000040', 'BPI:06' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000040','BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000041', 'BPI:02' , '' , 'TKI:000000000000000000000000000000000000', 'UPDATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000041','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000042', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000042','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000043', 'BPI:04' , '' , 'TKI:000000000000000000000000000000000000', 'CREATED' , RELATIVE_DATE(-1), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344', '' , '' , '' , '2old_val' , 'new_val2' , 'custom1', '' , 'custom3', 'custom4', 'some Details');
('THI:000000000000000000000000000000000043','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', RELATIVE_DATE(0), 'USER-1-2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'), INSERT INTO TASK_HISTORY_EVENT VALUES ('HEI:000000000000000000000000000000000044', 'BPI:03' , 'BPI:01' , 'TKI:000000000000000000000000000000000001', 'DELETED' , RELATIVE_DATE(0) , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' , 'DOCTYPE_DEFAULT' , '' , '' , 'custom1', '' , 'custom3', '' , 'some Details');
('THI:000000000000000000000000000000000044','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', RELATIVE_DATE(0) , 'USER-2-1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details');

View File

@ -10,19 +10,17 @@ class SampleDataProviderTest {
@Test @Test
void getScriptsNotNull() { void getScriptsNotNull() {
assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotNull(); assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotNull();
assertThat(SampleDataProvider.getScriptsWithEvents()).isNotNull();
} }
@Test @Test
void getScriptsNotEmpty() { void getScriptsNotEmpty() {
assertThat(SampleDataProvider.getSampleDataCreationScripts().count() > 0).isTrue(); assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotEmpty();
assertThat(SampleDataProvider.getScriptsWithEvents().count() > 0).isTrue();
} }
@Test @Test
void getScriptsFileExists() { void getScriptsFileExists() {
SampleDataProvider.getSampleDataCreationScripts() assertThat(SampleDataProvider.getSampleDataCreationScripts())
.map(SqlReplacer::getScriptBufferedStream) .extracting(SqlReplacer::getScriptBufferedStream)
.forEach(script -> assertThat(script).isNotNull()); .doesNotContainNull();
} }
} }

View File

@ -5,8 +5,9 @@ import java.util.UUID;
/** This class contains util methods for generating ids. */ /** This class contains util methods for generating ids. */
public final class IdGenerator { public final class IdGenerator {
private static final String SEPERATOR = ":"; private static final String SEPARATOR = ":";
// disable initialization
private IdGenerator() {} private IdGenerator() {}
/** /**
@ -16,10 +17,6 @@ public final class IdGenerator {
* @return a String with a length of 40 characters * @return a String with a length of 40 characters
*/ */
public static String generateWithPrefix(String prefix) { public static String generateWithPrefix(String prefix) {
return new StringBuilder() return prefix + SEPARATOR + UUID.randomUUID();
.append(prefix)
.append(SEPERATOR)
.append(UUID.randomUUID().toString())
.toString();
} }
} }

View File

@ -53,58 +53,63 @@
</dependency> </dependency>
<!-- test dependencies --> <!-- test dependencies -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>pro.taskana</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>taskana-common-test</artifactId>
<scope>test</scope> <version>${project.version}</version>
</dependency> <scope>test</scope>
<dependency> </dependency>
<groupId>org.springframework.boot</groupId> <dependency>
<artifactId>spring-boot-starter-jdbc</artifactId> <groupId>org.springframework.boot</groupId>
<scope>test</scope> <artifactId>spring-boot-starter-web</artifactId>
</dependency> <scope>test</scope>
<dependency> </dependency>
<groupId>com.h2database</groupId> <dependency>
<artifactId>h2</artifactId> <groupId>org.springframework.boot</groupId>
<scope>test</scope> <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency> <scope>test</scope>
<dependency> </dependency>
<groupId>org.springframework.plugin</groupId> <dependency>
<artifactId>spring-plugin-core</artifactId> <groupId>com.h2database</groupId>
<version>${version.spring.core}</version> <artifactId>h2</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<dependency> <groupId>org.springframework.plugin</groupId>
<groupId>org.assertj</groupId> <artifactId>spring-plugin-core</artifactId>
<artifactId>assertj-core</artifactId> <version>${version.spring.core}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.assertj</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>assertj-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>spring-test</artifactId> <artifactId>junit-jupiter</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-boot-test</artifactId> <artifactId>spring-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.restdocs</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-restdocs-core</artifactId> <artifactId>spring-boot-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.restdocs</groupId> <groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId> <artifactId>spring-restdocs-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>

View File

@ -6,11 +6,10 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl; import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
import pro.taskana.simplehistory.rest.assembler.TaskHistoryEventRepresentationModelAssembler;
/** Configuration for Taskana history REST service. */ /** Configuration for Taskana history REST service. */
@Configuration @Configuration
@ComponentScan({"pro.taskana", "pro.taskana.simplehistory.rest"}) @ComponentScan("pro.taskana")
@EnableTransactionManagement @EnableTransactionManagement
public class TaskHistoryRestConfiguration { public class TaskHistoryRestConfiguration {
@ -18,9 +17,4 @@ public class TaskHistoryRestConfiguration {
public SimpleHistoryServiceImpl getSimpleHistoryService() { public SimpleHistoryServiceImpl getSimpleHistoryService() {
return new SimpleHistoryServiceImpl(); return new SimpleHistoryServiceImpl();
} }
@Bean
public TaskHistoryEventRepresentationModelAssembler getTaskHistoryEventResourceAssembler() {
return new TaskHistoryEventRepresentationModelAssembler();
}
} }

View File

@ -5,6 +5,7 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
import org.springframework.hateoas.server.RepresentationModelAssembler; import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.lang.NonNull; import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import pro.taskana.common.api.exceptions.SystemException; import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.simplehistory.rest.TaskHistoryEventController; import pro.taskana.simplehistory.rest.TaskHistoryEventController;
@ -13,6 +14,7 @@ import pro.taskana.spi.history.api.events.task.TaskHistoryCustomField;
import pro.taskana.spi.history.api.events.task.TaskHistoryEvent; import pro.taskana.spi.history.api.events.task.TaskHistoryEvent;
/** Transforms any {@link TaskHistoryEvent} into its {@link TaskHistoryEventRepresentationModel}. */ /** Transforms any {@link TaskHistoryEvent} into its {@link TaskHistoryEventRepresentationModel}. */
@Component
public class TaskHistoryEventRepresentationModelAssembler public class TaskHistoryEventRepresentationModelAssembler
implements RepresentationModelAssembler<TaskHistoryEvent, TaskHistoryEventRepresentationModel> { implements RepresentationModelAssembler<TaskHistoryEvent, TaskHistoryEventRepresentationModel> {

View File

@ -1,80 +0,0 @@
package pro.taskana.simplehistory.rest.sampledata;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pro.taskana.common.internal.configuration.DB;
/** This class generates sample data for manual testing purposes. */
public class SampleDataGenerator {
private static final Logger LOGGER = LoggerFactory.getLogger(SampleDataGenerator.class);
private static final String TEST_DATA = "/sql.sample-data";
private static final String CLEAR = TEST_DATA + "/clear-db.sql";
private static final String TASK_HISTORY_EVENT = TEST_DATA + "/task-history-event.sql";
DataSource dataSource;
String dbProductName;
public SampleDataGenerator(DataSource dataSource) throws SQLException {
try (Connection connection = dataSource.getConnection()) {
dbProductName = connection.getMetaData().getDatabaseProductName();
if (LOGGER.isTraceEnabled()) {
String msg = connection.getMetaData().toString();
LOGGER.trace(msg);
}
}
this.dataSource = dataSource;
}
public void generateSampleData(String schemaName) {
final StringWriter outWriter = new StringWriter();
final PrintWriter logWriter = new PrintWriter(outWriter);
final StringWriter errorWriter = new StringWriter();
final PrintWriter errorLogWriter = new PrintWriter(errorWriter);
try (Connection connection = dataSource.getConnection()) {
ScriptRunner runner = new ScriptRunner(connection);
runner.runScript(selectSchemaScript(dbProductName, schemaName));
runner.setStopOnError(false);
runner.runScript(
new BufferedReader(
new InputStreamReader(
SampleDataGenerator.class.getResourceAsStream(CLEAR), StandardCharsets.UTF_8)));
runner.setStopOnError(true);
runner.setLogWriter(logWriter);
runner.setErrorLogWriter(errorLogWriter);
runner.runScript(
new BufferedReader(
new InputStreamReader(
SampleDataGenerator.class.getResourceAsStream(TASK_HISTORY_EVENT),
StandardCharsets.UTF_8)));
} catch (Exception e) {
LOGGER.error("caught Exception {}", e, e);
}
LOGGER.trace(outWriter.toString());
if (!errorWriter.toString().trim().isEmpty()) {
LOGGER.error(errorWriter.toString());
}
}
private StringReader selectSchemaScript(String dbProductName, String schemaName) {
return new StringReader(
DB.isPostgreSql(dbProductName)
? "SET search_path TO " + schemaName + ";"
: "SET SCHEMA " + schemaName + ";");
}
}

View File

@ -1,2 +0,0 @@
logging.level.pro.taskana=INFO
taskana.schemaName=TASKANA

View File

@ -1,3 +0,0 @@
-- the order is important!
DELETE FROM TASK_HISTORY_EVENT;
COMMIT;

View File

@ -1,3 +0,0 @@
DROP TABLE TASK_HISTORY_EVENT;
COMMIT;

View File

@ -1,47 +0,0 @@
INSERT INTO TASK_HISTORY_EVENT (ID, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY, ATTACHMENT_CLASSIFICATION_KEY, OLD_VALUE, NEW_VALUE, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, DETAILS) VALUES
-- BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, TASK_ID, EVENT_TYPE, CREATED, USER_ID, DOMAIN, WORKBASKET_KEY, POR_COMPANY , POR_SYSTEM, POR_INSTANCE , POR_TYPE , POR_VALUE , TASK_CLASSIFICATION_KEY, TASK_CLASSIFICATION_CATEGORY , ATTACHMENT_CLASSIFICATION_KEY , OLD_VALUE , NEW_VALUE , CUSTOM_1 , CUSTOM_2 , CUSTOM_3 , CUSTOM_4
('HEI:000000000000000000000000000000000000','BPI:01' ,'', 'TKI:000000000000000000000000000000000000', 'CREATED', CURRENT_TIMESTAMP , 'USER_2_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' ,' L140101' , 'TASK' ,'' ,'old_val12' ,'new_val12' ,'custom1' ,'custom2' , 'custom3' ,'custom4', 'some Details'),
('HEI:000000000000000000000000000000000001','BPI:02' ,'', 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -2, CURRENT_TIMESTAMP ), 'USER_1_1', 'DOMAIN_A', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '65464564' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000002','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000003','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000004','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000005','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000006','BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000007','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000008','BPI:04' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000009','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000010','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000011','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000012','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000013','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000014','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000015','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000016','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000017','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000018','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000019','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000020','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000021','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000022','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000023','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000024','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000025','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000026','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000027','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000028','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000029','BPI:03' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000030','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000031','BPI:05' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000032','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000033','BPI:06' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000034','BPI:02' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'CREATED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000035','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000036','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000037','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000038','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000039','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000040','BPI:06' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000041','BPI:02' ,'' , 'TKI:000000000000000000000000000000000000', 'UPDATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000042','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details'),
('HEI:000000000000000000000000000000000043','BPI:04' ,'' , 'TKI:000000000000000000000000000000000000', 'CREATED', DATEADD('DAY', -1, CURRENT_TIMESTAMP ), 'USER_1_2', 'DOMAIN_B', 'WBI:100000000000000000000000000000000001', '00' , 'PASystem', '00' , 'VNR' , '11223344' , '' , '' ,'' ,'2old_val' ,'new_val2' ,'custom1' ,'' , 'custom3' ,'custom4','some Details'),
('HEI:000000000000000000000000000000000044','BPI:03' ,'BPI:01', 'TKI:000000000000000000000000000000000001', 'DELETED', CURRENT_TIMESTAMP , 'USER_2_1', 'DOMAIN_B', 'WBI:100000000000000000000000000000000002', '11' , '' , '22' , '' , '' , 'L140101' , 'TASK' ,'DOCTYPE_DEFAULT' ,'' ,'' ,'custom1' ,'' , 'custom3' ,'','some Details');

View File

@ -1,62 +0,0 @@
package pro.taskana.simplehistory.rest;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import pro.taskana.simplehistory.rest.sampledata.SampleDataGenerator;
/** Example Application to create the documentation. */
@SpringBootApplication
@Import({TaskHistoryRestConfiguration.class})
public class ExampleDocumentationApplication {
@Value("${taskana.schemaName:TASKANA}")
private String schemaName;
@Autowired private SampleDataGenerator sampleDataGenerator;
public static void main(String[] args) {
SpringApplication.run(ExampleDocumentationApplication.class, args);
}
@Bean
@Primary
@ConfigurationProperties(prefix = "datasource")
public DataSourceProperties dataSourceProperties() {
DataSourceProperties props = new DataSourceProperties();
props.setUrl(
"jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS "
+ schemaName);
return props;
}
@Bean
public DataSource dataSource(DataSourceProperties properties) {
return properties.initializeDataSourceBuilder().build();
}
@Bean
public PlatformTransactionManager txManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
sampleDataGenerator = new SampleDataGenerator(dataSource);
sampleDataGenerator.generateSampleData(schemaName);
return sampleDataGenerator;
}
}

View File

@ -3,61 +3,44 @@ package pro.taskana.simplehistory.rest;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collections;
import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.ParameterizedTypeReference;
import org.springframework.hateoas.IanaLinkRelations; import org.springframework.hateoas.IanaLinkRelations;
import org.springframework.hateoas.Link; import org.springframework.hateoas.Link;
import org.springframework.hateoas.mediatype.hal.Jackson2HalModule;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
import pro.taskana.simplehistory.rest.models.TaskHistoryEventListResource; import pro.taskana.simplehistory.rest.models.TaskHistoryEventListResource;
import pro.taskana.simplehistory.rest.models.TaskHistoryEventRepresentationModel; import pro.taskana.simplehistory.rest.models.TaskHistoryEventRepresentationModel;
/** Controller for integration test. */ /** Controller for integration test. */
@ExtendWith(SpringExtension.class) @TaskanaSpringBootTest
@SpringBootTest(
classes = {TaskHistoryRestConfiguration.class},
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class TaskHistoryEventControllerIntTest { class TaskHistoryEventControllerIntTest {
@Value("${taskana.schemaName:TASKANA}") private static final RestTemplate TEMPLATE = RestHelper.TEMPLATE;
public String schemaName;
String server = "http://127.0.0.1:"; private final RestHelper restHelper;
RestTemplate template = getRestTemplate(); @Autowired
TaskHistoryEventControllerIntTest(RestHelper restHelper) {
HttpEntity<String> request; this.restHelper = restHelper;
}
@LocalServerPort int port;
@Test @Test
void testGetAllHistoryEvent() { void testGetAllHistoryEvent() {
ResponseEntity<TaskHistoryEventListResource> response = ResponseEntity<TaskHistoryEventListResource> response =
template.exchange( TEMPLATE.exchange(
server + port + "/api/v1/task-history-event", restHelper.toUrl("/api/v1/task-history-event"),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody()).isNotNull(); assertThat(response.getBody()).isNotNull();
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
@ -66,13 +49,13 @@ class TaskHistoryEventControllerIntTest {
@Test @Test
void testGetAllHistoryEventDescendingOrder() { void testGetAllHistoryEventDescendingOrder() {
String parameters = String url =
"/api/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=3&page=1"; "/api/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=3&page=1";
ResponseEntity<TaskHistoryEventListResource> response = ResponseEntity<TaskHistoryEventListResource> response =
template.exchange( TEMPLATE.exchange(
server + port + parameters, restHelper.toUrl(url),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody()).isNotNull(); assertThat(response.getBody()).isNotNull();
assertThat(response.getBody().getContent()).hasSize(3); assertThat(response.getBody().getContent()).hasSize(3);
@ -81,19 +64,19 @@ class TaskHistoryEventControllerIntTest {
.get() .get()
.extracting(Link::getHref) .extracting(Link::getHref)
.asString() .asString()
.endsWith(parameters); .endsWith(url);
} }
@Test @Test
void should_ReturnSpecificTaskHistoryEventWithoutDetails_When_ListIsQueried() { void should_ReturnSpecificTaskHistoryEventWithoutDetails_When_ListIsQueried() {
String url =
"/api/v1/task-history-event?business-process-id=BPI:01"
+ "&sort-by=business-process-id&order=asc&page-size=6&page=1";
ResponseEntity<TaskHistoryEventListResource> response = ResponseEntity<TaskHistoryEventListResource> response =
template.exchange( TEMPLATE.exchange(
server restHelper.toUrl(url),
+ port
+ "/api/v1/task-history-event?business-process-id=BPI:01"
+ "&sort-by=business-process-id&order=asc&page-size=6&page=1",
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody()).isNotNull(); assertThat(response.getBody()).isNotNull();
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
@ -105,10 +88,10 @@ class TaskHistoryEventControllerIntTest {
@Test @Test
void should_ReturnSpecificTaskHistoryEventWithDetails_When_SingleEventIsQueried() { void should_ReturnSpecificTaskHistoryEventWithDetails_When_SingleEventIsQueried() {
ResponseEntity<TaskHistoryEventRepresentationModel> response = ResponseEntity<TaskHistoryEventRepresentationModel> response =
template.exchange( TEMPLATE.exchange(
server + port + "/api/v1/task-history-event/HEI:000000000000000000000000000000000000", restHelper.toUrl("/api/v1/task-history-event/HEI:000000000000000000000000000000000000"),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventRepresentationModel.class)); ParameterizedTypeReference.forType(TaskHistoryEventRepresentationModel.class));
assertThat(response.getBody()).isNotNull(); assertThat(response.getBody()).isNotNull();
@ -120,10 +103,10 @@ class TaskHistoryEventControllerIntTest {
void testThrowsExceptionIfInvalidFilterIsUsed() { void testThrowsExceptionIfInvalidFilterIsUsed() {
ThrowingCallable httpCall = ThrowingCallable httpCall =
() -> () ->
template.exchange( TEMPLATE.exchange(
server + port + "/api/v1/task-history-event?invalid=BPI:01", restHelper.toUrl("/api/v1/task-history-event?invalid=BPI:01"),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThatThrownBy(httpCall) assertThatThrownBy(httpCall)
.isInstanceOf(HttpClientErrorException.class) .isInstanceOf(HttpClientErrorException.class)
@ -138,10 +121,10 @@ class TaskHistoryEventControllerIntTest {
final String finalCurrentTime = currentTime; final String finalCurrentTime = currentTime;
ThrowingCallable httpCall = ThrowingCallable httpCall =
() -> () ->
template.exchange( TEMPLATE.exchange(
server + port + "/api/v1/task-history-event?created=" + finalCurrentTime, restHelper.toUrl("/api/v1/task-history-event?created=" + finalCurrentTime),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThatThrownBy(httpCall) assertThatThrownBy(httpCall)
.isInstanceOf(HttpClientErrorException.class) .isInstanceOf(HttpClientErrorException.class)
@ -152,10 +135,10 @@ class TaskHistoryEventControllerIntTest {
// correct Format 'yyyy-MM-dd' // correct Format 'yyyy-MM-dd'
currentTime = currentTime.substring(0, 10); currentTime = currentTime.substring(0, 10);
ResponseEntity<TaskHistoryEventListResource> response = ResponseEntity<TaskHistoryEventListResource> response =
template.exchange( TEMPLATE.exchange(
server + port + "/api/v1/task-history-event?created=" + currentTime, restHelper.toUrl("/api/v1/task-history-event?created=" + currentTime),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody()).isNotNull(); assertThat(response.getBody()).isNotNull();
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
@ -164,13 +147,12 @@ class TaskHistoryEventControllerIntTest {
@Test @Test
void testGetSecondPageSortedByKey() { void testGetSecondPageSortedByKey() {
String parameters = String url = "/api/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2";
"/api/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2";
ResponseEntity<TaskHistoryEventListResource> response = ResponseEntity<TaskHistoryEventListResource> response =
template.exchange( TEMPLATE.exchange(
server + port + parameters, restHelper.toUrl(url),
HttpMethod.GET, HttpMethod.GET,
request, restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); ParameterizedTypeReference.forType(TaskHistoryEventListResource.class));
assertThat(response.getBody()).isNotNull(); assertThat(response.getBody()).isNotNull();
@ -182,7 +164,7 @@ class TaskHistoryEventControllerIntTest {
.get() .get()
.extracting(Link::getHref) .extracting(Link::getHref)
.asString() .asString()
.endsWith(parameters); .endsWith(url);
assertThat(response.getBody().getLink("allTaskHistoryEvent")) assertThat(response.getBody().getLink("allTaskHistoryEvent"))
.isNotNull() .isNotNull()
.get() .get()
@ -193,25 +175,4 @@ class TaskHistoryEventControllerIntTest {
assertThat(response.getBody().getLink(IanaLinkRelations.FIRST)).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.FIRST)).isNotNull();
assertThat(response.getBody().getLink(IanaLinkRelations.LAST)).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.LAST)).isNotNull();
} }
/**
* Return a REST template which is capable of dealing with responses in HAL format.
*
* @return RestTemplate
*/
private RestTemplate getRestTemplate() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.registerModule(new Jackson2HalModule());
mapper
.registerModule(new ParameterNamesModule())
.registerModule(new Jdk8Module())
.registerModule(new JavaTimeModule());
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/hal+json"));
converter.setObjectMapper(mapper);
return new RestTemplate(Collections.singletonList(converter));
}
} }

View File

@ -33,7 +33,7 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary;
import pro.taskana.workbasket.internal.WorkbasketQueryImpl; import pro.taskana.workbasket.internal.WorkbasketQueryImpl;
/** This class is responsible for the transfer of tasks. */ /** This class is responsible for the transfer of tasks. */
public class TaskTransferrer { class TaskTransferrer {
private static final String WAS_NOT_FOUND2 = " was not found."; private static final String WAS_NOT_FOUND2 = " was not found.";
private static final String TASK_IN_END_STATE_WITH_ID_CANNOT_BE_TRANSFERRED = private static final String TASK_IN_END_STATE_WITH_ID_CANNOT_BE_TRANSFERRED =
@ -43,15 +43,14 @@ public class TaskTransferrer {
private static final String THE_WORKBASKET = "The workbasket "; private static final String THE_WORKBASKET = "The workbasket ";
private static final String ID_PREFIX_HISTORY_EVENT = "HEI"; private static final String ID_PREFIX_HISTORY_EVENT = "HEI";
private static final Logger LOGGER = LoggerFactory.getLogger(TaskTransferrer.class); private static final Logger LOGGER = LoggerFactory.getLogger(TaskTransferrer.class);
private InternalTaskanaEngine taskanaEngine; private final InternalTaskanaEngine taskanaEngine;
private WorkbasketService workbasketService; private final WorkbasketService workbasketService;
private TaskServiceImpl taskService; private final TaskServiceImpl taskService;
private TaskMapper taskMapper; private final TaskMapper taskMapper;
private HistoryEventManager historyEventManager; private final HistoryEventManager historyEventManager;
TaskTransferrer( TaskTransferrer(
InternalTaskanaEngine taskanaEngine, TaskMapper taskMapper, TaskServiceImpl taskService) { InternalTaskanaEngine taskanaEngine, TaskMapper taskMapper, TaskServiceImpl taskService) {
super();
this.taskanaEngine = taskanaEngine; this.taskanaEngine = taskanaEngine;
this.taskService = taskService; this.taskService = taskService;
this.taskMapper = taskMapper; this.taskMapper = taskMapper;
@ -270,11 +269,7 @@ public class TaskTransferrer {
} }
List<MinimalTaskSummary> taskSummaries; List<MinimalTaskSummary> taskSummaries;
if (taskIds.isEmpty()) { taskSummaries = taskMapper.findExistingTasks(taskIds, null);
taskSummaries = new ArrayList<>();
} else {
taskSummaries = taskMapper.findExistingTasks(taskIds, null);
}
checkIfTransferConditionsAreFulfilled(taskIds, taskSummaries, bulkLog); checkIfTransferConditionsAreFulfilled(taskIds, taskSummaries, bulkLog);
updateTasksToBeTransferred(taskIds, taskSummaries, destinationWorkbasket); updateTasksToBeTransferred(taskIds, taskSummaries, destinationWorkbasket);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
@ -411,7 +406,7 @@ public class TaskTransferrer {
private void createTasksTransferredEvents( private void createTasksTransferredEvents(
List<MinimalTaskSummary> taskSummaries, TaskSummaryImpl updateObject) { List<MinimalTaskSummary> taskSummaries, TaskSummaryImpl updateObject) {
taskSummaries.stream() taskSummaries
.forEach( .forEach(
task -> { task -> {
TaskImpl newTask = (TaskImpl) taskService.newTask(task.getWorkbasketId()); TaskImpl newTask = (TaskImpl) taskService.newTask(task.getWorkbasketId());

View File

@ -1,6 +1,5 @@
package pro.taskana.sampledata; package pro.taskana.sampledata;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatCode;
import org.apache.ibatis.datasource.pooled.PooledDataSource; import org.apache.ibatis.datasource.pooled.PooledDataSource;
@ -24,16 +23,4 @@ class SampleDataGeneratorTest {
pooledDataSource.forceCloseAll(); pooledDataSource.forceCloseAll();
} }
@Test
void tableExists() {
PooledDataSource pooledDataSource = new PooledDataSource("org.h2.Driver", JDBC_URL, "sa", "sa");
assertThatCode(() -> new DbSchemaCreator(pooledDataSource, "TASKANA").run())
.doesNotThrowAnyException();
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(pooledDataSource, "TASKANA");
assertThat(sampleDataGenerator.tableExists("TASK")).isTrue();
assertThat(sampleDataGenerator.tableExists("TASKRANDOM")).isFalse();
pooledDataSource.forceCloseAll();
}
} }

View File

@ -3,7 +3,6 @@ package pro.taskana.common.rest;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import java.util.List; import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.ParameterizedTypeReference;
@ -20,19 +19,20 @@ import pro.taskana.common.test.rest.TaskanaSpringBootTest;
@TaskanaSpringBootTest @TaskanaSpringBootTest
class TaskanaEngineControllerIntTest { class TaskanaEngineControllerIntTest {
private static RestTemplate template; private static final RestTemplate TEMPLATE = RestHelper.TEMPLATE;
@Autowired
RestHelper restHelper;
@BeforeAll private final RestHelper restHelper;
static void init() {
template = RestHelper.TEMPLATE; @Autowired
TaskanaEngineControllerIntTest(RestHelper restHelper) {
this.restHelper = restHelper;
} }
@Test @Test
void testDomains() { void testDomains() {
ResponseEntity<List<String>> response = ResponseEntity<List<String>> response =
template.exchange( TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_DOMAIN), restHelper.toUrl(Mapping.URL_DOMAIN),
HttpMethod.GET, HttpMethod.GET,
restHelper.defaultRequest(), restHelper.defaultRequest(),
@ -43,7 +43,7 @@ class TaskanaEngineControllerIntTest {
@Test @Test
void testClassificationTypes() { void testClassificationTypes() {
ResponseEntity<List<String>> response = ResponseEntity<List<String>> response =
template.exchange( TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATION_TYPES), restHelper.toUrl(Mapping.URL_CLASSIFICATION_TYPES),
HttpMethod.GET, HttpMethod.GET,
restHelper.defaultRequest(), restHelper.defaultRequest(),
@ -54,7 +54,7 @@ class TaskanaEngineControllerIntTest {
@Test @Test
void testClassificationCategories() { void testClassificationCategories() {
ResponseEntity<List<String>> response = ResponseEntity<List<String>> response =
template.exchange( TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATION_CATEGORIES), restHelper.toUrl(Mapping.URL_CLASSIFICATION_CATEGORIES),
HttpMethod.GET, HttpMethod.GET,
restHelper.defaultRequest(), restHelper.defaultRequest(),
@ -66,7 +66,7 @@ class TaskanaEngineControllerIntTest {
@Test @Test
void testGetCurrentUserInfo() { void testGetCurrentUserInfo() {
ResponseEntity<TaskanaUserInfoRepresentationModel> response = ResponseEntity<TaskanaUserInfoRepresentationModel> response =
template.exchange( TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CURRENT_USER), restHelper.toUrl(Mapping.URL_CURRENT_USER),
HttpMethod.GET, HttpMethod.GET,
restHelper.defaultRequest(), restHelper.defaultRequest(),