#
# Run the Cluster/J JPA JUnit tests from MTR
#
--source include/have_ndb.inc
--source include/have_big5.inc
--source include/have_utf8.inc
--source include/have_sjis.inc
--source include/not_embedded.inc
--source suite/ndb/include/have_connectorj.inc
--source suite/ndb/include/have_java.inc
--source suite/ndb/include/have_junit.inc
--source suite/ndb/include/have_clusterj.inc
--source suite/ndb/include/have_clusterj_jpa.inc
--source suite/ndb/include/have_openjpa.inc

# workaround for http://issues.apache.org/jira/browse/OPENJPA-1224
# OpenJPA MySQL BigDecimal ignoring Precision/Scale column Annotation when generating tables
# fixed in only 1.3.0 and 2.0.0

drop table if exists decimaltypes;
create table decimaltypes (
 id int not null primary key,
 decimal_null_hash decimal(10,5),
 decimal_null_btree decimal(10,5),
 decimal_null_both decimal(10,5),
 decimal_null_none decimal(10,5)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;

--let JAVA_CLASSPATH=$CLUSTERJ_JPA_JAR
--let JAVA_CLASSPATH_1=$CLUSTERJ_JPA_TEST_JAR
--let JAVA_CLASSPATH_2=$CLUSTERJ_TEST_JAR
# MTR_CLASSPATH automatically added to JAVA_CLASSPATH
--let JAVA_JVM_OPTS= -ea -Xcheck:jni -Dclusterj.properties=$MYSQLTEST_VARDIR/tmp/clusterj.properties
--let JAVA_JVM_OPTS_1= -Djava.library.path="$NDBCLIENT_LIB_DIR"
--let JAVA_JVM_OPTS_2= -Dopenjpa.ConnectionDriverName="com.mysql.jdbc.Driver"
--let JAVA_JVM_OPTS_3= -Dopenjpa.ConnectionURL="jdbc:mysql://localhost:$MASTER_MYPORT/test?user=root"
--let JAVA_JVM_OPTS_4= -Dopenjpa.ndb.connectString="$NDB_CONNECTSTRING"
--let JAVA_JVM_OPTS_5= -Dcom.mysql.clusterj.jpa.PersistenceUnit="enhance"
--let JAVA_JVM_OPTS_6= -Dopenjpa.jdbc.SynchronizeMappings="buildSchema(ForeignKeys=true,SchemaAction='add,deleteTableContents')"
--let JAVA_JVM_OPTS_7= -Dopenjpa.jdbc.DBDictionary="mysql(TableType=ndbcluster)"
--let JAVA_CLASS= testsuite.clusterj.AllTests
--let JAVA_ARGUMENTS= $CLUSTERJ_JPA_TEST_JAR

--source suite/ndb/include/run_java.inc

drop table if exists T_Basic;
drop table if exists longlongstringpk;
drop table if exists charsetlatin1;
drop table if exists longintstringpk;
drop table if exists longlongstringfk;
drop table if exists longintstringfk;
drop table if exists a;
drop table if exists b0;
drop table if exists blobtypes;
drop table if exists decimaltypes;
drop table if exists bigintegertypes;
drop table if exists timestamptypes;
drop table if exists timetypes;
drop table if exists datetypes;
drop table if exists datetimetypes;
drop table if exists OPENJPA_SEQUENCE_TABLE;

exit;
