| This test is for testing if ic-based policy for loadbalancing works. |
| The following is happening in the client code: |
| InitialContext initial is used for looking up the following: |
| ejb/MyStudent |
| |
| Lookup is performed thrice with 3 different InitialContexts. |
| |
| The appclient script takes in a new config file called sun-acc-lb.xml which specifies the loadbalancingpolicy and endpoint list. Please specify the endpoints list as host:port values separated by comma. |
| For standalone clients, please modify the EnrollerClient.java's ENDPOINTS variable to specify the endpoints. |
| |
| Assume there are 2 hosts specified: |
| a:3700 and b:3700 |
| |
| start the server under domain1 for machine a |
| start the server under domain2 for machine b |
| start pointbase for both machines. |
| |
| run the following for the primary machine (for e.g. a) : |
| ant build setup deploy |
| |
| run the following for the secondary machine (for e.g. b) : |
| ant deploy |
| |
| Next, run the following for the primary machine (for e.g. a) : |
| ant run |
| |
| This will run the appclient twice, with java.naming.factory.initial set to |
| - com.sun.enterprise.naming.SerialInitContextFactory |
| - com.sun.appserv.naming.S1ASCtxFactory |
| |
| Next the stand alone client will be run with java.naming.factory.initial set to |
| - com.sun.enterprise.naming.SerialInitContextFactory |
| - com.sun.appserv.naming.S1ASCtxFactory |
| |
| |
| After executing the client, you can view the log created in the file specified in sun-acc-lb.xml. |
| The log displays the SerialContext instance value (address). Please keep the Log level to FINE. The same instance should be used for looking up the ejb refs. |
| |
| Make sure you run "ant unsetup setup" on all machines before executing the test multiple times. |
| |
| ant run does the following: |
| run appclient with SerialInitContextFactory |
| run appclient with S1ASCtxFactory |
| run standalone client with SerialInitContextFactory |
| run standalone client with S1ASCtxFactory |
| |
| This has a problem with cleaning the database if the server instances are on different machines. In that case, run appclient separately as "ant run-appclient" |
| |
| Remember to: |
| 1> comment out "-xml ..." in the runclient-common target in $APS_HOME/config/common.xml |
| 2> specify endpoints and target serverhost/port in sun-acc-lb.xml,sun-acc-lb1.xml,sun-acc-lb2.xml |
| 3> make sure that the admin's port is 4848 else you will need to modify the cluster-setup & cluster-unsetup scripts. |
| 4> start derby |
| 5> run "ant all" |
| 6> there are 4 cases: |
| sun-acc-lb.xml : no target-server specified. So results in a parse error |
| sun-acc.-lb1.xml : target-server+ specified and no endpoints |
| sun-acc-lb2.xml : both specified |
| sun-acc-lb3.xml :endpoints specified , only 1 target-server specified. |
| |
| 7> Do this for debugging : execute the following: |
| ./asadmin set --user admin --password adminadmin --host localhost --port 4848 domain.resources.jdbc-connection-pool.bmpEnrollerPool.property.DatabaseName=jdbc:pointbase:server://localhost:9092/sqe-samples,new |
| ./asadmin set --user admin --password adminadmin --host localhost --port 4848 domain.resources.jdbc-connection-pool.bmpEnrollerPool.property.User=pbPublic |
| ./asadmin set --user admin --password adminadmin --host localhost --port 4848 domain.resources.jdbc-connection-pool.bmpEnrollerPool.property.Password=pbPublic |
| ./asadmin create-jdbc-connection-pool --datasourceclassname com.pointbase.jdbc.jdbcDataSource --restype javax.sql.DataSource --target C1 --user admin --password adminadmin bmpEnrollerPool |
| ./asadmin create-jdbc-resource --user admin --password adminadmin --connectionpoolid bmpEnrollerPool --target C1 jdbc/bmp-enrollerDB |
| ./asadmin deploy --user admin --password adminadmin --target C1 --type application --retrieve /home/sheetal/ws7-15/appserv-tests//build/module/archive /home/sheetal/ws7-15/appserv-tests//build/module/archive/loadbalancing-AppApp.ear |