blob: 5d7d017b8afcad056ce6687f7284f6d5efe61493 [file] [log] [blame]
Vinay Vishal57171472018-09-18 20:22:00 +05301/*
2 * Copyright (c) 2006, 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.security.timerStandalone.client;
18
Gaurav Guptaed5e7312020-05-01 07:54:26 +053019import jakarta.ejb.EJB;
Vinay Vishal57171472018-09-18 20:22:00 +053020import com.sun.s1asdev.security.timerStandalone.*;
21import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
22
23public class Client {
24
David Matějčekf4dc06a2021-05-17 12:10:57 +020025 private static SimpleReporterAdapter stat =
Vinay Vishal57171472018-09-18 20:22:00 +053026 new SimpleReporterAdapter("appserv-tests");
27
28 public static void main (String[] args) {
29
30 stat.addDescription("security-timerStandalone");
31 Client client = new Client(args);
32 client.doTest();
33 stat.printSummary("security-timerStandalone");
David Matějčekf4dc06a2021-05-17 12:10:57 +020034 }
35
Vinay Vishal57171472018-09-18 20:22:00 +053036 public Client (String[] args) {
37 }
38
39 @EJB
40 private static Sful sful;
41
42 @EJB
43 private static Sless sless;
44
45 public void doTest() {
46
47 try {
48
49 System.out.println("invoking stateful");
50 sful.hello();
51
52 System.out.println("invoking stateless");
53 sless.hello();
54
55 System.out.println("Sleeping to wait for timeout to happen...");
56 // wait a bit for timeout to happen
57 Thread.sleep(12000);
58
59 System.out.println("Woke up. Now checking for timeout");
60
61 boolean timeoutCalled = sless.timeoutCalled();
62
63 if( timeoutCalled ) {
64 System.out.println("verified that timeout was called");
65 } else {
66 throw new Exception("timeout not called");
67 }
68
69 System.out.println("test complete");
70
71 stat.addStatus("local main", stat.PASS);
72
73 } catch(Exception e) {
74 e.printStackTrace();
75 stat.addStatus("local main" , stat.FAIL);
76 }
David Matějčekf4dc06a2021-05-17 12:10:57 +020077
78 return;
Vinay Vishal57171472018-09-18 20:22:00 +053079 }
80}