Skip to content

Commit

Permalink
Merge pull request jakartaee#1254 from alwin-joseph/jsp_platformtests
Browse files Browse the repository at this point in the history
Refactor JSP Platform Tests - spec/security & spec/tagext/resource
  • Loading branch information
alwin-joseph authored Mar 18, 2024
2 parents 553a6ee + 01a70c7 commit 6dccf77
Show file tree
Hide file tree
Showing 53 changed files with 5,845 additions and 667 deletions.
458 changes: 405 additions & 53 deletions glassfish-runner/jsp-tck/pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 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
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.pages.core.tck;

import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.WebArchive;

public class GlassfishApplicationArchiveProcessor implements ApplicationArchiveProcessor {
@Override
public void process(Archive<?> archive, TestClass testClass) {

if ("jsp_tagext_resource_httplistener_web.war".equals(archive.getName())) {
WebArchive webArchive = (WebArchive) archive;
webArchive.addAsWebInfResource("jsp_tagext_resource_httplistener_web.war.sun-web.xml", "sun-web.xml");
} else if ("jsp_tagext_resource_listener_web.war".equals(archive.getName())) {
WebArchive webArchive = (WebArchive) archive;
webArchive.addAsWebInfResource("jsp_tagext_resource_listener_web.war.sun-web.xml", "sun-web.xml");
} else if ("jsp_tagext_resource_taghandler_web.war".equals(archive.getName())) {
WebArchive webArchive = (WebArchive) archive;
webArchive.addAsWebInfResource("jsp_tagext_resource_taghandler_web.war.sun-web.xml", "sun-web.xml");
} else if ("jsp_sec_secbasic_web.war".equals(archive.getName())) {
WebArchive webArchive = (WebArchive) archive;
webArchive.addAsWebInfResource("jsp_sec_secbasic_web.war.sun-web.xml", "sun-web.xml");
} else if ("jsp_sec_secform_web.war".equals(archive.getName())) {
WebArchive webArchive = (WebArchive) archive;
webArchive.addAsWebInfResource("jsp_sec_secform_web.war.sun-web.xml", "sun-web.xml");
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 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
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.pages.core.tck;

import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;

public class GlassfishLoadableExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder extensionBuilder) {
extensionBuilder.service(ApplicationArchiveProcessor.class, GlassfishApplicationArchiveProcessor.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.glassfish.pages.core.tck.GlassfishLoadableExtension
2 changes: 1 addition & 1 deletion glassfish-runner/jsp-tck/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<group qualifier="glassfish-servers" default="true">
<container qualifier="http" default="true">
<configuration>
<property name="glassFishHome">target/glassfish7</property>
<property name="glassFishHome">target/glassfish8</property>
</configuration>
</container>
</group>
Expand Down
28 changes: 4 additions & 24 deletions jsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,35 +60,15 @@
<artifactId>libutil</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>web-servlet</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>web-jsp</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>assembly</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>tck-runtime</artifactId>
<version>6.1.0-M1</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>signaturetest</artifactId>
<version>11.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.netbeans.tools</groupId>
<groupId>jakarta.tck</groupId>
<artifactId>sigtest-maven-plugin</artifactId>
<version>1.7</version>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javatest</groupId>
Expand Down Expand Up @@ -226,9 +206,9 @@
<build>
<plugins>
<plugin>
<groupId>org.netbeans.tools</groupId>
<groupId>jakarta.tck</groupId>
<artifactId>sigtest-maven-plugin</artifactId>
<version>1.4</version>
<version>2.2</version>
<configuration>
<FileName>${project.build.directory}/jakarta.servlet.jsp.sig_${project.version}</FileName>
<packages>jakarta.servlet.jsp,jakarta.servlet.jsp.el,jakarta.servlet.jsp.tagext</packages>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@

import java.util.List;

import com.sun.ts.lib.util.TestUtil;
import java.lang.System.Logger;
import com.sun.ts.tests.common.webclient.WebTestCase;
import com.sun.ts.tests.common.webclient.http.HttpResponse;
import com.sun.ts.tests.common.webclient.validation.TokenizedValidator;

public class JspWriterValidator extends TokenizedValidator {

private static final Logger logger = System.getLogger(JspWriterValidator.class.getName());

private static final String UNIX_LINE_SEPARATOR = "\n";

private static final String WIN32_LINE_SEPARATOR = "\r\n";
Expand Down Expand Up @@ -65,15 +67,14 @@ public boolean validate(WebTestCase testCase) {
List searchList = testCase.getSearchStrings();
for (int i = 0, size = searchList.size(); i < size; i++) {
String string = (String) searchList.get(i);
TestUtil
.logTrace("[JspWriterValidator] Processing search string: " + string);
logger.log(Logger.Level.TRACE, "[JspWriterValidator] Processing search string: " + string);
for (int index = string.indexOf(eolToken); index > -1; index = string
.indexOf(eolToken)) {
StringBuffer sb = new StringBuffer(string);
sb.replace(index, index + 5, eol);
string = sb.toString();
}
TestUtil.logTrace("[JspWriterValidator] Adding (possibly) modified "
logger.log(Logger.Level.TRACE, "[JspWriterValidator] Adding (possibly) modified "
+ "search string: " + string);
searchList.set(i, string);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public void setup() throws Exception {
String hostname = url.getHost();
String portnum = Integer.toString(url.getPort());

assertFalse(isNullOrEmpty(hostname), "[AbstractUrlClient] 'webServerHost' was not set in the properties.");
assertFalse(isNullOrEmpty(hostname), "[AbstractUrlClient] 'webServerHost' was not set.");
_hostname = hostname.trim();
assertFalse(isNullOrEmpty(portnum), "[AbstractUrlClient] 'webServerPort' was not set in the properties.");
assertFalse(isNullOrEmpty(portnum), "[AbstractUrlClient] 'webServerPort' was not set.");
_port = Integer.parseInt(portnum.trim());

logger.log(Logger.Level.INFO, "[AbstractUrlClient] Test setup OK");
Expand Down
Loading

0 comments on commit 6dccf77

Please sign in to comment.