This topic covers basic steps and operations to test a CORBA (Common Object Request Broker Architecture) server. There are several ways to ensure the correct functionality of a CORBA server; the following are a few examples and simple exercises to help you better understand how SOAtest can simplify the process of server testing. Different scenarios will show how SOAtest can be incorporated into the testing of non-SOAP servers.
Sections include:
Note: Continue to Scenario 2 if you already have a Java client created.
To use the interfaces/IDL offered by the server, you need to generate the java stubs on the client side. In this section we are going to cover simple IDL to Java conversions.
A sample Calculator.idl file for the following exercise is included in the <INSTALL>/plugins/com.parasoft.ptest.libs.web_<VERSION>/root/build/examples/CORBA directory. In order to use IDLJ, make sure you have J2SDK installed and set the PATH variable so you can access the J2SDK’s executables from any directory.
To convert IDL to Java using IDLJ, complete the following:
Open a command prompt and navigate to the <INSTALL>/plugins/com.parasoft.ptest.libs.web_<VERSION>/root/build/examples/CORBA directory that contains the Calculator.idl file.
Run the following command to automatically generate packages with correct paths (Windows example):
idlj –pkgTranslate Persistent examples.CORBA –fall Calculator.idl |
Run the following command to compile the java files:
javac ../examples/CORBA/*.java. |
Now you have the necessary class files needed to communicate with the server. Please continue on to Scenario 2 to interface SOAtest with an existing java client.
For more information on IDLJ see the Oracle Java documentation.
In this section we will demonstrate how to invoke Java services from a CORBA server by using SOAtest’s Extension tool.
Select the Extension tool node, in the right GUI panel select the appropriate language from the Language drop-down menu to access your CORBA Java Client.
For example, for Jython you can enter something similar to the following in the Text field:
# In our example, examples.CORBA.PersistentClient is our CORBA Java Client from examples.CORBA import * from java.lang import * def foo(input, context): # Here we are Initializing the client by providing location of the server, # port number, and the service name client = PersistentClient("goldfish.parasoft.com", 2222, "GoldfishCorbaServer") # Here we are making the actual Method Invocation onto the Service "add(x,y)" return client.add(3, 5) |
foo()
.In this section we will demonstrate how to invoke non-Java services from CORBA server by using SOAtest’s External tool.