24 import com.mysql.ndbjtie.ndbapi.Ndb_cluster_connection;
25 import com.mysql.ndbjtie.ndbapi.Ndb;
26 import com.mysql.ndbjtie.ndbapi.NdbError;
36 private String mgmdConnect =
"localhost";
37 private String catalog =
"crunddb";
38 private String schema =
"def";
43 protected void init() {
48 mgmdConnect = System.getProperty(
"jtie.unit.ndb.connectstring", mgmdConnect);
52 out.println(
"creating cluster conn...");
55 out.println(
"... [ok, mgmd=" + mgmd +
"]");
59 out.println(
"connecting to mgmd ...");
60 final int retries = 0;
62 final int verbose = 1;
65 if (mgmd.
connect(retries, delay, verbose) != 0) {
67 +
" was not ready within "
68 + (retries * delay) +
"s.");
70 throw new RuntimeException(msg);
72 out.println(
"... [ok: " + mgmdConnect +
"]");
75 protected void close() {
77 out.println(
"closing mgmd conn ...");
80 out.println(
"... [ok, mgmd=" + mgmd +
"]");
91 protected void initConnection(
String catalog,
String schema) {
94 out.println(
"waiting until ready...");
95 final int initial_wait = 10;
96 final int final_wait = 0;
99 final String msg = (
"data nodes were not ready within "
100 + (initial_wait + final_wait) +
"s.");
102 throw new RuntimeException(msg);
104 out.println(
"... [ok]");
108 out.println(
"connecting to database...");
109 ndb =
Ndb.create(mgmd, catalog, schema);
110 final int max_no_tx = 10;
112 if (ndb.
init(max_no_tx) != 0) {
114 throw new RuntimeException(msg);
116 out.println(
"... [ok]");
119 protected void closeConnection() {
121 out.println(
"closing database conn ...");
124 out.println(
"... [ok]");
128 out.println(
"--> NdbJTieSmokeTest.test()");
131 initConnection(catalog, schema);
136 out.println(
"<-- NdbJTieSmokeTest.test()");
139 static public void main(
String[] args)
throws Exception {
140 out.println(
"--> NdbJTieSmokeTest.main()");
147 out.println(
"<-- NdbJTieSmokeTest.main()");