Compare commits

...

23 Commits

Author SHA1 Message Date
Anton Bobrov
1bb3ed339b 8314164: java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java fails intermittently in timeout
Backport-of: fbaaac63d4
2024-02-27 12:21:58 +00:00
Aleksey Shipilev
d2d988af90 8292182: [TESTLIB] Enhance JAXPPolicyManager to setup required permissions for jtreg version 7 jar
Backport-of: aa5b718933
2024-02-27 10:28:55 +00:00
Aleksey Shipilev
64269a3c5a 8285756: clean up use of bad arguments for @clean in langtools tests
Backport-of: 3312d8c620
2024-02-27 10:20:22 +00:00
Amos Shi
7bed7f1b2d 8274122: java/io/File/createTempFile/SpecialTempFile.java fails in Windows 11
Reviewed-by: mbaesken
Backport-of: d6ad2f1715
2024-02-27 09:53:45 +00:00
Aleksey Shipilev
10f08844e5 8207855: Make applications/jcstress invoke tests in batches
Backport-of: 4805473049
2024-02-27 09:37:45 +00:00
Anton Bobrov
a855cab3e3 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use
Backport-of: a48bcf3671
2024-02-27 09:26:38 +00:00
Sergey Bylokhov
a60a5c4305 8321151: JDK-8294427 breaks Windows L&F on all older Windows versions
Backport-of: f695ca5884
2024-02-26 18:20:14 +00:00
Anton Bobrov
93c5f7c50d 8326503: [11u] java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java fail because of package org.junit.jupiter.api does not exist
Reviewed-by: sgehwolf
2024-02-26 15:50:06 +00:00
Aleksey Shipilev
8dc28922c2 8323515: Create test alias "all" for all test roots
Reviewed-by: phh
Backport-of: 8b9bf75880
2024-02-26 08:53:41 +00:00
Andrew Lu
e075097dc8 8294158: HTML formatting for PassFailJFrame instructions
Backport-of: 14090ef603
2024-02-26 07:07:45 +00:00
Andrew John Hughes
ea06b5c966 8321480: ISO 4217 Amendment 176 Update
Reviewed-by: goetz
Backport-of: 223018a3aa
2024-02-23 17:20:35 +00:00
Andrew Lu
776f1e31a9 8294535: Add screen capture functionality to PassFailJFrame
Backport-of: dbb788f34d
2024-02-23 09:06:04 +00:00
Goetz Lindenmaier
6711fc8da7 8321408: Add Certainly roots R1 and E1
Reviewed-by: shade
Backport-of: e8f7eaeefe
2024-02-23 08:46:52 +00:00
Andrew Lu
43a56c89c6 8307299: Move more DnD tests to open
Backport-of: 950c5df859
2024-02-23 07:54:04 +00:00
Andrew Lu
fe8c20c8de 8306681: Open source more AWT DnD related tests
Backport-of: 05af487a2d
2024-02-23 02:29:30 +00:00
SendaoYan
30dfe8115d 8323640: [TESTBUG]testMemoryFailCount in jdk/internal/platform/docker/TestDockerMemoryMetrics.java always fail because OOM killed
Backport-of: 791b427f44
2024-02-22 18:04:31 +00:00
Anton Bobrov
1b207cc9cc 8054022: HttpURLConnection timeouts with Expect: 100-Continue and no chunking
Backport-of: 78839e9815
2024-02-22 09:53:46 +00:00
Amos Shi
f4cf239df1 8315602: Open source swing security manager test
Reviewed-by: rrich
Backport-of: fd6442c079
2024-02-22 07:53:30 +00:00
Andrew Lu
398f486c2a 8306812: Open source several AWT Miscellaneous tests
Backport-of: c494770ca0
2024-02-22 02:59:43 +00:00
Andrew Lu
aeb6381306 8306640: Open source several AWT TextArea related tests
Backport-of: 169a7c27a7
2024-02-22 02:56:17 +00:00
Andrew Lu
97241329cf 8306752: Open source several container and component AWT tests
Backport-of: 88d9ebf8e8
2024-02-22 02:55:56 +00:00
Andrew Lu
c9052141c1 8306755: Open source few Swing JComponent and AbstractButton tests
Backport-of: f3e8bd1d11
2024-02-22 02:55:28 +00:00
Andrew John Hughes
382942dffb 8326109: GCC 13 reports maybe-uninitialized warnings for jni.cpp with dtrace enabled
Reviewed-by: phh
2024-02-21 16:44:58 +00:00
91 changed files with 6375 additions and 69716 deletions

View File

@@ -0,0 +1,20 @@
Owner: CN=Certainly Root E1, O=Certainly, C=US
Issuer: CN=Certainly Root E1, O=Certainly, C=US
Serial number: 62533b1470333275cf98d9ab9bfccf8
Valid from: Thu Apr 01 00:00:00 GMT 2021 until: Sun Apr 01 00:00:00 GMT 2046
Signature algorithm name: SHA384withECDSA
Subject Public Key Algorithm: 384-bit EC (secp384r1) key
Version: 3
-----BEGIN CERTIFICATE-----
MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw
CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu
bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ
BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s
eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK
+IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2
QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E
BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4
hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm
ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG
BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
-----END CERTIFICATE-----

View File

@@ -0,0 +1,38 @@
Owner: CN=Certainly Root R1, O=Certainly, C=US
Issuer: CN=Certainly Root R1, O=Certainly, C=US
Serial number: 8e0ff94b907168653354f4d44439b7e0
Valid from: Thu Apr 01 00:00:00 GMT 2021 until: Sun Apr 01 00:00:00 GMT 2046
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 4096-bit RSA key
Version: 3
-----BEGIN CERTIFICATE-----
MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw
PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy
dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9
MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0
YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2
1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT
vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed
aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0
1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5
r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5
cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ
wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ
6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA
2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH
Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR
eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB
/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u
d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr
PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d
8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi
1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd
rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di
taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7
lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj
yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn
Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy
yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n
wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6
OV+KmalBWQewLK8=
-----END CERTIFICATE-----

View File

@@ -32,7 +32,7 @@ formatVersion=3
# Version of the currency code information in this class.
# It is a serial number that accompanies with each amendment.
dataVersion=175
dataVersion=176
# List of all valid ISO 4217 currency codes.
# To ensure compatibility, do not remove codes.
@@ -55,7 +55,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036
SRD968-SRG740-SSP728-STD678-STN930-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\
TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-UYI940-\
UYU858-UZS860-VEB862-VED926-VEF937-VES928-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\
XBB956-XBC957-XBD958-XCD951-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\
XBB956-XBC957-XBD958-XCD951-XCG532-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\
XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZMW967-ZWD716-ZWL932-\
ZWN942-ZWR935
@@ -189,11 +189,11 @@ CR=CRC
# COTE D'IVOIRE
CI=XOF
# CROATIA
HR=HRK;2022-12-31-23-00-00;EUR
HR=EUR
# CUBA
CU=CUP
# Cura\u00e7ao
CW=ANG
CW=ANG;2025-04-01-04-00-00;XCG
# CYPRUS
CY=EUR
# CZECHIA
@@ -510,7 +510,7 @@ SR=SRD
# SVALBARD AND JAN MAYEN
SJ=NOK
# Sint Maarten (Dutch part)
SX=ANG
SX=ANG;2025-04-01-04-00-00;XCG
# ESWATINI
SZ=SZL
# SWEDEN

View File

@@ -40,6 +40,10 @@ ifeq ($(TOOLCHAIN_TYPE), gcc)
# Need extra inlining to collapse all marking code into the hot marking loop
BUILD_LIBJVM_shenandoahConcurrentMark.cpp_CXXFLAGS := --param inline-unit-growth=1000
endif
ifeq ($(call check-jvm-feature, dtrace), true)
# DTRACE_PROBE macros trigger a maybe-uninitialized warning on 'ret'
BUILD_LIBJVM_jni.cpp_CXXFLAGS := -Wno-maybe-uninitialized
endif
endif
LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, 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
@@ -30,6 +30,7 @@ import java.io.FileNotFoundException;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
@@ -312,9 +313,15 @@ public class GenerateCurrencyData {
validCurrencyCodes.substring(i * 7 + 3, i * 7 + 6));
checkCurrencyCode(currencyCode);
int tableEntry = mainTable[(currencyCode.charAt(0) - 'A') * A_TO_Z + (currencyCode.charAt(1) - 'A')];
if (tableEntry == INVALID_COUNTRY_ENTRY ||
(tableEntry & SPECIAL_CASE_COUNTRY_MASK) != 0 ||
(tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) != (currencyCode.charAt(2) - 'A')) {
// Do not allow a future currency to be classified as an otherCurrency,
// otherwise it will leak out into Currency:getAvailableCurrencies
boolean futureCurrency = Arrays.asList(specialCaseNewCurrencies).contains(currencyCode);
boolean simpleCurrency = (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) == (currencyCode.charAt(2) - 'A');
// If neither a simple currency, or one defined in the future
// then the current currency is applicable to be added to the otherTable
if (!futureCurrency && !simpleCurrency) {
if (otherCurrenciesCount == maxOtherCurrencies) {
throw new RuntimeException("too many other currencies");
}

View File

@@ -1261,53 +1261,74 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
private void expect100Continue() throws IOException {
// Expect: 100-Continue was set, so check the return code for
// Acceptance
int oldTimeout = http.getReadTimeout();
boolean enforceTimeOut = false;
boolean timedOut = false;
if (oldTimeout <= 0) {
// 5s read timeout in case the server doesn't understand
// Expect: 100-Continue
http.setReadTimeout(5000);
enforceTimeOut = true;
// Expect: 100-Continue was set, so check the return code for
// Acceptance
int oldTimeout = http.getReadTimeout();
boolean timedOut = false;
boolean tempTimeOutSet = false;
if (oldTimeout <= 0 || oldTimeout > 5000) {
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
logger.fine("Timeout currently set to " +
oldTimeout + " temporarily setting it to 5 seconds");
}
// 5s read timeout in case the server doesn't understand
// Expect: 100-Continue
http.setReadTimeout(5000);
tempTimeOutSet = true;
}
try {
http.parseHTTP(responses, pi, this);
} catch (SocketTimeoutException se) {
if (!enforceTimeOut) {
throw se;
}
timedOut = true;
http.setIgnoreContinue(true);
try {
http.parseHTTP(responses, pi, this);
} catch (SocketTimeoutException se) {
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
logger.fine("SocketTimeoutException caught," +
" will attempt to send body regardless");
}
if (!timedOut) {
// Can't use getResponseCode() yet
String resp = responses.getValue(0);
// Parse the response which is of the form:
// HTTP/1.1 417 Expectation Failed
// HTTP/1.1 100 Continue
if (resp != null && resp.startsWith("HTTP/")) {
String[] sa = resp.split("\\s+");
responseCode = -1;
try {
// Response code is 2nd token on the line
if (sa.length > 1)
responseCode = Integer.parseInt(sa[1]);
} catch (NumberFormatException numberFormatException) {
timedOut = true;
}
if (!timedOut) {
// Can't use getResponseCode() yet
String resp = responses.getValue(0);
// Parse the response which is of the form:
// HTTP/1.1 417 Expectation Failed
// HTTP/1.1 100 Continue
if (resp != null && resp.startsWith("HTTP/")) {
String[] sa = resp.split("\\s+");
responseCode = -1;
try {
// Response code is 2nd token on the line
if (sa.length > 1)
responseCode = Integer.parseInt(sa[1]);
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
logger.fine("response code received " + responseCode);
}
}
if (responseCode != 100) {
throw new ProtocolException("Server rejected operation");
} catch (NumberFormatException numberFormatException) {
}
}
if (responseCode != 100) {
// responseCode will be returned to caller
throw new ProtocolException("Server rejected operation");
}
}
// If timeout was changed, restore to original value
if (tempTimeOutSet) {
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
logger.fine("Restoring original timeout : " + oldTimeout);
}
http.setReadTimeout(oldTimeout);
}
responseCode = -1;
responses.reset();
// Proceed
// Ignore any future 100 continue messages
http.setIgnoreContinue(true);
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
logger.fine("Set Ignore Continue to true");
}
responseCode = -1;
responses.reset();
// Proceed
}
/*
@@ -1369,7 +1390,6 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
boolean expectContinue = false;
String expects = requests.findValue("Expect");
if ("100-Continue".equalsIgnoreCase(expects) && streaming()) {
http.setIgnoreContinue(false);
expectContinue = true;
}
@@ -1378,6 +1398,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
if (expectContinue) {
http.setIgnoreContinue(false);
expect100Continue();
}
ps = (PrintStream)http.getOutputStream();
@@ -1419,6 +1440,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
}
}
// Streaming returns true if there is a request body to send
public boolean streaming () {
return (fixedContentLength != -1) || (fixedContentLengthLong != -1) ||
(chunkLength != -1);

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 2023, 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
@@ -266,6 +266,7 @@ XBB=XBB
XBC=XBC
XBD=XBD
XCD=XCD
XCG=XCG
XDR=XDR
XFO=XFO
XFU=XFU
@@ -491,6 +492,7 @@ xbb=European Monetary Unit
xbc=European Unit of Account (XBC)
xbd=European Unit of Account (XBD)
xcd=East Caribbean Dollar
xcg=Caribbean Guilder
xdr=Special Drawing Rights
xfo=French Gold Franc
xfu=French UIC-Franc

View File

@@ -90,6 +90,7 @@ typedef HRESULT(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme);
typedef HRESULT(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);
typedef HTHEME(__stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
typedef HTHEME(__stdcall *PFNOPENTHEMEDATAFORDPI)(HWND hwnd, LPCWSTR pszClassList, UINT dpi);
typedef HRESULT (__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc,
@@ -134,6 +135,7 @@ typedef HRESULT (__stdcall *PFNGETTHEMETRANSITIONDURATION)
(HTHEME hTheme, int iPartId, int iStateIdFrom, int iStateIdTo,
int iPropId, DWORD *pdwDuration);
static PFNOPENTHEMEDATA OpenThemeDataFunc = NULL;
static PFNOPENTHEMEDATAFORDPI OpenThemeDataForDpiFunc = NULL;
static PFNDRAWTHEMEBACKGROUND DrawThemeBackground = NULL;
static PFNCLOSETHEMEDATA CloseThemeData = NULL;
@@ -154,13 +156,17 @@ static PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT
//this function might not exist on Windows XP
static PFNGETTHEMETRANSITIONDURATION GetThemeTransitionDuration = NULL;
constexpr unsigned int defaultDPI = 96;
BOOL InitThemes() {
static BOOL InitThemes() {
static HMODULE hModThemes = NULL;
hModThemes = JDK_LoadSystemLibrary("UXTHEME.DLL");
DTRACE_PRINTLN1("InitThemes hModThemes = %x\n", hModThemes);
if(hModThemes) {
DTRACE_PRINTLN("Loaded UxTheme.dll\n");
OpenThemeDataFunc = (PFNOPENTHEMEDATA)GetProcAddress(hModThemes,
"OpenThemeData");
OpenThemeDataForDpiFunc = (PFNOPENTHEMEDATAFORDPI)GetProcAddress(
hModThemes, "OpenThemeDataForDpi");
DrawThemeBackground = (PFNDRAWTHEMEBACKGROUND)GetProcAddress(
@@ -198,7 +204,7 @@ BOOL InitThemes() {
(PFNGETTHEMETRANSITIONDURATION)GetProcAddress(hModThemes,
"GetThemeTransitionDuration");
if(OpenThemeDataForDpiFunc
if((OpenThemeDataForDpiFunc || OpenThemeDataFunc)
&& DrawThemeBackground
&& CloseThemeData
&& DrawThemeText
@@ -218,10 +224,12 @@ BOOL InitThemes() {
DTRACE_PRINTLN("Loaded function pointers.\n");
// We need to make sure we can load the Theme.
// Use the default DPI value of 96 on windows.
constexpr unsigned int defaultDPI = 96;
HTHEME hTheme = OpenThemeDataForDpiFunc (
AwtToolkit::GetInstance().GetHWnd(),
L"Button", defaultDPI);
HTHEME hTheme = OpenThemeDataForDpiFunc
? OpenThemeDataForDpiFunc(AwtToolkit::GetInstance().GetHWnd(),
L"Button", defaultDPI)
: OpenThemeDataFunc(AwtToolkit::GetInstance().GetHWnd(),
L"Button");
if(hTheme) {
DTRACE_PRINTLN("Loaded Theme data.\n");
CloseThemeData(hTheme);
@@ -285,11 +293,13 @@ JNIEXPORT jlong JNICALL Java_sun_awt_windows_ThemeReader_openTheme
JNU_ThrowOutOfMemoryError(env, 0);
return 0;
}
// We need to open the Theme on a Window that will stick around.
// The best one for that purpose is the Toolkit window.
HTHEME htheme = OpenThemeDataForDpiFunc(
AwtToolkit::GetInstance().GetHWnd(),
str, dpi);
HTHEME htheme = OpenThemeDataForDpiFunc
? OpenThemeDataForDpiFunc(AwtToolkit::GetInstance().GetHWnd(), str, dpi)
: OpenThemeDataFunc(AwtToolkit::GetInstance().GetHWnd(), str);
JNU_ReleaseStringPlatformChars(env, widget, str);
return (jlong) htheme;
}
@@ -469,9 +479,14 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_ThemeReader_paintBackground
rect.left = 0;
rect.top = 0;
rect.bottom = rectBottom;
rect.right = rectRight;
if (OpenThemeDataForDpiFunc) {
rect.bottom = rectBottom;
rect.right = rectRight;
} else {
rect.bottom = h;
rect.right = w;
}
ZeroMemory(pSrcBits,(BITS_PER_PIXEL>>3)*w*h);
HRESULT hres = DrawThemeBackground(hTheme, memDC, part, state, &rect, NULL);
@@ -494,6 +509,28 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_ThemeReader_paintBackground
ReleaseDC(NULL,defaultDC);
}
static void rescale(SIZE *size) {
static int dpiX = -1;
static int dpiY = -1;
if (dpiX == -1 || dpiY == -1) {
HWND hWnd = ::GetDesktopWindow();
HDC hDC = ::GetDC(hWnd);
dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(hWnd, hDC);
}
if (dpiX !=0 && dpiX != defaultDPI) {
float invScaleX = (float) defaultDPI / dpiX;
size->cx = (int) round(size->cx * invScaleX);
}
if (dpiY != 0 && dpiY != defaultDPI) {
float invScaleY = (float) defaultDPI / dpiY;
size->cy = (int) round(size->cy * invScaleY);
}
}
jobject newInsets(JNIEnv *env, jint top, jint left, jint bottom, jint right) {
if (env->EnsureLocalCapacity(2) < 0) {
return NULL;
@@ -785,6 +822,10 @@ JNIEXPORT jobject JNICALL Java_sun_awt_windows_ThemeReader_getPartSize
CHECK_NULL_RETURN(dimMID, NULL);
}
if (!OpenThemeDataForDpiFunc) {
rescale(&size);
}
jobject dimObj = env->NewObject(dimClassID, dimMID, size.cx, size.cy);
if (safe_ExceptionOccurred(env)) {
env->ExceptionDescribe();

View File

@@ -21,6 +21,11 @@
# questions.
#
# All tests
all = \
:hotspot_all
hotspot_all = \
/
@@ -28,6 +33,8 @@ hotspot_all_no_apps = \
/ \
-applications
# Component test groups
hotspot_compiler = \
compiler
@@ -417,6 +424,21 @@ hotspot_rest_runtime = \
-:hotspot_nmt \
-:hotspot_tier2_runtime_platform_agnostic
jcstress_part1 = \
applications/jcstress/seqcst.java
jcstress_part2 = \
applications/jcstress/accessAtomic.java \
applications/jcstress/acqrel.java \
applications/jcstress/atomics.java \
applications/jcstress/coherence.java \
applications/jcstress/locks.java
jcstress_part3 = \
applications/jcstress \
-:jcstress_part1 \
-:jcstress_part2
# Stress tests against information provided by VM via JMX
vmTestbase_nsk_monitoring = \
vmTestbase/nsk/monitoring

View File

@@ -29,6 +29,7 @@ import jdk.test.lib.process.ProcessTools;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
@@ -51,11 +52,6 @@ import java.util.function.Predicate;
* Use jcstress test suite to generate jtreg tests in 'test.src' or current
* directory. Used version is defined in JcstressRunner class.
*
* Each generated jtreg test file will contain several tests. Subdirectories are
* used to allow running all tests from a file using command line. 'copy',
* 'acqrel', 'fences', 'atomicity', 'seqcst.sync', 'seqcst.volatiles' and
* 'other' tests will be generated.
*
* This generator depends on testlibrary, therefore it should be compiled and
* added to classpath. One can replace @notest by @test in jtreg test
* description above to run this class with jtreg.
@@ -97,58 +93,18 @@ public class TestGenerator {
" */\n\n", years);
}
private static enum JcstressGroup {
MEMEFFECTS("memeffects"),
COPY("copy"),
ACQREL("acqrel"),
FENCES("fences"),
ATOMICITY("atomicity"),
SEQCST_SYNC("seqcst.sync"),
SEQCST_VOLATILES("seqcst.volatiles"),
OTHER("other", JcstressGroup.otherFilter());
private final String groupName;
private final Predicate<String> filter;
private JcstressGroup(String groupName, Predicate<String> filter) {
this.groupName = groupName;
this.filter = filter;
}
private JcstressGroup(String groupName) {
this(groupName, JcstressGroup.nameFilter(groupName));
}
private static Predicate<String> nameFilter(String group) {
return s -> s.startsWith("org.openjdk.jcstress.tests." + group + ".");
}
private static Predicate<String> otherFilter() {
return (s) -> {
for (JcstressGroup g : EnumSet.complementOf(EnumSet.of(OTHER))) {
if (g.filter.test(s)) {
return false;
}
}
return true;
};
}
}
public static String DESC_FORMAT = "\n"
+ "/**\n"
+ " * @test %1$s\n"
+ " * @library /test/lib /\n"
+ " * @run driver/timeout=2400 " + JcstressRunner.class.getName()
+ " * @run driver/timeout=21600 " + JcstressRunner.class.getName()
// verbose output
+ " -v"
// test mode preset
+ " -m default"
// test name
+ " -t %1$s\n"
+ " -t org.openjdk.jcstress.tests.%1$s\\.\n"
+ " */\n";
public static void main(String[] args) {
public static void main(String[] args) throws IOException {
Path path = JcstressRunner.pathToArtifact();
Path output;
try {
@@ -162,56 +118,32 @@ public class TestGenerator {
} catch (Exception e) {
throw new Error("Can not get list of tests", e);
}
for (JcstressGroup group : JcstressGroup.values()) {
try {
try (BufferedReader reader = Files.newBufferedReader(output)) {
// skip first 4 lines: name, -{80}, revision and empty line
for (int i = 0; i < 4; ++i) {
reader.readLine();
}
new TestGenerator(group).generate(reader);
}
} catch (IOException e) {
throw new Error("Generating tests for " + group.name()
+ " has failed", e);
}
}
BufferedReader reader = Files.newBufferedReader(output);
reader.lines()
.skip(4) // skip first 4 lines: name, -{80}, revision and empty line
.map(s -> s.split("\\.")[4]) // group by the package name following "org.openjdk.jcstress.tests."
.distinct()
.filter(s -> !s.startsWith("sample")) // skip sample test
.forEach(TestGenerator::generate);
output.toFile().delete();
}
private final JcstressGroup group;
private TestGenerator(JcstressGroup group) {
this.group = group;
}
private void generate(BufferedReader reader) throws IOException {
// array is needed to change value inside a lambda
long[] count = {0L};
String root = Utils.TEST_SRC;
Path testFile = Paths.get(root)
.resolve(group.groupName)
.resolve("Test.java");
File testDir = testFile.getParent().toFile();
if (!testDir.mkdirs() && !testDir.exists()) {
throw new Error("Can not create directories for "
+ testFile.toString());
}
private static void generate(String group) {
Path testFile = Paths.get(Utils.TEST_SRC).resolve(group + ".java");
System.out.println("Generating " + testFile);
try (PrintStream ps = new PrintStream(testFile.toFile())) {
ps.print(COPYRIGHT);
ps.printf("/* DO NOT MODIFY THIS FILE. GENERATED BY %s */\n",
getClass().getName());
TestGenerator.class.getName());
reader.lines()
.filter(group.filter)
.forEach(s -> {
count[0]++;
ps.printf(DESC_FORMAT, s);
});
ps.printf(DESC_FORMAT, group);
ps.print('\n');
} catch (FileNotFoundException e) {
System.out.println("Failed to generate tests for " + group);
}
System.out.printf("%d tests generated in %s%n",
count[0], group.groupName);
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test accessAtomic
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.accessAtomic\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test acqrel
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.acqrel\.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test atomicity
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.atomicity\.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test atomics
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.atomics\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test causality
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.causality\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test coherence
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.coherence\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test copy
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.copy\.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test countdownlatch
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.countdownlatch\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test defaultValues
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.defaultValues\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test executors
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.executors\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test fences
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.fences\.
*/

View File

@@ -1,829 +0,0 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test org.openjdk.jcstress.tests.fences.FencedAcquireReleaseTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.FencedAcquireReleaseTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.FencedDekkerTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.FencedDekkerTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.FencedPublicationTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.FencedPublicationTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.FencedReadTwiceTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.FencedReadTwiceTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.UnfencedAcquireReleaseTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.UnfencedAcquireReleaseTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.UnfencedDekkerTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.UnfencedDekkerTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.UnfencedPublicationTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.UnfencedPublicationTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.UnfencedReadTwiceTest
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.UnfencedReadTwiceTest
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.AcquireFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.FullFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadLoadFenceTest.LoadLoadFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.FullFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest1.ReleaseFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.AcquireFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.LoadStoreFenceTest2.FullFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreLoadFenceTest.FullFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.FullFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.ReleaseFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest1.StoreStoreFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.FullFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.ReleaseFenceString
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceBoolean
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceBoolean
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceByte
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceByte
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceChar
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceChar
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceDouble
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceDouble
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceFloat
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceFloat
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceInt
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceInt
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceLong
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceLong
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceShort
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceShort
*/
/**
* @test org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceString
* @library /test/lib /
* @run driver/timeout=2400 applications.jcstress.JcstressRunner -v -m default -t org.openjdk.jcstress.tests.fences.varHandles.StoreStoreFenceTest2.StoreStoreFenceString
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test future
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.future\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test init
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.init\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test initClass
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.initClass\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test initLen
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.initLen\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test interrupt
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.interrupt\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test locks
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.locks\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test memeffects
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.memeffects\.
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test seqcst
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.seqcst\.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test singletons
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.singletons\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test strings
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.strings\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test tearing
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.tearing\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test unsafe
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.unsafe\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test varhandles
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.varhandles\.
*/

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* DO NOT MODIFY THIS FILE. GENERATED BY applications.jcstress.TestGenerator */
/**
* @test volatiles
* @library /test/lib /
* @run driver/timeout=21600 applications.jcstress.JcstressRunner -v -t org.openjdk.jcstress.tests.volatiles\.
*/

View File

@@ -20,6 +20,14 @@
# questions.
#
# All tests
all = \
:jaxp_all
jaxp_all = \
/
# Tiered testing definitions
# No jaxp tests are tier 1.
@@ -34,6 +42,3 @@ tier3 =
# No tier 4 tests.
tier4 =
jaxp_all = \
javax/xml/jaxp

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, 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
@@ -23,7 +23,9 @@
package jaxp.library;
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;
import java.security.CodeSource;
import java.security.Permission;
import java.security.PermissionCollection;
@@ -161,7 +163,7 @@ public class JAXPPolicyManager {
*/
class TestPolicy extends Policy {
private final static Set<String> TEST_JARS =
Set.of("jtreg.jar", "javatest.jar", "testng.jar", "jcommander.jar");
Set.of("jtreg.*jar", "javatest.*jar", "testng.*jar", "jcommander.*jar");
private final PermissionCollection permissions = new Permissions();
private ThreadLocal<Map<Integer, Permission>> transientPermissions = new ThreadLocal<>();
@@ -213,9 +215,10 @@ class TestPolicy extends Policy {
private boolean isTestMachineryDomain(ProtectionDomain domain) {
CodeSource cs = (domain == null) ? null : domain.getCodeSource();
URL loc = (cs == null) ? null : cs.getLocation();
String path = (loc == null) ? null : loc.getPath();
return path != null && TEST_JARS.stream()
.filter(path::endsWith)
URI uri = (loc == null) ? null : URI.create(loc.toString());
String name = (uri == null) ? null : Path.of(uri).getFileName().toString();
return name != null && TEST_JARS.stream()
.filter(name::matches)
.findAny()
.isPresent();
}

View File

@@ -517,7 +517,6 @@ java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-
# jdk_io
java/io/pathNames/GeneralWin32.java 8180264 windows-all
java/io/File/createTempFile/SpecialTempFile.java 8274122 windows11
############################################################################

View File

@@ -20,6 +20,17 @@
# questions.
#
###############################################################################
#
# All tests
#
all = \
:jdk_all
jdk_all = \
/
###############################################################################
#
# Tiered testing definitions

View File

@@ -0,0 +1,376 @@
/*
* Copyright (c) 2000, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4240721
@summary Test Component.getListeners API added in 1.3
@key headful
@run main GetListenersTest
*/
import java.awt.Button;
import java.awt.Canvas;
import java.awt.Checkbox;
import java.awt.CheckboxMenuItem;
import java.awt.Choice;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.Panel;
import java.awt.Scrollbar;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentListener;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusListener;
import java.awt.event.HierarchyBoundsAdapter;
import java.awt.event.HierarchyBoundsListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.awt.event.WindowListener;
import java.awt.event.WindowStateListener;
import java.beans.BeanInfo;
import java.beans.EventSetDescriptor;
import java.beans.Introspector;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Method;
import java.util.EventListener;
public class GetListenersTest {
public static void main(String args[]) throws Exception {
EventQueue.invokeAndWait(()-> {
// Create frame with a bunch of components
// and test that each component returns
// the right type of listeners from Component.getListeners
GLTFrame gltFrame = new GLTFrame();
try {
gltFrame.initAndShowGui();
gltFrame.test();
} catch (Exception e) {
throw new RuntimeException("Test failed", e);
} finally {
gltFrame.dispose();
}
});
}
/*
* Checks an object has a listener for every support listener type
*/
static void checkForListenersOfEveryType(Object object) throws Exception {
Class type = object.getClass();
BeanInfo info = Introspector.getBeanInfo(type);
EventSetDescriptor esets[] = info.getEventSetDescriptors();
// ensure there are listeners for every type
for (int nset = 0; nset < esets.length; nset++) {
Class listenerType = esets[nset].getListenerType();
EventListener listener[] = getListeners(object, listenerType);
// Skip PropertyChangeListener for now
if (listener.length == 0 && validListenerToTest(listenerType)) {
throw new RuntimeException("getListeners didn't return type "
+ listenerType);
}
}
System.out.println("************");
System.out.println("PASSED: getListeners on "
+ object + " has all the right listeners.");
System.out.println("************");
}
/*
* Calls getListeners on the object
*/
static EventListener[] getListeners(Object object, Class type)
throws Exception {
Method methods[] = object.getClass().getMethods();
Method method = null;
for (int nmethod = 0; nmethod < methods.length; nmethod++) {
if (methods[nmethod].getName().equals("getListeners")) {
method = methods[nmethod];
break;
}
}
if (method == null) {
throw new RuntimeException("Object "
+ object + " has no getListeners method");
}
Class params[] = {type};
EventListener listeners[] = null;
listeners = (EventListener[]) method.invoke(object, params);
System.out.println("Listeners of type: " + type + " on " + object);
GetListenersTest.printArray(listeners);
return listeners;
}
/*
* Adds a listener of every type to the object
*/
static void addDummyListenersOfEveryType(Object object) throws Exception {
Class type = object.getClass();
BeanInfo info = Introspector.getBeanInfo(type);
EventSetDescriptor esets[] = info.getEventSetDescriptors();
// add every kind of listener
for (int nset = 0; nset < esets.length; nset++) {
Class listenerType = esets[nset].getListenerType();
EventListener listener = makeListener(listenerType);
Method addListenerMethod = esets[nset].getAddListenerMethod();
Object params[] = {listener};
addListenerMethod.invoke(object, params);
}
}
/*
* Determines what listeners to exclude from the test for now
*/
static boolean validListenerToTest(Class listenerType) {
/* Don't have any provision for PropertyChangeListeners... */
if ( listenerType == PropertyChangeListener.class ) {
return false;
}
return true;
}
static void testGetListeners(Object object) throws Exception {
GetListenersTest.addDummyListenersOfEveryType(object);
GetListenersTest.checkForListenersOfEveryType(object);
}
static void printArray(Object objects[]) {
System.out.println("{");
for(int n = 0; n < objects.length; n++) {
System.out.println("\t"+objects[n]+",");
}
System.out.println("}");
}
/*
* Makes a dummy listener implementation for the given listener type
*/
static EventListener makeListener(Class listenerType) throws Exception {
Object map[][] = {
{ActionListener.class, MyActionAdapter.class},
{AdjustmentListener.class, MyAdjustmentAdapter.class},
{ComponentListener.class, MyComponentAdapter.class},
{ContainerListener.class, MyContainerAdapter.class},
{FocusListener.class, MyFocusAdapter.class},
{HierarchyBoundsListener.class, MyHierarchyBoundsAdapter.class},
{HierarchyListener.class, MyHierarchyAdapter.class},
{InputMethodListener.class, MyInputMethodAdapter.class},
{ItemListener.class, MyItemAdapter.class},
{KeyListener.class, MyKeyAdapter.class},
{MouseListener.class, MyMouseAdapter.class},
{MouseMotionListener.class, MyMouseMotionAdapter.class},
{MouseWheelListener.class, MyMouseWheelAdapter.class},
{TextListener.class, MyTextAdapter.class},
{WindowListener.class, MyWindowAdapter.class},
{WindowFocusListener.class, MyWindowFocusAdapter.class},
{WindowStateListener.class, MyWindowStateAdapter.class},
{PropertyChangeListener.class, MyPropertyChangeAdapter.class},
};
for (int n = 0; n < map.length; n++) {
if (map[n][0] == listenerType) {
Class adapterClass = (Class) map[n][1];
EventListener listener =
(EventListener) adapterClass.newInstance();
return listener;
}
}
throw new RuntimeException("No adapter found for listener type "
+ listenerType);
}
}
class GLTFrame extends Frame {
MenuItem mitem;
CheckboxMenuItem cmitem;
GLTFrame() {
super("Component.getListeners API Test");
}
public void initAndShowGui() {
setLayout(new FlowLayout());
add(new Label("Label"));
add(new Button("Button"));
add(new Checkbox("Checkbox"));
Choice c = new Choice();
c.add("choice");
java.awt.List l = new java.awt.List();
l.add("list");
add(new Scrollbar());
add(new TextField("TextField"));
add(new TextArea("TextArea"));
add(new Panel());
add(new Canvas());
MenuBar menuBar = new MenuBar();
Menu menu = new Menu("Menu");
mitem = new MenuItem("Item 1");
cmitem = new CheckboxMenuItem("Item 2");
menu.add(mitem);
menu.add(cmitem);
menuBar.add(menu);
setMenuBar(menuBar);
pack();
setVisible(true);
}
public void test() throws Exception {
// test Frame.getListeners
GetListenersTest.testGetListeners(this);
//
// test getListeners on menu items
//
GetListenersTest.testGetListeners(mitem);
GetListenersTest.testGetListeners(cmitem);
//
// test getListeners on all AWT Components
//
Component components[] = getComponents();
for (int nc = 0; nc < components.length; nc++) {
GetListenersTest.testGetListeners(components[nc]);
}
}
}
/************************************************
* Dummy listener implementations we add to our components/models/objects
*/
class MyPropertyChangeAdapter implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent evt) {}
}
class MyActionAdapter implements ActionListener {
public void actionPerformed(ActionEvent ev) {
}
}
class MyAdjustmentAdapter implements AdjustmentListener {
public void adjustmentValueChanged(AdjustmentEvent e) {
}
}
class MyHierarchyAdapter implements HierarchyListener {
public void hierarchyChanged(HierarchyEvent e) {
}
}
class MyInputMethodAdapter implements InputMethodListener {
public void inputMethodTextChanged(InputMethodEvent event) {
}
public void caretPositionChanged(InputMethodEvent event) {
}
}
class MyItemAdapter implements ItemListener {
public void itemStateChanged(ItemEvent e) {
}
}
class MyTextAdapter implements TextListener {
public void textValueChanged(TextEvent e) {
}
}
class MyComponentAdapter extends ComponentAdapter {
}
class MyContainerAdapter extends ContainerAdapter {
}
class MyFocusAdapter extends FocusAdapter {
}
class MyHierarchyBoundsAdapter extends HierarchyBoundsAdapter {
}
class MyKeyAdapter extends KeyAdapter {
}
class MyMouseAdapter extends MouseAdapter {
}
class MyMouseMotionAdapter extends MouseMotionAdapter {
}
class MyMouseWheelAdapter implements MouseWheelListener {
public void mouseWheelMoved(MouseWheelEvent e) {}
}
class MyWindowAdapter extends WindowAdapter {
}
class MyWindowFocusAdapter implements WindowFocusListener {
public void windowGainedFocus(WindowEvent t) {}
public void windowLostFocus(WindowEvent t) {}
}
class MyWindowStateAdapter extends WindowAdapter {
}

View File

@@ -0,0 +1,127 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4852790
@summary Frame disposal must remove opened popup without exception
@key headful
*/
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
public class OpenedPopupFrameDisposal {
public static final int SIZE = 300;
volatile JFrame jf = null;
volatile JComboBox<String> jcb = null;
public void start() {
jf = new JFrame("OpenedPopupFrameDisposal - Frame to dispose");
// Note that original bug cannot be reproduced without JMenuBar present.
jf.setJMenuBar(new JMenuBar());
jf.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
jf.setLocationRelativeTo(null);
jf.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
jf.setVisible(false);
jf.dispose();
}
});
JPanel panel = new JPanel(new FlowLayout());
jcb = new JComboBox<>();
jcb.addItem("one");
jcb.addItem("two");
jcb.addItem("Three");
panel.add(jcb);
jf.getContentPane().add(panel, BorderLayout.CENTER);
jf.pack();
jf.setSize(new Dimension(SIZE, SIZE));
jf.setVisible(true);
}
public void test() throws Exception {
Robot robot = new Robot();
robot.delay(1000); // wait for jf visible
Point pt = jf.getLocationOnScreen();
int x, y;
x = pt.x + SIZE / 2;
y = pt.y + SIZE / 2;
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(1000);
pt = jcb.getLocationOnScreen();
x = pt.x + jcb.getWidth() / 2;
y = pt.y + jcb.getHeight() / 2;
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(1000);
// Here on disposal we had a NullPointerException
EventQueue.invokeAndWait(() -> {
if (jf != null) {
jf.setVisible(false);
jf.dispose();
}
});
}
public static void main(String[] args) throws Exception {
OpenedPopupFrameDisposal imt = new OpenedPopupFrameDisposal();
try {
EventQueue.invokeAndWait(imt::start);
imt.test();
} finally {
EventQueue.invokeAndWait(() -> {
if (imt.jf != null) {
imt.jf.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2002, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4546535
@summary java.awt.Container.remove(int) throws unexpected NPE
*/
import java.awt.Canvas;
import java.awt.Panel;
public class RemoveByIndexExceptionTest {
public static void main(String[] args) throws Exception {
Panel p = new Panel();
p.add(new Canvas());
p.remove(0);
int[] bad = {-1, 0, 1};
for (int i = 0; i < bad.length; i++) {
try {
System.out.println("Removing " + bad[i]);
p.remove(bad[i]);
System.out.println("No exception");
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
System.out.println("This is correct exception - " + e);
} catch (NullPointerException e) {
e.printStackTrace();
throw new RuntimeException("Test Failed: NPE was thrown.");
}
}
System.out.println("Test Passed.");
}
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4924516
@summary Verifies that SHOWING_CHANGED event is propagated to \
HierarchyListeners then toolkit enabled
@key headful
*/
import java.awt.AWTEvent;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.AWTEventListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class ShowingChangedEventTest
implements AWTEventListener, HierarchyListener{
private boolean eventRegisteredOnButton = false;
private final JFrame frame = new JFrame("ShowingChangedEventTest");
private final JPanel panel = new JPanel();
private final JButton button = new JButton();
public static void main(String[] args) throws Exception {
EventQueue.invokeAndWait(() -> {
ShowingChangedEventTest showingChangedEventTest
= new ShowingChangedEventTest();
try {
showingChangedEventTest.start();
} finally {
showingChangedEventTest.frame.dispose();
}
});
}
public void start () {
frame.getContentPane().add(panel);
panel.add(button);
frame.pack();
frame.setVisible(true);
Toolkit.getDefaultToolkit()
.addAWTEventListener(this, AWTEvent.HIERARCHY_EVENT_MASK);
button.addHierarchyListener(this);
panel.setVisible(false);
if (!eventRegisteredOnButton){
throw new RuntimeException("Event wasn't registered on Button.");
}
}
@Override
public void eventDispatched(AWTEvent awtevt) {
if (awtevt instanceof HierarchyEvent) {
HierarchyEvent hevt = (HierarchyEvent) awtevt;
if (hevt != null && (hevt.getChangeFlags()
& HierarchyEvent.SHOWING_CHANGED) != 0) {
System.out.println("Hierarchy event was received on Toolkit. "
+ "SHOWING_CHANGED for "
+ hevt.getChanged().getClass().getName());
}
}
}
@Override
public void hierarchyChanged(HierarchyEvent e) {
if ((HierarchyEvent.SHOWING_CHANGED & e.getChangeFlags()) != 0) {
System.out.println("Hierarchy event was received on Button. "
+ "SHOWING_CHANGED for "
+ e.getChanged().getClass().getName());
}
eventRegisteredOnButton = true;
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2004, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4994151
@summary REGRESSION: Bug when setting the foreground of a JWindow
@key headful
*/
import java.awt.EventQueue;
import java.awt.Color;
import javax.swing.JWindow;
public class SetForegroundTest {
static JWindow jwindow;
public static void main(String[] args) throws Exception {
try {
EventQueue.invokeAndWait(() -> {
jwindow = new JWindow();
jwindow.pack();
jwindow.setForeground(Color.BLACK);
System.out.println("TEST PASSED");
});
} finally {
EventQueue.invokeAndWait(() -> {
if (jwindow != null) {
jwindow.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,115 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4791953
@requires (os.family == "linux" | os.family == "mac")
@summary Checks that popup menu stay open after a triggering click.
@key headful
@run main/othervm -Dsun.java2d.uiScale=1 PopupMenuStayOpen
*/
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.InputEvent;
public class PopupMenuStayOpen {
public static final int MAX_COUNT = 100;
public volatile static boolean wasActionFired = false;
static Frame frame;
static PopupMenu pom;
volatile static Point point;
public static void main(String[] args) throws Exception {
String nm = Toolkit.getDefaultToolkit().getClass().getName();
try {
EventQueue.invokeAndWait(() -> {
frame = new Frame("Click-to-see-Popup");
pom = new PopupMenu();
frame.setTitle(nm);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
pom.add("A long enough line");
pom.getItem(0).addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
wasActionFired = true;
}
});
frame.add(pom);
frame.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
pom.show(frame, me.getX(), me.getY());
}
});
});
Robot robot = new Robot();
robot.delay(1000);
robot.waitForIdle();
EventQueue.invokeAndWait(() -> {
point = frame.getLocationOnScreen();
});
robot.mouseMove(point.x + 50, point.y + 100);
robot.mousePress(InputEvent.BUTTON2_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON2_DOWN_MASK);
robot.delay(1000);
robot.waitForIdle();
robot.mouseMove(point.x + 50 + 30, point.y + 100 + 15);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(500);
if (!wasActionFired) {
throw new RuntimeException("Popup not visible or has no focus");
}
System.out.println("Test Pass!!");
} finally {
EventQueue.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 1999, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4288230
@summary Tests that Robot can move mouse to another screen
@key headful
*/
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
public class RobotMoveMultiscreen {
static volatile int x_dest = 20;
static volatile int y_dest = 20;
static Frame frame;
static volatile Boolean testCondition = false;
public static void main(String[] args) throws Exception {
GraphicsDevice[] devs =
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
if (devs.length <= 1) {
System.out.println("Minimum 2 display screens are required" +
" for the test, Found " + devs.length);
return;
}
try {
EventQueue.invokeAndWait(() -> {
GraphicsDevice workDev = devs[devs.length - 1];
GraphicsConfiguration config = workDev.getDefaultConfiguration();
Rectangle bounds = config.getBounds();
x_dest = bounds.x + bounds.width / 2;
y_dest = bounds.y + bounds.height / 2;
frame = new Frame("Listening frame");
frame.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseMoved(MouseEvent e) {
testCondition = true;
}
});
frame.setLocation(x_dest,y_dest);
frame.setSize(100,100);
frame.setVisible(true);
});
Robot robot = new Robot();
robot.delay(1000);
robot.waitForIdle();
robot.mouseMove(x_dest+50, y_dest+50);
robot.waitForIdle();
EventQueue.invokeAndWait(() -> {
if (testCondition == false) {
throw new RuntimeException("Can't move to another display");
}
});
System.out.println("Test Pass!!");
} finally {
EventQueue.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4677084
@summary Tests that the PageIncrement (BlockIncrement) and
LineIncrement (UnitIncrement) cannot be < 1
@key headful
*/
import java.awt.Scrollbar;
public class PageIncrementTest {
static Scrollbar sb;
public static void main(String[] args) {
sb = new Scrollbar();
sb.setBlockIncrement(0);
sb.setUnitIncrement(0);
if (sb.getBlockIncrement() < 1) {
String msg = "Failed: getBlockIncrement() == " + sb.getBlockIncrement();
System.out.println(msg);
throw new RuntimeException(msg);
}
if (sb.getUnitIncrement() < 1) {
String msg = "Failed: getLineIncrement() == " + sb.getUnitIncrement();
System.out.println(msg);
throw new RuntimeException(msg);
}
sb.setBlockIncrement(-1);
sb.setUnitIncrement(-1);
if (sb.getBlockIncrement() < 1) {
String msg = "Failed: getBlockIncrement() == " + sb.getBlockIncrement();
System.out.println(msg);
throw new RuntimeException(msg);
}
if (sb.getUnitIncrement() < 1) {
String msg = "Failed: getLineIncrement() == " + sb.getUnitIncrement();
System.out.println(msg);
throw new RuntimeException(msg);
}
sb.setBlockIncrement(2);
sb.setUnitIncrement(2);
if (sb.getBlockIncrement() != 2) {
String msg = "Failed: getBlockIncrement() == " + sb.getBlockIncrement();
System.out.println(msg);
throw new RuntimeException(msg);
}
if (sb.getUnitIncrement() != 2) {
String msg = "Failed: getLineIncrement() == " + sb.getUnitIncrement();
System.out.println(msg);
throw new RuntimeException(msg);
}
System.out.println("Test Pass!!");
}
}

View File

@@ -0,0 +1,168 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4943277
@requires (os.family == "linux")
@summary XAWT: Scrollbar can't be controlled by keyboard
@key headful
*/
import java.awt.AWTException;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Robot;
import java.awt.Scrollbar;
import java.awt.Toolkit;
import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class ScrollbarKeyControlTest implements AdjustmentListener, KeyListener {
Scrollbar scrollbarV;
Scrollbar scrollbarH;
volatile int changesTotal = 0;
Robot robot;
Object LOCK = new Object();
Frame frame;
public static void main(String[] args) throws Exception {
if (!System.getProperty("os.name").startsWith("Linux")) {
System.out.println("This test is for XAWT only.");
return;
}
ScrollbarKeyControlTest scrollbarKeyControlTest = new ScrollbarKeyControlTest();
scrollbarKeyControlTest.init();
}
public void init() throws Exception {
try {
EventQueue.invokeAndWait(() -> {
frame = new Frame("Scrollbar Test");
scrollbarV = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 255);
scrollbarH = new Scrollbar(Scrollbar.HORIZONTAL, 0, 60, 0, 300);
scrollbarH.addAdjustmentListener(this);
scrollbarH.addKeyListener(this);
scrollbarV.addAdjustmentListener(this);
scrollbarV.addKeyListener(this);
frame.add("South", scrollbarH);
frame.add("East", scrollbarV);
frame.setSize(200, 200);
frame.setVisible(true);
frame.validate();
frame.toFront();
});
robot = new Robot();
robot.delay(1000);
robot.waitForIdle();
testOneScrollbar(scrollbarV);
if (changesTotal != 9) { //one by mouse click and six by keys
throw new RuntimeException("Test failed. Not all adjustment " +
"events received by vertical scrollbar (" + changesTotal + " of 9)");
}
changesTotal = 0;
testOneScrollbar(scrollbarH);
if (changesTotal != 9) { //one by mouse click and six by keys
throw new RuntimeException("Test failed. Not all adjustment " +
"events received by horizontal scrollbar (" + changesTotal + " of 9)");
}
System.out.println("Test passed. Adjustment Event called "
+ changesTotal + " times for each scrollbar");
} finally {
EventQueue.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
public void testOneScrollbar(Scrollbar sb) {
robot.waitForIdle();
robot.mouseMove(sb.getLocationOnScreen().x + sb.getWidth() / 2,
sb.getLocationOnScreen().y + sb.getHeight() / 2);
try {
synchronized (LOCK) {
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyRelease(KeyEvent.VK_DOWN);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_PAGE_DOWN);
robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_UP);
robot.keyRelease(KeyEvent.VK_UP);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_PAGE_UP);
robot.keyRelease(KeyEvent.VK_PAGE_UP);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_RIGHT);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_HOME);
robot.keyRelease(KeyEvent.VK_HOME);
LOCK.wait(2000);
robot.keyPress(KeyEvent.VK_END);
robot.keyRelease(KeyEvent.VK_END);
LOCK.wait(2000);
}
} catch (InterruptedException e) {
throw new RuntimeException("Test interrupted while keys being pressed.", e);
}
}
public void adjustmentValueChanged(AdjustmentEvent e) {
changesTotal++;
synchronized (LOCK) {
LOCK.notify();
}
System.out.println("Adjustment Event called ");
}
public void keyPressed(KeyEvent e) {
System.out.println("KeyPressed called");
}
public void keyReleased(KeyEvent e) {
System.out.println("in keyReleased");
}
public void keyTyped(KeyEvent e) {
System.out.println("in keyTyped");
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2004, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 5025532
@requires (os.family == "windows")
@summary Tests that textarea replaces text correctly if the text contains
line separators
@key headful
*/
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.TextArea;
import java.lang.reflect.InvocationTargetException;
public class ReplaceRangeTest {
static Frame f;
public static void main(String[] args) throws InterruptedException, InvocationTargetException {
try {
EventQueue.invokeAndWait(() -> {
f = new Frame("Test frame");
f.setSize(400, 400);
f.setLayout(new GridLayout(3, 1));
TextArea textArea1 = new TextArea(5, 80);
TextArea textArea2 = new TextArea(5, 80);
TextArea textArea3 = new TextArea(5, 80);
f.add(textArea1);
f.add(textArea2);
f.add(textArea3);
f.setVisible(true);
textArea1.setText("01234");
textArea1.replaceRange("X", 3, 4);
textArea2.setText("0\r\n234");
textArea2.replaceRange("X", 3, 4);
textArea3.setText("0\n\n34");
textArea3.replaceRange("X", 3, 4);
if (textArea1.getText().equals("012X4") &&
textArea2.getText().equals("0\r\n2X4") &&
textArea3.getText().equals("0\n\nX4")) {
System.out.println("Test Pass");
return;
} else {
throw new RuntimeException("Test FAILED");
}
});
} finally {
EventQueue.invokeAndWait(() -> {
if (f != null) {
f.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,155 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4800187
@requires (os.family == "windows")
@summary REGRESSION:show the wrong selection when there are \r characters in the text
@key headful
*/
import java.awt.Button;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.IllegalComponentStateException;
import java.awt.Point;
import java.awt.Robot;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.lang.reflect.InvocationTargetException;
public class TextAreaCRLFAutoDetectTest {
Frame f;
TextArea ta1;
TextArea ta2;
Button b;
boolean passed = true;
boolean crlf = true;
public static void main(String[] args) throws Exception {
TextAreaCRLFAutoDetectTest crlfAutoDetectTest = new TextAreaCRLFAutoDetectTest();
crlfAutoDetectTest.init();
crlfAutoDetectTest.start();
}
public void init() throws InterruptedException, InvocationTargetException {
EventQueue.invokeAndWait(() -> {
f = new Frame("TextAreaCRLFAutoDetectTest");
ta1 = new TextArea(5, 20);
ta2 = new TextArea(5, 20);
b = new Button("Click Me");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ta1.setText("");
ta2.setText("");
System.out.println("--------------------------------");
String eoln = (crlf) ? "\r\n" : "\n";
String s = eoln + "123" + eoln + "567" + eoln + "90" + eoln;
printString(" s=", s);
ta1.setText(s);
printString("ta1.getText()=", ta1.getText());
s = "67" + eoln + "9";
ta1.select(6, 10);
String s1 = ta1.getSelectedText();
printString("ta1.getSelectedText()=", s1);
passed = passed && s.equals(s1);
ta2.setText(s1);
printString(" ta2.getText()=", s1);
passed = passed && s1.equals(ta2.getText());
crlf = false;
}
});
f.setLayout(new FlowLayout());
f.add(ta1);
f.add(ta2);
f.add(b);
f.setLocation(300, 50);
f.pack();
f.setVisible(true);
});
}
public void start() throws Exception {
try {
Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(50);
robot.waitForIdle();
Point pt = new Point(0, 0);
boolean drawn = false;
while (!drawn) {
try {
pt = b.getLocationOnScreen();
} catch (IllegalComponentStateException icse) {
Thread.sleep(50);
continue;
}
drawn = true;
}
for (int i = 0; i < 2; i++) {
pt = b.getLocationOnScreen();
robot.mouseMove(pt.x + b.getWidth() / 2,
pt.y + b.getHeight() / 2);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
Thread.sleep(250);
}
if (!passed) {
throw new RuntimeException("TextAreaCRLFAutoDetectTest FAILED.");
} else {
System.out.println("TextAreaCRLFAutoDetectTest PASSED");
}
} catch (Exception e) {
throw new RuntimeException("The test was not completed.\n\n" + e);
} finally {
EventQueue.invokeAndWait(() -> {
if (f != null) {
f.dispose();
}
});
}
}
void printString(String t, String s) {
byte b[] = s.getBytes();
String o = t;
for (int i = 0; i < b.length; i++) {
o += Byte.toString(b[i]) + " ";
}
System.out.println(o);
}
}

View File

@@ -0,0 +1,116 @@
/*
* Copyright (c) 1998, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4072264
@summary REGRESSION:Test to verify getSelectedText,
getSelectedStart/End in TextArea class
@key headful
*/
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Robot;
import java.awt.TextArea;
public class TextLengthTest {
static final int MY_SIZE = 100;
static final int MY_START = 13;
static final int MY_END = 47;
TextArea ta;
Frame f;
int mySize;
int myStart;
int myEnd;
public static void main(String[] args) throws Exception {
TextLengthTest textLengthTest = new TextLengthTest();
textLengthTest.init();
textLengthTest.start();
}
public void init() throws Exception {
EventQueue.invokeAndWait(() -> {
f = new Frame("TextLengthTest");
ta = new TextArea(15, 30);
f.add(ta);
f.setSize(400, 400);
f.setVisible(true);
});
}
public void start() throws Exception {
try {
Robot r = new Robot();
r.delay(1000);
r.waitForIdle();
EventQueue.invokeAndWait(() -> {
StringBuffer bigStringBuffer = new StringBuffer();
for (int i = 1; i <= 10; i++) {
bigStringBuffer.append("abcdefghi\n");
}
ta.setText(bigStringBuffer.toString());
mySize = bigStringBuffer.toString().length();
System.out.println("String size = " + mySize);
if (mySize != MY_SIZE) {
throw new Error("The string size is " +
mySize + "but it should be " + MY_SIZE);
}
ta.select(MY_START, MY_END);
String str = new String(ta.getSelectedText());
str = str.toUpperCase();
myStart = ta.getSelectionStart();
myEnd = ta.getSelectionEnd();
System.out.println("Selected string start = " + myStart);
System.out.println("Selected string end = " + myEnd);
if (myStart != MY_START) {
throw new Error("The selected text starts at " +
mySize + "but it should start at " + MY_START);
}
if (myEnd != MY_END) {
throw new Error("The selected text ends at " +
myEnd + "but it should end at " + MY_END);
}
ta.replaceRange(str, myStart, myEnd);
});
} finally {
EventQueue.invokeAndWait(() -> {
if (f != null) {
f.dispose();
}
});
}
System.out.println("Test Pass");
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4260109
@summary tests that the text limit is set to the maximum possible value
@key headful
*/
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.TextArea;
public class TextLimitTest {
static Frame frame;
static TextArea textarea;
public static void main(String[] args) throws Exception {
try {
EventQueue.invokeAndWait(() -> {
StringBuffer buffer = new StringBuffer();
frame = new Frame("Text Limit Test");
textarea = new TextArea(3, 10);
frame.setLayout(new BorderLayout());
frame.add(textarea);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
/*
* The magic number 0xF700 was choosen because of the two reasons:
* - it shouldn't be greater since on win95 (even in native win32 apps)
* adding more than 0xF800 symbols to a textarea doesn't always work,
* - it shouldn't be less since in this case we won't run in the stack
* overflow on Win95 even if we use W2A allocating memory on the stack.
*/
for (int i = 0; i < 0xF700; i += 0x10) {
buffer.append("0123456789abcdef");
}
textarea.setText(buffer.toString());
System.out.println("Text length before append: " +
Integer.toString(textarea.getText().length(), 16));
textarea.append("0123456789abcdef");
int len = textarea.getText().length();
System.out.println("Text length after append: " +
Integer.toString(len, 16));
if (len != 0xF710) {
throw new RuntimeException("Test failed: textarea has " +
"wrong text limit!");
}
});
System.out.println("Test pass");
} finally {
EventQueue.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,304 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Robot;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetContext;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.AWTEventListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
/*
@test
@bug 4426794 4435403
@summary tests that drag notifications are targeted to the drop target
whose operable part is currently intersected by cursor's hotspot
@key headful
@run main DropTargetingTest
*/
public class DropTargetingTest implements AWTEventListener {
volatile JFrame sourceFrame;
volatile JFrame targetFrame1;
volatile JFrame targetFrame2;
volatile JButton obscurer;
volatile DragSource dragSource;
volatile Transferable transferable;
volatile DragSourceListener dragSourceListener;
volatile DragGestureListener dragGestureListener;
volatile Point srcPoint;
volatile Point dstPoint;
volatile Dimension d;
static class TestDropTargetListener extends DropTargetAdapter {
private boolean dropRecognized = false;
public void drop(DropTargetDropEvent dtde) {
dropRecognized = true;
dtde.rejectDrop();
synchronized (SYNC_LOCK) {
SYNC_LOCK.notifyAll();
}
}
public void reset() {
dropRecognized = false;
}
public boolean dropRecognized() {
return dropRecognized;
}
}
volatile TestDropTargetListener dropTargetListener;
static final Object SYNC_LOCK = new Object();
static final int FRAME_ACTIVATION_TIMEOUT = 2000;
static final int DROP_COMPLETION_TIMEOUT = 5000;
static final int MOUSE_RELEASE_TIMEOUT = 1000;
Component clickedComponent = null;
public static void main(String[] args) throws Exception {
DropTargetingTest test = new DropTargetingTest();
EventQueue.invokeAndWait(test::init);
try {
test.start();
} finally {
EventQueue.invokeAndWait(() -> {
if (test.sourceFrame != null) {
test.sourceFrame.dispose();
}
if (test.targetFrame1 != null) {
test.targetFrame1.dispose();
}
if (test.targetFrame2 != null) {
test.targetFrame2.dispose();
}
});
}
}
public void init() {
sourceFrame = new JFrame();
targetFrame1 = new JFrame();
targetFrame2 = new JFrame();
obscurer = new JButton("Obscurer");
dragSource = DragSource.getDefaultDragSource();
transferable = new StringSelection("TEXT");
dragSourceListener = new DragSourceAdapter() {};
dragGestureListener = new DragGestureListener() {
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, transferable, dragSourceListener);
}
};
dropTargetListener = new TestDropTargetListener();
sourceFrame.setTitle("DropTargetingTest Source frame");
sourceFrame.setBounds(100, 100, 100, 100);
sourceFrame.getToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);
dragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY,
dragGestureListener);
targetFrame1.setTitle("Target frame 1");
targetFrame1.setBounds(200, 100, 100, 100);
targetFrame1.getGlassPane().setVisible(true);
targetFrame1.getGlassPane().setDropTarget(
new DropTarget(targetFrame1.getGlassPane(), dropTargetListener));
targetFrame2.setTitle("Target frame 2");
targetFrame2.setBounds(300, 100, 100, 100);
targetFrame2.setDropTarget(new DropTarget(targetFrame1, dropTargetListener));
targetFrame2.getContentPane().add(obscurer);
sourceFrame.setVisible(true);
targetFrame1.setVisible(true);
targetFrame2.setVisible(true);
}
public static int sign(int n) {
return n < 0 ? -1 : n == 0 ? 0 : 1;
}
public void start() throws Exception {
Robot robot = new Robot();
robot.delay(FRAME_ACTIVATION_TIMEOUT);
if (!test(robot, targetFrame1)) {
throw new RuntimeException("Failed to recognize drop on a glass pane");
}
if (!test(robot, targetFrame2)) {
throw new RuntimeException("Failed to recognize drop on a composite component");
}
}
public void reset() {
clickedComponent = null;
}
public void eventDispatched(AWTEvent e) {
if (e.getID() == MouseEvent.MOUSE_RELEASED) {
clickedComponent = (Component)e.getSource();
synchronized (SYNC_LOCK) {
SYNC_LOCK.notifyAll();
}
}
}
boolean pointInComponent(Robot robot, Point p, Component comp)
throws InterruptedException {
robot.waitForIdle();
reset();
robot.mouseMove(p.x, p.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
synchronized (SYNC_LOCK) {
robot.mouseRelease(InputEvent.BUTTON1_MASK);
SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT);
}
Component c = clickedComponent;
while (c != null && c != comp) {
c = c.getParent();
}
return c == comp;
}
boolean test(Robot robot, JFrame targetFrame) throws Exception {
EventQueue.invokeAndWait(() -> {
srcPoint = sourceFrame.getLocationOnScreen();
d = sourceFrame.getSize();
});
srcPoint.translate(d.width / 2, d.height / 2);
if (!pointInComponent(robot, srcPoint, sourceFrame)) {
System.err.println("WARNING: Couldn't locate source frame.");
return true;
}
EventQueue.invokeAndWait(() -> {
dstPoint = targetFrame.getLocationOnScreen();
d = targetFrame.getSize();
});
dstPoint.translate(d.width / 2, d.height / 2);
if (!pointInComponent(robot, dstPoint, targetFrame)) {
System.err.println("WARNING: Couldn't locate target frame: " + targetFrame);
return true;
}
dropTargetListener.reset();
robot.mouseMove(srcPoint.x, srcPoint.y);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.mousePress(InputEvent.BUTTON1_MASK);
for (;!srcPoint.equals(dstPoint);
srcPoint.translate(sign(dstPoint.x - srcPoint.x),
sign(dstPoint.y - srcPoint.y))) {
robot.mouseMove(srcPoint.x, srcPoint.y);
robot.delay(10);
}
synchronized (SYNC_LOCK) {
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.keyRelease(KeyEvent.VK_CONTROL);
SYNC_LOCK.wait(DROP_COMPLETION_TIMEOUT);
}
return dropTargetListener.dropRecognized();
}
}
class DropTargetPanel extends Panel implements DropTargetListener {
final Dimension preferredDimension = new Dimension(200, 100);
boolean testPassed = true;
public DropTargetPanel() {
setDropTarget(new DropTarget(this, this));
}
public boolean getStatus() {
return testPassed;
}
public Dimension getPreferredSize() {
return preferredDimension;
}
public void dragEnter(DropTargetDragEvent dtde) {}
public void dragExit(DropTargetEvent dte) {
testPassed = false;
}
public void dragOver(DropTargetDragEvent dtde) {}
public void dropActionChanged(DropTargetDragEvent dtde) {}
public void drop(DropTargetDropEvent dtde) {
DropTargetContext dtc = dtde.getDropTargetContext();
if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
} else {
dtde.rejectDrop();
}
DataFlavor[] dfs = dtde.getCurrentDataFlavors();
Component comp = null;
if (dfs != null && dfs.length >= 1) {
Transferable transfer = dtde.getTransferable();
try {
comp = (Component)transfer.getTransferData(dfs[0]);
} catch (Throwable e) {
e.printStackTrace();
dtc.dropComplete(false);
}
}
dtc.dropComplete(true);
add(comp);
}
}

View File

@@ -0,0 +1,367 @@
/*
* Copyright (c) 2000, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.Button;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Robot;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.dnd.DragSourceEvent;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetContext;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/*
@test
@bug 4338893
@summary tests that dnd between two different VMs doesn't cause hang
on the dropping side.
@key headful
@run main/timeout=120 DroppingVMHangTest
*/
public class DroppingVMHangTest {
public static final int CODE_NOT_RETURNED = -1;
public static final int CODE_OK = 0;
public static final int CODE_FAILURE = 1;
public static final int CODE_HANG_FAILURE = 2;
public static final int CODE_OTHER_FAILURE = 3;
public static final int CODE_TIMEOUT = 4;
public static final int FRAME_ACTIVATION_TIMEOUT = 2000;
private int returnCode = CODE_NOT_RETURNED;
volatile Frame frame;
volatile Point p;
volatile Dimension d;
Robot robot = null;
public static void main(String[] args) throws Exception {
DroppingVMHangTest test = new DroppingVMHangTest();
if (args.length > 0) {
test.run(args);
} else {
EventQueue.invokeAndWait(test::init);
try {
test.start();
} finally {
EventQueue.invokeAndWait(() -> {
if (test.frame != null) {
test.frame.dispose();
}
});
}
}
}
public void run(String[] args) {
try {
frame = new Frame();
frame.setTitle("DroppingVMHangTest DropTarget frame");
frame.setLocation(300, 400);
frame.add(new DropTargetPanel());
frame.pack();
frame.setVisible(true);
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
if (args.length != 2) {
throw new RuntimeException("Incorrect number of arguments for child:" +
args.length);
}
int x = Integer.parseInt(args[0], 10);
int y = Integer.parseInt(args[1], 10);
Point sourcePoint = new Point(x, y);
Point targetPoint = frame.getLocationOnScreen();
Dimension d = frame.getSize();
targetPoint.translate(d.width / 2, d.height / 2);
robot = new Robot();
robot.mouseMove(x, y);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.mousePress(InputEvent.BUTTON1_MASK);
while (!sourcePoint.equals(targetPoint)) {
robot.mouseMove(sourcePoint.x, sourcePoint.y);
Thread.sleep(10);
int dx = sign(targetPoint.x - sourcePoint.x);
int dy = sign(targetPoint.y - sourcePoint.y);
sourcePoint.translate(dx, dy);
}
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.keyRelease(KeyEvent.VK_CONTROL);
Thread.sleep(5000);
System.exit(DroppingVMHangTest.CODE_TIMEOUT);
} catch (Throwable e) {
e.printStackTrace();
System.exit(DroppingVMHangTest.CODE_OTHER_FAILURE);
}
}
static int sign(int n) {
return n > 0 ? 1 : n < 0 ? -1 : 0;
}
public void init() {
frame = new Frame();
frame.setTitle("DragSource frame");
frame.setLocation(10, 200);
frame.add(new DragSourcePanel());
frame.pack();
frame.setVisible(true);
}
public void start() throws Exception {
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
EventQueue.invokeAndWait(() -> {
p = frame.getLocationOnScreen();
d = frame.getSize();
});
p.translate(d.width / 2, d.height / 2);
String javaPath = System.getProperty("java.home", "");
String command = javaPath + File.separator + "bin" +
File.separator + "java -cp " + System.getProperty("test.classes", ".") +
" DroppingVMHangTest" + " " + p.x + " " + p.y;
Process process = Runtime.getRuntime().exec(command);
returnCode = process.waitFor();
InputStream errorStream = process.getErrorStream();
int count = errorStream.available();
if (count > 0) {
byte[] b = new byte[count];
errorStream.read(b);
System.err.println("========= Child VM System.err ========");
System.err.print(new String(b));
System.err.println("======================================");
}
switch (returnCode) {
case CODE_NOT_RETURNED:
System.err.println("Child VM: failed to start");
break;
case CODE_OK:
System.err.println("Child VM: normal termination");
break;
case CODE_FAILURE:
System.err.println("Child VM: abnormal termination");
break;
case CODE_HANG_FAILURE:
System.err.println("Child VM: hang on drop");
break;
case CODE_OTHER_FAILURE:
System.err.println("Child VM: other failure");
break;
case CODE_TIMEOUT:
System.err.println("Child VM: failed to simulate drag-and-drop operation with Robot");
break;
}
if (returnCode != CODE_OK && returnCode != CODE_TIMEOUT) {
throw new RuntimeException("The test failed.");
}
}
}
class DragSourceButton extends Button implements Serializable,
Transferable,
DragGestureListener,
DragSourceListener {
private transient final DataFlavor dataflavor =
new DataFlavor(DragSourceButton.class, "DragSourceButton");
public DragSourceButton() {
this("DragSourceButton");
}
public DragSourceButton(String str) {
super(str);
DragSource ds = DragSource.getDefaultDragSource();
ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY,
this);
}
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, this, this);
}
public void dragEnter(DragSourceDragEvent dsde) {}
public void dragExit(DragSourceEvent dse) {}
public void dragOver(DragSourceDragEvent dsde) {}
public void dragDropEnd(DragSourceDropEvent dsde) {}
public void dropActionChanged(DragSourceDragEvent dsde) {}
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (!isDataFlavorSupported(flavor)) {
throw new UnsupportedFlavorException(flavor);
}
Object retObj = null;
ByteArrayOutputStream baoStream = new ByteArrayOutputStream();
ObjectOutputStream ooStream = new ObjectOutputStream(baoStream);
ooStream.writeObject(this);
ByteArrayInputStream baiStream = new ByteArrayInputStream(baoStream.toByteArray());
ObjectInputStream ois = new ObjectInputStream(baiStream);
try {
retObj = ois.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
throw new RuntimeException(e.toString());
}
return retObj;
}
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] { dataflavor };
}
public boolean isDataFlavorSupported(DataFlavor dflavor) {
return dataflavor.equals(dflavor);
}
}
class DragSourcePanel extends Panel {
final Dimension preferredDimension = new Dimension(200, 200);
public DragSourcePanel() {
setLayout(new GridLayout(1, 1));
add(new DragSourceButton());
}
public Dimension getPreferredSize() {
return preferredDimension;
}
}
class DropTargetPanel extends Panel implements DropTargetListener,
Runnable {
final Dimension preferredDimension = new Dimension(200, 200);
public DropTargetPanel() {
setDropTarget(new DropTarget(this, this));
}
public Dimension getPreferredSize() {
return preferredDimension;
}
public void dragEnter(DropTargetDragEvent dtde) {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
}
public void dragExit(DropTargetEvent dte) {}
public void dragOver(DropTargetDragEvent dtde) {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
}
public void drop(DropTargetDropEvent dtde) {
DropTargetContext dtc = dtde.getDropTargetContext();
if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
} else {
dtde.rejectDrop();
System.exit(DroppingVMHangTest.CODE_OTHER_FAILURE);
}
DataFlavor[] dfs = dtde.getCurrentDataFlavors();
Component comp = null;
if (dfs != null && dfs.length >= 1) {
Transferable transfer = dtde.getTransferable();
try {
comp = (Component)transfer.getTransferData(dfs[0]);
comp.getClass();
} catch (Throwable e) {
e.printStackTrace();
dtc.dropComplete(false);
System.exit(DroppingVMHangTest.CODE_OTHER_FAILURE);
}
}
dtc.dropComplete(true);
Thread thread = new Thread(this);
thread.start();
add(comp);
System.exit(DroppingVMHangTest.CODE_OK);
}
public void dropActionChanged(DropTargetDragEvent dtde) {}
public void run() {
try {
Thread.sleep(60000);
} catch (InterruptedException e) {
}
Runtime.getRuntime().halt(DroppingVMHangTest.CODE_HANG_FAILURE);
}
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright (c) 2003, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Point;
import java.awt.Robot;
import java.awt.datatransfer.StringSelection;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.event.InputEvent;
/*
@test
@bug 4869264
@summary tests that DragSourceDragEvent.getDropAction() accords to its new spec
(does not depend on the user drop action)
@key headful
@run main/othervm HonorTargetActionTest
*/
public class HonorTargetActionTest extends Frame {
private static final int FRAME_ACTIVATION_TIMEOUT = 3000;
private boolean dragOverCalled;
private int dropAction;
volatile Frame frame;
volatile Point startPoint;
volatile Point endPoint;
public static void main(String[] args) throws Exception {
HonorTargetActionTest test = new HonorTargetActionTest();
EventQueue.invokeAndWait(test::init);
try {
test.start();
} finally {
EventQueue.invokeAndWait(() -> {
if (test.frame != null) {
test.frame.dispose();
}
});
}
}
public void init() {
DragSourceListener dragSourceListener = new DragSourceAdapter() {
public void dragOver(DragSourceDragEvent dsde) {
dragOverCalled = true;
dropAction = dsde.getDropAction();
}
};
DragGestureListener dragGestureListener = new DragGestureListener() {
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, new StringSelection("OOKK"), dragSourceListener);
}
};
new DragSource().createDefaultDragGestureRecognizer(frame,
DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener);
DropTargetAdapter dropTargetListener = new DropTargetAdapter() {
public void dragEnter(DropTargetDragEvent dtde) {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
}
public void dragOver(DropTargetDragEvent dtde) {
dtde.acceptDrag(DnDConstants.ACTION_COPY);
}
public void drop(DropTargetDropEvent dtde) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
}
};
new DropTarget(frame, dropTargetListener);
dragOverCalled = false;
dropAction = 0;
frame = new Frame("Drag Test Frame");
setTitle("HonorTargetActionTest");
setSize (200,200);
setLayout (new BorderLayout());
setVisible(true);
validate();
frame.setBounds(100, 100, 200, 200);
frame.setVisible(true);
}
public void start() throws Exception {
Robot robot = new Robot();
robot.waitForIdle();
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
EventQueue.invokeAndWait(() -> {
startPoint = frame.getLocationOnScreen();
});
endPoint = new Point(startPoint);
robot.waitForIdle();
startPoint.translate(50, 50);
endPoint.translate(150, 150);
robot.mouseMove(startPoint.x, startPoint.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
for (Point p = new Point(startPoint); !p.equals(endPoint);
p.translate(sign(endPoint.x - p.x),
sign(endPoint.y - p.y))) {
robot.mouseMove(p.x, p.y);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
robot.mouseRelease(InputEvent.BUTTON1_MASK);
boolean failed = dragOverCalled && dropAction != DnDConstants.ACTION_COPY;
if (failed) {
throw new RuntimeException("test failed: dropAction=" + dropAction);
} else {
System.err.println("test passed");
}
}
public static int sign(int n) {
return n < 0 ? -1 : n == 0 ? 0 : 1;
}
}

View File

@@ -0,0 +1,273 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.Button;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Robot;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.InputEvent;
import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
/*
@test
@bug 4492640
@summary tests that inter-JVM dnd works properly for ACTION_LINK
@key headful
@run main InterJVMLinkTest
*/
public class InterJVMLinkTest {
public static final int CODE_NOT_RETURNED = -1;
public static final int CODE_OK = 0;
public static final int CODE_FAILURE = 1;
public static final int FRAME_ACTIVATION_TIMEOUT = 2000;
public static final int DROP_TIMEOUT = 60000;
private int returnCode = CODE_NOT_RETURNED;
volatile Frame frame;
volatile DropTargetPanel panel;
volatile Robot robot = null;
volatile Point p;
volatile Dimension d;
public static void main(String[] args) throws Exception {
InterJVMLinkTest test = new InterJVMLinkTest();
if (args.length > 0) {
test.run(args);
} else {
EventQueue.invokeAndWait(test::init);
try {
test.start();
} finally {
EventQueue.invokeAndWait(() -> {
if (test.frame != null) {
test.frame.dispose();
}
});
}
}
}
public void run(String[] args) {
try {
if (args.length != 4) {
throw new RuntimeException("Incorrect command line arguments.");
}
int x = Integer.parseInt(args[0]);
int y = Integer.parseInt(args[1]);
int w = Integer.parseInt(args[2]);
int h = Integer.parseInt(args[3]);
DragSourcePanel panel = new DragSourcePanel();
frame = new Frame();
frame.setTitle("DragSource frame");
frame.setLocation(300, 200);
frame.add(panel);
frame.pack();
frame.setVisible(true);
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
Point sourcePoint = panel.getLocationOnScreen();
Dimension d = panel.getSize();
sourcePoint.translate(d.width / 2, d.height / 2);
Point targetPoint = new Point(x + w / 2, y + h / 2);
robot = new Robot();
robot.mouseMove(sourcePoint.x, sourcePoint.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
for (; !sourcePoint.equals(targetPoint);
sourcePoint.translate(sign(targetPoint.x - sourcePoint.x),
sign(targetPoint.y - sourcePoint.y))) {
robot.mouseMove(sourcePoint.x, sourcePoint.y);
Thread.sleep(50);
}
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Thread.sleep(DROP_TIMEOUT);
System.exit(InterJVMLinkTest.CODE_OK);
} catch (Throwable e) {
e.printStackTrace();
System.exit(InterJVMLinkTest.CODE_FAILURE);
}
}
public static int sign(int n) {
return n < 0 ? -1 : n == 0 ? 0 : 1;
}
public void init() {
panel = new DropTargetPanel();
frame = new Frame();
frame.setTitle("InterJVMLinkTest DropTarget frame");
frame.setLocation(10, 200);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
public void start() throws Exception {
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
EventQueue.invokeAndWait(() -> {
p = panel.getLocationOnScreen();
d = panel.getSize();
});
String javaPath = System.getProperty("java.home", "");
String command = javaPath + File.separator + "bin" +
File.separator + "java -cp " + System.getProperty("test.classes", ".") +
" InterJVMLinkTest " +
p.x + " " + p.y + " " + d.width + " " + d.height;
Process process = Runtime.getRuntime().exec(command);
returnCode = process.waitFor();
InputStream errorStream = process.getErrorStream();
int count = errorStream.available();
if (count > 0) {
byte[] b = new byte[count];
errorStream.read(b);
System.err.println("========= Child VM System.err ========");
System.err.print(new String(b));
System.err.println("======================================");
}
switch (returnCode) {
case CODE_NOT_RETURNED:
System.err.println("Child VM: failed to start");
break;
case CODE_OK:
System.err.println("Child VM: normal termination");
break;
case CODE_FAILURE:
System.err.println("Child VM: abnormal termination");
break;
}
if (panel == null || (panel.isEntered() && !panel.isDropped())) {
throw new RuntimeException("The test failed.");
}
}
}
class DragSourceButton extends Button implements Serializable,
DragGestureListener {
final Transferable transferable = new StringSelection("TEXT");
final DragSourceListener dragSourceListener = new DragSourceAdapter() {
public void dragDropEnd(DragSourceDropEvent dsde) {
System.exit(InterJVMLinkTest.CODE_OK);
}
};
public DragSourceButton() {
super("DragSourceButton");
DragSource ds = DragSource.getDefaultDragSource();
ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_LINK,
this);
}
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, transferable, dragSourceListener);
}
}
class DragSourcePanel extends Panel {
final Dimension preferredDimension = new Dimension(200, 200);
public DragSourcePanel() {
setLayout(new GridLayout(1, 1));
add(new DragSourceButton());
}
public Dimension getPreferredSize() {
return preferredDimension;
}
}
class DropTargetPanel extends Panel implements DropTargetListener {
final Dimension preferredDimension = new Dimension(200, 200);
boolean entered = false;
boolean dropped = false;
public DropTargetPanel() {
setDropTarget(new DropTarget(this, DnDConstants.ACTION_LINK, this));
}
public Dimension getPreferredSize() {
return preferredDimension;
}
public void dragEnter(DropTargetDragEvent dtde) {
entered = true;
}
public void dragExit(DropTargetEvent dte) {}
public void dragOver(DropTargetDragEvent dtde) {}
public void drop(DropTargetDropEvent dtde) {
dtde.rejectDrop();
dropped = true;
}
public void dropActionChanged(DropTargetDragEvent dtde) {}
public boolean isEntered() {
return entered;
}
public boolean isDropped() {
return dropped;
}
}

View File

@@ -0,0 +1,283 @@
/*
* Copyright (c) 2002, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.AWTEvent;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.Robot;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragGestureRecognizer;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.AWTEventListener;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
/*
@test
@bug 4658741
@summary verifies that getDropSuccess() returns correct value for intra-JVM DnD
@key headful
@run main IntraJVMGetDropSuccessTest
*/
public class IntraJVMGetDropSuccessTest implements AWTEventListener {
static final Object SYNC_LOCK = new Object();
static final int FRAME_ACTIVATION_TIMEOUT = 3000;
static final int MOUSE_RELEASE_TIMEOUT = 1000;
static class DragSourceDropListener extends DragSourceAdapter {
private boolean finished = false;
private boolean dropSuccess = false;
public void reset() {
finished = false;
dropSuccess = false;
}
public boolean isDropFinished() {
return finished;
}
public boolean getDropSuccess() {
return dropSuccess;
}
public void dragDropEnd(DragSourceDropEvent dsde) {
finished = true;
dropSuccess = dsde.getDropSuccess();
synchronized (SYNC_LOCK) {
SYNC_LOCK.notifyAll();
}
}
}
static class ChildCanvas extends Canvas {
private final Dimension preferredDimension = new Dimension(100, 200);
public Dimension getPreferredSize() {
return preferredDimension;
}
}
volatile Frame frame;
volatile Canvas canvas1;
volatile Canvas canvas2;
volatile Canvas canvas3;
volatile Point p;
volatile Dimension d;
volatile Component c;
volatile DragSourceDropListener dragSourceListener;
volatile DragSource dragSource;
volatile Transferable transferable;
volatile DragGestureListener dragGestureListener;
volatile DragGestureRecognizer dragGestureRecognizer;
volatile DropTargetListener dropTargetListener;
volatile DropTarget dropTarget;
Component clickedComponent = null;
public static void main(String[] args) throws Exception {
IntraJVMGetDropSuccessTest test = new IntraJVMGetDropSuccessTest();
EventQueue.invokeAndWait(test::init);
try {
test.start();
} finally {
EventQueue.invokeAndWait(() -> {
if (test.frame != null) {
test.frame.dispose();
}
});
}
}
public void init() {
frame = new Frame();
canvas1 = new ChildCanvas();
canvas2 = new ChildCanvas();
canvas3 = new ChildCanvas();
dragSourceListener = new DragSourceDropListener();
dragSource = DragSource.getDefaultDragSource();
transferable = new StringSelection("TEXT");
dragGestureListener = new DragGestureListener() {
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, transferable, dragSourceListener);
}
};
dragGestureRecognizer =
dragSource.createDefaultDragGestureRecognizer(canvas2, DnDConstants.ACTION_COPY,
dragGestureListener);
dropTargetListener = new DropTargetAdapter() {
public void drop(DropTargetDropEvent dtde) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
dtde.dropComplete(true);
}
};
dropTarget = new DropTarget(canvas3, dropTargetListener);
canvas1.setBackground(Color.red);
canvas2.setBackground(Color.yellow);
canvas3.setBackground(Color.green);
frame.setTitle("IntraJVMGetDropSuccessTest");
frame.setLocation(100, 100);
frame.setLayout(new GridLayout(1, 3));
frame.getToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);
frame.add(canvas1);
frame.add(canvas2);
frame.add(canvas3);
frame.pack();
frame.setVisible(true);
}
public static int sign(int n) {
return n < 0 ? -1 : n == 0 ? 0 : 1;
}
public void start() throws Exception {
Robot robot = new Robot();
robot.delay(FRAME_ACTIVATION_TIMEOUT);
final Point srcPoint = getCenterLocationOnScreen(canvas2);
if (!pointInComponent(robot, srcPoint, canvas2)) {
System.err.println("WARNING: Couldn't locate " + canvas2);
return;
}
final Point dstPoint1 = getCenterLocationOnScreen(canvas1);
if (!pointInComponent(robot, dstPoint1, canvas1)) {
System.err.println("WARNING: Couldn't locate " + canvas1);
return;
}
final Point dstPoint2 = getCenterLocationOnScreen(canvas3);
if (!pointInComponent(robot, dstPoint2, canvas3)) {
System.err.println("WARNING: Couldn't locate " + canvas3);
return;
}
robot.waitForIdle();
test(robot, srcPoint, dstPoint1, false);
test(robot, srcPoint, dstPoint2, true);
test(robot, srcPoint, dstPoint1, false);
}
public Point getCenterLocationOnScreen(Component c) throws Exception {
EventQueue.invokeAndWait(() -> {
p = c.getLocationOnScreen();
d = c.getSize();
});
p.translate(d.width / 2, d.height / 2);
return p;
}
public void test(Robot robot, Point src, Point dst, boolean success)
throws InterruptedException {
dragSourceListener.reset();
robot.mouseMove(src.x, src.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
for (Point p = new Point(src); !p.equals(dst);
p.translate(sign(dst.x - p.x),
sign(dst.y - p.y))) {
robot.mouseMove(p.x, p.y);
robot.delay(50);
}
synchronized (SYNC_LOCK) {
robot.mouseRelease(InputEvent.BUTTON1_MASK);
SYNC_LOCK.wait();
}
if (!dragSourceListener.isDropFinished()) {
throw new RuntimeException("Drop not finished");
}
if (dragSourceListener.getDropSuccess() != success) {
throw new RuntimeException("getDropSuccess() returned wrong value:"
+ dragSourceListener.getDropSuccess());
}
}
public void reset() throws Exception {
EventQueue.invokeAndWait(() -> {
clickedComponent = null;
});
}
public void eventDispatched(AWTEvent e) {
if (e.getID() == MouseEvent.MOUSE_RELEASED) {
clickedComponent = (Component)e.getSource();
synchronized (SYNC_LOCK) {
SYNC_LOCK.notifyAll();
}
}
}
boolean pointInComponent(Robot robot, Point p, Component comp)
throws Exception {
robot.waitForIdle();
reset();
robot.mouseMove(p.x, p.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
synchronized (SYNC_LOCK) {
robot.mouseRelease(InputEvent.BUTTON1_MASK);
SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT);
}
EventQueue.invokeAndWait(() -> {
c = clickedComponent;
while (c != null && c != comp) {
c = c.getParent();
}
});
return c == comp;
}
}

View File

@@ -0,0 +1,382 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.List;
import java.awt.Panel;
import java.awt.Point;
import java.awt.Robot;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.dnd.DragSourceEvent;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetContext;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
import java.net.URL;
/*
@test
@bug 4416788
@summary Tests that URL can be recognized by a java drop target
@requires (os.family == "windows")
@key headful
@run main LinkAcceptanceTest
*/
public class LinkAcceptanceTest {
public static final int CODE_NOT_RETURNED = -1;
public static final int CODE_OK = 0;
public static final int CODE_FAILURE = 1;
public static final int FRAME_ACTIVATION_TIMEOUT = 2000;
public static final int DROP_TIMEOUT = 12000;
public static final int DROP_COMPLETION_TIMEOUT = 4000;
private int returnCode = CODE_NOT_RETURNED;
volatile Frame frame;
volatile Robot robot;
volatile Panel panel;
volatile Point p;
volatile Dimension d;
public static void main(String[] args) throws Exception {
LinkAcceptanceTest test = new LinkAcceptanceTest();
if (args.length > 0) {
test.run(args);
} else {
EventQueue.invokeAndWait(test::init);
try {
test.start();
} finally {
EventQueue.invokeAndWait(() -> {
if (test.frame != null) {
test.frame.dispose();
}
});
}
}
}
public void run(String[] args) {
try {
if (args.length != 4) {
throw new RuntimeException("Incorrect command line arguments.");
}
int x = Integer.parseInt(args[0]);
int y = Integer.parseInt(args[1]);
int w = Integer.parseInt(args[2]);
int h = Integer.parseInt(args[3]);
TransferableURL t = new TransferableURL();
panel = new DragSourcePanel(t);
frame = new Frame();
frame.setTitle("LinkAcceptanceTest DragSource frame");
frame.setLocation(300, 200);
frame.add(panel);
frame.pack();
frame.setVisible(true);
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
Point sourcePoint = panel.getLocationOnScreen();
Dimension d = panel.getSize();
sourcePoint.translate(d.width / 2, d.height / 2);
Point targetPoint = new Point(x + w / 2, y + h / 2);
robot = new Robot();
robot.mouseMove(sourcePoint.x, sourcePoint.y);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.mousePress(InputEvent.BUTTON1_MASK);
for (; !sourcePoint.equals(targetPoint);
sourcePoint.translate(sign(targetPoint.x - sourcePoint.x),
sign(targetPoint.y - sourcePoint.y))) {
robot.mouseMove(sourcePoint.x, sourcePoint.y);
Thread.sleep(10);
}
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.keyRelease(KeyEvent.VK_CONTROL);
synchronized (t) {
t.wait(DROP_TIMEOUT);
}
Thread.sleep(DROP_COMPLETION_TIMEOUT);
} catch (Throwable e) {
e.printStackTrace();
System.exit(LinkAcceptanceTest.CODE_FAILURE);
}
System.exit(LinkAcceptanceTest.CODE_OK);
}
public static int sign(int n) {
return n < 0 ? -1 : n == 0 ? 0 : 1;
}
public void init() {
panel = new DropTargetPanel();
frame = new Frame();
frame.setTitle("DropTarget frame");
frame.setLocation(10, 200);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
public void start() {
try {
Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
EventQueue.invokeAndWait(() -> {
p = panel.getLocationOnScreen();
d = panel.getSize();
});
String javaPath = System.getProperty("java.home", "");
String command = javaPath + File.separator + "bin" +
File.separator + "java -cp " + System.getProperty("test.classes", ".") +
" LinkAcceptanceTest " +
p.x + " " + p.y + " " + d.width + " " + d.height;
Process process = Runtime.getRuntime().exec(command);
returnCode = process.waitFor();
InputStream errorStream = process.getErrorStream();
int count = errorStream.available();
if (count > 0) {
byte[] b = new byte[count];
errorStream.read(b);
System.err.println("========= Child VM System.err ========");
System.err.print(new String(b));
System.err.println("======================================");
}
} catch (Throwable e) {
e.printStackTrace();
}
switch (returnCode) {
case CODE_NOT_RETURNED:
System.err.println("Child VM: failed to start");
break;
case CODE_OK:
System.err.println("Child VM: normal termination");
break;
case CODE_FAILURE:
System.err.println("Child VM: abnormal termination");
break;
}
if (returnCode != CODE_OK) {
throw new RuntimeException("The test failed.");
}
}
}
class TransferableURL implements Transferable {
public static String URL_STRING = "http://java.sun.com";
public static final int NUM_DATA_FLAVORS = 3;
static DataFlavor[] supportedFlavors = new DataFlavor[NUM_DATA_FLAVORS];
static String[] flavorList = { "application/x-java-url;class=java.net.URL",
"text/uri-list;class=java.lang.String",
"text/plain;class=java.lang.String" };
static {
try {
for (int i = 0; i < NUM_DATA_FLAVORS; i++) {
supportedFlavors[i] = new DataFlavor(flavorList[i]);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException("Failed to construct the flavor");
}
}
public DataFlavor[] getTransferDataFlavors() {
return supportedFlavors;
}
public boolean isDataFlavorSupported(DataFlavor flavor) {
for (int i = 0; i < NUM_DATA_FLAVORS; i++) {
if (flavor.equals(supportedFlavors[i])) {
return true;
}
}
return false;
}
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (!isDataFlavorSupported(flavor)) {
throw new UnsupportedFlavorException(flavor);
}
return new String(URL_STRING);
}
}
class DragSourceLabel extends Label implements Serializable,
DragGestureListener,
DragSourceListener {
final Transferable transferable;
public DragSourceLabel(Transferable t) {
super(TransferableURL.URL_STRING);
this.transferable = t;
DragSource ds = DragSource.getDefaultDragSource();
ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_LINK,
this);
}
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, transferable, this);
}
public void dragEnter(DragSourceDragEvent dsde) {}
public void dragExit(DragSourceEvent dse) {}
public void dragOver(DragSourceDragEvent dsde) {}
public void dragDropEnd(DragSourceDropEvent dsde) {}
public void dropActionChanged(DragSourceDragEvent dsde) {}
}
class DragSourcePanel extends Panel {
final Dimension preferredDimension = new Dimension(200, 200);
public DragSourcePanel(Transferable t) {
setLayout(new GridLayout(1, 1));
add(new DragSourceLabel(t));
}
public Dimension getPreferredSize() {
return preferredDimension;
}
}
class DropTargetPanel extends Panel implements DropTargetListener {
final Dimension preferredDimension = new Dimension(200, 200);
public DropTargetPanel() {
setBackground(Color.green);
setDropTarget(new DropTarget(this, this));
setLayout(new GridLayout(1, 1));
}
public Dimension getPreferredSize() {
return preferredDimension;
}
public void dragEnter(DropTargetDragEvent dtde) {
dtde.acceptDrag(DnDConstants.ACTION_LINK);
}
public void dragExit(DropTargetEvent dte) {}
public void dragOver(DropTargetDragEvent dtde) {
dtde.acceptDrag(DnDConstants.ACTION_LINK);
}
public void drop(DropTargetDropEvent dtde) {
DropTargetContext dtc = dtde.getDropTargetContext();
if ((dtde.getSourceActions() & DnDConstants.ACTION_LINK) != 0) {
dtde.acceptDrop(DnDConstants.ACTION_LINK);
} else {
dtde.rejectDrop();
return;
}
removeAll();
final List list = new List();
add(list);
Transferable t = dtde.getTransferable();
DataFlavor[] dfs = t.getTransferDataFlavors();
for (int i = 0; i < dfs.length; i++) {
DataFlavor flavor = dfs[i];
String transferText = null;
URL transferURL = null;
if (flavor.getRepresentationClass().equals(URL.class)) {
try {
transferURL = (URL)t.getTransferData(flavor);
} catch (Exception e) {
throw new RuntimeException("The test failed: unable to recognize " +
flavor.getMimeType());
}
list.add(transferURL + ":" + flavor.getMimeType());
}
if (flavor.getRepresentationClass().equals(String.class)) {
try {
transferText = (String)t.getTransferData(flavor);
} catch (Exception e) {
throw new RuntimeException("The test failed: unable to recognize " +
flavor.getMimeType());
}
list.add(transferText + ":" + flavor.getMimeType());
}
}
dtc.dropComplete(true);
validate();
}
public void dropActionChanged(DropTargetDragEvent dtde) {}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4388802
@summary tests that getting clipboard data doesn't crash when there are no
formats on the clipboard
@key headful
@run main ZeroFormatTransferableTest
*/
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
public class ZeroFormatTransferableTest {
public static void main(String[] args) throws InterruptedException, IOException {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new ZeroFormatTransferable(), null);
String javaPath = System.getProperty("java.home", "");
Process process = new ProcessBuilder(
javaPath + File.separator + "bin" + File.separator + "java",
"-cp",
System.getProperty("test.classes", "."),
"ZeroFormatTransferableTest").start();
process.waitFor();
InputStream errorStream = process.getErrorStream();
int count = errorStream.available();
if (count > 0) {
byte[] b = new byte[count];
errorStream.read(b);
System.err.println("========= Child VM System.err ========");
System.err.print(new String(b));
System.err.println("======================================");
}
}
}
class ZeroFormatTransferable implements Transferable {
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] {};
}
public boolean isDataFlavorSupported(DataFlavor df) {
return false;
}
public Object getTransferData(DataFlavor df)
throws UnsupportedFlavorException {
throw new UnsupportedFlavorException(df);
}
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) 2000, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4267393
@summary Ensures minimal amount of paints
@key headful
@run main ComponentResizedTest
*/
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.ComponentEvent;
import java.lang.reflect.InvocationTargetException;
public class ComponentResizedTest extends Frame {
volatile int paintCount = 0;
public static void main(String[] args) throws InterruptedException,
InvocationTargetException {
ComponentResizedTest componentResizedTest = new ComponentResizedTest();
EventQueue.invokeAndWait(componentResizedTest::init);
componentResizedTest.start();
if (componentResizedTest != null) EventQueue.invokeAndWait(()
-> componentResizedTest.dispose());
}
public void paint(Graphics g) {
System.out.println("Paint called");
++paintCount;
}
public void init() {
setTitle("ComponentResizedTest");
setSize(100, 100);
setLocationRelativeTo(null);
setVisible(true);
}
public void start () throws InterruptedException {
Thread.sleep(1000);
paintCount = 0;
dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED));
Thread.sleep(1000);
if (paintCount > 0) {
throw new RuntimeException("ComponentResizedTest failed. " +
"Paint called.");
}
}
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4420658
@summary No ClassCastException should be thrown when getComponent()
is called on an event with a non-Component source.
The result should be null.
@key headful
@run main ObjectSourceTest
*/
import java.awt.Component;
import java.awt.Frame;
import java.awt.event.ComponentEvent;
public class ObjectSourceTest {
static Frame frame;
public static void main(String[] args) {
frame = new Frame("ObjectSourceTest");
ComponentEvent ce = new ComponentEvent(frame, ComponentEvent.COMPONENT_SHOWN);
Object obj = new Object();
ce.setSource(obj);
Component comp = ce.getComponent();
if (comp != null) {
throw new RuntimeException("ObjectSourceTest failed. comp != null");
}
if (frame != null) {
frame.dispose();
}
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2002, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4523758
@requires (os.family == "windows")
@summary Checks denied setBounds doesn't generate ComponentEvent
@key headful
@run main ResizeDeniedTest
*/
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.lang.reflect.InvocationTargetException;
public class ResizeDeniedTest implements ComponentListener {
static int runs = 0;
static Frame frame;
public static void main(String[] args) throws InterruptedException,
InvocationTargetException {
ResizeDeniedTest resizeDeniedTest = new ResizeDeniedTest();
EventQueue.invokeAndWait(() -> {
frame = new Frame("ResizeDeniedTest");
frame.addComponentListener(resizeDeniedTest);
frame.setSize(1, 1);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
synchronized(resizeDeniedTest) {
resizeDeniedTest.wait(2000);
}
if (frame != null) {
EventQueue.invokeAndWait(() -> frame.dispose());
}
if (runs > 10) {
System.out.println("Infinite loop");
throw new RuntimeException("Infinite loop");
}
}
public void componentHidden(ComponentEvent e) {}
public void componentMoved(ComponentEvent e) {}
public void componentResized(ComponentEvent e) {
frame.setSize(1, 1);
System.out.println("Size " + frame.getSize());
++runs;
if (runs > 10) {
System.out.println("Infinite loop");
synchronized(this) {
this.notify();
}
throw new RuntimeException("Infinite loop");
}
}
public void componentShown(ComponentEvent e) {}
}

View File

@@ -0,0 +1,167 @@
/*
* Copyright (c) 2002, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4715486
@summary Tests that FocusEvent.opposite is not serialized
@key headful
@run main OppositeSerialization
*/
import java.awt.Button;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.FocusEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.InvocationTargetException;
import static java.lang.Integer.valueOf;
/**
* "This is an AUTOMATIC test",
* "however, that's what it does:",
* "1. It tests that FocusEvent.opposite field is written",
* "to serialized stream as null regardless of whether it",
* "is actually null or not. For this purpose, we serialize",
* "a FocusEvent with really huge opposite, and then check",
* "if serialized object is huge or not.",
* "2. It tests that FocusEvent.opposite deserializes as",
* "null, even if it was serialized in the previous version",
* "of JDK. For this purpose, file old.ser is included into",
* "test. It is FocusEvent serialized with 1.4, with non-null",
* "opposite. We check that after deserialization opposite",
* "field is null"
*/
public class OppositeSerialization {
static Button b1;
static Frame b2;
public static void main(String[] args) throws InterruptedException,
InvocationTargetException {
EventQueue.invokeAndWait(() -> {
b1 = new Button("OppositeSerialization - Source");
b2 = new Frame("OppositeSerialization - Opposite");
b2.setLayout(new FlowLayout());
for (int i = 0; i < 10000; i++) {
String s = (valueOf(i)).toString();
b2.add(new Button("Button" + s));
}
});
FocusEvent evt1 = new FocusEvent(b1, FocusEvent.FOCUS_GAINED, false, b2);
/*
* Here we test that opposite component isn't serialized.
* We created a really huge opposite component for a focus
* event evt1 and now we'll see if the size of serialized data
* is big.
*/
try {
FileOutputStream fos = new FileOutputStream("new.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(evt1);
oos.flush();
} catch (Exception e1) {
System.out.println("Sorry! Couldn't write the stream");
System.out.println("The test failed, but the reason is " +
"unrelated to the subject");
throw new RuntimeException("The test couldn't write serialized data");
}
File file = new File("new.ser");
if (file.length() > 50000) {
System.out.println("The test failed: serialized " +
"FocusEvent too huge");
System.err.println("Serialized FocusEvent is too huge.");
System.err.println("Probably opposite field is " +
"serialized incorrectly.");
throw new RuntimeException("Serialized FocusEvent is too huge");
}
/*
* Here we test that opposite is not deserialized even if it is present
* in the stream. old.ser is created with JDK1.4 using the following
* source code:
*
* import java.awt.event.*;
* import java.io.*;
* import java.awt.*;
*
* public class OldFocusSerializer {
*
* public static void main(String[] args) {
*
* Button b1 = new Button("Source");
* Button b2 = new Button("Opposite");
*
* FocusEvent evt1 = new FocusEvent(b1,
* FocusEvent.FOCUS_GAINED,
* false,
* b2);
*
* try {
* FileOutputStream fos = new FileOutputStream("old.ser");
* ObjectOutputStream oos = new ObjectOutputStream(fos);
* oos.writeObject(evt1);
* oos.flush();
* } catch (IOException e) {
* System.out.println("Sorry! Couldn't write the stream");
* }
* }
* }
*/
FocusEvent evt2;
String testPath = System.getProperty("test.src", ".");
try {
FileInputStream fis = new FileInputStream(testPath +
File.separator + "old.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
evt2 = (FocusEvent)ois.readObject();
} catch (Exception e2) {
System.out.println("The test failed as it couldn't read the stream");
throw new RuntimeException("The test couldn't read serialized data");
}
if (evt2.getOppositeComponent() != null) {
System.out.println("The test failed: opposite component " +
"deserialized to non-null value");
System.err.println("FocusEvent stored in old.ser should have " +
"null opposite field.");
throw new RuntimeException("Non-null opposite component " +
"after deserialization");
}
if (b2 != null) {
EventQueue.invokeAndWait(() -> b2.dispose());
}
System.out.println("The test passed");
}
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 4460376
@summary HierarchyEvents on Frame should be dispatched correctly
when on its child Window this event type enabled
@key headful
@run main HierarchyEventOnWindowTest
*/
import java.awt.AWTEvent;
import java.awt.Button;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.HierarchyBoundsAdapter;
import java.lang.reflect.InvocationTargetException;
public class HierarchyEventOnWindowTest {
static Frame frame;
public static void main(String args[]) throws InterruptedException,
InvocationTargetException {
EventQueue.invokeAndWait(() -> {
frame = new Frame("HierarchyEventOnWindowTest");
CustomWindow window = new CustomWindow(frame);
window.enableEvents();
frame.add(new Button(""));
window.disableEvents();
window.addHierarchyListener(e -> {});
window.addHierarchyBoundsListener(new HierarchyBoundsAdapter(){});
frame.add(new Button(""));
});
if (frame != null) {
EventQueue.invokeAndWait(() -> frame.dispose());
}
}
}
class CustomWindow extends Window {
public CustomWindow(Frame frame) {
super(frame);
}
public void enableEvents() {
enableEvents(AWTEvent.HIERARCHY_EVENT_MASK |
AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK);
}
public void disableEvents() {
disableEvents(AWTEvent.HIERARCHY_EVENT_MASK |
AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, 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
@@ -21,30 +21,47 @@
* questions.
*/
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.Timer;
import javax.swing.text.JTextComponent;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import static javax.swing.SwingUtilities.invokeAndWait;
import static javax.swing.SwingUtilities.isEventDispatchThread;
@@ -68,8 +85,13 @@ public class PassFailJFrame {
private static volatile boolean failed;
private static volatile boolean timeout;
private static volatile String testFailedReason;
private static final AtomicInteger imgCounter = new AtomicInteger(0);
private static JFrame frame;
private static Robot robot;
public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER}
public PassFailJFrame(String instructions) throws InterruptedException,
@@ -114,21 +136,69 @@ public class PassFailJFrame {
public PassFailJFrame(String title, String instructions, long testTimeOut,
int rows, int columns) throws InterruptedException,
InvocationTargetException {
this(title, instructions, testTimeOut, rows, columns, false);
}
/**
* Constructs a JFrame with a given title & serves as test instructional
* frame where the user follows the specified test instruction in order
* to test the test case & mark the test pass or fail. If the expected
* result is seen then the user click on the 'Pass' button else click
* on the 'Fail' button and the reason for the failure should be
* specified in the JDialog JTextArea.
* <p>
* The test instruction frame also provides a way for the tester to take
* a screenshot (full screen or individual frame) if this feature
* is enabled by passing {@code true} as {@code enableScreenCapture}
* parameter.
*
* @param title title of the Frame.
* @param instructions the instruction for the tester on how to test
* and what is expected (pass) and what is not
* expected (fail).
* @param testTimeOut test timeout where time is specified in minutes.
* @param rows number of visible rows of the JTextArea where the
* instruction is show.
* @param columns Number of columns of the instructional
* JTextArea
* @param enableScreenCapture if set to true, 'Capture Screen' button & its
* associated UIs are added to test instruction
* frame
* @throws InterruptedException exception thrown when thread is
* interrupted
* @throws InvocationTargetException if an exception is thrown while
* creating the test instruction frame on
* EDT
*/
public PassFailJFrame(String title, String instructions, long testTimeOut,
int rows, int columns,
boolean enableScreenCapture) throws InterruptedException,
InvocationTargetException {
if (isEventDispatchThread()) {
createUI(title, instructions, testTimeOut, rows, columns);
createUI(title, instructions, testTimeOut, rows, columns,
enableScreenCapture);
} else {
invokeAndWait(() -> createUI(title, instructions, testTimeOut,
rows, columns));
rows, columns, enableScreenCapture));
}
}
private PassFailJFrame(Builder builder) throws InterruptedException,
InvocationTargetException {
this(builder.title, builder.instructions, builder.testTimeOut,
builder.rows, builder.columns, builder.screenCapture);
}
private static void createUI(String title, String instructions,
long testTimeOut, int rows, int columns) {
long testTimeOut, int rows, int columns,
boolean enableScreenCapture) {
frame = new JFrame(title);
frame.setLayout(new BorderLayout());
JTextArea instructionsText = new JTextArea(instructions, rows, columns);
instructionsText.setEditable(false);
instructionsText.setLineWrap(true);
JTextComponent text = instructions.startsWith("<html>")
? configureHTML(instructions, rows, columns)
: configurePlainText(instructions, rows, columns);
text.setEditable(false);
long tTimeout = TimeUnit.MINUTES.toMillis(testTimeOut);
@@ -149,7 +219,7 @@ public class PassFailJFrame {
});
timer.start();
frame.add(testTimeoutLabel, BorderLayout.NORTH);
frame.add(new JScrollPane(instructionsText), BorderLayout.CENTER);
frame.add(new JScrollPane(text), BorderLayout.CENTER);
JButton btnPass = new JButton("Pass");
btnPass.addActionListener((e) -> {
@@ -167,6 +237,10 @@ public class PassFailJFrame {
buttonsPanel.add(btnPass);
buttonsPanel.add(btnFail);
if (enableScreenCapture) {
buttonsPanel.add(createCapturePanel());
}
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
@@ -184,6 +258,117 @@ public class PassFailJFrame {
windowList.add(frame);
}
private static JTextComponent configurePlainText(String instructions,
int rows, int columns) {
JTextArea text = new JTextArea(instructions, rows, columns);
text.setLineWrap(true);
text.setWrapStyleWord(true);
return text;
}
private static JTextComponent configureHTML(String instructions,
int rows, int columns) {
JEditorPane text = new JEditorPane("text/html", instructions);
text.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
Boolean.TRUE);
// Set preferred size as if it were JTextArea
text.setPreferredSize(new JTextArea(rows, columns).getPreferredSize());
HTMLEditorKit kit = (HTMLEditorKit) text.getEditorKit();
StyleSheet styles = kit.getStyleSheet();
// Reduce the default margins
styles.addRule("ol, ul { margin-left-ltr: 20; margin-left-rtl: 20 }");
// Make the size of code blocks the same as other text
styles.addRule("code { font-size: inherit }");
return text;
}
private static JComponent createCapturePanel() {
JComboBox<CaptureType> screenShortType = new JComboBox<>(CaptureType.values());
JButton capture = new JButton("ScreenShot");
capture.addActionListener((e) ->
captureScreen((CaptureType) screenShortType.getSelectedItem()));
JPanel panel = new JPanel();
panel.add(screenShortType);
panel.add(capture);
return panel;
}
private enum CaptureType {
FULL_SCREEN("Capture Full Screen"),
WINDOWS("Capture Individual Frame");
private final String type;
CaptureType(String type) {
this.type = type;
}
@Override
public String toString() {
return type;
}
}
private static Robot createRobot() {
if (robot == null) {
try {
robot = new Robot();
} catch (AWTException e) {
String errorMsg = "Failed to create an instance of Robot.";
JOptionPane.showMessageDialog(frame, errorMsg, "Failed",
JOptionPane.ERROR_MESSAGE);
forceFail(errorMsg + e.getMessage());
}
}
return robot;
}
private static void captureScreen(Rectangle bounds) {
Robot robot = createRobot();
List<Image> imageList = robot.createMultiResolutionScreenCapture(bounds)
.getResolutionVariants();
Image image = imageList.get(imageList.size() - 1);
File file = new File("CaptureScreen_"
+ imgCounter.incrementAndGet() + ".png");
try {
ImageIO.write((RenderedImage) image, "png", file);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static void captureScreen(CaptureType type) {
switch (type) {
case FULL_SCREEN:
Arrays.stream(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getScreenDevices())
.map(GraphicsDevice::getDefaultConfiguration)
.map(GraphicsConfiguration::getBounds)
.forEach(PassFailJFrame::captureScreen);
break;
case WINDOWS:
windowList.stream()
.filter(Window::isShowing)
.map(Window::getBounds)
.forEach(PassFailJFrame::captureScreen);
break;
default:
throw new IllegalStateException("Unexpected value of capture type");
}
JOptionPane.showMessageDialog(frame,
"Screen Captured Successfully",
"Screen Capture",
JOptionPane.INFORMATION_MESSAGE);
}
private static String convertMillisToTimeStr(long millis) {
if (millis < 0) {
return "00:00:00";
@@ -421,4 +606,72 @@ public class PassFailJFrame {
testFailedReason = FAILURE_REASON + reason;
latch.countDown();
}
public static class Builder {
private String title;
private String instructions;
private long testTimeOut;
private int rows;
private int columns;
private boolean screenCapture = false;
public Builder title(String title) {
this.title = title;
return this;
}
public Builder instructions(String instructions) {
this.instructions = instructions;
return this;
}
public Builder testTimeOut(long testTimeOut) {
this.testTimeOut = testTimeOut;
return this;
}
public Builder rows(int rows) {
this.rows = rows;
return this;
}
public Builder columns(int columns) {
this.columns = columns;
return this;
}
public Builder screenCapture() {
this.screenCapture = true;
return this;
}
public PassFailJFrame build() throws InterruptedException,
InvocationTargetException {
validate();
return new PassFailJFrame(this);
}
private void validate() {
if (this.title == null) {
this.title = TITLE;
}
if (this.instructions == null || this.instructions.length() == 0) {
throw new RuntimeException("Please provide the test " +
"instruction for this manual test");
}
if (this.testTimeOut == 0L) {
this.testTimeOut = TEST_TIMEOUT;
}
if (this.rows == 0) {
this.rows = ROWS;
}
if (this.columns == 0) {
this.columns = COLUMNS;
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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
@@ -24,7 +24,11 @@
/*
* @test
* @bug 8013827 8011950 8017212 8025128
* @library /test/lib
* @modules java.base/jdk.internal.util
* @summary Check whether File.createTempFile can handle special parameters
* @build jdk.test.lib.OSVersion jdk.test.lib.Platform
@run main SpecialTempFile
* @author Dan Xu
*/
@@ -32,10 +36,11 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import jdk.test.lib.Platform;
import jdk.test.lib.OSVersion;
public class SpecialTempFile {
private static void test(String name, String[] prefix, String[] suffix,
boolean exceptionExpected) throws IOException
{
@@ -48,7 +53,7 @@ public class SpecialTempFile {
final String exceptionMsg = "Unable to create temporary file";
String[] dirs = { null, "." };
Path testPath = Paths.get(System.getProperty("test.dir", "."));
Path testPath = Path.of(System.getProperty("test.dir", "."));
for (int i = 0; i < prefix.length; i++) {
boolean exceptionThrown = false;
File f = null;
@@ -99,12 +104,15 @@ public class SpecialTempFile {
test("SlashedName", slashPre, slashSuf, true);
// Windows tests
if (!System.getProperty("os.name").startsWith("Windows"))
if (!Platform.isWindows())
return;
// Test JDK-8013827
String[] resvPre = { "LPT1.package.zip", "com7.4.package.zip" };
String[] resvSuf = { ".temp", ".temp" };
test("ReservedName", resvPre, resvSuf, true);
boolean exceptionExpected =
!(System.getProperty("os.name").endsWith("11") ||
new OSVersion(10, 0).compareTo(OSVersion.current()) > 0);
test("ReservedName", resvPre, resvSuf, exceptionExpected);
}
}

View File

@@ -0,0 +1,431 @@
/*
* Copyright (c) 2023, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8054022
* @summary Verify that expect 100-continue doesn't hang
* @library /test/lib
* @run junit/othervm HttpURLConnectionExpectContinueTest
* @run junit/othervm -Djava.net.preferIPv4Stack=true HttpURLConnectionExpectContinueTest
* @run junit/othervm -Djava.net.preferIPv6Addresses=true HttpURLConnectionExpectContinueTest
*/
import jdk.test.lib.net.URIBuilder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.Assert.assertTrue;
public class HttpURLConnectionExpectContinueTest {
private static class Control {
volatile ServerSocket serverSocket = null;
volatile boolean stop = false;
volatile boolean respondWith100Continue = false;
volatile boolean write100ContinueTwice = false;
volatile String response = null;
}
private static Thread serverThread = null;
private static volatile Control control;
static final Logger logger;
static {
control = new Control();
logger = Logger.getLogger("sun.net.www.protocol.http.HttpURLConnection");
logger.setLevel(Level.ALL);
Logger.getLogger("").getHandlers()[0].setLevel(Level.ALL);
}
@BeforeClass
public static void startServerSocket() throws Exception {
control.serverSocket = new ServerSocket();
control.serverSocket.setReuseAddress(true);
control.serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
Runnable runnable = () -> {
while (!control.stop) {
try {
Socket socket = control.serverSocket.accept();
InputStream inputStream = socket.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
StringBuilder stringBuilder = new StringBuilder();
// Read initial request
byte b;
while (true) {
b = (byte) inputStreamReader.read();
stringBuilder.append((char) b);
if (stringBuilder.length() >= 4) {
char[] lastBytes = new char[4];
stringBuilder.getChars(
stringBuilder.length() - 4,
stringBuilder.length(), lastBytes, 0);
if (Arrays.equals(lastBytes, new char[]{'\r', '\n', '\r', '\n'})) {
break;
}
}
}
OutputStream outputStream = socket.getOutputStream();
String header = stringBuilder.toString();
String contentLengthString = "Content-Length:";
// send 100 continue responses if set by test
if (control.respondWith100Continue) {
outputStream.write("HTTP/1.1 100 Continue\r\n\r\n".getBytes());
outputStream.flush();
if (control.write100ContinueTwice) {
outputStream.write("HTTP/1.1 100 Continue\r\n\r\n".getBytes());
outputStream.flush();
}
}
// expect main request to be received
int idx = header.indexOf(contentLengthString);
if (idx >= 0) {
String substr = header.substring(idx + contentLengthString.length());
idx = substr.indexOf('\r');
substr = substr.substring(0, idx);
int contentLength = Integer.parseInt(substr.trim());
StringBuilder contentLengthBuilder = new StringBuilder();
for (int i = 0; i < contentLength; i++) {
b = (byte) inputStreamReader.read();
contentLengthBuilder.append((char) b);
}
} else {
StringBuilder contentLengthBuilder = new StringBuilder();
while (true) {
b = (byte) inputStreamReader.read();
contentLengthBuilder.append((char) b);
if (contentLengthBuilder.length() >= 2) {
char[] lastBytes = new char[2];
contentLengthBuilder.getChars(
contentLengthBuilder.length() - 2,
contentLengthBuilder.length(), lastBytes, 0);
if (Arrays.equals(lastBytes, new char[]{'\r', '\n'})) {
String lengthInHex =
contentLengthBuilder.substring(0, contentLengthBuilder.length() - 2);
int contentLength = Integer.parseInt(lengthInHex, 16);
char[] body = new char[contentLength];
inputStreamReader.read(body);
break;
// normally we have to parse more data,
// but for simplicity we expect no more chunks...
}
}
}
}
// send response
outputStream.write(control.response.getBytes());
outputStream.flush();
} catch (SocketException e) {
// ignore
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
serverThread = new Thread(runnable);
serverThread.start();
}
@AfterClass
public static void stopServerSocket() throws Exception {
control.stop = true;
control.serverSocket.close();
serverThread.join();
}
@Test
public void testNonChunkedRequestAndNoExpect100ContinueResponse() throws Exception {
String body = "testNonChunkedRequestAndNoExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = false;
control.write100ContinueTwice = false;
HttpURLConnection connection = createConnection();
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testNonChunkedRequestWithExpect100ContinueResponse() throws Exception {
String body = "testNonChunkedRequestWithExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = true;
control.write100ContinueTwice = false;
HttpURLConnection connection = createConnection();
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testNonChunkedRequestWithDoubleExpect100ContinueResponse() throws Exception {
String body = "testNonChunkedRequestWithDoubleExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = true;
control.write100ContinueTwice = true;
HttpURLConnection connection = createConnection();
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testChunkedRequestAndNoExpect100ContinueResponse() throws Exception {
String body = "testChunkedRequestAndNoExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = false;
control.write100ContinueTwice = false;
HttpURLConnection connection = createConnection();
connection.setChunkedStreamingMode(body.length() / 2);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testChunkedRequestWithExpect100ContinueResponse() throws Exception {
String body = "testChunkedRequestWithExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = true;
control.write100ContinueTwice = false;
HttpURLConnection connection = createConnection();
connection.setChunkedStreamingMode(body.length() / 2);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testChunkedRequestWithDoubleExpect100ContinueResponse() throws Exception {
String body = "testChunkedRequestWithDoubleExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = true;
control.write100ContinueTwice = true;
HttpURLConnection connection = createConnection();
connection.setChunkedStreamingMode(body.length() / 2);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testFixedLengthRequestAndNoExpect100ContinueResponse() throws Exception {
String body = "testFixedLengthRequestAndNoExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = false;
control.write100ContinueTwice = false;
HttpURLConnection connection = createConnection();
connection.setFixedLengthStreamingMode(body.length());
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testFixedLengthRequestWithExpect100ContinueResponse() throws Exception {
String body = "testFixedLengthRequestWithExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = true;
control.write100ContinueTwice = false;
HttpURLConnection connection = createConnection();
connection.setFixedLengthStreamingMode(body.getBytes().length);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
@Test
public void testFixedLengthRequestWithDoubleExpect100ContinueResponse() throws Exception {
String body = "testFixedLengthRequestWithDoubleExpect100ContinueResponse";
control.response = "HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length() + "\r\n" +
"\r\n" +
body + "\r\n";
control.respondWith100Continue = true;
control.write100ContinueTwice = true;
HttpURLConnection connection = createConnection();
connection.setFixedLengthStreamingMode(body.getBytes().length);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(body.getBytes());
outputStream.close();
int responseCode = connection.getResponseCode();
String responseBody = new String(connection.getInputStream().readAllBytes(), StandardCharsets.UTF_8).strip();
System.err.println("response body: " + responseBody);
assertTrue(String.format("Expected 200 response, instead received %s", responseCode),
responseCode == 200);
assertTrue(String.format("Expected response %s, instead received %s", body, responseBody),
body.equals(responseBody));
}
// Creates a connection with all the common settings used in each test
private HttpURLConnection createConnection() throws Exception {
URL url = URIBuilder.newBuilder()
.scheme("http")
.loopback()
.port(control.serverSocket.getLocalPort())
.toURL();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setReadTimeout(5000);
connection.setUseCaches(false);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Connection", "Close");
connection.setRequestProperty("Expect", "100-Continue");
return connection;
}
}

View File

@@ -24,7 +24,7 @@
* @test
* @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
* 8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269
* 8208746 8209775 8264792 8274658 8283277 8296239
* 8208746 8209775 8264792 8274658 8283277 8296239 8321480
* @summary Validate ISO 4217 data for Currency class.
* @modules java.base/java.util:open
* jdk.localedata
@@ -100,7 +100,7 @@ public class ValidateISO4217 {
/* Codes that are obsolete, do not have related country, extra currency */
static final String otherCodes =
"ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-"
+ "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
+ "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-HRK-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
+ "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-"
+ "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-"
+ "YUM-ZMK-ZWD-ZWN-ZWR";

View File

@@ -1,12 +1,12 @@
#
#
# Amendments up until ISO 4217 AMENDMENT NUMBER 175
# (As of 31 March 2023)
# Amendments up until ISO 4217 AMENDMENT NUMBER 176
# (As of 06 December 2023)
#
# Version
FILEVERSION=3
DATAVERSION=175
DATAVERSION=176
# ISO 4217 currency data
AF AFN 971 2
@@ -67,9 +67,9 @@ CD CDF 976 2
CK NZD 554 2
CR CRC 188 2
CI XOF 952 0
HR HRK 191 2 2022-12-31-23-00-00 EUR 978 2
HR EUR 978 2
CU CUP 192 2
CW ANG 532 2
CW ANG 532 2 2025-04-01-04-00-00 XCG 532 2
CY EUR 978 2
CZ CZK 203 2
DK DKK 208 2
@@ -233,7 +233,7 @@ LK LKR 144 2
SD SDG 938 2
SR SRD 968 2
SJ NOK 578 2
SX ANG 532 2
SX ANG 532 2 2025-04-01-04-00-00 XCG 532 2
SZ SZL 748 2
SE SEK 752 2
CH CHF 756 2

View File

@@ -0,0 +1,143 @@
/*
* Copyright (c) 1999, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4143867 4237390 4383709
@summary Tests set/getAction(.) and some constructors with Action argument
@key headful
@run main bug4143867
*/
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultButtonModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JToggleButton;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.SwingUtilities;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeListener;
public class bug4143867 {
static final int TEST_MNEMONIC = KeyEvent.VK_1;
static JFrame fr;
public static void main(String[] argv) throws Exception {
bug4143867 b = new bug4143867();
SwingUtilities.invokeAndWait(() -> {
try {
b.doInitAndTest();
} finally {
if (fr != null) {
fr.dispose();
}
}
});
}
public void doInitAndTest() {
fr = new JFrame("bug4143867");
JMenuBar mb = new JMenuBar();
JMenu m = mb.add(new JMenu("Menu1"));
fr.setJMenuBar(mb);
JMenuItem it1 = m.add(new JMenuItem("Item1"));
fr.getContentPane().setLayout(new FlowLayout());
JButton bt1 = new JButton("Button1");
fr.getContentPane().add(bt1);
final AbstractAction al = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
System.out.println("Pressed...");
}
};
al.putValue(Action.NAME, "Action");
al.putValue(Action.MNEMONIC_KEY, new Integer(TEST_MNEMONIC));
m.add(al);
m.getItem(0).setAction(al);
bt1.setAction(al);
JButton bt2 = new JButton(al);
fr.getContentPane().add(bt2);
if (it1.getAction() != al || m.getItem(1).getAction() != al ||
bt1.getAction() != al || bt2.getAction() != al) {
throw new RuntimeException("Action was not set correctly.");
}
if (bt1.getMnemonic() != TEST_MNEMONIC) {
throw new RuntimeException("Failed 4383709: JButton doesn't get mnemonic from Action");
}
class TestProtectedOfAbstractButton extends AbstractButton {
public void test() {
PropertyChangeListener pcl = createActionPropertyChangeListener(null);
setModel(new DefaultButtonModel());
configurePropertiesFromAction(al);
}
}
TestProtectedOfAbstractButton tpAB = new TestProtectedOfAbstractButton();
tpAB.test();
// Constructors presence test
JRadioButton ct1 = new JRadioButton(al);
JCheckBox ct2 = new JCheckBox(al);
JRadioButton ct3 = new JRadioButton(al);
JToggleButton ct4 = new JToggleButton(al);
JMenuItem ct5 = new JMenuItem(al);
JMenu ct6 = new JMenu(al);
JCheckBoxMenuItem ct7 = new JCheckBoxMenuItem(al);
JRadioButtonMenuItem ct8 = new JRadioButtonMenuItem(al);
if (ct1.getAction() != al) {
throw new RuntimeException("Constructor error in JRadioButton...");
}
if (ct2.getAction() != al) {
throw new RuntimeException("Constructor error in JCheckBox...");
}
if (ct3.getAction() != al) {
throw new RuntimeException("Constructor error in JRadioButton...");
}
if (ct4.getAction() != al) {
throw new RuntimeException("Constructor error in JToggleButton...");
}
if (ct5.getAction() != al) {
throw new RuntimeException("Constructor error in JMenuItem...");
}
if (ct6.getAction() != al) {
throw new RuntimeException("Constructor error in JMenu...");
}
if (ct7.getAction() != al) {
throw new RuntimeException("Constructor error in JCheckBoxMenuItem...");
}
if (ct8.getAction() != al) {
throw new RuntimeException("Constructor error in JRadioButtonMenuItem...");
}
}
}

View File

@@ -0,0 +1,109 @@
/*
* Copyright (c) 2002, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4147740
@summary Tests that AbstractButton does not update images it doesn't use
@key headful
@run main bug4147740
*/
import java.awt.Image;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.ImageIcon;
import java.awt.Robot;
import javax.swing.SwingUtilities;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
public class bug4147740 {
static JButton b;
static JFrame frame;
static volatile boolean imageUpdated = false;
static volatile boolean shouldUpdate = true;
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
try {
SwingUtilities.invokeAndWait(() -> {
frame = new JFrame("bug4147740");
b = new AnimatedButton();
frame.getContentPane().add(b);
b.addHierarchyListener(new Listener());
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
robot.waitForIdle();
robot.delay(1000);
} finally {
SwingUtilities.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
static class Listener implements HierarchyListener {
public void hierarchyChanged(HierarchyEvent ev) {
if ((ev.getChangeFlags() | HierarchyEvent.SHOWING_CHANGED) != 0 &&
frame.isShowing()) {
frame.repaint();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
synchronized(b) {
b.setEnabled(false);
shouldUpdate = false;
}
}
});
}
}
}
static class AnimatedButton extends JButton {
boolean shouldNotUpdate = false;
AnimatedButton() {
super();
setIcon(new ImageIcon("animated.gif"));
setDisabledIcon(new ImageIcon("static.gif"));
}
public boolean imageUpdate(Image img, int infoflags,
int x, int y, int w, int h) {
boolean updated;
synchronized(b) {
updated = super.imageUpdate(img, infoflags, x, y, w, h);
if (!shouldUpdate && updated) {
throw new RuntimeException("Failed: unused image is being updated");
}
}
return updated;
}
}
}

View File

@@ -0,0 +1,120 @@
/*
* Copyright (c) 1999, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4246045
@summary AbstractButton fires accessible PropertyChangeEvent incorrectly
@key headful
@run main bug4246045
*/
import java.awt.Container;
import java.awt.Robot;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleState;
public class bug4246045 {
class Listener implements PropertyChangeListener {
boolean state = false; // focused or not
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().equals(
AccessibleContext.ACCESSIBLE_STATE_PROPERTY)) {
boolean reported = false;
if (e.getNewValue() == null) {
reported = false;
} else if (e.getNewValue().equals(AccessibleState.FOCUSED)) {
reported = true;
} else {
throw new RuntimeException("Unknown value of ACCESSIBLE_STATE_PROPERTY");
}
if (!state == reported) {
state = reported;
} else {
throw new RuntimeException("Bad value of ACCESSIBLE_STATE_PROPERTY");
}
}
}
}
static JFrame frame;
static JButton btn;
static JToggleButton tb;
static JTextField dummy;
public void init() {
btn = new JButton("JButton");
tb = new JToggleButton("JToggleButton");
dummy = new JTextField();
Container pane = frame.getContentPane();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
pane.add(btn);
pane.add(tb);
pane.add(dummy);
Listener bl = new Listener();
btn.getAccessibleContext().addPropertyChangeListener(bl);
Listener tbl = new Listener();
tb.getAccessibleContext().addPropertyChangeListener(tbl);
}
public void start() {
btn.requestFocus();
btn.transferFocus();
tb.transferFocus();
}
public static void main(String[] argv) throws Exception {
Robot robot = new Robot();
bug4246045 bug = new bug4246045();
try {
SwingUtilities.invokeAndWait(() -> {
frame = new JFrame("4246045 Test");
bug.init();
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
bug.start();
});
robot.waitForIdle();
robot.delay(1000);
} finally {
SwingUtilities.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) 2001, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
@bug 4419219
@summary Tests that registerKeyboardAction(null, ...) doen't throw NPE.
@key headful
@run main bug4419219
*/
import java.awt.Robot;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.InputEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.KeyStroke;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
public class bug4419219 {
static volatile boolean passed = true;
static JFrame frame;
static Robot robo;
public static void main(String[] args) throws Exception {
robo = new Robot();
robo.setAutoWaitForIdle(true);
robo.setAutoDelay(100);
SwingUtilities.invokeAndWait(() -> {
try {
frame = new JFrame("bug4419219 Table");
final String[] names = {"col"};
final Object[][] data = {{"A"}, {"B"}, {"C"}, {"D"}, {"E"}};
JTable tableView = (JTable)new TestTable(data, names);
// unregister ctrl-A
tableView.registerKeyboardAction(null,
KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK),
JComponent.WHEN_FOCUSED);
frame.getContentPane().add(tableView);
frame.setSize(250,250);
frame.setLocationRelativeTo(null);
frame.addWindowListener(new TestStateListener());
frame.setVisible(true);
} finally {
if (frame != null) {
frame.dispose();
}
}
});
if (!passed) {
throw new RuntimeException("Test failed.");
}
}
static class TestStateListener extends WindowAdapter {
public void windowOpened(WindowEvent ev) {
robo.delay(1000);
robo.mouseMove(100,100);
robo.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robo.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robo.keyPress(KeyEvent.VK_CONTROL);
robo.keyPress(KeyEvent.VK_A);
robo.keyRelease(KeyEvent.VK_A);
robo.keyRelease(KeyEvent.VK_CONTROL);
}
}
static class TestTable extends JTable {
public TestTable(Object[][] data, String[] names) {
super(data, names);
}
protected boolean processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed) {
try {
return super.processKeyBinding(ks, e, condition, pressed);
} catch (NullPointerException ex) {
passed = false;
}
return false;
}
}
}

View File

@@ -0,0 +1,92 @@
/*
* Copyright (c) 2004, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4962718
* @summary Propertychange Listener not fired by inheritPopupMenu and Popupmenu properties
* @key headful
* @run main bug4962718
*/
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
public class bug4962718 {
static volatile boolean popupWasSet = false;
static volatile boolean inheritWasSet = false;
static JFrame frame;
public static void main(String[] args) throws Exception {
try {
SwingUtilities.invokeAndWait(() -> {
frame = new JFrame("bug4962718");
JButton button = new JButton("For test");
JPopupMenu popup = new JPopupMenu();
button.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("inheritsPopupMenu")) {
inheritWasSet = true;
} else if( evt.getPropertyName().
equals("componentPopupMenu")) {
popupWasSet = true;
}
}
});
frame.add(button);
button.setInheritsPopupMenu(true);
button.setInheritsPopupMenu(false);
button.setComponentPopupMenu(popup);
button.setComponentPopupMenu(null);
frame.pack();
frame.setVisible(true);
});
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
if (!inheritWasSet) {
throw new RuntimeException("Test failed, inheritsPopupMenu " +
" property change listener was not called");
}
if (!popupWasSet) {
throw new RuntimeException("Test failed, componentPopupMenu " +
" property change listener was not called");
}
} finally {
SwingUtilities.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
}
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 1999, 2023, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4178276
* @key headful
* @summary RTFEditorkit.write(...) doesn't throw NPE when used in SecurityManager
* @run main/othervm bug4178276
*/
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import javax.swing.text.Document;
import javax.swing.text.rtf.RTFEditorKit;
public class bug4178276 {
public static void main(String[] argv) throws Exception {
System.setSecurityManager(new SecurityManager());
String test="{\\rtf1\\ansi\\deff0\\deftab720{\\fonttbl{\\f0\\f swiss MS Sans Serif;}}{\\colortbl\\red0\\green0\\blue0;}\\qc\\plain\\f0 Test 1 \\par \\ql\\plain\\f0 Test 2 \\par \\qr\\plain\\f0 Test 3 \\par \\qj\\plain\\f0 Test 4}";
RTFEditorKit c = new RTFEditorKit();
Document doc = c.createDefaultDocument();
try {
c.read(new ByteArrayInputStream(test.getBytes(
StandardCharsets.ISO_8859_1)), doc, 0);
ByteArrayOutputStream sw = new ByteArrayOutputStream();
c.write(sw, doc, 0, 0);
} catch (Exception e) {
throw new RuntimeException("Unexpected NPE exception...", e);
}
}
}

View File

@@ -72,12 +72,12 @@ public class MetricsMemoryTester {
} else {
long count = Metrics.systemMetrics().getMemoryFailCount();
// Allocate 512M of data
byte[][] bytes = new byte[64][];
// Allocate 512M of data in 1M chunks per iteration
byte[][] bytes = new byte[64 * 8][];
boolean atLeastOneAllocationWorked = false;
for (int i = 0; i < 64; i++) {
for (int i = 0; i < 64 * 8; i++) {
try {
bytes[i] = new byte[8 * 1024 * 1024];
bytes[i] = new byte[1024 * 1024];
atLeastOneAllocationWorked = true;
// Break out as soon as we see an increase in failcount
// to avoid getting killed by the OOM killer.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, 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
@@ -451,6 +451,24 @@
* @run main/othervm -Djava.security.debug=certpath CAInterop emsigneccrootcag3 CRL
*/
/*
* @test id=certainlyrootr1
* @bug 8321408
* @summary Interoperability tests with Certainly Root R1
* @library /test/lib
* @build jtreg.SkippedException ValidatePathWithURL CAInterop
* @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop certainlyrootr1 DEFAULT
*/
/*
* @test id=certainlyroote1
* @bug 8321408
* @summary Interoperability tests with Certainly Root E1
* @library /test/lib
* @build jtreg.SkippedException ValidatePathWithURL CAInterop
* @run main/othervm -Djava.security.debug=certpath,ocsp CAInterop certainlyroote1 DEFAULT
*/
/**
* Collection of certificate validation tests for interoperability with external CAs
*/
@@ -613,6 +631,13 @@ public class CAInterop {
return new CATestURLs("https://testovg3.emsign.com/RootOVG3.html",
"https://testovg3r.emsign.com/RootOVG3MR.html");
case "certainlyrootr1":
return new CATestURLs("https://valid.root-r1.certainly.com",
"https://revoked.root-r1.certainly.com");
case "certainlyroote1":
return new CATestURLs("https://valid.root-e1.certainly.com",
"https://revoked.root-e1.certainly.com");
default: throw new RuntimeException("No test setup found for: " + alias);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@@ -29,6 +29,7 @@
* 8223499 8225392 8232019 8234245 8233223 8225068 8225069 8243321 8243320
* 8243559 8225072 8258630 8259312 8256421 8225081 8225082 8225083 8245654
* 8305975 8304760 8307134 8295894 8314960 8317373 8317374 8318759 8319187
* 8321408
* @summary Check root CA entries in cacerts file
*/
import java.io.ByteArrayInputStream;
@@ -47,12 +48,13 @@ public class VerifyCACerts {
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
private static final int COUNT = 106;
private static final int COUNT = 108;
// SHA-256 of cacerts, can be generated with
// shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
private static final String CHECKSUM
= "61:5F:6D:C5:9C:A3:8A:65:3F:CB:F9:F5:26:04:23:F4:53:A6:8C:B3:8B:2B:0A:F0:66:7D:9E:67:B9:4D:AC:B7";
= "81:D4:84:F6:92:78:A4:82:25:06:DC:42:25:C9:5D:6C:63:E4:99:CE:BC:ED:66:B3:8C:BA:E6:BA:6B:34:0F:01";
// map of cert alias to SHA-256 fingerprint
@SuppressWarnings("serial")
private static final Map<String, String> FINGERPRINT_MAP = new HashMap<>() {
@@ -269,6 +271,10 @@ public class VerifyCACerts {
"86:A1:EC:BA:08:9C:4A:8D:3B:BE:27:34:C6:12:BA:34:1D:81:3E:04:3C:F9:E8:A8:62:CD:5C:57:A3:6B:BE:6B");
put("emsignrootcag2 [jdk]",
"1A:A0:C2:70:9E:83:1B:D6:E3:B5:12:9A:00:BA:41:F7:EE:EF:02:08:72:F1:E6:50:4B:F0:F6:C3:F2:4F:3A:F3");
put("certainlyrootr1 [jdk]",
"77:B8:2C:D8:64:4C:43:05:F7:AC:C5:CB:15:6B:45:67:50:04:03:3D:51:C6:0C:62:02:A8:E0:C3:34:67:D3:A0");
put("certainlyroote1 [jdk]",
"B4:58:5F:22:E4:AC:75:6A:4E:86:12:A1:36:1C:5D:9D:03:1A:93:FD:84:FE:BB:77:8F:A3:06:8B:0F:C4:2D:C2");
}
};

View File

@@ -20,6 +20,14 @@
# questions.
#
# All tests
all = \
:langtools_all
langtools_all = \
/
# Tiered testing definitions
# (Nearly) all langtools tests are tier 1.

View File

@@ -29,7 +29,7 @@
* @compile package-info.java
* @run main/othervm T6257443 -yes foo/package-info.class
*
* @clean foo.package-info
* @clean foo.*
*
* @compile -printsource package-info.java
* @run main/othervm T6257443 -no foo/package-info.class

View File

@@ -26,7 +26,7 @@
* @bug 8015927
* @summary Class reference duplicates in constant pool
* @modules jdk.jdeps/com.sun.tools.classfile
* @clean ClassRefDupInConstantPoolTest$Duplicates.class
* @clean ClassRefDupInConstantPoolTest$Duplicates
* @run main ClassRefDupInConstantPoolTest
*/

View File

@@ -25,6 +25,6 @@
* @test
* @bug 8021112
* @summary Verify that deprecated warnings are printed correctly for package-info.java
* @clean pack.package-info pack.DeprecatedClass
* @clean pack.*
* @compile/ref=PackageInfo.out -source 8 -XDrawDiagnostics -Xlint:deprecation,-options pack/package-info.java pack/DeprecatedClass.java
*/