< prev index next >

test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java

Print this page

        

@@ -21,14 +21,14 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 8153732 8212202 8221263 8221412
+ * @bug 8153732 8212202 8221263 8221412 8222108
  * @requires (os.family == "Windows")
  * @summary Windows remote printer changes do not reflect in lookupPrintServices()
- * @run main/manual RemotePrinterStatusRefresh
+ * @run main/manual/othervm -Dsun.java2d.print.minRefreshTime=120 RemotePrinterStatusRefresh
  */
 
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;

@@ -61,10 +61,13 @@
 
 import static javax.swing.BorderFactory.createTitledBorder;
 
 public class RemotePrinterStatusRefresh extends WindowAdapter {
 
+    private static final long DEFAULT_REFRESH_TIME = 240L;
+    private static final long MINIMAL_REFRESH_TIME = 120L;
+
     private static final long refreshTime = getRefreshTime();
 
     private static final long TIMEOUT = refreshTime * 4 + 60;
 
 

@@ -179,11 +182,11 @@
             "Please follow the steps for this manual test:\n"
                     + "Step 0: \"Before\" list is populated with currently "
                     +          "configured printers.\n"
                     + "Step 1: Add or Remove a network printer using "
                     +          "Windows Control Panel.\n"
-                    + "Step 2: Wait for 4 minutes after adding or removing.\n"
+                    + "Step 2: Wait for 2\u20134 minutes after adding or removing.\n"
                     + "             \"Next printer refresh in\" gives you a "
                     +          "rough estimation on when update will happen.\n"
                     + "Step 3: Click Refresh."
                     +          "\"After\" list is populated with updated list "
                     +          "of printers.\n"

@@ -193,11 +196,11 @@
                     +               "green color, removed ones \u2014 with "
                     +               "red color.\n"
                     + "Step 5: Click Pass if the list of printers is correctly "
                     +          "updated.\n"
                     + "Step 6: If the list is not updated, wait for another "
-                    +          "4 minutes, and then click Refresh again.\n"
+                    +          "2\u20134 minutes, and then click Refresh again.\n"
                     + "Step 7: If the list does not update, click Fail.\n"
                     + "\n"
                     + "You have to click Refresh to enable Pass and Fail buttons. "
                     + "If no button is pressed,\n"
                     + "the test will time out. "

@@ -213,16 +216,17 @@
         }
     }
 
     private static long getRefreshTime() {
         String refreshTime =
-                System.getProperty("sun.java2d.print.minRefreshTime", "240");
+                System.getProperty("sun.java2d.print.minRefreshTime",
+                                   Long.toString(DEFAULT_REFRESH_TIME));
         try {
             long value = Long.parseLong(refreshTime);
-            return value < 240L ? 240L : value;
+            return value < MINIMAL_REFRESH_TIME ? MINIMAL_REFRESH_TIME : value;
         } catch (NumberFormatException e) {
-            return 240L;
+            return DEFAULT_REFRESH_TIME;
         }
     }
 
     private static void createUI() {
         test = new RemotePrinterStatusRefresh();
< prev index next >