Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 1 | /* |
Gaurav Gupta | 3655507 | 2020-03-26 14:10:23 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 3 | * |
| 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 | |
| 17 | package org.glassfish.test.jms.jmsxdeliverycount.client; |
| 18 | |
| 19 | import javax.naming.*; |
Gaurav Gupta | 3655507 | 2020-03-26 14:10:23 +0530 | [diff] [blame^] | 20 | import jakarta.jms.*; |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 21 | import org.glassfish.test.jms.jmsxdeliverycount.ejb.*; |
| 22 | import com.sun.ejte.ccl.reporter.SimpleReporterAdapter; |
| 23 | |
| 24 | public 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 | } |