Skip to content

Commit

Permalink
Fix implicit jakarta.servlet.http import test
Browse files Browse the repository at this point in the history
The test previously used HttpUtils which has been removed in Servlet
6.0. Switch to using Cookie.
  • Loading branch information
markt-asf committed Oct 6, 2021
1 parent 3b8a748 commit 1fc46b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ public void implicitImportServletTest() throws Fault {
* @assertion_ids: JSP:SPEC:35
*
* @test_Strategy: Validate that classes from the jakarta.servlet.http package
* are implicitly imported by creating and using an instance of HttpUtils.
* are implicitly imported by creating and using an instance of Cookie.
*/

public void implicitImportHttpTest() throws Fault {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2021 Oracle and/or its affiliates and others.
* 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 @@ -150,7 +151,7 @@ public void implicitImportServletTest() throws Fault {
* @assertion_ids: JSP:SPEC:229.19.1
*
* @test_Strategy: Validate that classes from the jakarta.servlet.http package
* are implicitly imported by creating and using an instance of HttpUtils.
* are implicitly imported by creating and using an instance of Cookie.
*/

public void implicitImportHttpTest() throws Fault {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%--
Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2021 Oracle and/or its affiliates and others.
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 @@ -22,7 +23,7 @@
Description: Use jsp page directive with language="java"
Do not specify jakarta.servlet.http in the import attribute
as it should be available implicitly. Validate
that an HttpUtils object can be created.
that an Cookie object can be created.
Result:No error
**/ %>
Expand All @@ -33,12 +34,12 @@

<%
HttpUtils hu = new HttpUtils();
Cookie cookie = new Cookie("name","value");
%>

<%= hu instanceof jakarta.servlet.http.HttpUtils %>
<%= cookie instanceof jakarta.servlet.http.Cookie %>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%--
Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2003, 2021 Oracle and/or its affiliates and others.
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 @@ -18,10 +19,10 @@

<%@ tag language="java" %>
<%
HttpUtils ex = new HttpUtils();
if(ex instanceof jakarta.servlet.http.HttpUtils) {
Cookie ex = new Cookie("name","value");
if(ex instanceof jakarta.servlet.http.Cookie) {
out.println("Test PASSED.");
} else {
out.println("Test FAILED. HttpUtils instance is not instance of jakarta.servlet.http.HttpUtils");
out.println("Test FAILED. Cookie instance is not instance of jakarta.servlet.http.Cookie");
}
%>

0 comments on commit 1fc46b5

Please sign in to comment.