Skip to content

Commit

Permalink
default porting class fix.
Browse files Browse the repository at this point in the history
Signed-off-by: Gurunandan Rao <[email protected]>
  • Loading branch information
gurunrao committed Dec 12, 2023
1 parent 7a8b926 commit d5b6b58
Show file tree
Hide file tree
Showing 87 changed files with 3,463 additions and 30 deletions.
5 changes: 1 addition & 4 deletions glassfish-runner/saaj-tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@
<goal>verify</goal>
</goals>
<configuration>
<!--
<test>com.sun.ts.tests.saaj.api.jakarta_xml_soap.SOAPConnection.URLClient#callTest</test>
-->
<includes>
<include>**/*Client*.*</include>
</includes>
Expand All @@ -169,7 +166,7 @@
<glassfish.home>${project.build.directory}/${glassfish.toplevel.dir}</glassfish.home>
<webServerHost>localhost</webServerHost>
<webServerPort>8080</webServerPort>
<porting.ts.url.class.1>com.sun.ts.tests.saaj.lib.implementation.sun.common.SunRIURL</porting.ts.url.class.1>
<porting.ts.url.class.1>com.sun.ts.lib.porting.implementation.SunRIURL</porting.ts.url.class.1>
</systemPropertyVariables>
</configuration>
</execution>
Expand Down
44 changes: 21 additions & 23 deletions glassfishtck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,26 @@
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jakartatck</groupId>
<artifactId>project</artifactId>
<version>10.0.0-SNAPSHOT</version>
</parent>

<artifactId>glassfishtck</artifactId>
<packaging>jar</packaging>

<name>glassfishtck</name>
<description>glassfishtck</description>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>runtime</artifactId>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jakartatck</groupId>
<artifactId>project</artifactId>
<version>10.0.0-SNAPSHOT</version>
</parent>

<artifactId>glassfishtck</artifactId>
<packaging>jar</packaging>

<name>glassfishtck</name>
<description>glassfishtck</description>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>runtime</artifactId>
</dependency>
</dependencies>

</project>
8 changes: 5 additions & 3 deletions runtime/src/main/java/com/sun/ts/lib/porting/TSURL.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class TSURL implements TSURLInterface, Serializable {
private TSURLInterface ctsURL = null;

private String sClass = "porting.ts.url.class.1";

private String portingDefault = "com.sun.ts.lib.porting.implementation.SunRIURL";

public TSURL() {
// we'll initialize the impl when the individual method is called
Expand Down Expand Up @@ -66,7 +68,7 @@ public URL getURL(String protocol, String host, int port, String file)
if (ctsURL == null) {
try {
// create and initialize a new instance of TSURLInterface
Class c = Class.forName(TestUtil.getProperty(sClass));
Class c = Class.forName(System.getProperty(sClass, portingDefault));
ctsURL = (TSURLInterface) c.newInstance();
} catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -95,7 +97,7 @@ public String getURLString(String protocol, String host, int port,
if (ctsURL == null) {
try {
// create and initialize a new instance of TSURLInterface
Class c = Class.forName(TestUtil.getProperty(sClass));
Class c = Class.forName(System.getProperty(sClass, portingDefault));
ctsURL = (TSURLInterface) c.newInstance();
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -118,7 +120,7 @@ public String getRequest(String request) {
// create and initialize a new instance of TSURLInterface
// Class c = Class.forName(TestUtil.getProperty(sClass));
// Use the system property porting.ts.url.class.1
Class c = Class.forName(System.getProperty(sClass, "com.sun.ts.tests.jaxrs.lib.implementation.sun.common.SunRIURL"));
Class c = Class.forName(System.getProperty(sClass, portingDefault));
ctsURL = (TSURLInterface) c.newInstance();
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (c) 2007, 2023 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 com.sun.ts.lib.porting.implementation;

import java.net.MalformedURLException;
import java.net.URL;

import com.sun.ts.lib.porting.TSURLInterface;

// import com.sun.ts.lib.porting.TSURLInterface;

/**
* This is a J2EE Reference specific implementation of the TSURLInterface which
* is to be used for J2EE-TS testing. TS tests use this interface to obtain the
* URL String to use to access a given web component. If a given J2EE Server
* implmentation requires that URLs be created in a different manner, then this
* implementation can be replaced.
*
* @author Kyle Grucci
*/
public class SunRIURL implements TSURLInterface {
private URL url = null;

/**
* This method is called by TS tests to get the URL to use to access a given web
* component.
*
* @param protocol - the name of the protocol.
* @param host - the name of the host.
* @param port - the port number.
* @param file - the host file.
* @return a valid URL object.
*/
public URL getURL(String protocol, String host, int port, String file) throws MalformedURLException {
try {
url = new URL(protocol, host, port, file);
} catch (MalformedURLException e) {
// logger.log(Logger.Level.ERROR,"Failed during URL creation", e);
throw e;
}
return url;
}

/**
* This method is called by TS tests to get the URL to use to access a given web
* component.
*
* @param protocol - the name of the protocol.
* @param host - the name of the host.
* @param port - the port number.
* @param file - the host file.
* @return a valid URL as a String.
*/
public String getURLString(String protocol, String host, int port, String file) {
if (file.startsWith("/"))
return protocol + "://" + host + ":" + port + file;
else
return protocol + "://" + host + ":" + port + "/" + file;
}

/**
* This method is called by TS tests to get the request string to use to access
* a given web component.
*
* @param request - the request file.
* @return a valid String object.
*/
public String getRequest(String request) {
return request;
}
}
92 changes: 92 additions & 0 deletions saaj/src/main/java/com/sun/ts/tests/saaj/common/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.sun.ts.tests.saaj.common;

import java.io.IOException;
import java.io.InputStream;
import java.lang.System.Logger;
import java.net.URL;
import java.net.URLConnection;
import java.util.Properties;

import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;

import com.sun.ts.lib.porting.TSURL;

@ExtendWith(ArquillianExtension.class)
public class Client {

protected static final String PROTOCOL = "http";

protected static final String HOSTNAME = "localhost";

protected static final int PORTNUM = 8000;

public static final String WEBSERVERHOSTPROP = "webServerHost";

public static final String WEBSERVERPORTPROP = "webServerPort";

protected TSURL tsurl = new TSURL();

protected URL url = null;

protected URLConnection urlConn = null;

protected Properties props = new Properties();

protected String hostname = HOSTNAME;

protected int portnum = PORTNUM;

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

public static void addFilesToArchive(String contentRoot, String[] fileNames, WebArchive archive)
throws IOException {
for (String fileName : fileNames) {
InputStream inStream = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(contentRoot + fileName);
ByteArrayAsset attach = new ByteArrayAsset(inStream);
archive.add(attach, fileName);
}
}

/*
* @class.setup_props: webServerHost; webServerPort;
*/
@BeforeEach
public void setup() throws Exception {
boolean pass = true;

try {
hostname = System.getProperty(WEBSERVERHOSTPROP);
if (hostname == null)
pass = false;
else if (hostname.equals(""))
pass = false;
try {
portnum = Integer.parseInt(System.getProperty(WEBSERVERPORTPROP));
} catch (Exception e) {
pass = false;
}
} catch (Exception e) {
throw new Exception("setup failed:", e);
}
props.put(WEBSERVERHOSTPROP, hostname);
props.put(WEBSERVERPORTPROP, String.valueOf(portnum));
if (!pass) {
logger.log(Logger.Level.ERROR, "Please specify host & port of web server " + "in config properties: "
+ WEBSERVERHOSTPROP + ", " + WEBSERVERPORTPROP);
throw new Exception("setup failed:");
}
logger.log(Logger.Level.INFO, "setup ok");
}

@AfterEach
public void cleanup() throws Exception {
logger.log(Logger.Level.INFO, "cleanup ok");
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<head>
<!--
Copyright (c) 2018 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
-->

<title>Welcome to the JAXM TCK, Version 1.1</title>
</head>
<body bgcolor="#ffffff">
<CENTER><h1>Your Starting Point</h1></center><hr>


<h2>Guide to Documentation</h2>

<p>The <a href="COPYRIGHT-jaxm.html">JAXM Copyright</a> provides
the copyright information notice for the JAXM TCK, Version 1.1.<p>

<p>The <a href="ReleaseNotes-jaxm.html">JAXM ReleaseNotes</a> provide the
information that you need to install, set up, and run the JAXM TCK, Version 1.1.<p>

<p>The <a href="JAXMJavadocAssertions.html">Javadoc Assertion List</a> lists all the javadoc assertions that are tested by the JAXM TCK.

<p>The <a href="JAXMSpecAssertions.html">Specification Assertion List</a> lists all the specification assertions that are tested by the JAXM TCK.

<p>Additional documentation includes the JavaTest README file, ReleaseNotes
file, and user's guide:

<ul>
<li><p>The <a href="JavaTest3.0/README-javatest.html">README</a> file contains
basic information about the JavaTest, Version 3.0.2 harness.</p></li>

<li><p>The <a href="JavaTest3.0/javatest.pdf"><em>JavaTest User's Guide</em></a>,
in PDF format, contains information about using the test harness tool.</p></li>

<li><p>The <a href="JavaTest3.0/ReleaseNotes-javatest.html">ReleaseNotes</a>
provide information that is not contained in the <em>JavaTest User's
Guide</em> manual, and which supercede any information in the manual.<p></li>
</ul>

<p>&nbsp;</p>
<rule>
<p><em>Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved.</em></p>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d5b6b58

Please sign in to comment.