Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.sun.s1asdev.jdbc.appauthtx.client; |
| 18 | |
| 19 | import javax.naming.*; |
| 20 | import java.rmi.*; |
| 21 | import java.util.*; |
| 22 | |
| 23 | import com.sun.s1asdev.jdbc.appauthtx.ejb.SimpleBMPHome; |
| 24 | import com.sun.s1asdev.jdbc.appauthtx.ejb.SimpleBMP; |
| 25 | import com.sun.ejte.ccl.reporter.SimpleReporterAdapter; |
| 26 | |
| 27 | public class SimpleBMPClient { |
| 28 | |
| 29 | public static void main(String[] args) |
| 30 | throws Exception { |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame^] | 31 | |
| 32 | String testSuite = "AppAuthTX "; |
| 33 | SimpleReporterAdapter stat = new SimpleReporterAdapter(); |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 34 | |
| 35 | InitialContext ic = new InitialContext(); |
| 36 | Object objRef = ic.lookup("java:comp/env/ejb/SimpleBMPHome"); |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame^] | 37 | SimpleBMPHome simpleBMPHome = (SimpleBMPHome) |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 38 | javax.rmi.PortableRemoteObject.narrow(objRef, SimpleBMPHome.class); |
| 39 | |
| 40 | SimpleBMP simpleBMP = simpleBMPHome.create(); |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame^] | 41 | stat.addDescription("JDBC Application Authentication TX test"); |
| 42 | |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 43 | System.out.println(" All tests will fail with Derby till XA driver is fixed"); |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame^] | 44 | if ( simpleBMP.test1() ) { |
| 45 | stat.addStatus(testSuite+"test1 : ", stat.PASS); |
| 46 | } else { |
| 47 | stat.addStatus(testSuite+"test1 : ", stat.FAIL); |
| 48 | } |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 49 | |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame^] | 50 | if ( simpleBMP.test2() ) { |
| 51 | stat.addStatus(testSuite+"test2 : ", stat.PASS); |
| 52 | } else { |
| 53 | stat.addStatus(testSuite+"test2 : ", stat.FAIL); |
| 54 | } |
Vinay Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 55 | |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame^] | 56 | 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 Vishal | 5717147 | 2018-09-18 20:22:00 +0530 | [diff] [blame] | 64 | } |
| 65 | } |