Changes to Refactor session handling requested by Holger

This commit is contained in:
BerndBreier 2017-11-24 16:19:08 +01:00
parent ea988efd46
commit 483831bfa4
21 changed files with 217 additions and 147 deletions

View File

@ -0,0 +1,13 @@
package pro.taskana.exceptions;
/**
* Thrown in ConnectionManagementMode AUTOCOMMIT when an attempt to commit fails.
*
*/
@SuppressWarnings("serial")
public class AutocommitFailedException extends RuntimeException {
public AutocommitFailedException(Throwable cause) {
super("Autocommit failed", cause);
}
}

View File

@ -1,8 +1,7 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import org.apache.ibatis.session.RowBounds;
import pro.taskana.TaskanaEngine;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.model.Classification;
import pro.taskana.persistence.ClassificationQuery;

View File

@ -3,7 +3,6 @@ package pro.taskana.impl;
import pro.taskana.ClassificationService;
import pro.taskana.TaskanaEngine;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.persistence.ClassificationQueryImpl;
import pro.taskana.impl.util.IdGenerator;
import pro.taskana.model.Classification;
import pro.taskana.model.mappings.ClassificationMapper;

View File

@ -1,10 +1,9 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import java.util.List;
import org.apache.ibatis.session.RowBounds;
import pro.taskana.TaskanaEngine;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.model.ObjectReference;
import pro.taskana.persistence.ObjectReferenceQuery;

View File

@ -1,11 +1,10 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import java.util.List;
import org.apache.ibatis.session.RowBounds;
import pro.taskana.TaskanaEngine;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.model.Task;
import pro.taskana.model.TaskState;
import pro.taskana.model.WorkbasketAuthorization;

View File

@ -14,7 +14,6 @@ import pro.taskana.TaskanaEngine;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskNotFoundException;
import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.persistence.TaskQueryImpl;
import pro.taskana.impl.util.IdGenerator;
import pro.taskana.model.DueWorkbasketCounter;
import pro.taskana.model.ObjectReference;

View File

@ -1,6 +1,5 @@
package pro.taskana.impl;
import java.sql.SQLException;
import java.util.Stack;
import org.apache.ibatis.mapping.Environment;
@ -20,6 +19,7 @@ import pro.taskana.TaskService;
import pro.taskana.TaskanaEngine;
import pro.taskana.WorkbasketService;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.AutocommitFailedException;
import pro.taskana.exceptions.ConnectionNotSetException;
import pro.taskana.impl.persistence.MapTypeHandler;
import pro.taskana.model.mappings.ClassificationMapper;
@ -79,103 +79,25 @@ public class TaskanaEngineImpl implements TaskanaEngine {
return this.taskanaEngineConfiguration;
}
/**
* Open the connection to the database.
* to be called at the begin of each Api call that accesses the database
*
*/
public void openConnection() {
initSqlSession();
if (mode != ConnectionManagementMode.EXPLICIT) {
pushSessionToStack(this.sessionManager);
}
}
/**
* Initializes the SqlSessionManager.
*
*/
void initSqlSession() {
if (mode == ConnectionManagementMode.EXPLICIT && this.connection == null) {
throw new ConnectionNotSetException();
} else if (mode != ConnectionManagementMode.EXPLICIT) {
if (!this.sessionManager.isManagedSessionStarted()) {
this.sessionManager.startManagedSession();
}
}
}
/**
* closes the connection to the database in mode EXPLICIT.
* In mode EXPLICIT, closes the client's connection, sets it to null and switches to mode PARTICIPATE
* Has the same effect as setConnection(null)
*/
@Override
public void closeConnection() {
if (this.mode == ConnectionManagementMode.EXPLICIT) {
this.connection = null;
if (sessionManager.isManagedSessionStarted()) {
sessionManager.close();
}
mode = ConnectionManagementMode.PARTICIPATE;
}
}
/**
* Returns the database connection into the pool.
* In the case of nested calls, simply pops the latest session from the session stack.
* Closes the connection if the session stack is empty.
* In mode AUTOCOMMIT commits before the connection is closed.
* To be called at the end of each Api call that accesses the database
*/
public void returnConnection() {
if (this.mode != ConnectionManagementMode.EXPLICIT) {
popSessionFromStack();
if (getSessionStack().isEmpty()
&& this.sessionManager != null && this.sessionManager.isManagedSessionStarted()) {
if (this.mode == ConnectionManagementMode.AUTOCOMMIT) {
try {
this.sessionManager.commit();
} catch (Exception e) {
LOGGER.debug("closeSession(): Tried to Autocommit and caught exception" + e);
}
}
this.sessionManager.close();
}
}
}
/**
* sets the connection management mode.
*
* @param mode - the connection management mode
* Valid values are
* PARTICIPATE - to be used in managed environments where taskana participates in surrounding transactions
* AUTOCOMMIT - to be used in non-managed environments. Taskana commits each single API call explicitly
* EXPLICIT - to be used in non-managed environments. Gives commit control to the client.
* PARTICIPATE - taskana participates in global transaction. This is the default mode
* AUTOCOMMIT - taskana commits each API call separately
* EXPLICIT - commit processing is managed explicitly by the client
*/
@Override
public void setConnectionManagementMode(ConnectionManagementMode mode) {
if (this.mode == ConnectionManagementMode.EXPLICIT && connection != null
&& mode != ConnectionManagementMode.EXPLICIT) {
try {
connection.close();
} catch (SQLException e) {
LOGGER.debug("setConnectionManagementMode(" + mode + ") tried to close connection and caught " + e);
if (sessionManager.isManagedSessionStarted()) {
sessionManager.close();
}
connection = null;
this.mode = mode;
} else {
this.mode = mode;
}
}
/**
* retrieve the SqlSession used by taskana.
* @return the myBatis SqlSession object used by taskana
*/
public SqlSession getSqlSession() {
return this.sessionManager;
this.mode = mode;
}
/**
@ -202,6 +124,81 @@ public class TaskanaEngineImpl implements TaskanaEngine {
}
}
/**
* closes the connection to the database in mode EXPLICIT.
* In mode EXPLICIT, closes the client's connection, sets it to null and switches to mode PARTICIPATE
* Has the same effect as setConnection(null)
*/
@Override
public void closeConnection() {
if (this.mode == ConnectionManagementMode.EXPLICIT) {
this.connection = null;
if (sessionManager.isManagedSessionStarted()) {
sessionManager.close();
}
mode = ConnectionManagementMode.PARTICIPATE;
}
}
/**
* Open the connection to the database.
* to be called at the begin of each Api call that accesses the database
*
*/
void openConnection() {
initSqlSession();
if (mode != ConnectionManagementMode.EXPLICIT) {
pushSessionToStack(this.sessionManager);
}
}
/**
* Initializes the SqlSessionManager.
*
*/
void initSqlSession() {
if (mode == ConnectionManagementMode.EXPLICIT && this.connection == null) {
throw new ConnectionNotSetException();
} else if (mode != ConnectionManagementMode.EXPLICIT) {
if (!this.sessionManager.isManagedSessionStarted()) {
this.sessionManager.startManagedSession();
}
}
}
/**
* Returns the database connection into the pool.
* In the case of nested calls, simply pops the latest session from the session stack.
* Closes the connection if the session stack is empty.
* In mode AUTOCOMMIT commits before the connection is closed.
* To be called at the end of each Api call that accesses the database
*/
void returnConnection() {
if (this.mode != ConnectionManagementMode.EXPLICIT) {
popSessionFromStack();
if (getSessionStack().isEmpty()
&& this.sessionManager != null && this.sessionManager.isManagedSessionStarted()) {
if (this.mode == ConnectionManagementMode.AUTOCOMMIT) {
try {
this.sessionManager.commit();
} catch (Exception e) {
LOGGER.error("closeSession(): Tried to Autocommit and caught exception" + e);
throw new AutocommitFailedException(e);
}
}
this.sessionManager.close();
}
}
}
/**
* retrieve the SqlSession used by taskana.
* @return the myBatis SqlSession object used by taskana
*/
SqlSession getSqlSession() {
return this.sessionManager;
}
/**
* This method creates the sqlSessionManager of myBatis. It integrates all the
* SQL mappers

View File

@ -4,9 +4,10 @@ import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import pro.taskana.impl.persistence.ClassificationQueryImpl;
import pro.taskana.impl.persistence.ObjectReferenceQueryImpl;
import pro.taskana.impl.persistence.TaskQueryImpl;
import pro.taskana.impl.ClassificationQueryImpl;
import pro.taskana.impl.ObjectReferenceQueryImpl;
import pro.taskana.impl.TaskQueryImpl;
import pro.taskana.model.Classification;
import pro.taskana.model.ObjectReference;
import pro.taskana.model.Task;

View File

@ -1,4 +1,4 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
@ -13,8 +13,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.model.Classification;
/**

View File

@ -1,5 +1,18 @@
package pro.taskana.impl;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.sql.Date;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -7,19 +20,11 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.persistence.TestClassificationQuery;
import pro.taskana.model.Classification;
import pro.taskana.model.mappings.ClassificationMapper;
import java.sql.Date;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
/**
* Unit Test for ClassificationServiceImpl.
* @author EH

View File

@ -1,4 +1,4 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
@ -13,8 +13,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.model.ObjectReference;
/**

View File

@ -1,4 +1,4 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
@ -13,8 +13,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.model.Task;
import pro.taskana.model.TaskState;

View File

@ -1,4 +1,4 @@
package pro.taskana.impl.persistence;
package pro.taskana.impl;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.model.Classification;

View File

@ -19,6 +19,7 @@ import pro.taskana.configuration.DbScriptRunner;
public class DBCleaner {
private static final Logger LOGGER = LoggerFactory.getLogger(DbScriptRunner.class);
private static final String DB_CLEAR_SCRIPT = "/sql/clear-db.sql";
private static final String DB_DROP_TABLES_SCRIPT = "/sql/drop-tables.sql";
private StringWriter outWriter = new StringWriter();
private PrintWriter logWriter = new PrintWriter(outWriter);
@ -28,21 +29,26 @@ public class DBCleaner {
/**
* Clears the db.
* @param dropTables if true drop tables, else clean tables
* @throws SQLException
*/
public void clearDb(DataSource dataSource) throws SQLException {
Connection connection = dataSource.getConnection();
ScriptRunner runner = new ScriptRunner(connection);
LOGGER.debug(connection.getMetaData().toString());
public void clearDb(DataSource dataSource, boolean dropTables) throws SQLException {
try (Connection connection = dataSource.getConnection()) {
ScriptRunner runner = new ScriptRunner(connection);
LOGGER.debug(connection.getMetaData().toString());
runner.setStopOnError(true);
runner.setLogWriter(logWriter);
runner.setErrorLogWriter(errorLogWriter);
runner.runScript(new InputStreamReader(this.getClass().getResourceAsStream(DB_CLEAR_SCRIPT)));
runner.closeConnection();
runner.setStopOnError(true);
runner.setLogWriter(logWriter);
runner.setErrorLogWriter(errorLogWriter);
if (dropTables) {
runner.runScript(new InputStreamReader(this.getClass().getResourceAsStream(DB_DROP_TABLES_SCRIPT)));
} else {
runner.runScript(new InputStreamReader(this.getClass().getResourceAsStream(DB_CLEAR_SCRIPT)));
}
} catch (Exception e) {
LOGGER.error("caught Exception " + e);
}
LOGGER.debug(outWriter.toString());
if (!errorWriter.toString().trim().isEmpty()) {
LOGGER.error(errorWriter.toString());

View File

@ -13,6 +13,7 @@ import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import pro.taskana.ClassificationService;
@ -38,6 +39,12 @@ public class ClassificationServiceImplIntAutoCommitTest {
private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl;
@BeforeClass
public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(ds, true);
}
@Before
public void setup() throws FileNotFoundException, SQLException, LoginException {
@ -48,7 +55,7 @@ public class ClassificationServiceImplIntAutoCommitTest {
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource);
cleaner.clearDb(dataSource, false);
}
@Test

View File

@ -15,6 +15,7 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import pro.taskana.ClassificationService;
@ -41,6 +42,12 @@ public class ClassificationServiceImplIntExplicitTest {
private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl;
@BeforeClass
public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(ds, true);
}
@Before
public void setup() throws FileNotFoundException, SQLException, LoginException {
@ -51,7 +58,7 @@ public class ClassificationServiceImplIntExplicitTest {
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.EXPLICIT);
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource);
cleaner.clearDb(dataSource, false);
}
@Test

View File

@ -11,6 +11,7 @@ import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import pro.taskana.TaskanaEngine;
@ -18,12 +19,12 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskNotFoundException;
import pro.taskana.impl.ClassificationQueryImpl;
import pro.taskana.impl.ObjectReferenceQueryImpl;
import pro.taskana.impl.TaskServiceImpl;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.configuration.DBCleaner;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
import pro.taskana.impl.persistence.ClassificationQueryImpl;
import pro.taskana.impl.persistence.ObjectReferenceQueryImpl;
import pro.taskana.impl.util.IdGenerator;
import pro.taskana.model.Task;
import pro.taskana.model.TaskState;
@ -42,6 +43,13 @@ public class TaskServiceImplIntAutocommitTest {
private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl;
@BeforeClass
public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(ds, true);
}
@Before
public void setup() throws FileNotFoundException, SQLException, LoginException {
dataSource = TaskanaEngineConfigurationTest.getDataSource();
@ -52,7 +60,7 @@ public class TaskServiceImplIntAutocommitTest {
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
taskServiceImpl = (TaskServiceImpl) taskanaEngine.getTaskService();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource);
cleaner.clearDb(dataSource, false);
}
@Test

View File

@ -13,6 +13,7 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import pro.taskana.TaskanaEngine;
@ -20,12 +21,12 @@ import pro.taskana.TaskanaEngine.ConnectionManagementMode;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskNotFoundException;
import pro.taskana.impl.ClassificationQueryImpl;
import pro.taskana.impl.ObjectReferenceQueryImpl;
import pro.taskana.impl.TaskServiceImpl;
import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.configuration.DBCleaner;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
import pro.taskana.impl.persistence.ClassificationQueryImpl;
import pro.taskana.impl.persistence.ObjectReferenceQueryImpl;
import pro.taskana.impl.util.IdGenerator;
import pro.taskana.model.Task;
import pro.taskana.model.TaskState;
@ -44,6 +45,13 @@ public class TaskServiceImplIntExplicitTest {
private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl;
@BeforeClass
public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(ds, true);
}
@Before
public void setup() throws FileNotFoundException, SQLException, LoginException {
dataSource = TaskanaEngineConfigurationTest.getDataSource();
@ -53,7 +61,7 @@ public class TaskServiceImplIntExplicitTest {
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.EXPLICIT);
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource);
cleaner.clearDb(dataSource, false);
}
@Test
@ -65,7 +73,7 @@ public class TaskServiceImplIntExplicitTest {
String id1 = IdGenerator.generateWithPrefix("TWB");
task.setWorkbasketId(id1);
task = taskServiceImpl.create(task);
taskanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session
connection.commit(); // needed so that the change is visible in the other session
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();

View File

@ -1,7 +1,19 @@
package pro.taskana.impl.integration;
import java.io.FileNotFoundException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource;
import org.h2.store.fs.FileUtils;
import org.junit.*;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode;
@ -16,13 +28,6 @@ import pro.taskana.impl.util.IdGenerator;
import pro.taskana.model.Workbasket;
import pro.taskana.model.WorkbasketAccessItem;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource;
import java.io.FileNotFoundException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Integration Test for workbasketServiceImpl with connection management mode AUTOCOMMIT.
@ -41,6 +46,13 @@ public class WorkbasketServiceImplIntAutocommitTest {
private TaskanaEngineImpl taskanaEngineImpl;
private WorkbasketService workBasketService;
@BeforeClass
public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(ds, true);
}
@Before
public void setup() throws FileNotFoundException, SQLException, LoginException {
dataSource = TaskanaEngineConfigurationTest.getDataSource();
@ -50,7 +62,7 @@ public class WorkbasketServiceImplIntAutocommitTest {
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
workBasketService = taskanaEngine.getWorkbasketService();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource);
cleaner.clearDb(dataSource, false);
}
@Test
@ -206,11 +218,6 @@ public class WorkbasketServiceImplIntAutocommitTest {
workBasketService.getWorkbasketAuthorization(accessItem.getId()).getAccessId());
}
@After
public void cleanUp() {
taskanaEngineImpl.returnConnection();
}
@AfterClass
public static void cleanUpClass() {
FileUtils.deleteRecursive("~/data", true);

View File

@ -14,6 +14,7 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import pro.taskana.TaskanaEngine;
@ -47,6 +48,13 @@ public class WorkbasketServiceImplIntExplicitTest {
private TaskanaEngineImpl taskanaEngineImpl;
private WorkbasketService workBasketService;
@BeforeClass
public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource();
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(ds, true);
}
@Before
public void setup() throws FileNotFoundException, SQLException, LoginException {
dataSource = TaskanaEngineConfigurationTest.getDataSource();
@ -55,7 +63,7 @@ public class WorkbasketServiceImplIntExplicitTest {
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.EXPLICIT);
DBCleaner cleaner = new DBCleaner();
cleaner.clearDb(dataSource);
cleaner.clearDb(dataSource, false);
}
@Test

View File

@ -0,0 +1,8 @@
DROP TABLE TASKANA_SCHEMA_VERSION;
DROP TABLE TASK;
DROP TABLE WORKBASKET;
DROP TABLE DISTRIBUTION_TARGETS;
DROP TABLE CLASSIFICATION;
DROP TABLE WORKBASKET_ACCESS_LIST;
DROP TABLE OBJECT_REFERENCE;
COMMIT;