Skip to content

Commit

Permalink
SOAP standalone TCK refactor with Junit and Arquillian (#1204)
Browse files Browse the repository at this point in the history
* refactor with junit annotation, setup parameters.

Signed-off-by: Gurunandan Rao <[email protected]>

* logger changes.

Signed-off-by: Gurunandan Rao <[email protected]>

* ShrinkWrap and Arquillian support.

Signed-off-by: Gurunandan Rao <[email protected]>

* format code and fixs for refactored code.

Signed-off-by: Gurunandan Rao <[email protected]>

* logger update for saaj.

Signed-off-by: Gurunandan Rao <[email protected]>

* default porting class fix.

Signed-off-by: Gurunandan Rao <[email protected]>

---------

Signed-off-by: Gurunandan Rao <[email protected]>
  • Loading branch information
gurunrao authored May 19, 2024
1 parent c3e6921 commit d78d8ae
Show file tree
Hide file tree
Showing 151 changed files with 51,497 additions and 50,081 deletions.
177 changes: 177 additions & 0 deletions glassfish-runner/saaj-tck/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<!--
Copyright (c) 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
-->
<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/maven-v4_0_0.xsd">
<groupId>jakarta</groupId>
<artifactId>glassfish.saaj-tck</artifactId>
<version>10.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.glassfish</groupId>
<artifactId>standalone-tck</artifactId>
<version>10.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
<tck.artifactId>jakarta.saaj-tck</tck.artifactId>
<tck.version>3.0.0</tck.version>
<arquillian.core.version>1.7.0.Alpha10</arquillian.core.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit.jupiter.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>jakartatck</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>jakartatck</groupId>
<artifactId>libutil</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>jakartatck</groupId>
<artifactId>saaj-tck</artifactId>
<version>10.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
<version>${arquillian.core.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<version>${arquillian.core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.omnifaces.arquillian</groupId>
<artifactId>arquillian-glassfish-server-managed</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>full</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<glassfish-artifact-id>glassfish</glassfish-artifact-id>
</properties>
</profile>
<profile>
<id>web</id>
<properties>
<glassfish-artifact-id>web</glassfish-artifact-id>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>unpack</id>
<phase>pre-integration-test</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.glassfish.main.distributions</groupId>
<artifactId>${glassfish-artifact-id}</artifactId>
<version>${glassfish.container.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-dependecies</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>jakartatck</includeGroupIds>
<outputDirectory>${project.build.directory}/${glassfish.toplevel.dir}/glassfish/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<executions>
<execution>
<id>gf-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/*Client*.*</include>
</includes>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/webservices-osgi.jar</additionalClasspathElement>
<additionalClasspathElement>${project.build.directory}/${glassfish.toplevel.dir}/glassfish/modules/jaxb-osgi.jar</additionalClasspathElement>
</additionalClasspathElements>
<dependenciesToScan>jakartatck:saaj-tck</dependenciesToScan>
<systemPropertyVariables>
<glassfish.home>${project.build.directory}/${glassfish.toplevel.dir}</glassfish.home>
<webServerHost>localhost</webServerHost>
<webServerPort>8080</webServerPort>
<porting.ts.url.class.1>com.sun.ts.lib.porting.implementation.SunRIURL</porting.ts.url.class.1>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
16 changes: 6 additions & 10 deletions glassfishtck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
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>
<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>jakarta.tck</groupId>
<artifactId>project</artifactId>
<version>11.0.0-SNAPSHOT</version>
</parent>

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

<name>glassfishtck</name>
<description>glassfishtck</description>
<artifactId>glassfishtck</artifactId>
<packaging>jar</packaging>
<name>glassfishtck</name>
<description>glassfishtck</description>

<dependencies>
<dependency>
Expand Down
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;
}
}
25 changes: 24 additions & 1 deletion saaj/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@
<version>11.0.0-SNAPSHOT</version>
</parent>

<artifactId>saaj</artifactId>
<artifactId>saaj-tck</artifactId>
<packaging>jar</packaging>

<name>saaj</name>
<description>saaj</description>

<properties>
<arquillian.junit>1.7.0.Alpha14</arquillian.junit>
<junit.jupiter.version>5.9.1</junit.jupiter.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<tck.version>${project.version}</tck.version>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand All @@ -53,6 +61,21 @@
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<version>${arquillian.junit}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-core</artifactId>
<version>${arquillian.junit}</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Loading

0 comments on commit d78d8ae

Please sign in to comment.