changeset 10874:bfcdf46bbe23 jdk-11+5

8198858: Remove use of internal packages of core modules from unit tests Reviewed-by: arapte
author kcr
date Tue, 13 Mar 2018 07:32:10 -0700
parents f82a2e491b72
children 007530dd472a 7ed584a5a2be
files modules/javafx.graphics/src/test/addExports modules/javafx.graphics/src/test/java/test/com/sun/javafx/text/TextLayoutTest.java modules/javafx.graphics/src/test/java/test/javafx/concurrent/ServiceLifecycleTest.java modules/javafx.graphics/src/test/java/test/javafx/concurrent/ServiceWithSecurityManagerTest.java tests/system/src/test/addExports tests/system/src/test/java/test/robot/javafx/embed/swing/RT23603Test.java
diffstat 6 files changed, 15 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.graphics/src/test/addExports	Tue Mar 13 15:20:46 2018 +0530
+++ b/modules/javafx.graphics/src/test/addExports	Tue Mar 13 07:32:10 2018 -0700
@@ -53,6 +53,3 @@
 --add-exports=javafx.graphics/com.sun.javafx.cursor=ALL-UNNAMED
 --add-exports=javafx.graphics/com.sun.javafx.text=ALL-UNNAMED
 --add-exports=javafx.graphics/com.sun.prism.shape=ALL-UNNAMED
---add-exports=java.desktop/sun.font=ALL-UNNAMED
---add-exports=java.desktop/sun.awt=ALL-UNNAMED
---add-exports=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED
--- a/modules/javafx.graphics/src/test/java/test/com/sun/javafx/text/TextLayoutTest.java	Tue Mar 13 15:20:46 2018 +0530
+++ b/modules/javafx.graphics/src/test/java/test/com/sun/javafx/text/TextLayoutTest.java	Tue Mar 13 07:32:10 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -33,13 +33,12 @@
 import com.sun.javafx.scene.text.TextSpan;
 import com.sun.javafx.scene.text.TextLine;
 import com.sun.javafx.scene.text.FontHelper;
-import com.sun.javafx.text.PrismTextLayout;
+import com.sun.javafx.font.CharToGlyphMapper;
 import com.sun.javafx.text.PrismTextLayout;
 
 import org.junit.Ignore;
 import org.junit.Test;
 
-import sun.font.CharToGlyphMapper;
 import static org.junit.Assert.*;
 
 public class TextLayoutTest {
--- a/modules/javafx.graphics/src/test/java/test/javafx/concurrent/ServiceLifecycleTest.java	Tue Mar 13 15:20:46 2018 +0530
+++ b/modules/javafx.graphics/src/test/java/test/javafx/concurrent/ServiceLifecycleTest.java	Tue Mar 13 07:32:10 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,7 +25,6 @@
 
 package test.javafx.concurrent;
 
-import com.sun.org.apache.xerces.internal.util.DOMUtil;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import test.javafx.concurrent.mocks.MythicalEvent;
--- a/modules/javafx.graphics/src/test/java/test/javafx/concurrent/ServiceWithSecurityManagerTest.java	Tue Mar 13 15:20:46 2018 +0530
+++ b/modules/javafx.graphics/src/test/java/test/javafx/concurrent/ServiceWithSecurityManagerTest.java	Tue Mar 13 07:32:10 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -32,7 +32,6 @@
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.InitializationError;
 import org.junit.runners.model.Statement;
-import sun.awt.AWTSecurityManager;
 
 /**
  * A test for the Service lifecycle methods with a security manager installed.
@@ -86,7 +85,7 @@
 
         /**
          */
-        private final class StrictSecurityManager extends AWTSecurityManager {
+        private final class StrictSecurityManager extends SecurityManager {
             // If you create a Thread that is a child of mainThreadGroup, that is OK.
             // If you create a ThreadGroup that is a child of mainThreadGroup, then that is bad.
             private ThreadGroup securityThreadGroup = new ThreadGroup("Security Thread Group");
--- a/tests/system/src/test/addExports	Tue Mar 13 15:20:46 2018 +0530
+++ b/tests/system/src/test/addExports	Tue Mar 13 07:32:10 2018 -0700
@@ -24,4 +24,3 @@
 --add-exports javafx.graphics/com.sun.prism.impl=ALL-UNNAMED
 # compilation additions
 --add-exports=javafx.graphics/com.sun.glass.events=ALL-UNNAMED
---add-exports=java.desktop/sun.awt=ALL-UNNAMED
--- a/tests/system/src/test/java/test/robot/javafx/embed/swing/RT23603Test.java	Tue Mar 13 15:20:46 2018 +0530
+++ b/tests/system/src/test/java/test/robot/javafx/embed/swing/RT23603Test.java	Tue Mar 13 07:32:10 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -34,13 +34,10 @@
 import java.awt.Dimension;
 import java.awt.Point;
 import java.awt.Robot;
-import java.awt.Toolkit;
 
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
 
-import sun.awt.SunToolkit;
-
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -50,6 +47,7 @@
 
 import org.junit.Test;
 import org.junit.Ignore;
+import test.util.Util;
 
 /**
  * RT-23603: WebView does not display in JFXPanel on initialization
@@ -68,10 +66,14 @@
         //
         waitForLatch(l1, 5000);
 
-        //
-        // wait for frame to become really visible
-        //
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        // FIXME: implement the following without accessing sun.awt classes
+        // In the mean time, we will sleep for 1 second which is what other
+        // similar tests do.
+//        //
+//        // wait for frame to become really visible
+//        //
+//        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        Util.sleep(1000);
 
         // 3 pulses should guarantee the scene is rendered
         final CountDownLatch l2 = new CountDownLatch(3);