blob: 73b21b63cc44173786fc7b2daf414ad77b6c8791 [file] [log] [blame]
Vinay Vishal57171472018-09-18 20:22:00 +05301/*
Gaurav Gupta36555072020-03-26 14:10:23 +05302 * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
Vinay Vishal57171472018-09-18 20:22:00 +05303 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v. 2.0, which is available at
6 * http://www.eclipse.org/legal/epl-2.0.
7 *
8 * This Source Code may also be made available under the following Secondary
9 * Licenses when the conditions for such availability set forth in the
10 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11 * version 2 with the GNU Classpath Exception, which is available at
12 * https://www.gnu.org/software/classpath/license.html.
13 *
14 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15 */
16
17package org.glassfish.test.jms.jmsxdeliverycount.client;
18
19import javax.naming.*;
Gaurav Gupta36555072020-03-26 14:10:23 +053020import jakarta.jms.*;
Vinay Vishal57171472018-09-18 20:22:00 +053021import org.glassfish.test.jms.jmsxdeliverycount.ejb.*;
22import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
23
24public class Client {
25 private final static SimpleReporterAdapter STAT = new SimpleReporterAdapter("appserv-tests");
26
27 public static void main (String[] args) {
28 STAT.addDescription("JMSXDeliveryCount-stateless-ejb1");
29 Client client = new Client(args);
30 client.doTest();
31 STAT.printSummary("JMSXDeliveryCount-stateless-ejb1ID");
32 }
33
34 public Client (String[] args) {
35 }
36
37 public void doTest() {
38 String ejbName = "MySessionBean";
39 String text = "Hello World!";
40 try {
41 Context ctx = new InitialContext();
42 MySessionBeanRemote beanRemote = (MySessionBeanRemote) ctx.lookup(MySessionBeanRemote.RemoteJNDIName);
43 beanRemote.sendMessage(text);
44
45 boolean received1 = beanRemote.checkMessage1(text);
46 boolean received2 = beanRemote.checkMessage2(text);
47 if (received1 && received2)
48 STAT.addStatus("JMSXDeliveryCount-ejb1 " + ejbName, STAT.PASS);
49 else
50 STAT.addStatus("JMSXDeliveryCount-ejb1 " + ejbName, STAT.FAIL);
51 } catch(Exception e) {
52 e.printStackTrace();
53 STAT.addStatus("JMSXDeliveryCount-ejb1 " + ejbName, STAT.FAIL);
54 }
55 }
56}