openjdk-1.8.0/Add-CaptchaTest-and-fix-KAE-Testcases.patch
2024-01-19 09:13:31 +08:00

136 lines
6.8 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

diff --git a/jdk/test/java/awt/FontClass/CaptchaTest.java b/jdk/test/java/awt/FontClass/CaptchaTest.java
new file mode 100644
index 000000000..7f2ed1275
--- /dev/null
+++ b/jdk/test/java/awt/FontClass/CaptchaTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2023 Xiaotao NAN. All rights reserved.
+ */
+import java.awt.Graphics2D;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.Random;
+
+/*
+ * @test
+ * @summary Check if the captcha can be successfully generated
+ * @author XiaotaoNAN
+ * I8ME2N(https://gitee.com/openeuler/bishengjdk-8/issues/I8ME2N?from=project-issue)
+ */
+
+public class CaptchaTest {
+
+ /**
+ * Check if the captcha can be successfully generated.
+ * @param n the number of digits int the captcha.
+ * @param fontName the font name.
+ * @throws IOException
+ */
+ public static String captchaTest(int n,String fontName) throws IOException {
+ int width = 100, height = 50;
+ BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g = image.createGraphics();
+ g.setColor(Color.LIGHT_GRAY);
+ g.fillRect(0, 0, width, height);
+ String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ Random random = new Random();
+ StringBuilder sbuffer = new StringBuilder();
+ for (int i = 0; i < n; i++) {
+ int index = random.nextInt(chars.length());
+ char c = chars.charAt(index);
+ sbuffer.append(c);
+ g.setColor(new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255)));
+ g.setFont(new Font(fontName, Font.BOLD, 25));
+ g.drawString(Character.toString(c), 20 + i * 15, 25);
+ }
+ image.flush();
+ g.dispose();
+ return sbuffer.toString();
+ }
+
+ public static void main(String[] args) throws IOException {
+ String captcha = captchaTest(4,"Times New Roman");
+ System.out.println(captcha);
+ }
+
+}
diff --git a/jdk/test/java/security/Provider/SunJCEValidator.java b/jdk/test/java/security/Provider/SunJCEValidator.java
index 314abb380..e6b9f18ad 100644
--- a/jdk/test/java/security/Provider/SunJCEValidator.java
+++ b/jdk/test/java/security/Provider/SunJCEValidator.java
@@ -37,10 +37,10 @@
*- @TestCaseType:Function test
*- @RequirementID:AR.SR.IREQ02758058.001.001
*- @RequirementName: java.security.Provider.getService() is synchronized and became scalability bottleneck
- *- @Condition:JDK8u302及以后
- *- @Brief:测试相应provider更改底层架构以后所提供的service是否与原先有差异以openJDK8u302为准
- * -#step:比较openJDK8u302 SunJceProvider与此特性修改后的SunJceProvider所提供的service是否一致
- *- @Expect:正常运行
+ *- @Condition:JDK8u302 and later
+ *- @Brief:Check whether the service provided by the corresponding provider after changing the underlying architecture is different from the original one (subject to openJDK8u302)
+ * -#step:Compare whether the service provided by openJDK8u302 SunJceProvider is consistent with the modified SunJceProvider with this feature
+ *- @Expect:Normal Running
*- @Priority:Level 1
*/
diff --git a/jdk/test/java/security/Provider/SunJSSEValidator.java b/jdk/test/java/security/Provider/SunJSSEValidator.java
index 5817c3b7f..0cf0663a4 100644
--- a/jdk/test/java/security/Provider/SunJSSEValidator.java
+++ b/jdk/test/java/security/Provider/SunJSSEValidator.java
@@ -37,10 +37,10 @@
*- @TestCaseType:Function test
*- @RequirementID:AR.SR.IREQ02758058.001.001
*- @RequirementName: java.security.Provider.getService() is synchronized and became scalability bottleneck
- *- @Condition:JDK8u302及以后
- *- @Brief:测试相应provider更改底层架构以后所提供的service是否与原先有差异以openJDK8u302为准
- * -#step:比较openJDK8u302 SunJSSEProvider与此特性修改后的SunJSSEProvider所提供的service是否一致
- *- @Expect:正常运行
+ *- @Condition:JDK8u302 and later
+ *- @Brief:Check whether the service provided by the corresponding provider after changing the underlying architecture is different from the original one (subject to openJDK8u302)
+ * -#step:Compare whether the service provided by openJDK8u302 SunJSSEProvider is consistent with the modified SunJSSEProvider with this feature
+ *- @Expect:Normal Running
*- @Priority:Level 1
*/
diff --git a/jdk/test/java/security/Provider/SunRsaSignValidator.java b/jdk/test/java/security/Provider/SunRsaSignValidator.java
index 66fb33a44..ddcf6107b 100644
--- a/jdk/test/java/security/Provider/SunRsaSignValidator.java
+++ b/jdk/test/java/security/Provider/SunRsaSignValidator.java
@@ -37,10 +37,10 @@
*- @TestCaseType:Function test
*- @RequirementID:AR.SR.IREQ02758058.001.001
*- @RequirementName: java.security.Provider.getService() is synchronized and became scalability bottleneck
- *- @Condition:JDK8u302及以后
- *- @Brief:测试相应provider更改底层架构以后所提供的service是否与原先有差异以openJDK8u302为准
- * -#step:比较openJDK8u302 SunRsaSignProvider与此特性修改后的SunRsaSignProvider所提供的service是否一致
- *- @Expect:正常运行
+ *- @Condition:JDK8u302 and later
+ *- @Brief:Check whether the service provided by the corresponding provider after changing the underlying architecture is different from the original one (subject to openJDK8u302).
+ * -#step:Compare whether the service provided by openJDK8u302 SunRsaSignProvider is consistent with the modified SunRsaSignProvider with this feature.
+ *- @Expect:Normal Running.
*- @Priority:Level 1
*/
diff --git a/jdk/test/java/security/Provider/SunValidator.java b/jdk/test/java/security/Provider/SunValidator.java
index 3f4b81222..b1fc38303 100644
--- a/jdk/test/java/security/Provider/SunValidator.java
+++ b/jdk/test/java/security/Provider/SunValidator.java
@@ -37,10 +37,10 @@
*- @TestCaseType:Function test
*- @RequirementID:AR.SR.IREQ02758058.001.001
*- @RequirementName: java.security.Provider.getService() is synchronized and became scalability bottleneck
- *- @Condition:JDK8u302及以后
- *- @Brief:测试相应provider更改底层架构以后所提供的service是否与原先有差异以openJDK8u302为准
- * -#step:比较openJDK8u302 SunProvider与此特性修改后的SunProvider所提供的service是否一致
- *- @Expect:正常运行
+ *- @Condition:JDK8u302 and later
+ *- @Brief:Check whether the service provided by the corresponding provider after changing the underlying architecture is different from the original one (subject to openJDK8u302).
+ * -#step:Compare whether the service provided by openJDK8u302 SunProvider is consistent with the modified SunProvider with this feature.
+ *- @Expect:Normal Running.
*- @Priority:Level 1
*/