Changeset 4108


Ignore:
Timestamp:
06/08/08 15:31:14 (11 years ago)
Author:
cbyrom
Message:

Add new test suite to exercise the EchoClientADB class - and refactor
this to improve testability + add various axis2 config files to be
used in the different tests and add info to docs describing setting
up and running tests.

Location:
TI12-security/trunk/java/axis2
Files:
7 added
2 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/java/axis2/xmlbWsseEchoClient/src/wssecurity/test/security/ndg/EchoClientADB.java

    r4099 r4108  
    33import java.rmi.RemoteException; 
    44 
     5import org.apache.axis2.AxisFault; 
     6import org.apache.axis2.context.ConfigurationContext; 
     7import org.apache.axis2.context.ConfigurationContextFactory; 
     8 
    59import wssecurity.test.security.ndg.EchoServiceADBStub.Echo; 
    610import wssecurity.test.security.ndg.EchoServiceADBStub.EchoResponse; 
    7  
    8 import org.apache.axis2.context.ConfigurationContext; 
    9 import org.apache.axis2.context.ConfigurationContextFactory; 
    1011 
    1112/** 
     
    1718public class EchoClientADB  
    1819{ 
    19     public static void main(java.lang.String args[]) 
     20        private EchoServiceADBStub service = null; 
     21 
     22        public static void main(java.lang.String args[]) 
    2023    { 
    2124        try 
    2225        { 
    23                 String configDir = "/home/users/cbyrom/eclipseWorkspace/TI12-security-java/axis2/xmlbWsseEchoClient"; 
    24                 ConfigurationContext ctx =  
    25                         ConfigurationContextFactory. 
    26                         createConfigurationContextFromFileSystem(configDir,  
    27                                                                                 configDir + "/conf/axis2.xml"); 
     26                EchoClientADB client = new EchoClientADB(); 
     27 
     28                client.configureServiceConnection("/home/users/cbyrom/eclipseWorkspace/TI12-security-java/axis2/xmlbWsseEchoClient", 
     29                                "http://localhost:7000/Echo"); 
    2830                 
    29                 String endpointURI = "http://localhost:7000/Echo"; 
    30                 EchoServiceADBStub service = new EchoServiceADBStub(ctx, endpointURI); 
    31                  
    32                 callEchoService(service); 
     31                client.runServices(); 
    3332        } 
    3433        catch(Exception e) 
    3534        { 
    36                 System.out.println("Something bad happened:"); 
     35                System.out.println("Back to the drawing board...:"); 
    3736            e.printStackTrace(); 
    3837        } 
    3938    } 
    4039 
    41         private static void callEchoService(EchoServiceADBStub service) throws RemoteException  
     40 
     41        private void runServices() throws RemoteException  
     42        { 
     43        this.callEchoService("Hello echo server!"); 
     44        } 
     45 
     46    /** 
     47     * Set up the connection from the client to the service - via the generated stub class 
     48     * @param configDir - axis2 conf directory, with axis2.xml file to set up the connection 
     49     * @param endpointURI - endpoint of service 
     50     * @throws AxisFault  
     51     */ 
     52        public void configureServiceConnection(String configDir, String endpointURI) throws AxisFault  
     53        { 
     54        // set up the connection to the client 
     55        ConfigurationContext ctx =  
     56                ConfigurationContextFactory. 
     57                createConfigurationContextFromFileSystem(configDir,  
     58                                                                        configDir + "/conf/axis2.xml"); 
     59         
     60        this.service = new EchoServiceADBStub(ctx, endpointURI); 
     61        } 
     62 
     63        public EchoResponse callEchoService(String message) throws RemoteException  
    4264        { 
    4365                Echo echoCall = new Echo(); 
    44                 echoCall.setEchoIn("Hello echo server!"); 
    45                 EchoResponse res = service.Echo(echoCall); 
     66                echoCall.setEchoIn(message); 
     67                EchoResponse res = this.service.Echo(echoCall); 
    4668                System.out.println("Service returned successfully - result:"); 
    4769                System.out.println(res.localEchoResult); 
     70                return res; 
     71        } 
     72 
     73 
     74        public void setService(EchoServiceADBStub service) { 
     75                this.service = service; 
    4876        } 
    4977 
  • TI12-security/trunk/java/axis2/xmlbWsseEchoClient/src/wssecurity/test/security/ndg/README.txt

    r4095 r4108  
    858519. Include a password callback class, if this is set in axis2.xml, in the source code structure - NB, the 
    8686basic PWCBHandler.java, included in this directory, can be used as a starting point. 
    87 20. Start up the service associated with the wsdl used in step 6. and run the client as a 
     8720. Adjust the server configuration file - to include the CA cert file in pem format - i.e. 
     88as created in step 16(iii) in the trusted CA cert file list. 
     8921. Start up the service associated with the wsdl used in step 6. and run the client as a 
    8890java app - with luck the service should return without a problem. 
    8991 
     
    9799 
    98100EchoClientADB.java is a client that uses the Axis Data Bindings. 
     101 
     102Running Tests 
     103----------------- 
     104The EchoClientADBTest class contains a number of tests to exercise the EchoClientADB class 
     105under a variety of circumstances.  To get this running, edit the test.properties file so that 
     106the configuration dir and the endpoint url are correct.  NB, the endpoints are currently set 
     107to allow tcpmon to be connected into the system - i.e. input port 7000, service port 7100. 
Note: See TracChangeset for help on using the changeset viewer.