Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSTL Test Fix(tckrefactor branch) for issues/255 in JDK21 due to space character before AM/PM #1329

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -14,9 +14,6 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

/*
* $URL$ $LastChangedDate$
*/

package com.sun.ts.tests.jstl.common.client;

Expand Down Expand Up @@ -231,4 +228,20 @@ private void setStandardCompatProperties(String testValue,
testCase.setRequest(req);

}

public boolean isJavaVersion20OrGreater() {
boolean isJavaVersion20OrGreater = false;

String version = System.getProperty("java.version");
int majorVersionDot = version.indexOf(".");

version = version.substring(0, majorVersionDot);

if (Integer.parseInt(version) >= 20) {
isJavaVersion20OrGreater = true;
}

return isJavaVersion20OrGreater;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -58,6 +58,7 @@ public static WebArchive createDeployment() throws IOException {
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFDValueTest.jsp")), "positiveFDValueTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFNScopeTest.jsp")), "positiveFNScopeTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextI18NTest.jsp")), "positiveFormatLocalizationContextI18NTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextI18NTestJava20Plus.jsp")), "positiveFormatLocalizationContextI18NTestJava20Plus.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveForTokensTest.jsp")), "positiveForTokensTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveIfScopeTest.jsp")), "positiveIfScopeTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveImportAbsUrlTest.jsp")), "positiveImportAbsUrlTest.jsp");
Expand Down Expand Up @@ -246,14 +247,19 @@ public void positiveFNScopeTest() throws Exception {
*/
@Test
public void positiveFormatLocalizationContextI18NTest() throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextI18NTest.gf");
setGoldenFileStream(gfStream);
InputStream gfStream;
TEST_PROPS.setProperty(TEST_NAME,
"positiveFormatLocalizationContextI18NTest");
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextI18NTest.jsp");
// TEST_PROPS.setProperty(GOLDENFILE,
// "positiveFormatLocalizationContextI18NTest.gf");
if (isJavaVersion20OrGreater()) {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextI18NTestJava20Plus.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextI18NTestJava20Plus.gf");
} else {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextI18NTest.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextI18NTest.gf");
}
setGoldenFileStream(gfStream);
TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: en-US");
invoke();
}
Expand Down Expand Up @@ -760,9 +766,14 @@ public void positiveSetSelectVarTest() throws Exception {
*/
@Test
public void positiveSetTimezoneValueTest() throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveSetTimezoneValueTest.gf");
setGoldenFileStream(gfStream);
InputStream gfStream;
TEST_PROPS.setProperty(STANDARD_COMPAT, "positiveSetTimezoneValueTest");
if (isJavaVersion20OrGreater()) {
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveSetTimezoneValueTestJava20Plus.gf");
} else {
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveSetTimezoneValueTest.gf");
}
setGoldenFileStream(gfStream);
TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: en");
invoke();
}
Expand All @@ -779,9 +790,15 @@ public void positiveSetTimezoneValueTest() throws Exception {
*/
@Test
public void positiveTimezoneValueTest() throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveTimezoneValueTest.gf");
setGoldenFileStream(gfStream);
InputStream gfStream;
TEST_PROPS.setProperty(STANDARD_COMPAT, "positiveTimezoneValueTest");
if (isJavaVersion20OrGreater()) {
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveTimezoneValueTestJava20Plus.gf");
} else {
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveTimezoneValueTest.gf");
}
setGoldenFileStream(gfStream);

TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: en");
invoke();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -48,10 +48,13 @@ public static WebArchive createDeployment() throws IOException {
archive.setWebXML(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/jstl_fmt_locctx_web.xml"));

archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextBrowserLocaleTest.jsp")), "positiveFormatLocalizationContextBrowserLocaleTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextBrowserLocaleTestJava20Plus.jsp")), "positiveFormatLocalizationContextBrowserLocaleTestJava20Plus.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextBundleTest.jsp")), "positiveFormatLocalizationContextBundleTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextBundleTestJava20Plus.jsp")), "positiveFormatLocalizationContextBundleTestJava20Plus.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextI18NTest.jsp")), "positiveFormatLocalizationContextI18NTest.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextI18NTestJava20Plus.jsp")), "positiveFormatLocalizationContextI18NTestJava20Plus.jsp");
archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextLocaleTest.jsp")), "positiveFormatLocalizationContextLocaleTest.jsp");

archive.add(new UrlAsset(JSTLClientIT.class.getClassLoader().getResource(packagePath+"/positiveFormatLocalizationContextLocaleTestJava20Plus.jsp")), "positiveFormatLocalizationContextLocaleTestJava20Plus.jsp");
archive.addAsLibrary(getCommonJarArchive());

return archive;
Expand All @@ -73,14 +76,19 @@ public static WebArchive createDeployment() throws IOException {
*/
@Test
public void positiveFormatLocalizationContextBundleTest() throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextBundleTest.gf");
setGoldenFileStream(gfStream);
InputStream gfStream;
TEST_PROPS.setProperty(TEST_NAME,
"positiveFormatLocalizationContextBundleTest");
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextBundleTest.jsp");
// TEST_PROPS.setProperty(GOLDENFILE,
// "positiveFormatLocalizationContextBundleTest.gf");
if (isJavaVersion20OrGreater()) {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextBundleTestJava20Plus.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextBundleTestJava20Plus.gf");
} else {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextBundleTest.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextBundleTest.gf");
}
setGoldenFileStream(gfStream);
TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: en-US");
invoke();
}
Expand All @@ -101,12 +109,20 @@ public void positiveFormatLocalizationContextBundleTest() throws Exception {
*/
@Test
public void positiveFormatLocalizationContextI18NTest() throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextI18NTest.gf");
setGoldenFileStream(gfStream);
InputStream gfStream;
TEST_PROPS.setProperty(TEST_NAME,
"positiveFormatLocalizationContextI18NTest");
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextI18NTest.jsp");
if (isJavaVersion20OrGreater()) {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextI18NTestJava20Plus.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextI18NTestJava20Plus.gf");
} else {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextI18NTest.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextI18NTest.gf");
}
setGoldenFileStream(gfStream);

// TEST_PROPS.setProperty(GOLDENFILE,
// "positiveFormatLocalizationContextI18NTest.gf");
TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: en-US");
Expand All @@ -127,14 +143,19 @@ public void positiveFormatLocalizationContextI18NTest() throws Exception {
*/
@Test
public void positiveFormatLocalizationContextLocaleTest() throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextLocaleTest.gf");
InputStream gfStream;
if (isJavaVersion20OrGreater()) {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextLocaleTestJava20Plus.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextLocaleTestJava20Plus.gf");
} else {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextLocaleTest.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextLocaleTest.gf");
}
setGoldenFileStream(gfStream);
TEST_PROPS.setProperty(TEST_NAME,
"positiveFormatLocalizationContextLocaleTest");
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextLocaleTest.jsp");
// TEST_PROPS.setProperty(GOLDENFILE,
// "positiveFormatLocalizationContextLocaleTest.gf");
TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: de-DE");
invoke();
}
Expand All @@ -153,15 +174,24 @@ public void positiveFormatLocalizationContextLocaleTest() throws Exception {
@Test
public void positiveFormatLocalizationContextBrowserLocaleTest()
throws Exception {
InputStream gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextBrowserLocaleTest.gf");
setGoldenFileStream(gfStream);
InputStream gfStream ;
TEST_PROPS.setProperty(TEST_NAME,
"positiveFormatLocalizationContextBrowserLocaleTest");
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextBrowserLocaleTest.jsp");
// TEST_PROPS.setProperty(GOLDENFILE,
// "positiveFormatLocalizationContextBrowserLocaleTest.gf");
if (isJavaVersion20OrGreater()) {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextBrowserLocaleTestJava20Plus.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextBrowserLocaleTestJava20Plus.gf");
} else {
TEST_PROPS.setProperty(REQUEST,
"positiveFormatLocalizationContextBrowserLocaleTest.jsp");
gfStream = JSTLClientIT.class.getClassLoader().getResourceAsStream(packagePath+"/positiveFormatLocalizationContextBrowserLocaleTest.gf");
}
setGoldenFileStream(gfStream);

TEST_PROPS.setProperty(REQUEST_HEADERS, "Accept-Language: en-US");
invoke();
}

}
Loading