File: have_clusterj.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (140 lines) | stat: -rw-r--r-- 4,555 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
--perl
use strict;

use File::Basename;
use IO::File;
use lib "lib/";
use My::Find;

#
# Look for Cluster/J library, if not found: skip test.
#

#
# Set up paths
#
my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR";
my $mysql_test_dir = $ENV{MYSQL_TEST_DIR} or die "Need MYSQL_TEST_DIR";
my $basedir = dirname($mysql_test_dir);
my $version = $ENV{MYSQL_SERVER_VERSION};

# In the RPM case, binaries and libraries are installed in the
# default system locations, instead of having our own private base
# directory. And we install "usr/share/mysql-test". Moving up two
# more directory relative to "mysql-test" gives us a usable base
# directory for RPM installs.
if (! -d "$basedir/sql" and ! -d "$basedir/bin" )
{
  $basedir= dirname($basedir);
}

my $bindir = $ENV{MTR_BINDIR} || $basedir; # Out of source set MTR_BINDIR

#
# Check if the needed jars and libs are available
#

my $clusterj_jar = my_find_file($bindir,
                                [ "storage/ndb/clusterj", 
                                  "share/java",
                                  "share/mysql/java",
                                  "share/mysql-8.0/java",
                                  "lib/java"
                                ],
                                "clusterj-$version.jar",
                                NOT_REQUIRED);

my $clusterj_test_jar = my_find_file($bindir,
                                     [ "storage/ndb/clusterj/clusterj-test",
                                       "share/java",
                                       "share/mysql/java",
                                       "share/mysql-8.0/java",
                                       "lib/java"
                                     ],
                                     "clusterj-test-$version.jar",
                                     NOT_REQUIRED);

# The expected installation locations are lib, lib/mysql, lib64/mysql, lib/x86_64-linux-gnu
my $ndbclient_lib = my_find_file($bindir,
                                [ "library_output_directory",
                                  "lib*/*",
                                  "lib"
                                ],
                                [ "ndbclient.dll",
                                  "libndbclient.so",
                                  "libndbclient.dylib"
                                ],
                                NOT_REQUIRED);

my $F = IO::File->new("$vardir/tmp/have_clusterj_result.inc", 'w') or die;
print $F "# Looking for clusterj-$version.jar\n";

if ($clusterj_jar) {
  print $F "--let \$CLUSTERJ_JAR= $clusterj_jar\n"; 
  print $F "--echo Found clusterj.jar\n"
} else {
  print $F "--let \$skip_test=1\n";
  print $F "--let \$skip_reason=Could not find clusterj jar file\n";
}

if ($clusterj_test_jar) {
  print $F "--let \$CLUSTERJ_TEST_JAR= $clusterj_test_jar\n";
  print $F "--echo Found clusterj_test jar\n"
} else {
  print $F "--let \$skip_test=1\n";
  print $F "--let \$skip_reason=Could not find clusterj test jar file\n";
}

if ($ndbclient_lib) {
  my $ndbclient_lib_dir = dirname($ndbclient_lib);
  print $F "--let \$NDBCLIENT_LIB_DIR= $ndbclient_lib_dir\n";
  print $F "--echo Found ndbclient library\n"
} else {
  # Test runs only when ndb is compiled and enabled.
  # If not able to find libndbclient, probably an issue with this script.
  print $F "die Did not find libndbclient\n";
}

$F->close();

write_properties();

sub add {
   my $F = shift;
   my $prop = shift;
   my $val = shift;
   print $F "com.mysql.clusterj.$prop=$val\n";
}

sub write_properties {
  my $db = 'test';
  my $user = 'root';
  my $F = IO::File->new("$vardir/tmp/clusterj.properties", 'w') or die;
  add($F, 'connectstring', $ENV{'NDB_CONNECTSTRING'});
  add($F, 'connect.retries', '4');
  add($F, 'connect.delay', '5');
  add($F, 'connect.verbose', '1');
  add($F, 'connect.timeout.before', '30');
  add($F, 'connect.timeout.after', '20');
  add($F, 'jdbc.url', "jdbc:mysql://localhost:$ENV{MASTER_MYPORT}/$db");
  add($F, 'jdbc.driver', 'com.mysql.cj.jdbc.Driver');
  add($F, 'jdbc.username', $user);
  add($F, 'jdbc.password', '');
  add($F, 'username', '');
  add($F, 'password', '');
  add($F, 'database', $db);
  add($F, 'max.transactions', '1024');
  $F->close();
}

EOF

--source $MYSQLTEST_VARDIR/tmp/have_clusterj_result.inc
--remove_file $MYSQLTEST_VARDIR/tmp/have_clusterj_result.inc

# skip if the required jars were not found
if ($skip_test) {
  # remove the clusterj.properties file
  --remove_file $MYSQLTEST_VARDIR/tmp/clusterj.properties
  --skip $skip_reason
}