Skip to content

Commit

Permalink
Fix pluggability test. Listener is shared. Don't hard-code context path.
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Mar 19, 2024
1 parent 39a9818 commit 6d114aa
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2024 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 @@ -31,7 +31,7 @@ public class TestListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {
StringBuffer testData = new StringBuffer("Testing_Session_Cookie_Config");
String domain = "sun.com";
String path = "/servlet_jsh_sessioncookieconfig_web/TestServlet";
String path = sce.getServletContext().getContextPath() + "/TestServlet";
boolean isSecure = true;
boolean httpOnly = false;
int maxage = 50000;
Expand Down Expand Up @@ -76,7 +76,7 @@ public void contextInitialized(ServletContextEvent sce) {
if (!scf.getAttribute(attrName).equals(attrValue)) {
testData.append("|getAttribute-FAILED-expecting-" + attrValue + "-got-" + scf.getAttribute(attrName));
}

if (scf.getName() != null && !"JSESSIONID".equals(scf.getName())) {
testData.append("|getName-FAILED-expecting-null-or-JSESSIONID-got-" + scf.getName());
}
Expand All @@ -85,7 +85,7 @@ public void contextInitialized(ServletContextEvent sce) {
if (!scf.getName().equals(name)) {
testData.append("|getName-FAILED-expecting-" + name + "-got-" + scf.getName());
}

sce.getServletContext().setAttribute(this.getClass().getName(), testData.toString());
}
}

0 comments on commit 6d114aa

Please sign in to comment.