changeset 18:ca5106c73209

7902260: Use Platform class in jemmy to check Operating System Reviewed-by: shurailine Contributed-by: abdul.kolarkunnu@oracle.com
author akolarkunnu
date Thu, 09 Aug 2018 08:20:22 -0700
parents d68de8bda9d8
children 28044ad4f002
files src/org/netbeans/jemmy/JemmyProperties.java src/org/netbeans/jemmy/operators/JMenuBarOperator.java src/org/netbeans/jemmy/operators/Operator.java
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/netbeans/jemmy/JemmyProperties.java	Thu Aug 09 08:18:24 2018 -0700
+++ b/src/org/netbeans/jemmy/JemmyProperties.java	Thu Aug 09 08:20:22 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
 import org.netbeans.jemmy.drivers.DriverInstaller;
 import org.netbeans.jemmy.drivers.InputDriverInstaller;
 import org.netbeans.jemmy.explorer.GUIBrowser;
+import org.netbeans.jemmy.util.Platform;
 
 /**
  *
@@ -811,7 +812,7 @@
             getCurrentOutput().printStackTrace(e);
         }
         if (installer == null) {
-            if (System.getProperty("os.name").startsWith("Mac OS X")) {
+            if (Platform.isOSX()) {
                 installer = new APIDriverInstaller((model & SHORTCUT_MODEL_MASK) != 0);
             } else {
                 installer = new DefaultDriverInstaller((model & SHORTCUT_MODEL_MASK) != 0);
--- a/src/org/netbeans/jemmy/operators/JMenuBarOperator.java	Thu Aug 09 08:18:24 2018 -0700
+++ b/src/org/netbeans/jemmy/operators/JMenuBarOperator.java	Thu Aug 09 08:20:22 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
 import org.netbeans.jemmy.Timeouts;
 import org.netbeans.jemmy.drivers.DriverManager;
 import org.netbeans.jemmy.drivers.MenuDriver;
+import org.netbeans.jemmy.util.Platform;
 
 /**
  * <BR><BR>Timeouts used: <BR>
@@ -600,7 +601,7 @@
         }
         JMenuItemOperator result;
         // isVisible() on items returns false on mac, so we need a special searcher.
-        if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) { // NOI18N
+        if (Platform.isOSX()) {
             ComponentSearcher searcher = new ComponentSearcher((Container) menuCont.getSource());
             searcher.setOutput(output);
             Component c = searcher.findComponent(new JMenuItemOperator.JMenuItemByLabelFinder(path[path.length - 1], getComparator()));
--- a/src/org/netbeans/jemmy/operators/Operator.java	Thu Aug 09 08:18:24 2018 -0700
+++ b/src/org/netbeans/jemmy/operators/Operator.java	Thu Aug 09 08:20:22 2018 -0700
@@ -49,6 +49,7 @@
 import org.netbeans.jemmy.Waiter;
 import org.netbeans.jemmy.util.DefaultVisualizer;
 import org.netbeans.jemmy.util.MouseVisualizer;
+import org.netbeans.jemmy.util.Platform;
 
 /**
  * Keeps all environment and low-level methods.
@@ -303,10 +304,9 @@
         //Linux - new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false)
         //solaris - new MouseVisualizer()
         //others - new DefaultVisualizer()
-        String os = System.getProperty("os.name").toUpperCase();
-        if (os.startsWith("LINUX")) {
+        if (Platform.isLinux()) {
             setDefaultComponentVisualizer(new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false));
-        } else if (os.startsWith("SUNOS")) {
+        } else if (Platform.isSolaris()) {
             setDefaultComponentVisualizer(new MouseVisualizer());
         } else {
             setDefaultComponentVisualizer(new DefaultVisualizer());