blob: 99430c6d7653cfbec74abefd5eafda41e2a52efc [file] [log] [blame]
Vinay Vishal57171472018-09-18 20:22:00 +05301/*
2 * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
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
17package com.sun.s1asdev.jdbc.appauthtx.client;
18
19import javax.naming.*;
20import java.rmi.*;
21import java.util.*;
22
23import com.sun.s1asdev.jdbc.appauthtx.ejb.SimpleBMPHome;
24import com.sun.s1asdev.jdbc.appauthtx.ejb.SimpleBMP;
25import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
26
27public class SimpleBMPClient {
28
29 public static void main(String[] args)
30 throws Exception {
David Matějčekf4dc06a2021-05-17 12:10:57 +020031
32 String testSuite = "AppAuthTX ";
33 SimpleReporterAdapter stat = new SimpleReporterAdapter();
Vinay Vishal57171472018-09-18 20:22:00 +053034
35 InitialContext ic = new InitialContext();
36 Object objRef = ic.lookup("java:comp/env/ejb/SimpleBMPHome");
David Matějčekf4dc06a2021-05-17 12:10:57 +020037 SimpleBMPHome simpleBMPHome = (SimpleBMPHome)
Vinay Vishal57171472018-09-18 20:22:00 +053038 javax.rmi.PortableRemoteObject.narrow(objRef, SimpleBMPHome.class);
39
40 SimpleBMP simpleBMP = simpleBMPHome.create();
David Matějčekf4dc06a2021-05-17 12:10:57 +020041 stat.addDescription("JDBC Application Authentication TX test");
42
Vinay Vishal57171472018-09-18 20:22:00 +053043 System.out.println(" All tests will fail with Derby till XA driver is fixed");
David Matějčekf4dc06a2021-05-17 12:10:57 +020044 if ( simpleBMP.test1() ) {
45 stat.addStatus(testSuite+"test1 : ", stat.PASS);
46 } else {
47 stat.addStatus(testSuite+"test1 : ", stat.FAIL);
48 }
Vinay Vishal57171472018-09-18 20:22:00 +053049
David Matějčekf4dc06a2021-05-17 12:10:57 +020050 if ( simpleBMP.test2() ) {
51 stat.addStatus(testSuite+"test2 : ", stat.PASS);
52 } else {
53 stat.addStatus(testSuite+"test2 : ", stat.FAIL);
54 }
Vinay Vishal57171472018-09-18 20:22:00 +053055
David Matějčekf4dc06a2021-05-17 12:10:57 +020056 if ( simpleBMP.test3() ) {
57 stat.addStatus(testSuite+"test3 : ", stat.PASS);
58 } else {
59 stat.addStatus(testSuite+"test3 : ", stat.FAIL);
60 }
61
62 System.out.println("jdbc appauthtx status:");
63 stat.printSummary();
Vinay Vishal57171472018-09-18 20:22:00 +053064 }
65}