Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 2a530a5

Browse files
YRutujayaminikb
authored andcommitted
Fixes #21941 JMS Tests added to CI pipeline (#21942)
1 parent c4163aa commit 2a530a5

File tree

1,396 files changed

+47012
-25645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,396 files changed

+47012
-25645
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?>
2+
<!DOCTYPE project [
3+
<!--
4+
5+
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6+
7+
Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
8+
9+
The contents of this file are subject to the terms of either the GNU
10+
General Public License Version 2 only ("GPL") or the Common Development
11+
and Distribution License("CDDL") (collectively, the "License"). You
12+
may not use this file except in compliance with the License. You can
13+
obtain a copy of the License at
14+
https://oss.oracle.com/licenses/CDDL+GPL-1.1
15+
or LICENSE.txt. See the License for the specific
16+
language governing permissions and limitations under the License.
17+
18+
When distributing the software, include this License Header Notice in each
19+
file and include the License file at LICENSE.txt.
20+
21+
GPL Classpath Exception:
22+
Oracle designates this particular file as subject to the "Classpath"
23+
exception as provided by Oracle in the GPL Version 2 section of the License
24+
file that accompanied this code.
25+
26+
Modifications:
27+
If applicable, add the following below the License Header, with the fields
28+
enclosed by brackets [] replaced by your own identifying information:
29+
"Portions Copyright [year] [name of copyright owner]"
30+
31+
Contributor(s):
32+
If you wish your version of this file to be governed by only the CDDL or
33+
only the GPL Version 2, indicate your decision by adding "[Contributor]
34+
elects to include this software in this distribution under the [CDDL or GPL
35+
Version 2] license." If you don't indicate a single choice of license, a
36+
recipient has the option to distribute your version of this file under
37+
either the CDDL, the GPL Version 2 or to extend the choice of license to
38+
its licensees as provided above. However, if you add GPL Version 2 code
39+
and therefore, elected the GPL Version 2 license, then the option applies
40+
only if the new code is made subject to such option by the copyright
41+
holder.
42+
43+
-->
44+
45+
<!ENTITY commonSetup SYSTEM "../../../../config/properties.xml">
46+
<!ENTITY commonBuild SYSTEM "../../../../config/common.xml">
47+
<!ENTITY testproperties SYSTEM "build.properties">
48+
]>
49+
50+
<project name="JMSXDeliveryCount-acc1App" default="usage" basedir=".">
51+
52+
&commonSetup;
53+
&commonBuild;
54+
&testproperties;
55+
56+
<target name="all" depends="clean,build,create-resources,run,undeploy,delete-resources"/>
57+
58+
<target name="clean" depends="init-common">
59+
<antcall target="clean-common"/>
60+
</target>
61+
62+
<target name="compile" depends="clean">
63+
<antcall target="compile-common">
64+
<param name="src" value="client"/>
65+
</antcall>
66+
</target>
67+
68+
<target name="build" depends="init-common">
69+
<antcall target="package-client"/>
70+
<antcall target="package-client2"/>
71+
</target>
72+
73+
<target name="package-client" depends="compile">
74+
<delete file="${appclient.jar}"/>
75+
<echo message="common.xml: Generating appclient-jar inside build directory"
76+
level="verbose"/>
77+
<mkdir dir="${assemble.dir}"/>
78+
<mkdir dir="${build.classes.dir}/META-INF"/>
79+
<copy file="${application-client.xml}" tofile="${build.classes.dir}/META-INF/application-client.xml"/>
80+
<copy file="${sun-application-client.xml}" tofile="${build.classes.dir}/META-INF/sun-application-client.xml"/>
81+
<jar jarfile="${build.base.dir}/archive/${appname}AppClient.jar" basedir="${build.classes.dir}"
82+
update="true" includes ="**/*Client.class">
83+
<manifest>
84+
<attribute name="Main-Class" value="org.glassfish.test.jms.jmsxdeliverycount.client.Client"/>
85+
</manifest>
86+
<metainf dir="${build.classes.dir}/META-INF">
87+
<include name="application-client.xml"/>
88+
<include name="sun-application-client.xml"/>
89+
</metainf>
90+
</jar>
91+
</target>
92+
93+
<target name="package-client2" depends="init-common">
94+
<delete file="${appclient.jar}"/>
95+
<echo message="common.xml: Generating appclient-jar inside build directory"
96+
level="verbose"/>
97+
<mkdir dir="${assemble.dir}"/>
98+
<mkdir dir="${build.classes.dir}/META-INF"/>
99+
<copy file="${application-client.xml}" tofile="${build.classes.dir}/META-INF/application-client.xml"/>
100+
<copy file="${sun-application-client.xml}" tofile="${build.classes.dir}/META-INF/sun-application-client.xml"/>
101+
<jar jarfile="${build.base.dir}/archive/${appname}AppClient2.jar" basedir="${build.classes.dir}"
102+
update="true" includes ="**/*Client2.class">
103+
<manifest>
104+
<attribute name="Main-Class" value="org.glassfish.test.jms.jmsxdeliverycount.client.Client2"/>
105+
</manifest>
106+
<metainf dir="${build.classes.dir}/META-INF">
107+
<include name="application-client.xml"/>
108+
<include name="sun-application-client.xml"/>
109+
</metainf>
110+
</jar>
111+
</target>
112+
113+
<target name="create-resources" depends="init-common">
114+
<antcall target="asadmin-batch-common">
115+
<param name="asadmin.file" value="create_resources.asadmin"/>
116+
</antcall>
117+
</target>
118+
119+
<target name="delete-resources" depends="init-common">
120+
<antcall target="asadmin-batch-common">
121+
<param name="asadmin.file" value="delete_resources.asadmin"/>
122+
</antcall>
123+
</target>
124+
125+
<target name="run" depends="build">
126+
<exec executable="${APPCLIENT}" failonerror="true">
127+
<arg line="-client ${build.base.dir}/archive/${appname}AppClient.jar"/>
128+
<env key="APPCPATH" value="${env.APS_HOME}/lib/reporter.jar"/>
129+
</exec>
130+
<exec executable="${APPCLIENT}" failonerror="true">
131+
<arg line="-client ${build.base.dir}/archive/${appname}AppClient2.jar"/>
132+
<env key="APPCPATH" value="${env.APS_HOME}/lib/reporter.jar"/>
133+
</exec>
134+
</target>
135+
136+
<target name="undeploy" depends="init-common">
137+
<antcall target="undeploy-common"/>
138+
</target>
139+
140+
<target name="usage">
141+
<antcall target="usage-common"/>
142+
<echo>
143+
ant create-resources Create all destinations and connection factories
144+
ant delete-resources Delete all destinations and connection factories
145+
</echo>
146+
</target>
147+
</project>
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
12+
* or LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
40+
41+
package org.glassfish.test.jms.jmsxdeliverycount.client;
42+
43+
import javax.naming.*;
44+
import javax.jms.*;
45+
import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
46+
47+
public class Client {
48+
private final static SimpleReporterAdapter STAT = new SimpleReporterAdapter("appserv-tests");
49+
50+
public static void main (String[] args) {
51+
STAT.addDescription("JMSXDeliveryCount-acc1-1");
52+
Client client = new Client(args);
53+
client.sendMessages();
54+
client.doTest();
55+
STAT.printSummary("JMSXDeliveryCount-acc1-1ID");
56+
}
57+
58+
public Client (String[] args) {
59+
}
60+
61+
public void sendMessages() {
62+
try {
63+
Context ctx = new InitialContext();
64+
Queue queue = (Queue) ctx.lookup("jms/jms_unit_test_Queue");
65+
QueueConnectionFactory qconFactory = (QueueConnectionFactory) ctx.lookup("jms/jms_unit_test_QCF");
66+
QueueConnection conn = qconFactory.createQueueConnection();
67+
conn.start();
68+
QueueSession qsession = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
69+
QueueSender qsender = qsession.createSender(queue);
70+
for (int i=0; i<10; i++) {
71+
TextMessage msg = qsession.createTextMessage("" + i);
72+
qsender.send(msg);
73+
}
74+
qsession.close();
75+
conn.close();
76+
} catch(Exception e) {
77+
e.printStackTrace();
78+
STAT.addStatus("JMSXDeliveryCount-acc1-1 ", STAT.FAIL);
79+
}
80+
}
81+
82+
public void doTest() {
83+
try {
84+
Context ctx = new InitialContext();
85+
Queue queue = (Queue) ctx.lookup("jms/jms_unit_test_Queue");
86+
QueueConnectionFactory qconFactory = (QueueConnectionFactory) ctx.lookup("jms/jms_unit_test_QCF");
87+
QueueConnection qcon = qconFactory.createQueueConnection();
88+
qcon.start();
89+
QueueSession qsession = qcon.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
90+
MessageConsumer qreceiver = qsession.createConsumer(queue);
91+
TextMessage message = (TextMessage) qreceiver.receive(10000);
92+
if (message == null) {
93+
STAT.addStatus("JMSXDeliveryCount-acc1-1 ", STAT.FAIL);
94+
return;
95+
}
96+
int deliveryCount = message.getIntProperty("JMSXDeliveryCount");
97+
if (deliveryCount != 1) {
98+
STAT.addStatus("JMSXDeliveryCount-acc1-1 ", STAT.FAIL);
99+
return;
100+
}
101+
qsession.recover();
102+
message = (TextMessage) qreceiver.receive(10000);
103+
if (message == null) {
104+
STAT.addStatus("JMSXDeliveryCount-acc1-1 ", STAT.FAIL);
105+
return;
106+
}
107+
qcon.close();
108+
STAT.addStatus("JMSXDeliveryCount-acc1-1 ", STAT.PASS);
109+
} catch(Exception e) {
110+
e.printStackTrace();
111+
STAT.addStatus("JMSXDeliveryCount-acc1-1 ", STAT.FAIL);
112+
}
113+
}
114+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
12+
* or LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
40+
41+
package org.glassfish.test.jms.jmsxdeliverycount.client;
42+
43+
import javax.naming.*;
44+
import javax.jms.*;
45+
import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
46+
47+
public class Client2 {
48+
private final static SimpleReporterAdapter STAT = new SimpleReporterAdapter("appserv-tests");
49+
50+
public static void main (String[] args) {
51+
STAT.addDescription("JMSXDeliveryCount-acc1-2");
52+
Client2 client2 = new Client2(args);
53+
client2.doTest();
54+
STAT.printSummary("JMSXDeliveryCount-acc1-2ID");
55+
}
56+
57+
public Client2 (String[] args) {
58+
}
59+
60+
public void doTest() {
61+
try {
62+
Context ctx = new InitialContext();
63+
Queue queue = (Queue) ctx.lookup("jms/jms_unit_test_Queue");
64+
QueueConnectionFactory qconFactory = (QueueConnectionFactory) ctx.lookup("jms/jms_unit_test_QCF");
65+
QueueConnection qcon = qconFactory.createQueueConnection();
66+
qcon.start();
67+
QueueSession qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
68+
MessageConsumer qreceiver = qsession.createConsumer(queue);
69+
TextMessage message = (TextMessage) qreceiver.receive(10000);
70+
if (message == null) {
71+
STAT.addStatus("JMSXDeliveryCount-acc1-2 ", STAT.FAIL);
72+
return;
73+
}
74+
int deliveryCount = message.getIntProperty("JMSXDeliveryCount");
75+
if (deliveryCount != 3) {
76+
STAT.addStatus("JMSXDeliveryCount-acc1-2 ", STAT.FAIL);
77+
return;
78+
}
79+
for (int i=1; i<10; i++) {
80+
message = (TextMessage) qreceiver.receive(10000);
81+
if (message == null) {
82+
STAT.addStatus("JMSXDeliveryCount-acc1-2 ", STAT.FAIL);
83+
return;
84+
}
85+
deliveryCount = message.getIntProperty("JMSXDeliveryCount");
86+
if (deliveryCount != 1) {
87+
STAT.addStatus("JMSXDeliveryCount-acc1-2 ", STAT.FAIL);
88+
return;
89+
}
90+
}
91+
qcon.close();
92+
STAT.addStatus("JMSXDeliveryCount-acc1-2 ", STAT.PASS);
93+
} catch(Exception e) {
94+
e.printStackTrace();
95+
STAT.addStatus("JMSXDeliveryCount-acc1-2 ", STAT.FAIL);
96+
}
97+
}
98+
}

0 commit comments

Comments
 (0)