From 403c93a83cb59034efcf0611d0d201f064b2cc7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Mu=C3=B1oz?= Date: Fri, 8 Sep 2023 19:43:16 +0200 Subject: [PATCH] [JBPM-10200] Add a profile for testing postgresql with testcontainers --- .../java/org/jbpm/bpmn2/ActivityTest.java | 5 +- jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml | 18 ++- .../jbpm/casemgmt/impl/objects/Patient.java | 2 +- .../filtered-resources/datasource.properties | 19 ++++ .../services/task/DeadlinesLocalTest.java | 65 +++++++---- .../jbpm/services/task/TaskContentTest.java | 19 +++- .../jbpm/services/task/TaskReminderTest.java | 18 ++- jbpm-runtime-manager/pom.xml | 17 +++ jbpm-services/jbpm-executor/pom.xml | 19 +++- .../executor/DBUnavilabilityExecutorTest.java | 9 +- .../jbpm/executor/ExtendedExecutorTest.java | 9 +- .../services/test/QueryServiceImplTest.java | 9 +- .../services/test/TaskQueryBuilderTest.java | 32 +++--- .../resources/kjar-jpa/persistence-test.jar | Bin 11838 -> 11874 bytes .../filtered-resources/datasource.properties | 19 ++++ .../util/ArquillianTestWrapperExtension.java | 14 ++- .../resources/kjar-jpa/persistence-test.jar | Bin 11633 -> 11874 bytes jbpm-test-coverage/pom.xml | 18 +++ .../test/functional/TransactionsTest.java | 1 - .../functional/event/SignalEventTest.java | 71 +++++++----- .../timer/SerializedTimerRollbackTest.java | 28 ++--- pom.xml | 106 +++++++++++++++++- 22 files changed, 381 insertions(+), 117 deletions(-) create mode 100644 jbpm-human-task/jbpm-human-task-audit/src/test/filtered-resources/datasource.properties create mode 100644 jbpm-services/jbpm-services-cdi/src/test/filtered-resources/datasource.properties diff --git a/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/ActivityTest.java b/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/ActivityTest.java index 82d98fbd87..262eef283f 100644 --- a/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/ActivityTest.java +++ b/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/ActivityTest.java @@ -56,6 +56,7 @@ import org.jbpm.workflow.instance.node.WorkItemNodeInstance; import org.junit.After; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -115,8 +116,8 @@ public ActivityTest(boolean persistence) throws Exception { super(persistence); } - @Before - public void setup() throws Exception { + @BeforeClass + public static void setup() throws Exception { setUpDataSource(); } diff --git a/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml b/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml index 2cae13d59c..7b8f905ef5 100644 --- a/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml +++ b/jbpm-case-mgmt/jbpm-case-mgmt-impl/pom.xml @@ -197,5 +197,21 @@ - + + + tc-postgres + + + + maven-surefire-plugin + + + true + + + + + + + diff --git a/jbpm-case-mgmt/jbpm-case-mgmt-impl/src/test/java/org/jbpm/casemgmt/impl/objects/Patient.java b/jbpm-case-mgmt/jbpm-case-mgmt-impl/src/test/java/org/jbpm/casemgmt/impl/objects/Patient.java index 565583ab21..796deefe5b 100644 --- a/jbpm-case-mgmt/jbpm-case-mgmt-impl/src/test/java/org/jbpm/casemgmt/impl/objects/Patient.java +++ b/jbpm-case-mgmt/jbpm-case-mgmt-impl/src/test/java/org/jbpm/casemgmt/impl/objects/Patient.java @@ -28,7 +28,7 @@ @Entity -@SequenceGenerator(name="patientIdSeq", sequenceName="PATIENT_ID_SEQ") +@SequenceGenerator(name="patientIdSeq", sequenceName="PATIENT_ID_SEQ", allocationSize = 1) public class Patient implements Serializable { private static final long serialVersionUID = 5264889024424345041L; diff --git a/jbpm-human-task/jbpm-human-task-audit/src/test/filtered-resources/datasource.properties b/jbpm-human-task/jbpm-human-task-audit/src/test/filtered-resources/datasource.properties new file mode 100644 index 0000000000..eede454dfb --- /dev/null +++ b/jbpm-human-task/jbpm-human-task-audit/src/test/filtered-resources/datasource.properties @@ -0,0 +1,19 @@ +maxPoolSize=${maven.btm.maxPoolSize} +allowLocalTransactions=true +# JDBC/Database properties that are set in the maven pom +# +# the below variable names (i.e. "${maven.datasource.classname}) are +# automagically replaced with their values (defined in the pom.xml) +# because of the fact that is set to true in for the +# src/test/resources directory in the pom. +# +className=${maven.datasource.classname} +driverClassName=${maven.jdbc.driver.class} +user=${maven.jdbc.username} +password=${maven.jdbc.password} +url=${maven.jdbc.url} +serverName=${maven.jdbc.db.server} +portNumber=${maven.jdbc.db.port} +databaseName=${maven.jdbc.db.name} +defaultSchema=${maven.jdbc.schema} +txType=${maven.tx.type} diff --git a/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/DeadlinesLocalTest.java b/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/DeadlinesLocalTest.java index eced280988..8f7c652cf7 100644 --- a/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/DeadlinesLocalTest.java +++ b/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/DeadlinesLocalTest.java @@ -22,34 +22,51 @@ import org.jbpm.services.task.impl.TaskDeadlinesServiceImpl; import org.kie.test.util.db.PoolingDataSourceWrapper; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.kie.internal.task.api.InternalTaskService; public class DeadlinesLocalTest extends DeadlinesBaseTest { - private PoolingDataSourceWrapper pds; - private EntityManagerFactory emf; - - @Before - public void setup() { - this.notificationListener = new MockNotificationListener(); - pds = setupPoolingDataSource(); - emf = Persistence.createEntityManagerFactory( "org.jbpm.services.task" ); - this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator() - .entityManagerFactory(emf) - .getTaskService(); - } - - @After - public void clean() { - TaskDeadlinesServiceImpl.reset(); - super.tearDown(); - if (emf != null) { - emf.close(); - } - if (pds != null) { - pds.close(); - } - } + private static boolean setupDataSource = false; + private static PoolingDataSourceWrapper pds; + private static EntityManagerFactory emf; + + @BeforeClass + public static void beforeClass() { + setupDataSource = true; + pds = setupPoolingDataSource(); + emf = Persistence.createEntityManagerFactory( "org.jbpm.services.task"); + } + + @Before + public void setup() { + this.notificationListener = new MockNotificationListener(); + + this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator() + .entityManagerFactory(emf) + .getTaskService(); + } + + @After + public void clean() { + TaskDeadlinesServiceImpl.reset(); + super.tearDown(); + } + + @AfterClass + public static void afterClass() { + if (!setupDataSource) { + return; + } + + if (emf != null) { + emf.close(); + } + if (pds != null) { + pds.close(); + } + } } diff --git a/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskContentTest.java b/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskContentTest.java index 6f1d36b3e4..25d4731385 100644 --- a/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskContentTest.java +++ b/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskContentTest.java @@ -29,20 +29,25 @@ import org.jbpm.services.task.impl.factories.TaskFactory; import org.kie.test.util.db.PoolingDataSourceWrapper; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.kie.api.task.model.Task; import org.kie.internal.task.api.InternalTaskService; public class TaskContentTest extends HumanTaskServicesBaseTest { - private PoolingDataSourceWrapper pds; - private EntityManagerFactory emf; + private static PoolingDataSourceWrapper pds; + private static EntityManagerFactory emf; - @Before - public void setup() { + @BeforeClass + public static void beforeClass() { pds = setupPoolingDataSource(); emf = Persistence.createEntityManagerFactory("org.jbpm.services.task"); - + } + + @Before + public void setup() { this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf) .getTaskService(); } @@ -50,6 +55,10 @@ public void setup() { @After public void clean() { super.tearDown(); + } + + @AfterClass + public static void afterClass() { if( emf != null ) { emf.close(); } diff --git a/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskReminderTest.java b/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskReminderTest.java index 405de262c5..94a7ce8745 100644 --- a/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskReminderTest.java +++ b/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/services/task/TaskReminderTest.java @@ -21,7 +21,9 @@ import org.kie.test.util.db.PoolingDataSourceWrapper; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.kie.internal.task.api.InternalTaskService; import org.kie.internal.utils.ChainedProperties; import org.kie.internal.utils.ClassLoaderUtil; @@ -29,9 +31,15 @@ public class TaskReminderTest extends TaskReminderBaseTest { - private PoolingDataSourceWrapper pds; - private EntityManagerFactory emf; + private static PoolingDataSourceWrapper pds; + private static EntityManagerFactory emf; + @BeforeClass + public static void beforeClass() { + pds = setupPoolingDataSource(); + emf = Persistence.createEntityManagerFactory("org.jbpm.services.task"); + } + @Before public void setup() { final ChainedProperties props = ChainedProperties.getChainedProperties( "email.conf", ClassLoaderUtil.getClassLoader( null, getClass(), false )); @@ -46,8 +54,6 @@ public void setup() { // Do nothing } - pds = setupPoolingDataSource(); - emf = Persistence.createEntityManagerFactory("org.jbpm.services.task"); this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator() .entityManagerFactory(emf) .getTaskService(); @@ -64,6 +70,10 @@ public void clean() { } } super.tearDown(); + } + + @AfterClass + public static void afterClass() { if (emf != null) { emf.close(); } diff --git a/jbpm-runtime-manager/pom.xml b/jbpm-runtime-manager/pom.xml index 8c2e15cac8..130b7a7aab 100644 --- a/jbpm-runtime-manager/pom.xml +++ b/jbpm-runtime-manager/pom.xml @@ -383,4 +383,21 @@ + + + tc-postgres + + + + maven-surefire-plugin + + + true + + + + + + + diff --git a/jbpm-services/jbpm-executor/pom.xml b/jbpm-services/jbpm-executor/pom.xml index 07a31ab25b..5fac5c27c5 100644 --- a/jbpm-services/jbpm-executor/pom.xml +++ b/jbpm-services/jbpm-executor/pom.xml @@ -239,7 +239,6 @@ true - @@ -313,5 +312,21 @@ - + + + tc-postgres + + + + maven-surefire-plugin + + + **/DB*Test.java + + + + + + + diff --git a/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/DBUnavilabilityExecutorTest.java b/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/DBUnavilabilityExecutorTest.java index 8d3c3ba1c4..3f175aee97 100644 --- a/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/DBUnavilabilityExecutorTest.java +++ b/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/DBUnavilabilityExecutorTest.java @@ -58,9 +58,12 @@ public class DBUnavilabilityExecutorTest{ @BeforeClass public static void createDBServer() { dsProps = ExecutorTestUtil.getDatasourceProperties(); - dsProps.setProperty("url", "jdbc:h2:tcp://localhost:9123/./target/jbpm-exec-test;MODE=LEGACY;NON_KEYWORDS=VALUE"); - dsProps.setProperty("tcpPort", "9123"); - PersistenceUtil.startH2TcpServer(dsProps); + String jdbcUrl = dsProps.getProperty("url"); + if (jdbcUrl != null && jdbcUrl.matches("jdbc:h2:.*")) { + dsProps.setProperty("url", "jdbc:h2:tcp://localhost:9123/./target/jbpm-exec-test;MODE=LEGACY;NON_KEYWORDS=VALUE"); + dsProps.setProperty("tcpPort", "9123"); + PersistenceUtil.startH2TcpServer(dsProps); + } } @AfterClass diff --git a/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/ExtendedExecutorTest.java b/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/ExtendedExecutorTest.java index 9db7f48472..e1751c9a03 100644 --- a/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/ExtendedExecutorTest.java +++ b/jbpm-services/jbpm-executor/src/test/java/org/jbpm/executor/ExtendedExecutorTest.java @@ -66,9 +66,12 @@ public static void createDBServer() { System.setProperty("org.kie.executor.setDefaultOwner", "true"); System.setProperty("org.kie.executor.olderThan", "2"); dsProps = ExecutorTestUtil.getDatasourceProperties(); - dsProps.setProperty("url", "jdbc:h2:tcp://localhost:9123/./target/jbpm-exec-test;MODE=LEGACY;NON_KEYWORDS=VALUE"); - dsProps.setProperty("tcpPort", "9123"); - PersistenceUtil.startH2TcpServer(dsProps); + String jdbcUrl = dsProps.getProperty("url"); + if (jdbcUrl != null && jdbcUrl.matches("jdbc:h2:.*")) { + dsProps.setProperty("url", "jdbc:h2:tcp://localhost:9123/./target/jbpm-exec-test;MODE=LEGACY;NON_KEYWORDS=VALUE"); + dsProps.setProperty("tcpPort", "9123"); + PersistenceUtil.startH2TcpServer(dsProps); + } IdProvider.reset(); } diff --git a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/QueryServiceImplTest.java b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/QueryServiceImplTest.java index bfba3ef7e4..4150f77e06 100644 --- a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/QueryServiceImplTest.java +++ b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/QueryServiceImplTest.java @@ -346,8 +346,15 @@ public void testGetProcessInstancesByProcessId() { public void testGetProcessInstancesWithVariables() { query = new SqlQueryDefinition("getAllProcessInstancesWithVariables", dataSourceJNDIname); - query.setExpression("select pil.*, v.variableId, v.value " + "from ProcessInstanceLog pil " + "inner join (select vil.processInstanceId ,vil.variableId, MAX(vil.ID) maxvilid FROM VariableInstanceLog vil " + "GROUP BY vil.processInstanceId, vil.variableId ORDER BY vil.processInstanceId) x " + "ON (v.variableId = x.variableId AND v.id = x.maxvilid )" + "INNER JOIN VariableInstanceLog v " + "ON (v.processInstanceId = pil.processInstanceId)"); + query.setExpression("SELECT pil.*, v.variableId, v.value " + + "FROM ProcessInstanceLog pil " + + "INNER JOIN (" + + " SELECT vil.processInstanceId, vil.variableId, MAX(vil.ID) AS maxvilid" + + " FROM VariableInstanceLog vil" + + " GROUP BY vil.processInstanceId, vil.variableId" + + ") x ON (pil.processInstanceId = x.processInstanceId) " + + "INNER JOIN VariableInstanceLog v ON (v.variableId = x.variableId AND v.id = x.maxvilid)"); queryService.registerQuery(query); Map params = new HashMap(); diff --git a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/TaskQueryBuilderTest.java b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/TaskQueryBuilderTest.java index 2967c0d29f..4a541b6283 100644 --- a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/TaskQueryBuilderTest.java +++ b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/test/TaskQueryBuilderTest.java @@ -327,18 +327,15 @@ public void testFormName() { ProcessInstance instance = processService.getProcessInstance(pids[0]); assertNotNull(instance); + + Long hrTaskId = claimAndCompleteTask(pids[0],"katy"); + Long itTaskId = claimAndCompleteTask(pids[0], "salaboy"); - claimAndCompleteTask(pids[0], 0, "katy"); - claimAndCompleteTask(pids[0], 1, "salaboy"); - - List taskIds = runtimeDataService.getTasksByProcessInstanceId(pids[0]); - - UserTaskInstanceDesc userTask = runtimeDataService.getTaskById(taskIds.get(2)); - assertEquals("CreateProposal", userTask.getFormName()); - assertEquals("Proposal for: ", userTask.getSubject()); - - userTask = runtimeDataService.getTaskByWorkItemId(taskIds.get(0)); + UserTaskInstanceDesc userTask = runtimeDataService.getTaskByWorkItemId(hrTaskId); assertEquals("HRInterview", userTask.getFormName()); + + userTask = runtimeDataService.getTaskByWorkItemId(itTaskId); + assertEquals("TechInterview", userTask.getFormName()); ProcessInstanceDesc instanceDesc = runtimeDataService.getProcessInstanceById(pids[0]); assertNotNull(instanceDesc); @@ -347,6 +344,7 @@ public void testFormName() { assertNotNull(tasks); assertEquals(1, tasks.size()); assertEquals("CreateProposal", tasks.get(0).getFormName()); + assertEquals("Proposal for: ", tasks.get(0).getSubject()); } @Test @@ -364,12 +362,18 @@ public void testFormNameParallelTasks() { assertThat(tasks).extracting("getFormName").contains("HRInterview","TechInterview"); } - private void claimAndCompleteTask(Long processInstanceId, int position, String user) { - List taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId); - assertTrue(!taskIds.isEmpty()); - Long taskId = taskIds.get(position); + private Long claimAndCompleteTask(Long processInstanceId, String user) { + ProcessInstanceDesc instanceDesc = runtimeDataService.getProcessInstanceById(pids[0]); + assertNotNull(instanceDesc); + List tasks = instanceDesc.getActiveTasks(); + assertNotNull(tasks); + assertEquals(1, tasks.size()); + Long taskId = tasks.get(0).getTaskId(); + userTaskService.claim(taskId, user); userTaskService.start(taskId, user); userTaskService.complete(taskId, user, new HashMap<>()); + + return taskId; } } diff --git a/jbpm-services/jbpm-kie-services/src/test/resources/kjar-jpa/persistence-test.jar b/jbpm-services/jbpm-kie-services/src/test/resources/kjar-jpa/persistence-test.jar index 91bd669e5cad14d4ecdca2ba9ee6991d5f099485..3a385baba6edb696cfa7b2be8c164861ac3b029d 100644 GIT binary patch delta 807 zcmdlN^C)J+Cf0fe1_llW4quJ%l{Lj0{}>q)-072FJrEVpMdGJuJxA>RGB3TCn`9eaoQurfjtdyU3q<1gKxBJNKdxC7iCE7>U??SGjO$I5AW{^*J5jHn~6#aDYi+sZTqu8qv| zdZ)Oq^ZSjDGwqDG$!I;CS3OnMvux9{%!tnidhULFSz+^Vf84z5m5r(@LG3dRr^aSo zo-ix?{EDSEvt{aIxOuu2r6jW6+s;l)E>kfKdA0cu|EsIEe(n?NfAM-|>BcTu_~q}X zqlv$LLyg*>q}2vhKaiGt^++e9$wow_aQUg%)7JZoKi|CDlwI?}vV-dFwY(cdhMT z=O63p{?)1fZm)e%l6igY7FC(ey1VwAU?<>z9y zW_Mb+E~k8nE@g`jC|NF_p~8CE|3-@Sm5hUuv#0KRRd@En@pJ#p-tg*v4nC~Kns<9$ zSNHwDYlLn!^Xz>eIP;3$fi7Kp=|!axCH{#Qb!FGAE8E*}t8!oVlR5kUe)v=LX8zK} z_M1PlXDF%2F^k|xR}w&R1_odIdkon0YcbEmCYea{5?DmduI2CLPdMD zB#oZOV>XH-)Z7TExAXYd>(Al0I3fpHfHE5A@ewJ$PY1IyNXU6EM&3fxJkFgfr%AGd zJus>?-9O+sp3J*9^7Y&f_E=odrOkJkOpCfSG`Nc5HZEWbd#xX0-r@=v!R!%9mRX()WZ zd~w)rT^7tCxoMZwEck|px;P7(fQNz%-Ldq##p}b_`Q&cRUJ8G-Y4FSC8m$J0Y*zw% zy8JD#=F2mEmbAjF*UrIEfPayxEXQ;w);tN(Jg&yG;=ja#c!|@)(YQy;eo44gu1HWAchSADRs8;^iScN`uY8x z>@IeJfUeiyAFBW3$4y)6XyZ-1+~8o!h|tab%?e zw`pe3hrJ-Qdl?Q@hsvaO0ak4B-4Lz91bqk-bm3rmvFj29)LfLC6XI9i+-N^_yKCv- zAG7@jXd)y(0~7-Q00;oDO=eBl@iG$*0ssKL1pojT000000000003d*qi7FnGS1b^d z&ng-M@duMV3K^5?EfbR$D;fe73X?qw8 is set to true in for the +# src/test/resources directory in the pom. +# +className=${maven.datasource.classname} +driverClassName=${maven.jdbc.driver.class} +user=${maven.jdbc.username} +password=${maven.jdbc.password} +url=${maven.jdbc.url} +serverName=${maven.jdbc.db.server} +portNumber=${maven.jdbc.db.port} +databaseName=${maven.jdbc.db.name} +defaultSchema=${maven.jdbc.schema} +txType=${maven.tx.type} diff --git a/jbpm-services/jbpm-services-cdi/src/test/java/org/jbpm/services/cdi/test/util/ArquillianTestWrapperExtension.java b/jbpm-services/jbpm-services-cdi/src/test/java/org/jbpm/services/cdi/test/util/ArquillianTestWrapperExtension.java index 8e33d4a679..ccbfa9acd1 100644 --- a/jbpm-services/jbpm-services-cdi/src/test/java/org/jbpm/services/cdi/test/util/ArquillianTestWrapperExtension.java +++ b/jbpm-services/jbpm-services-cdi/src/test/java/org/jbpm/services/cdi/test/util/ArquillianTestWrapperExtension.java @@ -22,6 +22,7 @@ import org.jboss.arquillian.core.spi.LoadableExtension; import org.jboss.arquillian.test.spi.event.suite.AfterSuite; import org.jboss.arquillian.test.spi.event.suite.BeforeSuite; +import org.jbpm.test.persistence.util.PersistenceUtil; import org.kie.test.util.db.DataSourceFactory; import org.kie.test.util.db.PoolingDataSourceWrapper; @@ -39,11 +40,14 @@ public static class DataSourceHandler { public void init(@Observes BeforeSuite event, ContainerRegistry registry) { Properties driverProperties = new Properties(); - driverProperties.put("user", "sa"); - driverProperties.put("password", "sasa"); - driverProperties.put("url", "jdbc:h2:mem:mydb;MODE=LEGACY;NON_KEYWORDS=VALUE"); - driverProperties.put("driverClassName", "org.h2.Driver"); - driverProperties.put("className", "org.h2.jdbcx.JdbcDataSource"); + driverProperties.put("user", PersistenceUtil.getDatasourceProperties().getProperty("user")); + driverProperties.put("password", PersistenceUtil.getDatasourceProperties().getProperty("password")); + driverProperties.put("url", PersistenceUtil.getDatasourceProperties().getProperty("url")); + driverProperties.put("driverClassName", PersistenceUtil.getDatasourceProperties().getProperty("driverClassName")); + driverProperties.put("className", PersistenceUtil.getDatasourceProperties().getProperty("className")); + driverProperties.put("databaseName", PersistenceUtil.getDatasourceProperties().getProperty("databaseName")); + driverProperties.put("serverName", PersistenceUtil.getDatasourceProperties().getProperty("serverName")); + driverProperties.put("portNumber", PersistenceUtil.getDatasourceProperties().getProperty("portNumber")); ds = DataSourceFactory.setupPoolingDataSource("jdbc/testDS1", driverProperties); } diff --git a/jbpm-services/jbpm-services-cdi/src/test/resources/kjar-jpa/persistence-test.jar b/jbpm-services/jbpm-services-cdi/src/test/resources/kjar-jpa/persistence-test.jar index 3b7ae83157bb066c14cd2b77468b872b1e0aa4c6..3a385baba6edb696cfa7b2be8c164861ac3b029d 100644 GIT binary patch delta 1250 zcmewu^(bb;Cf0fe1_llW4quJ%l{Lj0{}>q)-072FJrEVpMdGJuJxA>RGB3TCn`9eaoQurfjtdyU3q<1gKxBJNKdxC7iCE7>U??SGjO$I5AW{^*J5jHn~6#aDYi+sZTqu8qv| zdZ)Oq^ZSjDGwqDG$!I;CS3OnMvux9{%!tnidhULFSz+^Vf84z5m5r(@LG3dRr^aSo zo-ix?{EDSEvt{aIxOuu2r6jW6+s;l)E>kfKdA0cu|EsIEe(n?NfAM-|>BcTu_~q}X zqlv$LLyg*>q}2vhKaiGt^++e9$wow_aQUg%)7JZoKi|CDlwI?}vV-dFwY(cdhMT z=O63p{?)1fZm)e%l6igY7FC(ey1VwAU?<>z9y zW_Mb+E~k8nE@g`jC|NF_p~8CE|3-@Sm5hUuv#0KRRd@En@pJ#p-tg*v4nC~Kns<9$ zSNHwDYlLn!^Xz>eIP;3$fi7Kp=|!axCH{#Qb!FGAE8E*}t8!oVlR5kUe)v=LX8zK} z_M1PlvvDzP_nrJxP!&We2B(zy<$OP zQv@|Rj=C%n(D)gcyj3VGH0;TR>D?9Q_O#`=9e>8_`{2;r*4tsOTTa9V-Y!!9!mQL$ zmYZ{Nk#A)82C=Vd>@8ujJHF4UwrD@ix_U9|EQUoL>CckR7$r|z*w|afaKOlW;=5@w zN9#jc9*ey?;}H?1dGUY5EZ_RQ!Us++Pn8c6;rwl}X7Wmr`C?{4Nw)8o9OiqFRiUy( z$oFVd1Bcv<{+Z=AC2JTq@XqhyTqI|*Pjc=YM^2r!os+su15=$HmGU-AomV$;Rj^h* z$-|qSa#woZ2X<#hduuU1*@CG*-fR2pynA4~Q+>Wsz4Y1G-g*4f@3?p0|JB^?{AS-C z>p9o`e;;4}bX|4ct+{*OY)jkr=;qSnQAfUB4PJ4>f3n$^i{VmPtDoibWxEEfI-j0% zJnrKozX|?!?0Z++2Y55HOwQ4k+AJ(wDW)RFEP^8^O8~_g7=XdfFnNQfoJ42{DL5b_O+XAe delta 998 zcmaD9^D%0}CRTA~1_llW&ww=F-CUX%`Is0Owz4uXNH9$9)sm{88ge%8k%7Rz@0yG5 zJZ9LtMqtUSysfJOv=uMLzSWg_(8sPbAr})jr6!q*`ZKmJP+{m?(>^=5!{`Kji z`WsqYUI`T6SmT{56!iI(=GH0VhYxN&ut8!`;+B8qb|>B6I3%sOlKzwR)lu7X@09+3 zk)CuVYL|!e%imAC50|}OmBM$@_xF;rgXT6@jz(T!u@O-zJbvo6Sbl%{^U1qSt2OH{ zq#ay8A$yCI%%)h@H$OjZ-!n`9{FlgEoa^JP**h8jD+NdQ-Sk^iDYd9FsyF?m`}t8uKWmQWVK?3B98D0IW{$cso&%dp2#=l`cUc7tVQqg)Lk)r4R1}lEuIUzm8)_>l)JtZp& zIooTR`^0x1I3;?Q?fYTfu2M@uC&LwUUw*l>=y==gfW%pI{;fKfz}yw}*MV7c#xb?~ zi`=-+-PrRb_e*hio@~41w>-wr$0vkx-B~u*cK)}93-3}bd~CHQ-(ro}c(mMk3)ke& zhCb(7o1Y$CCoU9F?Ral4&;Cyj)qZE*jz9hGALHh~>}*_2egTtNg;YV5j*uQ7DDjln zDft#KFfeRjn4BS`Ro}Ofv%!JKb+JNHdTL^6LjFTGK83C*j!8SWKmvV|1u!I*0 z3tI@R`SZc!)6Yi!xF^lr0S`1zxs@F1vgPRLxxu+l|55v=ZEN42l2;e3Q#$wh_~Ttm zR$S4!EV=dOmN{xBMk}TGj+FfuO-Fwk$ti)m*nJEy26viwWXLuxqw{h$$r{ejA4^2wUt=> zfF7OvKu5yrt>ark28Q@}Uq@&E;0XNyZ$>7FWef};H8A5rv=E#l(D2q#Wb#LCMS0W! zV_;B*t5IlJ(&#eTP$z)ttI*_E!qSuH>1Z*zN>4teW5ARyJ^7E0DN~>HWMf?`rd`sL m^L0I#R>@DEuV6Cyt*#c+Sw$ezaI%*kA6Fn70|S>j$W#DSZ=false + + tc-postgres + + org.quartz.impl.jdbcjobstore.PostgreSQLDelegate + + + + + maven-surefire-plugin + + + true + + + + + + diff --git a/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/TransactionsTest.java b/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/TransactionsTest.java index d42a67ddaa..66953c71bc 100644 --- a/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/TransactionsTest.java +++ b/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/TransactionsTest.java @@ -86,7 +86,6 @@ public void testStartProcessRollback() throws Exception { ut.begin(); processId = startProcess(ksession); - assertProcessInstanceActive(processId); } finally { ut.rollback(); } diff --git a/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/event/SignalEventTest.java b/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/event/SignalEventTest.java index 5c94aaaa49..9636430477 100644 --- a/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/event/SignalEventTest.java +++ b/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/event/SignalEventTest.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.assertj.core.api.Assertions; import org.jbpm.test.JbpmTestCase; import org.junit.Test; @@ -115,7 +114,7 @@ public void testSignalManually() { KieSession ksession = getKieSession(); ProcessInstance pi1 = ksession.startProcess(INTERMEDIATE_CATCH_ID); - getKieSession().startProcess(INTERMEDIATE_CATCH_ID); + ProcessInstance pi2 = getKieSession().startProcess(INTERMEDIATE_CATCH_ID); switch (scope) { case DEFAULT: @@ -134,14 +133,16 @@ public void testSignalManually() { List instances = getRuntimeEngine().getAuditService().findProcessInstances(); Assertions.assertThat(instances).hasSize(2); - Assertions.assertThat(instances.get(0).getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); - Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); + ProcessInstanceLog instance1 = getRuntimeEngine().getAuditService().findProcessInstance(pi1.getId()); + Assertions.assertThat(instance1.getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); + Assertions.assertThat(instance1.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); - Assertions.assertThat(instances.get(1).getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); + ProcessInstanceLog instance2 = getRuntimeEngine().getAuditService().findProcessInstance(pi2.getId()); + Assertions.assertThat(instance2.getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); if (strategy == Strategy.SINGLETON) { - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance2.getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); } else if (strategy == Strategy.PROCESS_INSTANCE) { - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); + Assertions.assertThat(instance2.getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); } } @@ -168,21 +169,23 @@ public void testSignalEndThrowIntermediateCatch() { createRuntimeManager(strategy, null, throwingProcessFile, INTERMEDIATE_CATCH); - getKieSession().startProcess(INTERMEDIATE_CATCH_ID); - getKieSession().startProcess(throwingProcessId); + ProcessInstance pi1 = getKieSession().startProcess(INTERMEDIATE_CATCH_ID); + ProcessInstance pi2 = getKieSession().startProcess(throwingProcessId); List instances = getRuntimeEngine().getAuditService().findProcessInstances(); Assertions.assertThat(instances).hasSize(2); - Assertions.assertThat(instances.get(0).getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); - Assertions.assertThat(instances.get(1).getProcessId()).isEqualTo(throwingProcessId); - + ProcessInstanceLog instance1 = getRuntimeEngine().getAuditService().findProcessInstance(pi1.getId()); + ProcessInstanceLog instance2 = getRuntimeEngine().getAuditService().findProcessInstance(pi2.getId()); + Assertions.assertThat(instance1.getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); + Assertions.assertThat(instance2.getProcessId()).isEqualTo(throwingProcessId); + if (strategy == Strategy.SINGLETON) { - Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance1.getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance2.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); } else if (strategy == Strategy.PROCESS_INSTANCE) { - Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance1.getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); + Assertions.assertThat(instance2.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); } } @@ -209,7 +212,7 @@ public void testSignalIntermediateThrowStartCatch() { createRuntimeManager(strategy, null, throwingProcessFile, START_CATCH); - getKieSession().startProcess(throwingProcessId); + ProcessInstance throwingPI = getKieSession().startProcess(throwingProcessId); boolean run = (strategy == Strategy.SINGLETON && scope != Scope.PROCESS_INSTANCE) || (strategy == Strategy.PROCESS_INSTANCE && scope == Scope.PROJECT) || @@ -218,12 +221,14 @@ public void testSignalIntermediateThrowStartCatch() { List instances = getRuntimeEngine().getAuditService().findProcessInstances(); Assertions.assertThat(instances).hasSize(run ? 2 : 1); - Assertions.assertThat(instances.get(0).getProcessId()).isEqualTo(throwingProcessId); - Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); + ProcessInstanceLog instance1 = getRuntimeEngine().getAuditService().findProcessInstance(throwingPI.getId()); + Assertions.assertThat(instance1.getProcessId()).isEqualTo(throwingProcessId); + Assertions.assertThat(instance1.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); if (run) { - Assertions.assertThat(instances.get(1).getProcessId()).isEqualTo(START_CATCH_ID); - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); + instances.remove(instance1); + Assertions.assertThat(instances.get(0).getProcessId()).isEqualTo(START_CATCH_ID); + Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); } } @@ -316,27 +321,31 @@ public void testSignalSubProcess() { createRuntimeManager(strategy, null, SUBPROCESS_CATCH, throwingProcessFile, INTERMEDIATE_CATCH); - getKieSession().startProcess(INTERMEDIATE_CATCH_ID); + ProcessInstance pi1 = getKieSession().startProcess(INTERMEDIATE_CATCH_ID); Map parameters = new HashMap(); parameters.put("subprocess", throwingProcessId); - getKieSession().startProcess(SUBPROCESS_CATCH_ID, parameters); + ProcessInstance pi2 = getKieSession().startProcess(SUBPROCESS_CATCH_ID, parameters); List instances = getRuntimeEngine().getAuditService().findProcessInstances(); Assertions.assertThat(instances).hasSize(3); - Assertions.assertThat(instances.get(0).getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); - Assertions.assertThat(instances.get(1).getProcessId()).isEqualTo(SUBPROCESS_CATCH_ID); - Assertions.assertThat(instances.get(2).getProcessId()).isEqualTo(throwingProcessId); + ProcessInstanceLog instance1 = getRuntimeEngine().getAuditService().findProcessInstance(pi1.getId()); + ProcessInstanceLog instance2 = getRuntimeEngine().getAuditService().findProcessInstance(pi2.getId()); + instances.removeAll(Arrays.asList(instance1, instance2)); + ProcessInstanceLog instance3 = instances.get(0); + Assertions.assertThat(instance1.getProcessId()).isEqualTo(INTERMEDIATE_CATCH_ID); + Assertions.assertThat(instance2.getProcessId()).isEqualTo(SUBPROCESS_CATCH_ID); + Assertions.assertThat(instance3.getProcessId()).isEqualTo(throwingProcessId); if (strategy == Strategy.SINGLETON) { - Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance1.getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance2.getStatus()).isEqualTo(scope == Scope.PROCESS_INSTANCE ? ProcessInstance.STATE_ACTIVE : ProcessInstance.STATE_COMPLETED); } else if (strategy == Strategy.PROCESS_INSTANCE) { - Assertions.assertThat(instances.get(0).getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); - Assertions.assertThat(instances.get(1).getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); + Assertions.assertThat(instance1.getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); + Assertions.assertThat(instance2.getStatus()).isEqualTo(scope == Scope.PROJECT ? ProcessInstance.STATE_COMPLETED : ProcessInstance.STATE_ACTIVE); } - Assertions.assertThat(instances.get(2).getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); + Assertions.assertThat(instance3.getStatus()).isEqualTo(ProcessInstance.STATE_COMPLETED); } } diff --git a/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/timer/SerializedTimerRollbackTest.java b/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/timer/SerializedTimerRollbackTest.java index cc4744169a..987af7da1c 100644 --- a/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/timer/SerializedTimerRollbackTest.java +++ b/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/timer/SerializedTimerRollbackTest.java @@ -21,10 +21,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.sql.Blob; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; +import java.io.ByteArrayInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -38,6 +35,7 @@ import org.drools.core.common.InternalKnowledgeRuntime; import org.drools.core.marshalling.impl.MarshallingConfigurationImpl; +import org.drools.persistence.info.SessionInfo; import org.drools.serialization.protobuf.ProtobufMarshaller; import org.jbpm.process.instance.InternalProcessRuntime; import org.jbpm.process.instance.timer.TimerInstance; @@ -110,16 +108,13 @@ public void testSerizliableTestsWithExternalRollback() { } } - Connection c = getDs().getConnection(); - Statement st = c.createStatement(); - ResultSet rs = st.executeQuery("select rulesbytearray from sessioninfo"); - rs.next(); - Blob b = rs.getBlob("rulesbytearray"); - assertNotNull(b); + List sessionsInfo = getEmf().createEntityManager().createQuery("SELECT o FROM SessionInfo o", SessionInfo.class).getResultList(); + assertTrue(!sessionsInfo.isEmpty()); + byte[] b = sessionsInfo.get(0).getData(); KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(); ProtobufMarshaller marshaller = new ProtobufMarshaller(builder.newKieBase(), new MarshallingConfigurationImpl()); - StatefulKnowledgeSession session = marshaller.unmarshall(b.getBinaryStream()); + StatefulKnowledgeSession session = marshaller.unmarshall(new ByteArrayInputStream(b)); assertNotNull(session); TimerManager timerManager = ((InternalProcessRuntime) ((InternalKnowledgeRuntime) session).getProcessRuntime()).getTimerManager(); @@ -177,16 +172,13 @@ public void testSerizliableTestsWithEngineRollback() { } } - Connection c = getDs().getConnection(); - Statement st = c.createStatement(); - ResultSet rs = st.executeQuery("select rulesbytearray from sessioninfo"); - rs.next(); - Blob b = rs.getBlob("rulesbytearray"); - assertNotNull(b); + List sessionsInfo = getEmf().createEntityManager().createQuery("SELECT o FROM SessionInfo o", SessionInfo.class).getResultList(); + assertTrue(!sessionsInfo.isEmpty()); + byte[] b = sessionsInfo.get(0).getData(); KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(); ProtobufMarshaller marshaller = new ProtobufMarshaller(builder.newKieBase(), new MarshallingConfigurationImpl()); - StatefulKnowledgeSession session = marshaller.unmarshall(b.getBinaryStream()); + StatefulKnowledgeSession session = marshaller.unmarshall(new ByteArrayInputStream(b)); assertNotNull(session); TimerManager timerManager = ((InternalProcessRuntime) ((InternalKnowledgeRuntime) session).getProcessRuntime()).getTimerManager(); diff --git a/pom.xml b/pom.xml index 683563086e..d62d7a4661 100644 --- a/pom.xml +++ b/pom.xml @@ -31,8 +31,6 @@ sa sasa - - jdbc:h2:mem:jbpm-db;MODE=LEGACY;OLD_INFORMATION_SCHEMA=TRUE;NON_KEYWORDS=VALUE PUBLIC @@ -202,6 +200,110 @@ jbpm-distribution + + + tc-postgres + + org.hibernate.dialect.PostgreSQL82Dialect + org.postgresql.xa.PGXADataSource + org.postgresql.Driver + sa + sa + tcdb + public + 15.3 + false + + + + + org.postgresql + postgresql + ${version.org.postgresql} + + + + + + org.postgresql + postgresql + + + + + + org.codehaus.gmaven + groovy-maven-plugin + 2.1.1 + + + testcontainers-postgres-start + generate-test-sources + + execute + + + + import org.testcontainers.containers.PostgreSQLContainer; + + if (${skipTests}) { + log.info "Skipping execution..."; + return; + } + log.info "Starting postgres db testcontainer..."; + db = new PostgreSQLContainer("postgres:${postgres.db.version}-alpine") + .withUsername("${maven.jdbc.username}") + .withDatabaseName("${maven.jdbc.db.name}") + .withPassword("${maven.jdbc.password}") + .withEnv(Collections.singletonMap("PGDATA","/var/lib/postgresql/data")) + .withTmpFs(Collections.singletonMap("/var/lib/postgresql/data","rw")) + .withReuse(true) + .withCommand("-c max_prepared_transactions=10 -c max_connections=1000"); + + db.start(); + project.properties.setProperty('maven.jdbc.url', db.getJdbcUrl()); + project.properties.setProperty('maven.jdbc.db.port', db.getExposedPorts().toString()); + project.properties.setProperty('maven.jdbc.db.server', db.getHost()); + project.properties.setProperty('testcontainer.containerid', db.getContainerId()); + project.properties.setProperty('testcontainer.imageName', db.getDockerImageName()); + log.info "Started postgres db testcontainer at "+db.getJdbcUrl()+":"+db.getExposedPorts().toString(); + + + + + testcontainers-postgres-stop + prepare-package + + execute + + + + import org.testcontainers.utility.ResourceReaper; + + if (${skipTests}) { + log.info "Skipping execution..."; + return; + } + containerId = "${testcontainer.containerid}" + imageName = "${testcontainer.imageName}" + log.info "Stopping postgres-db $containerId - $imageName" + ResourceReaper.instance().stopAndRemoveContainer(containerId, imageName); + log.info "Stopped postgres-db $containerId - $imageName" + + + + + + + org.testcontainers + postgresql + ${version.org.testcontainers} + + + + + + mariadb