Here are the basic steps - I tried to put it in a doc. The rationale for
using a class for each idl method is:
A) Avoiding DII which will result in generic corba exceptions which are
harder for the user to debug 
B) the class allows the user to put in any special steps or treatment he
needs to do before/after the corba call.
Thanks,
Anil
-------------------------


For Developers (Not So Quick Start)
1.      Ensure that a jar containing the idl generated code is in your
classpath. eg. To test the pmcs server, jar up the Pmcs folder that contains
the java files generated by the idl to java compiler that was run on
Pmcs.idl
2.      For each method in the idl, write a simple class that extends
MethodTask containing the following boiler plate code: 

.       The class should be in the same package as the sampler viz.
org.apache.jmeter.protocol.corba.sampler

.       For each argument (input or output) of the idl method, declare a
member variable of the same type. This will store the input data. Also
declare a reference to the server.

.       implement abstract method execute() that is inherited from
MethodTask. execute() calls connectToServer(), invokes the method on it and
returns the result back to the caller. This method is called by the
CorbaSampler.sample() method which is run during the test.

.       implement abstract method loadInputData() that is inherited from
MethodTask. loadInputData() takes the name-value pairs of strings stored in
the Properties object and loads the input data in member variables of the
correct type.

For example, to test the idl method verifyHome in Pmcs, write this simple
class:

public class VerifyHome extends MethodTask {
  Pmcs.PmcsUserMgt manager;
  String id = ""; // argument in idl method
  public VerifyHome() { }

  public java.lang.Object execute() throws Exception {
    BooleanHolder isHome = null;
    try {
          this.manager = connectToServer();
      isHome = new org.omg.CORBA.BooleanHolder();
      manager.verifyHome(id, isHome);
    }
    catch (UnsupportedOperationError ex) {
    }
    return new Boolean((boolean)isHome.value);
  }

  public void loadInputData(Properties inputData) throws Exception {
          loadConnectionData(inputData);
    id = inputData.getProperty("verifyHome.id");
    if(id == null)
       throw new Exception("verifyHome.id undefined");
   }
}

3.      create input data files in the format below. For ease of use we
employ name-value property data. We store the method to be invoked and its
arguments. These are read by the loadInputData method above. 

# input data file: pmcsInputData.properties
# FORMAT: method.i = methodName
# methodName.param0.field0 =
# methodName.param0.field1 =
# methodName.param0.field1.field00 =
# ...
# example:
# method.3 = createUser
# createUser.id = Gary
# createUser.propertyList.address = "123 Sprint Parkway"
# createUser.propertyList.phone = "913-213 1234"
# createUser.propertyList.title = "CEO"

ORBInitialPort=2500
ORBInitialHost=localhost
ServerNameComponent=PMCSUserManager

method.0 = verifyHome
verifyHome.id = Gary

method.1 = createUser
createUser.id = Gary

4.      test the classes you have written, outside of JMeter. For example in
the VerifyHome class, add a main() to verify that your classes can invoke on
the corba server.

public static void main(String[] args) {
MethodTask vh = new VerifyHome();
Vh.loadInputData((new Properties()).load(new
FileInputStream("inputData.properties")));
Object result = Vh.execute();
System.out.println("result:" + result);
} 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to