01: package org.mockejb.test;
02:
03: import javax.ejb.CreateException;
04: import javax.ejb.EJBObject;
05: import javax.jms.JMSException;
06: import javax.naming.NamingException;
07: import java.util.Collection;
08: import java.security.Principal;
09: import java.sql.SQLException;
10: import java.rmi.RemoteException;
11:
12: /**
13: * Business interface of the sample bean.
14: * You can also use local interface with mockejb.
15: */
16: public interface SampleService extends EJBObject {
17:
18: public final static String JNDI_NAME = "mockejb/SampleService";
19:
20: String echoString(String input) throws RemoteException;
21:
22: String invokeOtherBean() throws NamingException, CreateException,
23: RemoteException;
24:
25: void invokeExternalService() throws NamingException,
26: CreateException, RemoteException;
27:
28: /**
29: * Sends the message with the provided message text to the test topic
30: * @param message message text to send
31: * @throws NamingException
32: * @throws JMSException
33: */
34: void sendMessage(String message) throws NamingException,
35: JMSException, RemoteException;
36:
37: /**
38: * Retrieves all values for the column from the provided table
39: * @param columnName column name to select from
40: * @param tableName table name to select from
41: * @return collection of retrieved values
42: */
43: Collection selectFromTable(String tableName, String columnName)
44: throws NamingException, SQLException, RemoteException;
45:
46: /**
47: * Add a record to the table and rolls back the transaction
48: */
49: void rollbackSampleTransaction() throws NamingException,
50: SQLException, CreateException, RemoteException;
51:
52: void throwSystemException() throws NamingException,
53: CreateException, RemoteException;
54:
55: void throwAppException() throws RemoteException, Exception;
56:
57: // Methods for security testing
58:
59: /**
60: * Returns the result of the EJBContext.isCallerInRole check.
61: * @param name role name
62: * @return true if the current user has the given role
63: */
64: boolean hasRole(String role);
65:
66: /**
67: * Returns the principal provided by the "getCallerPrincipal" method of
68: * the EJBContext for this bean.
69: *
70: * @return current principal
71: */
72: Principal getPrincipal();
73: }
|