1# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3#
4# This code is free software; you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 2 only, as
6# published by the Free Software Foundation.
7#
8# This code is distributed in the hope that it will be useful, but WITHOUT
9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11# version 2 for more details (a copy is included in the LICENSE file that
12# accompanied this code).
13#
14# You should have received a copy of the GNU General Public License version
15# 2 along with this work; if not, write to the Free Software Foundation,
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17#
18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19# or visit www.oracle.com if you need additional information or have any
20# questions.
21
22if [ -z "${TESTJAVA}" ]; then
23  echo "TESTJAVA undefined: can't continue."
24  exit 1
25fi
26
27OS=`uname`
28
29case "$OS" in
30    Linux* )
31        GNOMESID=`pgrep gnome-session`
32        DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS /proc/$GNOMESID/environ | cut -d= -f2-`
33        export DBUS_SESSION_BUS_ADDRESS
34        DISPLAY=`grep -z DISPLAY /proc/$GNOMESID/environ | cut -d= -f2-`
35        export DISPLAY
36        ;;
37    Sun* )
38        GNOMESID=`pgrep gnome-session`
39        DBUS_SESSION_BUS_ADDRESS=`pargs -e $GNOMESID | grep DBUS_SESSION_BUS_ADDRESS | cut -d= -f2-`
40        export DBUS_SESSION_BUS_ADDRESS
41        DISPLAY=`pargs -e $GNOMESID | grep DISPLAY | cut -d= -f2-`
42        export DISPLAY
43        ;;
44    * )
45        echo "This Feature is not to be tested on $OS"
46        exit 0
47        ;;
48esac
49
50if [ ${GNOME_DESKTOP_SESSION_ID:-nonset} = "nonset" ];
51then
52    if [ ${GNOME_SESSION_NAME:-nonset} = "nonset" ];
53    then
54        echo "This test should run under Gnome"
55        exit 0
56    fi
57fi
58
59SCHEMAS=`gsettings list-schemas | wc -l`
60
61if [ $SCHEMAS -eq 0 ];
62then
63    TOOL=`which gconftool-2`
64    USE_GSETTINGS="false"
65else
66    TOOL=`which gsettings`
67    USE_GSETTINGS="true"
68fi
69
70cd ${TESTSRC}
71echo $PWD
72echo "${TESTJAVA}/bin/javac -d ${TESTCLASSES} rfe4758438.java"
73${TESTJAVA}/bin/javac -d ${TESTCLASSES} rfe4758438.java
74
75cd ${TESTCLASSES}
76${TESTJAVA}/bin/java -DuseGsettings=${USE_GSETTINGS} -Dtool=${TOOL} ${TESTVMOPTS} rfe4758438
77
78if [ $? -ne 0 ]
79then
80    echo "Test failed. See the error stream output"
81    exit 1
82fi
83exit 0
84