11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * @test 26 * @bug 4931668 7146533 27 * @summary Tests XEmbed server/client functionality 28 * @author Denis Mikhalkin: area=awt.xembed 29 * @requires (!(os.family=="mac") & !(os.family=="windows")) 30 * @library /lib/testlibrary 31 * @build jdk.testlibrary.Platform 32 * @modules java.desktop/sun.awt 33 * @compile JavaClient.java TesterClient.java TestXEmbedServer.java 34 * @run main/timeout=6000 RunTestXEmbed 35 */ 36 37 import java.awt.Rectangle; 38 import java.lang.reflect.Method; 39 import java.util.logging.*; 40 import java.util.*; 41 import java.io.*; 42 43 public class RunTestXEmbed extends TestXEmbedServer { 44 private static final Logger log = Logger.getLogger("test.xembed"); 45 private Method test; 46 private boolean passed = false; 47 public RunTestXEmbed(Method test) { 48 super(false); 49 this.test = test; 50 } 51 52 public Process startClient(Rectangle bounds[], long window) { 53 try { 54 String java_home = System.getProperty("java.home"); 55 StringBuilder buf = new StringBuilder(); 56 for (int i = 0; i < bounds.length; i++) { 57 buf.append(" " + bounds[i].x); 58 buf.append(" " + bounds[i].y); 59 buf.append(" " + bounds[i].width); 60 buf.append(" " + bounds[i].height); 61 } 62 Map envs = System.getenv(); 63 String enva[] = new String[envs.size()]; 64 int ind = 0; 65 Iterator iter = envs.entrySet().iterator(); 66 while (iter.hasNext()) { 67 Map.Entry entry = (Map.Entry)iter.next(); 68 if (!"AWT_TOOLKIT".equals(entry.getKey())) { 69 enva[ind++] = entry.getKey() + "=" + entry.getValue(); 70 } else { 71 enva[ind++] = "AWT_TOOLKIT=sun.awt.X11.XToolkit"; 72 } 73 } 74 Process proc = Runtime.getRuntime().exec(java_home + 75 "/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient " 76 + test.getName() + " " + window + buf, 77 enva); 78 System.err.println("Test for " + test.getName() + " has started."); 79 log.fine("Test for " + test.getName() + " has started."); 80 new InputReader(proc.getInputStream()); 81 new InputReader(proc.getErrorStream()); 82 try { 83 passed = (proc.waitFor() == 0); 84 } catch (InterruptedException ie) { 85 } 86 log.fine("Test for " + test.getName() + " has finished."); 87 File logFile = new File("java3.txt"); 88 if (logFile.exists()) { 89 logFile.renameTo(new File(test.getName() + ".txt")); 90 } 91 return proc; 92 } catch (IOException ex1) { 93 ex1.printStackTrace(); 94 } 95 return null; | 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * @test 26 * @bug 4931668 7146533 27 * @summary Tests XEmbed server/client functionality 28 * @author Denis Mikhalkin: area=awt.xembed 29 * @requires (!(os.family=="mac") & !(os.family=="windows")) 30 * @library /lib/testlibrary 31 * @modules java.desktop/sun.awt 32 * @build jdk.testlibrary.Platform 33 * @compile JavaClient.java TesterClient.java TestXEmbedServer.java 34 * @run main/timeout=6000 RunTestXEmbed 35 */ 36 37 import java.awt.Rectangle; 38 import java.lang.reflect.Method; 39 import java.util.logging.*; 40 import java.util.*; 41 import java.io.*; 42 import jdk.testlibrary.Platform; 43 44 public class RunTestXEmbed extends TestXEmbedServer { 45 private static final Logger log = Logger.getLogger("test.xembed"); 46 private Method test; 47 private boolean passed = false; 48 public RunTestXEmbed(Method test) { 49 super(false); 50 this.test = test; 51 } 52 53 public Process startClient(Rectangle bounds[], long window) { 54 try { 55 String java_home = System.getProperty("java.home"); 56 StringBuilder buf = new StringBuilder(); 57 for (int i = 0; i < bounds.length; i++) { 58 buf.append(" " + bounds[i].x); 59 buf.append(" " + bounds[i].y); 60 buf.append(" " + bounds[i].width); 61 buf.append(" " + bounds[i].height); 62 } 63 Map envs = System.getenv(); 64 String enva[] = new String[envs.size()]; 65 int ind = 0; 66 Iterator iter = envs.entrySet().iterator(); 67 while (iter.hasNext()) { 68 Map.Entry entry = (Map.Entry)iter.next(); 69 if (!"AWT_TOOLKIT".equals(entry.getKey())) { 70 enva[ind++] = entry.getKey() + "=" + entry.getValue(); 71 } else { 72 enva[ind++] = "AWT_TOOLKIT=sun.awt.X11.XToolkit"; 73 } 74 } 75 Process proc = Runtime.getRuntime().exec(java_home + 76 "/bin/java -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient " 77 + test.getName() + " " + window + buf, 78 enva); 79 System.err.println("Test for " + test.getName() + " has started."); 80 log.fine("Test for " + test.getName() + " has started."); 81 new InputReader(proc.getInputStream()); 82 new InputReader(proc.getErrorStream()); 83 try { 84 passed = (proc.waitFor() == 0); 85 } catch (InterruptedException ie) { 86 } 87 log.fine("Test for " + test.getName() + " has finished."); 88 File logFile = new File("java3.txt"); 89 if (logFile.exists()) { 90 logFile.renameTo(new File(test.getName() + ".txt")); 91 } 92 return proc; 93 } catch (IOException ex1) { 94 ex1.printStackTrace(); 95 } 96 return null; |