1 22 package org.jboss.ejb3.test.ssladvanced.unit; 23 24 import javax.naming.InitialContext ; 25 import javax.naming.NamingException ; 26 import org.jboss.ejb3.test.ssladvanced.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 testOverrideSSLBindings() throws Exception 83 { 84 System.out.println("*** TEST SSL Bindings"); 85 InitialContext ctx = new InitialContext (); 86 BusinessInterface sf = (BusinessInterface)ctx.lookup("OverrideStatefulClusteredSSL"); 87 assertEquals(sf.echo("123"), "123"); 88 } 89 90 public void testNormalBindings() throws Exception 91 { 92 System.out.println("*** TEST Normal Bindings"); 93 InitialContext ctx = new InitialContext (); 94 BusinessInterface sf = (BusinessInterface)ctx.lookup("StatefulNormal"); 95 assertEquals(sf.echo("123"), "*** 123 ***"); 96 97 BusinessInterface sfc = (BusinessInterface)ctx.lookup("StatefulClusteredNormal"); 98 assertEquals(sfc.echo("123"), "*** 123 ***"); 99 100 BusinessInterface sl = (BusinessInterface)ctx.lookup("StatelessNormal"); 101 assertEquals(sl.echo("123"), "*** 123 ***"); 102 103 BusinessInterface slc = (BusinessInterface)ctx.lookup("StatelessClusteredNormal"); 104 assertEquals(slc.echo("123"), "*** 123 ***"); 105 106 System.out.println("*** success"); 107 } 108 109 public void testOverrideNormalBindings() throws Exception 110 { 111 System.out.println("*** TEST Normal Bindings"); 112 InitialContext ctx = new InitialContext (); 113 BusinessInterface sf = (BusinessInterface)ctx.lookup("OverrideStatefulClusteredNormal"); 114 assertEquals(sf.echo("123"), "123"); 115 } 116 117 118 public static Test suite() throws Exception 119 { 120 return getDeploySetup(SSLUnitTestCase.class, "ssladvanced-test.jar"); 121 } 122 123 124 } 125 | Popular Tags |