1 22 package org.jboss.test.iiopperf.test; 23 24 25 import javax.ejb.*; 26 import javax.naming.*; 27 import javax.rmi.PortableRemoteObject ; 28 29 import org.jboss.test.iiopperf.interfaces.*; 30 31 import junit.framework.Test; 32 import junit.framework.TestCase; 33 import junit.framework.TestSuite; 34 import org.jboss.test.JBossTestCase; 35 36 37 41 public class T9PassExceptionTestCase 42 extends JBossTestCase 43 { 44 46 private java.util.Properties cosnamingJndiProps; 48 49 51 public T9PassExceptionTestCase(String name) 53 throws java.io.IOException 54 { 55 super(name); 56 java.net.URL url; 57 58 url = ClassLoader.getSystemResource("cosnaming.jndi.properties"); 59 cosnamingJndiProps = new java.util.Properties (); 60 cosnamingJndiProps.load(url.openStream()); 61 } 62 63 65 InitialContext getInitialContext(java.util.Properties jndiProps) 66 throws Exception 67 { 68 return new InitialContext(jndiProps); 69 } 70 71 73 78 public void testJRMPReceiveException() 79 throws Exception 80 { 81 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 82 getInitialContext().lookup(SessionHome.JNDI_NAME), 83 SessionHome.class); 84 Session session = home.create(); 85 session.sendRemote(session); 86 int n = getIterationCount(); 87 long start = System.currentTimeMillis(); 88 for (int i = 0 ; i < n; i++) 89 { 90 try 91 { 92 session.throwException(); 93 } 94 catch (Exception e) 95 { 96 } 97 } 98 long end = System.currentTimeMillis(); 99 getLog().info("JRMP throwException: " + 100 ((end - start) / (double)n) + " ms/call"); 101 } 102 103 108 public void testIIOPReceiveException() 109 throws Exception 110 { 111 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 112 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 113 SessionHome.class); 114 Session session = home.create(); 115 session.sendRemote(session); 116 int n = getIterationCount(); 117 long start = System.currentTimeMillis(); 118 for (int i = 0 ; i < n; i++) 119 { 120 try 121 { 122 session.throwException(); 123 } 124 catch (Exception e) 125 { 126 } 127 } 128 long end = System.currentTimeMillis(); 129 getLog().info("IIOP throwException: " + 130 ((end - start) / (double)n) + " ms/call"); 131 } 132 133 public static Test suite() throws Exception 134 { 135 return getDeploySetup(T9PassExceptionTestCase.class, "iiopperf.jar"); 136 } 137 138 } 139 | Popular Tags |