Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMS Standalone TCK test refactor with Junit. #1185

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions glassfish-runner/jms-tck/j2ee.pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#
# 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
#
AS_ADMIN_USERPASSWORD=j2ee
16 changes: 16 additions & 0 deletions glassfish-runner/jms-tck/javajoe.pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# 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
#
AS_ADMIN_USERPASSWORD=javajoe
565 changes: 565 additions & 0 deletions glassfish-runner/jms-tck/pom.xml

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions glassfish-runner/jms-tck/src/test/resources/jndi.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright (c) 2013, 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
#

# Properties for establishing initial JNDI Context. These properties
# are automatically read by JNDI during new InitialContext() as long
# as this file is in the search path. For JMS TCK the Open Message
# Queue uses the JNDI FileSystem Context Provider.
#
# If on a WINDOWS based system then the path below will need to contain
# the drive letter in the path. The path below is for UNIX based systems.
# So for WINDOWS platforms the (java.naming.provider.url) MUST BE:
# java.naming.provider.url=file:///C:/tmp/ri_admin_objects
#
java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
java.naming.provider.url=file:///tmp/ri_admin_objects
8 changes: 8 additions & 0 deletions glassfish-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
<properties>
<glassfish-artifact-id>glassfish</glassfish-artifact-id>

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

<jsonb.tck.version>3.0.0</jsonb.tck.version>
<json.tck.version>2.1.0</json.tck.version>
<jakarta.rest.version>3.1.0</jakarta.rest.version>
<tck.artifactId>jakarta-restful-ws-tck</tck.artifactId>

<glassfish.container.version>7.0.0</glassfish.container.version>
<glassfish.toplevel.dir>glassfish7</glassfish.toplevel.dir>
<jakarta.rest.version>3.1.0</jakarta.rest.version>
Expand Down
27 changes: 25 additions & 2 deletions jms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,19 @@
<version>11.0.0-SNAPSHOT</version>
</parent>

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

<name>JMS</name>
<description>JMS</description>
<description>JMS TCK tests</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>
Expand Down Expand Up @@ -61,6 +69,21 @@
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-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
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
* Copyright (c) 2007, 2020 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.implementation.sun.jms;

import javax.naming.Context;
import javax.naming.InitialContext;

import com.sun.ts.lib.porting.TSJMSObjectsInterface;
import com.sun.ts.lib.util.TestUtil;

import jakarta.jms.ConnectionFactory;
import jakarta.jms.QueueConnectionFactory;
import jakarta.jms.Topic;
import jakarta.jms.TopicConnectionFactory;

/**
* This is an implementation of the TSJMSObjectsInterface. An implementation of
* this class must be supplied by any JMS implementation wishing to get JMS
* adminsitered objects: ConnectionFactories, queues and topics.
*
* @author Dianne Jiao
*/

public class SunRIJMSObjects implements TSJMSObjectsInterface {
private static Context jndiContext = null;

private static QueueConnectionFactory qcf = null;

private static TopicConnectionFactory tcf = null;

private static ConnectionFactory cf = null;

private jakarta.jms.Topic testTopic = null;

private jakarta.jms.Queue testQueue = null;

private void getJNDIContext() throws Exception {

if (jndiContext == null) {
try {
TestUtil.logTrace("Getting initial context");
jndiContext = new InitialContext();
} catch (javax.naming.NamingException ne) {
TestUtil.logErr("Could not create JNDI context because: ", ne);
TestUtil.printStackTrace(ne);
throw ne;
}
}
}

/**
* This method allows individual implementation to get the Queue
*/

public jakarta.jms.Queue getQueue(String name) throws Exception {
getJNDIContext();

try {
testQueue = (jakarta.jms.Queue) jndiContext.lookup(name);
} catch (Exception e) {
TestUtil.logErr("Failed to lookup Queue");
TestUtil.printStackTrace(e);
throw e;
}
return testQueue;
}

/**
* This method allows individual implementation to get the Topic
*/

public Topic getTopic(String name) throws Exception {
getJNDIContext();

try {
testTopic = (Topic) jndiContext.lookup(name);
} catch (Exception e) {
TestUtil.logErr("Failed to lookup Topic");
TestUtil.printStackTrace(e);
throw e;
}
return testTopic;
}

/**
* This method allows individual implementation to get the
* QueueConnectionFactory
*/

public QueueConnectionFactory getQueueConnectionFactory(String name) throws Exception {
getJNDIContext();

try {
qcf = (QueueConnectionFactory) jndiContext.lookup(name);
} catch (Exception e) {
TestUtil.logErr("Failed to lookup QueueConnectionFactory");
TestUtil.printStackTrace(e);
throw e;
}
return qcf;
}

/**
* This method allows individual implementation to get the
* TopicConnectionFactory
*/

public TopicConnectionFactory getTopicConnectionFactory(String name) throws Exception {
getJNDIContext();

try {
tcf = (TopicConnectionFactory) jndiContext.lookup(name);
} catch (Exception e) {
TestUtil.logErr("Failed to lookup TopicConnectionFactory");
TestUtil.printStackTrace(e);
throw e;
}
return tcf;
}

/**
* This method allows individual implementation to get the ConnectionFactory
*/

public ConnectionFactory getConnectionFactory(String name) throws Exception {
getJNDIContext();

try {
cf = (ConnectionFactory) jndiContext.lookup(name);
} catch (Exception e) {
TestUtil.logErr("Failed to lookup ConnectionFactory");
TestUtil.printStackTrace(e);
throw e;
}
return cf;
}
}
Loading
Loading