Skip to content

Commit

Permalink
Fix more db tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarrez committed Jul 4, 2024
1 parent 7d272cc commit e47f7d4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.common.engine.impl.persistence.entity.PropertyEntity;
import org.flowable.common.engine.impl.persistence.entity.PropertyEntityManager;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.rest.service.BaseSpringRestTestCase;
import org.flowable.rest.service.api.RestUrls;
import org.junit.Before;
import org.junit.Test;

import com.fasterxml.jackson.databind.JsonNode;
Expand All @@ -36,6 +39,25 @@
*/
public class EnginePropertiesResourceTest extends BaseSpringRestTestCase {

protected boolean databaseReset;

@Before
public void createDatabase() throws Exception {
if (!databaseReset) {
managementService.executeCommand(new Command<Object>() {

@Override
public Object execute(CommandContext commandContext) {
processEngineConfiguration.getSchemaManager().schemaDrop();
processEngineConfiguration.getSchemaManager().schemaCreate();
return null;
}

});
databaseReset = true;
}
}

@Test
public void testGetAllProperties() throws Exception {
CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_ENGINE_PROPERTIES)), HttpStatus.SC_OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.flowable.common.engine.impl.AbstractEngineConfiguration;
import org.flowable.rest.service.BaseSpringRestTestCase;
import org.flowable.rest.service.api.RestUrls;
import org.flowable.task.api.Task;
Expand All @@ -42,6 +43,11 @@ public class TableDataResourceTest extends BaseSpringRestTestCase {
*/
@Test
public void testGetTableColumns() throws Exception {
// This test only works on H2
if (!processEngineConfiguration.getDatabaseType().equalsIgnoreCase(AbstractEngineConfiguration.DATABASE_TYPE_H2)) {
return;
}

try {

Task task = taskService.newTask();
Expand Down

0 comments on commit e47f7d4

Please sign in to comment.