From 3a6f3dea8732b6c1c8fad12a86949c4752f14a6c Mon Sep 17 00:00:00 2001 From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Date: Sun, 11 Oct 2020 16:29:56 +0200 Subject: [PATCH] TSK-1407: taskana-simplehistory-rest-spring now using provided test util classes from taskana-common-test --- .../sampledata/SampleDataGenerator.java | 52 ++------ .../sampledata/SampleDataProvider.java | 7 +- .../pro/taskana/sampledata/SqlReplacer.java | 4 - .../sql/sample-data/task-history-event.sql | 93 +++++++------- .../sampledata/SampleDataProviderTest.java | 10 +- .../common/internal/util/IdGenerator.java | 9 +- .../taskana-simplehistory-rest-spring/pom.xml | 109 ++++++++-------- .../rest/TaskHistoryRestConfiguration.java | 8 +- ...toryEventRepresentationModelAssembler.java | 2 + .../rest/sampledata/SampleDataGenerator.java | 80 ------------ .../src/main/resources/application.properties | 2 - .../resources/sql.sample-data/clear-db.sql | 3 - .../resources/sql.sample-data/drop-tables.sql | 3 - .../sql.sample-data/task-history-event.sql | 47 ------- .../rest/ExampleDocumentationApplication.java | 62 --------- .../TaskHistoryEventControllerIntTest.java | 121 ++++++------------ .../task/internal/TaskTransferrer.java | 21 ++- .../sampledata/SampleDataGeneratorTest.java | 13 -- .../rest/TaskanaEngineControllerIntTest.java | 22 ++-- 19 files changed, 187 insertions(+), 481 deletions(-) delete mode 100644 history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/sampledata/SampleDataGenerator.java delete mode 100644 history/taskana-simplehistory-rest-spring/src/main/resources/application.properties delete mode 100644 history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/clear-db.sql delete mode 100644 history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql delete mode 100644 history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/task-history-event.sql delete mode 100644 history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/ExampleDocumentationApplication.java diff --git a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java index b56347bab..e49835d55 100644 --- a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java +++ b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataGenerator.java @@ -18,7 +18,6 @@ import java.util.stream.Stream; import javax.sql.DataSource; import org.apache.ibatis.jdbc.RuntimeSqlException; import org.apache.ibatis.jdbc.ScriptRunner; -import org.apache.ibatis.jdbc.SqlRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,17 +28,14 @@ public class SampleDataGenerator { private static final String CACHED_TEST = "TEST"; 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_CLEARDB = "CLEARDB"; - private static final String CACHED_DROPDB = "DROPDB"; - private static HashMap> cachedScripts = new HashMap<>(); + private static final String CACHED_CLEAR_DB = "CLEARDB"; + private static final String CACHED_DROP_DB = "DROP_DB"; + private static final HashMap> CACHED_SCRIPTS = new HashMap<>(); private final DataSource dataSource; private final ZonedDateTime now; - /** - * This value cannot be automatically obtained by connection.getSchema(), because setting not yet - * existing schema will result into an SQL Exception. - */ + // This value cannot be automatically obtained by connection.getSchema(), because setting not yet + // existing schema will result into an SQL Exception. private final String schema; public SampleDataGenerator(DataSource dataSource, String schema) { @@ -54,21 +50,9 @@ public class SampleDataGenerator { public void generateSampleData() { LOGGER.debug("entry to generateSampleData()"); - runScripts( - (runner) -> { - clearDb(); - Stream 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); - }); + clearDb(); + Stream scripts = SampleDataProvider.getSampleDataCreationScripts(); + executeAndCacheScripts(scripts, CACHED_SAMPLE); if (LOGGER.isDebugEnabled()) { LOGGER.debug("exit from generateSampleData()"); } @@ -93,30 +77,17 @@ public class SampleDataGenerator { public void clearDb() { LOGGER.debug("entry to clearDb()"); Stream scripts = SampleDataProvider.getScriptsToClearDatabase(); - executeAndCacheScripts(scripts, CACHED_CLEARDB); + executeAndCacheScripts(scripts, CACHED_CLEAR_DB); LOGGER.debug("exit from clearDb()"); } public void dropDb() { LOGGER.debug("entry to dropDb()"); Stream scripts = SampleDataProvider.getScriptsToDropDatabase(); - executeAndCacheScripts(scripts, CACHED_DROPDB); + executeAndCacheScripts(scripts, CACHED_DROP_DB); 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 parseScripts(Stream scripts) { try (Connection connection = dataSource.getConnection()) { String dbProductName = connection.getMetaData().getDatabaseProductName(); @@ -156,7 +127,7 @@ public class SampleDataGenerator { LOGGER.debug("entry to executeAndCacheScripts(scripts = {}, cacheKey = {})", scripts, cacheKey); runScripts( runner -> - cachedScripts.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream() + CACHED_SCRIPTS.computeIfAbsent(cacheKey, key -> parseScripts(scripts)).stream() .map(s -> s.getBytes(StandardCharsets.UTF_8)) .map(ByteArrayInputStream::new) .map(s -> new InputStreamReader(s, StandardCharsets.UTF_8)) @@ -174,6 +145,7 @@ public class SampleDataGenerator { connection.setSchema(schema); runner.setLogWriter(logWriter); runner.setErrorLogWriter(errorLogWriter); + runner.setStopOnError(true); return runner; } } diff --git a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataProvider.java b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataProvider.java index 045dc8637..ff815a937 100644 --- a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataProvider.java +++ b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SampleDataProvider.java @@ -43,11 +43,8 @@ public final class SampleDataProvider { SAMPLE_TASK_COMMENT, SAMPLE_ATTACHMENT, SAMPLE_WORKBASKET_ACCESS_LIST, - SAMPLE_OBJECT_REFERENCE); - } - - static Stream getScriptsWithEvents() { - return Stream.concat(getSampleDataCreationScripts(), Stream.of(SAMPLE_TASK_HISTORY_EVENT)); + SAMPLE_OBJECT_REFERENCE, + SAMPLE_TASK_HISTORY_EVENT); } static Stream getScriptsToClearDatabase() { diff --git a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SqlReplacer.java b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SqlReplacer.java index d8c8c854c..db336a4e0 100644 --- a/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SqlReplacer.java +++ b/common/taskana-common-data/src/main/java/pro/taskana/sampledata/SqlReplacer.java @@ -24,10 +24,6 @@ final class SqlReplacer { return parseAndReplace(getScriptBufferedStream(scriptPath), now, dbProductName); } - static boolean isPostgreSql(String databaseProductName) { - return "PostgreSQL".equals(databaseProductName); - } - static boolean isDb2(String dbProductName) { return dbProductName != null && dbProductName.contains("DB2"); } diff --git a/common/taskana-common-data/src/main/resources/sql/sample-data/task-history-event.sql b/common/taskana-common-data/src/main/resources/sql/sample-data/task-history-event.sql index ef05e4835..ba4a87274 100644 --- a/common/taskana-common-data/src/main/resources/sql/sample-data/task-history-event.sql +++ b/common/taskana-common-data/src/main/resources/sql/sample-data/task-history-event.sql @@ -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 --- 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 -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'), -('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'); \ No newline at end of file +-- 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 ); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); +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'); \ No newline at end of file diff --git a/common/taskana-common-data/src/test/java/pro/taskana/sampledata/SampleDataProviderTest.java b/common/taskana-common-data/src/test/java/pro/taskana/sampledata/SampleDataProviderTest.java index 6f60f2955..4287f5cb0 100644 --- a/common/taskana-common-data/src/test/java/pro/taskana/sampledata/SampleDataProviderTest.java +++ b/common/taskana-common-data/src/test/java/pro/taskana/sampledata/SampleDataProviderTest.java @@ -10,19 +10,17 @@ class SampleDataProviderTest { @Test void getScriptsNotNull() { assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotNull(); - assertThat(SampleDataProvider.getScriptsWithEvents()).isNotNull(); } @Test void getScriptsNotEmpty() { - assertThat(SampleDataProvider.getSampleDataCreationScripts().count() > 0).isTrue(); - assertThat(SampleDataProvider.getScriptsWithEvents().count() > 0).isTrue(); + assertThat(SampleDataProvider.getSampleDataCreationScripts()).isNotEmpty(); } @Test void getScriptsFileExists() { - SampleDataProvider.getSampleDataCreationScripts() - .map(SqlReplacer::getScriptBufferedStream) - .forEach(script -> assertThat(script).isNotNull()); + assertThat(SampleDataProvider.getSampleDataCreationScripts()) + .extracting(SqlReplacer::getScriptBufferedStream) + .doesNotContainNull(); } } diff --git a/common/taskana-common/src/main/java/pro/taskana/common/internal/util/IdGenerator.java b/common/taskana-common/src/main/java/pro/taskana/common/internal/util/IdGenerator.java index 0d8746596..9372e1422 100644 --- a/common/taskana-common/src/main/java/pro/taskana/common/internal/util/IdGenerator.java +++ b/common/taskana-common/src/main/java/pro/taskana/common/internal/util/IdGenerator.java @@ -5,8 +5,9 @@ import java.util.UUID; /** This class contains util methods for generating ids. */ public final class IdGenerator { - private static final String SEPERATOR = ":"; + private static final String SEPARATOR = ":"; + // disable initialization private IdGenerator() {} /** @@ -16,10 +17,6 @@ public final class IdGenerator { * @return a String with a length of 40 characters */ public static String generateWithPrefix(String prefix) { - return new StringBuilder() - .append(prefix) - .append(SEPERATOR) - .append(UUID.randomUUID().toString()) - .toString(); + return prefix + SEPARATOR + UUID.randomUUID(); } } diff --git a/history/taskana-simplehistory-rest-spring/pom.xml b/history/taskana-simplehistory-rest-spring/pom.xml index 200081b1d..605de8a4e 100644 --- a/history/taskana-simplehistory-rest-spring/pom.xml +++ b/history/taskana-simplehistory-rest-spring/pom.xml @@ -53,58 +53,63 @@ - - org.springframework.boot - spring-boot-starter-web - test - - - org.springframework.boot - spring-boot-starter-jdbc - test - - - com.h2database - h2 - test - - - org.springframework.plugin - spring-plugin-core - ${version.spring.core} - test - - - - org.assertj - assertj-core - test - - - org.junit.jupiter - junit-jupiter - test - - - org.springframework - spring-test - test - - - org.springframework.boot - spring-boot-test - test - - - org.springframework.restdocs - spring-restdocs-core - test - - - org.springframework.restdocs - spring-restdocs-mockmvc - test - + + pro.taskana + taskana-common-test + ${project.version} + test + + + org.springframework.boot + spring-boot-starter-web + test + + + org.springframework.boot + spring-boot-starter-jdbc + test + + + com.h2database + h2 + test + + + org.springframework.plugin + spring-plugin-core + ${version.spring.core} + test + + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter + test + + + org.springframework + spring-test + test + + + org.springframework.boot + spring-boot-test + test + + + org.springframework.restdocs + spring-restdocs-core + test + + + org.springframework.restdocs + spring-restdocs-mockmvc + test + diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryRestConfiguration.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryRestConfiguration.java index 1f188027c..3bf4514e7 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryRestConfiguration.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryRestConfiguration.java @@ -6,11 +6,10 @@ import org.springframework.context.annotation.Configuration; import org.springframework.transaction.annotation.EnableTransactionManagement; import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl; -import pro.taskana.simplehistory.rest.assembler.TaskHistoryEventRepresentationModelAssembler; /** Configuration for Taskana history REST service. */ @Configuration -@ComponentScan({"pro.taskana", "pro.taskana.simplehistory.rest"}) +@ComponentScan("pro.taskana") @EnableTransactionManagement public class TaskHistoryRestConfiguration { @@ -18,9 +17,4 @@ public class TaskHistoryRestConfiguration { public SimpleHistoryServiceImpl getSimpleHistoryService() { return new SimpleHistoryServiceImpl(); } - - @Bean - public TaskHistoryEventRepresentationModelAssembler getTaskHistoryEventResourceAssembler() { - return new TaskHistoryEventRepresentationModelAssembler(); - } } diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/assembler/TaskHistoryEventRepresentationModelAssembler.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/assembler/TaskHistoryEventRepresentationModelAssembler.java index 3310b5f5e..76ea53833 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/assembler/TaskHistoryEventRepresentationModelAssembler.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/assembler/TaskHistoryEventRepresentationModelAssembler.java @@ -5,6 +5,7 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import org.springframework.hateoas.server.RepresentationModelAssembler; import org.springframework.lang.NonNull; +import org.springframework.stereotype.Component; import pro.taskana.common.api.exceptions.SystemException; 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; /** Transforms any {@link TaskHistoryEvent} into its {@link TaskHistoryEventRepresentationModel}. */ +@Component public class TaskHistoryEventRepresentationModelAssembler implements RepresentationModelAssembler { diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/sampledata/SampleDataGenerator.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/sampledata/SampleDataGenerator.java deleted file mode 100644 index 8cf4f5a57..000000000 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/sampledata/SampleDataGenerator.java +++ /dev/null @@ -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 + ";"); - } -} diff --git a/history/taskana-simplehistory-rest-spring/src/main/resources/application.properties b/history/taskana-simplehistory-rest-spring/src/main/resources/application.properties deleted file mode 100644 index c98e26959..000000000 --- a/history/taskana-simplehistory-rest-spring/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -logging.level.pro.taskana=INFO -taskana.schemaName=TASKANA diff --git a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/clear-db.sql b/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/clear-db.sql deleted file mode 100644 index efd190cb5..000000000 --- a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/clear-db.sql +++ /dev/null @@ -1,3 +0,0 @@ --- the order is important! -DELETE FROM TASK_HISTORY_EVENT; -COMMIT; diff --git a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql b/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql deleted file mode 100644 index afc3cbfdc..000000000 --- a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/drop-tables.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE TASK_HISTORY_EVENT; - -COMMIT; diff --git a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/task-history-event.sql b/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/task-history-event.sql deleted file mode 100644 index cc3259ffc..000000000 --- a/history/taskana-simplehistory-rest-spring/src/main/resources/sql.sample-data/task-history-event.sql +++ /dev/null @@ -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'); \ No newline at end of file diff --git a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/ExampleDocumentationApplication.java b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/ExampleDocumentationApplication.java deleted file mode 100644 index 4970a4878..000000000 --- a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/ExampleDocumentationApplication.java +++ /dev/null @@ -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; - } -} diff --git a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java index c2f602b86..8827ac37a 100644 --- a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java +++ b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java @@ -3,61 +3,44 @@ package pro.taskana.simplehistory.rest; import static org.assertj.core.api.Assertions.assertThat; 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.util.Collections; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.hateoas.IanaLinkRelations; 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.HttpStatus; -import org.springframework.http.MediaType; 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.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.TaskHistoryEventRepresentationModel; /** Controller for integration test. */ -@ExtendWith(SpringExtension.class) -@SpringBootTest( - classes = {TaskHistoryRestConfiguration.class}, - webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@TaskanaSpringBootTest class TaskHistoryEventControllerIntTest { - @Value("${taskana.schemaName:TASKANA}") - public String schemaName; + private static final RestTemplate TEMPLATE = RestHelper.TEMPLATE; - String server = "http://127.0.0.1:"; + private final RestHelper restHelper; - RestTemplate template = getRestTemplate(); - - HttpEntity request; - - @LocalServerPort int port; + @Autowired + TaskHistoryEventControllerIntTest(RestHelper restHelper) { + this.restHelper = restHelper; + } @Test void testGetAllHistoryEvent() { ResponseEntity response = - template.exchange( - server + port + "/api/v1/task-history-event", + TEMPLATE.exchange( + restHelper.toUrl("/api/v1/task-history-event"), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); @@ -66,13 +49,13 @@ class TaskHistoryEventControllerIntTest { @Test void testGetAllHistoryEventDescendingOrder() { - String parameters = + String url = "/api/v1/task-history-event?sort-by=business-process-id&order=desc&page-size=3&page=1"; ResponseEntity response = - template.exchange( - server + port + parameters, + TEMPLATE.exchange( + restHelper.toUrl(url), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getContent()).hasSize(3); @@ -81,19 +64,19 @@ class TaskHistoryEventControllerIntTest { .get() .extracting(Link::getHref) .asString() - .endsWith(parameters); + .endsWith(url); } @Test 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 response = - template.exchange( - server - + port - + "/api/v1/task-history-event?business-process-id=BPI:01" - + "&sort-by=business-process-id&order=asc&page-size=6&page=1", + TEMPLATE.exchange( + restHelper.toUrl(url), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); @@ -105,10 +88,10 @@ class TaskHistoryEventControllerIntTest { @Test void should_ReturnSpecificTaskHistoryEventWithDetails_When_SingleEventIsQueried() { ResponseEntity response = - template.exchange( - server + port + "/api/v1/task-history-event/HEI:000000000000000000000000000000000000", + TEMPLATE.exchange( + restHelper.toUrl("/api/v1/task-history-event/HEI:000000000000000000000000000000000000"), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); @@ -120,10 +103,10 @@ class TaskHistoryEventControllerIntTest { void testThrowsExceptionIfInvalidFilterIsUsed() { ThrowingCallable httpCall = () -> - template.exchange( - server + port + "/api/v1/task-history-event?invalid=BPI:01", + TEMPLATE.exchange( + restHelper.toUrl("/api/v1/task-history-event?invalid=BPI:01"), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThatThrownBy(httpCall) .isInstanceOf(HttpClientErrorException.class) @@ -138,10 +121,10 @@ class TaskHistoryEventControllerIntTest { final String finalCurrentTime = currentTime; ThrowingCallable httpCall = () -> - template.exchange( - server + port + "/api/v1/task-history-event?created=" + finalCurrentTime, + TEMPLATE.exchange( + restHelper.toUrl("/api/v1/task-history-event?created=" + finalCurrentTime), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThatThrownBy(httpCall) .isInstanceOf(HttpClientErrorException.class) @@ -152,10 +135,10 @@ class TaskHistoryEventControllerIntTest { // correct Format 'yyyy-MM-dd' currentTime = currentTime.substring(0, 10); ResponseEntity response = - template.exchange( - server + port + "/api/v1/task-history-event?created=" + currentTime, + TEMPLATE.exchange( + restHelper.toUrl("/api/v1/task-history-event?created=" + currentTime), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThat(response.getBody()).isNotNull(); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); @@ -164,13 +147,12 @@ class TaskHistoryEventControllerIntTest { @Test void testGetSecondPageSortedByKey() { - String parameters = - "/api/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2"; + String url = "/api/v1/task-history-event?sort-by=workbasket-key&order=desc&page=2&page-size=2"; ResponseEntity response = - template.exchange( - server + port + parameters, + TEMPLATE.exchange( + restHelper.toUrl(url), HttpMethod.GET, - request, + restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventListResource.class)); assertThat(response.getBody()).isNotNull(); @@ -182,7 +164,7 @@ class TaskHistoryEventControllerIntTest { .get() .extracting(Link::getHref) .asString() - .endsWith(parameters); + .endsWith(url); assertThat(response.getBody().getLink("allTaskHistoryEvent")) .isNotNull() .get() @@ -193,25 +175,4 @@ class TaskHistoryEventControllerIntTest { assertThat(response.getBody().getLink(IanaLinkRelations.FIRST)).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)); - } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java index 25305919a..ad6afbd2e 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/TaskTransferrer.java @@ -33,7 +33,7 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary; import pro.taskana.workbasket.internal.WorkbasketQueryImpl; /** 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 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 ID_PREFIX_HISTORY_EVENT = "HEI"; private static final Logger LOGGER = LoggerFactory.getLogger(TaskTransferrer.class); - private InternalTaskanaEngine taskanaEngine; - private WorkbasketService workbasketService; - private TaskServiceImpl taskService; - private TaskMapper taskMapper; - private HistoryEventManager historyEventManager; + private final InternalTaskanaEngine taskanaEngine; + private final WorkbasketService workbasketService; + private final TaskServiceImpl taskService; + private final TaskMapper taskMapper; + private final HistoryEventManager historyEventManager; TaskTransferrer( InternalTaskanaEngine taskanaEngine, TaskMapper taskMapper, TaskServiceImpl taskService) { - super(); this.taskanaEngine = taskanaEngine; this.taskService = taskService; this.taskMapper = taskMapper; @@ -270,11 +269,7 @@ public class TaskTransferrer { } List taskSummaries; - if (taskIds.isEmpty()) { - taskSummaries = new ArrayList<>(); - } else { - taskSummaries = taskMapper.findExistingTasks(taskIds, null); - } + taskSummaries = taskMapper.findExistingTasks(taskIds, null); checkIfTransferConditionsAreFulfilled(taskIds, taskSummaries, bulkLog); updateTasksToBeTransferred(taskIds, taskSummaries, destinationWorkbasket); if (LOGGER.isDebugEnabled()) { @@ -411,7 +406,7 @@ public class TaskTransferrer { private void createTasksTransferredEvents( List taskSummaries, TaskSummaryImpl updateObject) { - taskSummaries.stream() + taskSummaries .forEach( task -> { TaskImpl newTask = (TaskImpl) taskService.newTask(task.getWorkbasketId()); diff --git a/lib/taskana-core/src/test/java/pro/taskana/sampledata/SampleDataGeneratorTest.java b/lib/taskana-core/src/test/java/pro/taskana/sampledata/SampleDataGeneratorTest.java index 8e5013794..00318bd27 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/sampledata/SampleDataGeneratorTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/sampledata/SampleDataGeneratorTest.java @@ -1,6 +1,5 @@ package pro.taskana.sampledata; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import org.apache.ibatis.datasource.pooled.PooledDataSource; @@ -24,16 +23,4 @@ class SampleDataGeneratorTest { 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(); - } } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerIntTest.java index 0c6b1b2d5..5f21386e9 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerIntTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerIntTest.java @@ -3,7 +3,6 @@ package pro.taskana.common.rest; import static org.assertj.core.api.Assertions.assertThat; import java.util.List; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; @@ -20,19 +19,20 @@ import pro.taskana.common.test.rest.TaskanaSpringBootTest; @TaskanaSpringBootTest class TaskanaEngineControllerIntTest { - private static RestTemplate template; - @Autowired - RestHelper restHelper; + private static final RestTemplate TEMPLATE = RestHelper.TEMPLATE; - @BeforeAll - static void init() { - template = RestHelper.TEMPLATE; + private final RestHelper restHelper; + + @Autowired + TaskanaEngineControllerIntTest(RestHelper restHelper) { + this.restHelper = restHelper; } + @Test void testDomains() { ResponseEntity> response = - template.exchange( + TEMPLATE.exchange( restHelper.toUrl(Mapping.URL_DOMAIN), HttpMethod.GET, restHelper.defaultRequest(), @@ -43,7 +43,7 @@ class TaskanaEngineControllerIntTest { @Test void testClassificationTypes() { ResponseEntity> response = - template.exchange( + TEMPLATE.exchange( restHelper.toUrl(Mapping.URL_CLASSIFICATION_TYPES), HttpMethod.GET, restHelper.defaultRequest(), @@ -54,7 +54,7 @@ class TaskanaEngineControllerIntTest { @Test void testClassificationCategories() { ResponseEntity> response = - template.exchange( + TEMPLATE.exchange( restHelper.toUrl(Mapping.URL_CLASSIFICATION_CATEGORIES), HttpMethod.GET, restHelper.defaultRequest(), @@ -66,7 +66,7 @@ class TaskanaEngineControllerIntTest { @Test void testGetCurrentUserInfo() { ResponseEntity response = - template.exchange( + TEMPLATE.exchange( restHelper.toUrl(Mapping.URL_CURRENT_USER), HttpMethod.GET, restHelper.defaultRequest(),