1 22 package org.jboss.ejb3.test.ssl.unit; 23 24 import javax.naming.InitialContext ; 25 import javax.naming.NamingException ; 26 import org.jboss.ejb3.test.ssl.BusinessInterface; 27 import org.jboss.test.JBossTestCase; 28 import junit.framework.Test; 29 30 36 37 public class SSLUnitTestCase 38 extends JBossTestCase 39 { 40 org.jboss.logging.Logger log = getLog(); 41 42 43 public SSLUnitTestCase(String name) 44 { 45 super(name); 46 } 47 48 public void testNoDefaultBinding() throws Exception 49 { 50 System.out.println("*** TEST No default binding"); 51 InitialContext ctx = new InitialContext (); 52 try 53 { 54 BusinessInterface bi = (BusinessInterface)ctx.lookup(BusinessInterface.class.getName()); 55 throw new Exception ("Nothing should be bound to the default name"); 56 } 57 catch(NamingException e) 58 { 59 60 } 61 System.out.println("*** success"); 62 } 63 64 public void testSSLBindings() throws Exception 65 { 66 System.out.println("*** TEST SSL Bindings"); 67 InitialContext ctx = new InitialContext (); 68 BusinessInterface sf = (BusinessInterface)ctx.lookup("StatefulSSL"); 69 assertEquals(sf.echo("123"), "*** 123 ***"); 70 71 BusinessInterface sfc = (BusinessInterface)ctx.lookup("StatefulClusteredSSL"); 72 assertEquals(sfc.echo("123"), "*** 123 ***"); 73 74 BusinessInterface sl = (BusinessInterface)ctx.lookup("StatelessSSL"); 75 assertEquals(sl.echo("123"), "*** 123 ***"); 76 77 BusinessInterface slc = (BusinessInterface)ctx.lookup("StatelessClusteredSSL"); 78 assertEquals(slc.echo("123"), "*** 123 ***"); 79 System.out.println("*** success"); 80 } 81 82 public void testNormalBindings() throws Exception 83 { 84 System.out.println("*** TEST Normal Bindings"); 85 InitialContext ctx = new InitialContext (); 86 BusinessInterface sf = (BusinessInterface)ctx.lookup("StatefulNormal"); 87 assertEquals(sf.echo("123"), "*** 123 ***"); 88 89 BusinessInterface sfc = (BusinessInterface)ctx.lookup("StatefulClusteredNormal"); 90 assertEquals(sfc.echo("123"), "*** 123 ***"); 91 92 BusinessInterface sl = (BusinessInterface)ctx.lookup("StatelessNormal"); 93 assertEquals(sl.echo("123"), "*** 123 ***"); 94 95 BusinessInterface slc = (BusinessInterface)ctx.lookup("StatelessClusteredNormal"); 96 assertEquals(slc.echo("123"), "*** 123 ***"); 97 98 System.out.println("*** success"); 99 } 100 101 102 public static Test suite() throws Exception 103 { 104 return getDeploySetup(SSLUnitTestCase.class, "ssl-test.jar"); 105 } 106 107 108 } 109 | Popular Tags |