MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
have_clusterj_jpa.inc
1 --perl
2 use strict;
3 
4 use File::Basename;
5 use IO::File;
6 use lib "lib/";
7 use My::Find;
8 
9 #
10 # Look for Cluster/J JPA library, if not found: skip test.
11 #
12 
13 #
14 # Set up paths
15 #
16 my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR";
17 my $mysql_test_dir = $ENV{MYSQL_TEST_DIR} or die "Need MYSQL_TEST_DIR";
18 my $basedir = dirname($mysql_test_dir);
19 
20 #
21 # Check if the needed jars are available
22 #
23 my $clusterj_jpa_jar = my_find_file($basedir,
24  ["storage/ndb/clusterj/clusterj-openjpa",
25  "share/mysql/java", # install unix
26  "lib/java"], # install windows
27  "clusterjpa-*.jar", NOT_REQUIRED);
28 
29 my $clusterj_jpa_test_jar = my_find_file($basedir,
30  ["storage/ndb/clusterj/clusterj-jpatest",
31  "share/mysql/java", # install unix
32  "lib/java"], # install windows
33  "clusterj-jpatest-*.jar", NOT_REQUIRED);
34 
35 my $F = IO::File->new("$vardir/tmp/have_clusterj_jpa_result.inc", 'w') or die;
36 if ($clusterj_jpa_jar) {
37  print $F "--let \$CLUSTERJ_JPA_JAR= $clusterj_jpa_jar\n";
38  print $F "--echo Found clusterj-openjpa.jar: '\$CLUSTERJ_JPA_JAR'\n"
39 } else {
40  print $F "skip Could not find clusterj jpa jar file\n";
41 }
42 
43 if ($clusterj_jpa_test_jar) {
44  print $F "--let \$CLUSTERJ_JPA_TEST_JAR= $clusterj_jpa_test_jar\n";
45  print $F "--echo Found clusterj_jpa_test jar: '\$CLUSTERJ_JPA_TEST_JAR'\n"
46 } else {
47  print $F "skip Could not find clusterj jpa test jar file\n";
48 }
49 
50 $F->close();
51 
52 EOF
53 
54 --source $MYSQLTEST_VARDIR/tmp/have_clusterj_jpa_result.inc