fix: tweak test framework to cope with JSON type on H2 for versions older than 1.4.200
1.4.200 has some data corruption issues
Remove global `hibernate.globally_quoted_identifiers` as Hibernate was quoting the JSON type field
in `autohbm2ddl` which was breaking the tests.
MODIFY
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/EntityManagerFactoryAccessor.java
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/EntityManagerFactoryAccessor.java
@@ -75,9 +75,6 @@ public class EntityManagerFactoryAccessor implements IEntityManagerFactoryAccess
String dialect = System.getProperty("apiman.hibernate.dialect", s);
properties.put("hibernate.hbm2ddl.auto", autoValue);
properties.put("hibernate.dialect", dialect);
- properties.put("hibernate.globally_quoted_identifiers", "true");
- //properties.put("hibernate.connection.handling_mode", "DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT");
- // properties.put("hibernate.transaction.jta.platform", "com.atomikos.icatch.jta.hibernate4.AtomikosPlatform");
// First try using standard JPA to load the persistence unit. If that fails, then
// try using hibernate directly in a couple ways (depends on hibernate version and

MODIFY
manager/test/api/src/main/java/io/apiman/manager/test/server/ManagerApiTestServer.java
manager/test/api/src/main/java/io/apiman/manager/test/server/ManagerApiTestServer.java
@@ -62,6 +62,7 @@ import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher;
import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;
import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener;
import org.jboss.weld.environment.servlet.Listener;
+import org.jdbi.v3.core.Jdbi;
import org.testcontainers.elasticsearch.ElasticsearchContainer;
/**
@@ -184,6 +185,14 @@ public class ManagerApiTestServer {
} else {
ds = createInMemoryDatasource();
}
+ try {
+ // For H2 versions older than 1.4.200 this ensures JSON type exists.
+ Jdbi.create(ds).useHandle(h -> {
+ h.getConnection().setAutoCommit(false);
+ h.execute("CREATE domain IF NOT EXISTS json AS other");
+ h.commit();
+ });
+ } catch (Exception e) {}
// ctx.bind("java:/comp/env/jdbc/ApiManagerDS", ds);
ctx.bind("java:/apiman/datasources/apiman-manager", ds);
} catch (NameAlreadyBoundException nbe) {

fix: tweak test framework to cope with JSON type on H2 for versions older than 1.4.200

1.4.200 has some data corruption issues

Remove global `hibernate.globally_quoted_identifiers` as Hibernate was quoting the JSON type field 
in `autohbm2ddl` which was breaking the tests.