"Java RMI EJB Tutorial.pps"
Java RMI/EJB Tutorial SilkPerformer 2006 Release 2 Introduction This presentation offers an overview of how to record and replay Java RMI and EJB virtual users. It also shows example use of the sample RMI application (Product Manager) that ships with SilkPerformer. 2 11/24/2006 1 What to Record/Replay Record and replay the client A virtual user is a simulated client application RMI/EJB Client Applications Server/ Server farm 3 11/24/2006 Preparation: Create a Project Choose project type Java / Java RMI/EJB (recording) 4 11/24/2006 2 Preparation: Profile Settings Select a Java JDK (version 1.2 or higher) For use internally by the recorder Used for replay via SilkPerformer Java Framework Add the Classpath elements that are required by the recorded application The classpath is not required for recording. It is required for: Compiling the recorded script Replay 5 11/24/2006 Preparation: Profile Settings Choose a JDK Define the classpath Java options 6 11/24/2006 3 Preparation: Profile Settings Set the record log level to Debug When contacting technical support, send exported projects with Debug logging enabled Set log level to Debug 7 11/24/2006 Preparation: Application Profile Define an application profile for the application you want to record Enter the path to the executable / startup script (.exe, Enter the name of the executable .bat, or .cmd) that hosts the Java VM (e.g., java.exe or javaw.exe) Select Custom Application Select the Java APIs that are to be recorded Add a new application profile 8 11/24/2006 4 Preparation: Application Profile for IBM JVM Recording IBM‘s Java virtual machine requires additional settings Edit Java Settings Select Manual 9 11/24/2006 Preparation: Startup Script for IBM JVM Recording IBM‘s Java virtual machine also requires a customized startup script Original startup script Customized copy Insert call to of startup script perfPrepareJavaRecording.cmd (adjust SilkPerformer‘s home directory if necessary) Add the command line parameter %PERFREC_OPTIONS% 10 11/24/2006 5 Recording Click the Model Script workflow button Launch the application Perform the actions that are to be recorded 11 11/24/2006 Recording Recorded Java When you are done: source code Stop recording Save the script Overview log 12 11/24/2006 6 Recorded Result x.java The Java source file that contains the recorded actions This file can be compiled from within the SilkPerformer Workbench The file is compiled automatically The classpath must be specified correctly (Java Profile Settings) x.bdf BDL stub code that launches the Java virtual user 13 11/24/2006 Testing Applets Recording Applets Use Sun Java VM in the browser (not Microsoft) Replay Remove the recorded API calls: JavaSetOption(JAVA_CLASSPATH and JavaSetOption(JAVA_CMDLINE_OPTIONS from the BDL script Obtain JAR and CLASS files from the server; copy these files to the local machine; enter the classpath in Java Profile Settings. Use recorded comments in the recorded Java source code to find JAR and class files // ###ClassPath### // ###Applet CodeBase### // ###Applet parameters queried by the Applet### // codebase=… // archive=… // code=… 14 11/24/2006 7 Example: Product Manager The RMI sample application that ships with SilkPerformer is called Product Manager. To launch Product Manager, go to: C:\Borland\SilkPerformer/Sample Applications/Java Samples/Product Manager 15 11/24/2006 Example: Create a Project Project type: Java / Java RMI/EJB (recording) 16 11/24/2006 8 Example: Application Profile Modify the existing Internet Explorer application profile Deselect Web Select Java RMI Select Java JNDI This is required because this sample uses JNDI for the bootstrapping of remote object references 17 11/24/2006 Example: Profile Settings Specify script generation details at Profile Settings / Record / Script / Java 18 11/24/2006 9 Example: Profile Settings Specify Java Settings Add ProductManager.jar from the SilkPerformer samples directory 19 11/24/2006 Example: Start Servers Start the RMI and LDAP servers Open the Product Manager sample HTML page and follow the instructions: Step 1: Start the LDAP database Step 2: Start JNDI name server Step 3: Start RMI over IIOP server 20 11/24/2006 10 Example: Model Script Open the Model Script dialog Enter the location of the RMI sample application HTML page Click the ProductManager – DemoVersion.htm link to launch the applet The applet loads and the recorder begins recording the JNDI and RMI activities of the applet. Perform searches for products; change products; add new products, etc. 21 11/24/2006 Example: Save the Recorded Script Save the recorded script Specify a valid Java identifier 22 11/24/2006 11 Example: Recorded BDL Script Comment out (or delete) the recorded API calls: JavaSetOption(JAVA_CLASSPATH JavaSetOption(JAVA_CMDLINE_OPTIONS 23 11/24/2006 Example: Recorded Java Script 24 11/24/2006 12 Example: Replay Script Continue with SilkPerformer‘s workflow: Run a TryScript Customize the script Identify the baseline 25 11/24/2006 13