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 T1PassStringsTestCase 42 extends JBossTestCase 43 { 44 46 private java.util.Properties cosnamingJndiProps; 48 String str10 = "0123456789"; 49 String str100; 50 String str1000; 51 String str10000; 52 53 55 public T1PassStringsTestCase(String name) 57 throws java.io.IOException 58 { 59 super(name); 60 java.net.URL url; 61 62 url = ClassLoader.getSystemResource("cosnaming.jndi.properties"); 63 cosnamingJndiProps = new java.util.Properties (); 64 cosnamingJndiProps.load(url.openStream()); 65 66 str100 = ""; 67 for (int i = 0; i < 10; i++) 68 str100 = str100 + str10; 69 70 str1000 = ""; 71 for (int i = 0; i < 10; i++) 72 str1000 = str1000 + str100; 73 74 str10000 = ""; 75 for (int i = 0; i < 10; i++) 76 str10000 = str10000 + str1000; 77 78 } 79 80 82 InitialContext getInitialContext(java.util.Properties jndiProps) 83 throws Exception 84 { 85 return new InitialContext(jndiProps); 86 } 87 88 90 95 public void testJRMPSendString10() 96 throws Exception 97 { 98 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 99 getInitialContext().lookup(SessionHome.JNDI_NAME), 100 SessionHome.class); 101 Session session = home.create(); 102 int n = getIterationCount(); 103 long start = System.currentTimeMillis(); 104 for (int i = 0 ; i < n; i++) 105 { 106 session.sendString(str10); 107 } 108 long end = System.currentTimeMillis(); 109 getLog().info("JRMP sendString(10): " + 110 ((end - start) / (double)n) + " ms/call"); 111 } 112 113 118 public void testIIOPSendString10() 119 throws Exception 120 { 121 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 122 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 123 SessionHome.class); 124 Session session = home.create(); 125 int n = getIterationCount(); 126 long start = System.currentTimeMillis(); 127 for (int i = 0 ; i < n; i++) 128 { 129 session.sendString(str10); 130 } 131 long end = System.currentTimeMillis(); 132 getLog().info("IIOP sendString(10): " + 133 ((end - start) / (double)n) + " ms/call"); 134 } 135 136 141 public void testJRMPReceiveString10() 142 throws Exception 143 { 144 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 145 getInitialContext().lookup(SessionHome.JNDI_NAME), 146 SessionHome.class); 147 Session session = home.create(); 148 session.sendString(str10); 149 int n = getIterationCount(); 150 long start = System.currentTimeMillis(); 151 for (int i = 0 ; i < n; i++) 152 { 153 session.receiveString(); 154 } 155 long end = System.currentTimeMillis(); 156 getLog().info("JRMP receiveString(10): " + 157 ((end - start) / (double)n) + " ms/call"); 158 } 159 160 165 public void testIIOPReceiveString10() 166 throws Exception 167 { 168 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 169 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 170 SessionHome.class); 171 Session session = home.create(); 172 session.sendString(str10); 173 int n = getIterationCount(); 174 long start = System.currentTimeMillis(); 175 for (int i = 0 ; i < n; i++) 176 { 177 session.receiveString(); 178 } 179 long end = System.currentTimeMillis(); 180 getLog().info("IIOP receiveString(10): " + 181 ((end - start) / (double)n) + " ms/call"); 182 } 183 184 189 public void testJRMPSendReceiveString10() 190 throws Exception 191 { 192 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 193 getInitialContext().lookup(SessionHome.JNDI_NAME), 194 SessionHome.class); 195 Session session = home.create(); 196 int n = getIterationCount(); 197 long start = System.currentTimeMillis(); 198 for (int i = 0 ; i < n; i++) 199 { 200 session.sendReceiveString(str10); 201 } 202 long end = System.currentTimeMillis(); 203 getLog().info("JRMP sendReceiveString(10): " + 204 ((end - start) / (double)n) + " ms/call"); 205 } 206 207 212 public void testIIOPSendReceiveString10() 213 throws Exception 214 { 215 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 216 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 217 SessionHome.class); 218 Session session = home.create(); 219 int n = getIterationCount(); 220 long start = System.currentTimeMillis(); 221 for (int i = 0 ; i < n; i++) 222 { 223 session.sendReceiveString(str10); 224 } 225 long end = System.currentTimeMillis(); 226 getLog().info("IIOP sendReceiveString(10): " + 227 ((end - start) / (double)n) + " ms/call"); 228 } 229 230 235 public void testJRMPSendString100() 236 throws Exception 237 { 238 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 239 getInitialContext().lookup(SessionHome.JNDI_NAME), 240 SessionHome.class); 241 Session session = home.create(); 242 int n = getIterationCount(); 243 long start = System.currentTimeMillis(); 244 for (int i = 0 ; i < n; i++) 245 { 246 session.sendString(str100); 247 } 248 long end = System.currentTimeMillis(); 249 getLog().info("JRMP sendString(100): " + 250 ((end - start) / (double)n) + " ms/call"); 251 } 252 253 258 public void testIIOPSendString100() 259 throws Exception 260 { 261 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 262 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 263 SessionHome.class); 264 Session session = home.create(); 265 int n = getIterationCount(); 266 long start = System.currentTimeMillis(); 267 for (int i = 0 ; i < n; i++) 268 { 269 session.sendString(str100); 270 } 271 long end = System.currentTimeMillis(); 272 getLog().info("IIOP sendString(100): " + 273 ((end - start) / (double)n) + " ms/call"); 274 } 275 276 281 public void testJRMPReceiveString100() 282 throws Exception 283 { 284 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 285 getInitialContext().lookup(SessionHome.JNDI_NAME), 286 SessionHome.class); 287 Session session = home.create(); 288 session.sendString(str100); 289 int n = getIterationCount(); 290 long start = System.currentTimeMillis(); 291 for (int i = 0 ; i < n; i++) 292 { 293 session.receiveString(); 294 } 295 long end = System.currentTimeMillis(); 296 getLog().info("JRMP receiveString(100): " + 297 ((end - start) / (double)n) + " ms/call"); 298 } 299 300 305 public void testIIOPReceiveString100() 306 throws Exception 307 { 308 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 309 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 310 SessionHome.class); 311 Session session = home.create(); 312 session.sendString(str100); 313 int n = getIterationCount(); 314 long start = System.currentTimeMillis(); 315 for (int i = 0 ; i < n; i++) 316 { 317 session.receiveString(); 318 } 319 long end = System.currentTimeMillis(); 320 getLog().info("IIOP receiveString(100): " + 321 ((end - start) / (double)n) + " ms/call"); 322 } 323 324 329 public void testJRMPSendReceiveString100() 330 throws Exception 331 { 332 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 333 getInitialContext().lookup(SessionHome.JNDI_NAME), 334 SessionHome.class); 335 Session session = home.create(); 336 int n = getIterationCount(); 337 long start = System.currentTimeMillis(); 338 for (int i = 0 ; i < n; i++) 339 { 340 session.sendReceiveString(str100); 341 } 342 long end = System.currentTimeMillis(); 343 getLog().info("JRMP sendReceiveString(100): " + 344 ((end - start) / (double)n) + " ms/call"); 345 } 346 347 352 public void testIIOPSendReceiveString100() 353 throws Exception 354 { 355 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 356 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 357 SessionHome.class); 358 Session session = home.create(); 359 int n = getIterationCount(); 360 long start = System.currentTimeMillis(); 361 for (int i = 0 ; i < n; i++) 362 { 363 session.sendReceiveString(str100); 364 } 365 long end = System.currentTimeMillis(); 366 getLog().info("IIOP sendReceiveString(100): " + 367 ((end - start) / (double)n) + " ms/call"); 368 } 369 370 375 public void testJRMPSendString1000() 376 throws Exception 377 { 378 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 379 getInitialContext().lookup(SessionHome.JNDI_NAME), 380 SessionHome.class); 381 Session session = home.create(); 382 int n = getIterationCount(); 383 long start = System.currentTimeMillis(); 384 for (int i = 0 ; i < n; i++) 385 { 386 session.sendString(str1000); 387 } 388 long end = System.currentTimeMillis(); 389 getLog().info("JRMP sendString(1000): " + 390 ((end - start) / (double)n) + " ms/call"); 391 } 392 393 398 public void testIIOPSendString1000() 399 throws Exception 400 { 401 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 402 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 403 SessionHome.class); 404 Session session = home.create(); 405 int n = getIterationCount(); 406 long start = System.currentTimeMillis(); 407 for (int i = 0 ; i < n; i++) 408 { 409 session.sendString(str1000); 410 } 411 long end = System.currentTimeMillis(); 412 getLog().info("IIOP sendString(1000): " + 413 ((end - start) / (double)n) + " ms/call"); 414 } 415 416 421 public void testJRMPReceiveString1000() 422 throws Exception 423 { 424 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 425 getInitialContext().lookup(SessionHome.JNDI_NAME), 426 SessionHome.class); 427 Session session = home.create(); 428 session.sendString(str1000); 429 int n = getIterationCount(); 430 long start = System.currentTimeMillis(); 431 for (int i = 0 ; i < n; i++) 432 { 433 session.receiveString(); 434 } 435 long end = System.currentTimeMillis(); 436 getLog().info("JRMP receiveString(1000): " + 437 ((end - start) / (double)n) + " ms/call"); 438 } 439 440 445 public void testIIOPReceiveString1000() 446 throws Exception 447 { 448 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 449 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 450 SessionHome.class); 451 Session session = home.create(); 452 session.sendString(str1000); 453 int n = getIterationCount(); 454 long start = System.currentTimeMillis(); 455 for (int i = 0 ; i < n; i++) 456 { 457 session.receiveString(); 458 } 459 long end = System.currentTimeMillis(); 460 getLog().info("IIOP receiveString(1000): " + 461 ((end - start) / (double)n) + " ms/call"); 462 } 463 464 469 public void testJRMPSendReceiveString1000() 470 throws Exception 471 { 472 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 473 getInitialContext().lookup(SessionHome.JNDI_NAME), 474 SessionHome.class); 475 Session session = home.create(); 476 int n = getIterationCount(); 477 long start = System.currentTimeMillis(); 478 for (int i = 0 ; i < n; i++) 479 { 480 session.sendReceiveString(str1000); 481 } 482 long end = System.currentTimeMillis(); 483 getLog().info("JRMP sendReceiveString(1000): " + 484 ((end - start) / (double)n) + " ms/call"); 485 } 486 487 492 public void testIIOPSendReceiveString1000() 493 throws Exception 494 { 495 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 496 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 497 SessionHome.class); 498 Session session = home.create(); 499 int n = getIterationCount(); 500 long start = System.currentTimeMillis(); 501 for (int i = 0 ; i < n; i++) 502 { 503 session.sendReceiveString(str1000); 504 } 505 long end = System.currentTimeMillis(); 506 getLog().info("IIOP sendReceiveString(1000): " + 507 ((end - start) / (double)n) + " ms/call"); 508 } 509 510 515 public void testJRMPSendString10000() 516 throws Exception 517 { 518 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 519 getInitialContext().lookup(SessionHome.JNDI_NAME), 520 SessionHome.class); 521 Session session = home.create(); 522 int n = getIterationCount(); 523 long start = System.currentTimeMillis(); 524 for (int i = 0 ; i < n; i++) 525 { 526 session.sendString(str10000); 527 } 528 long end = System.currentTimeMillis(); 529 getLog().info("JRMP sendString(10000): " + 530 ((end - start) / (double)n) + " ms/call"); 531 } 532 533 538 public void testIIOPSendString10000() 539 throws Exception 540 { 541 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 542 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 543 SessionHome.class); 544 Session session = home.create(); 545 int n = getIterationCount(); 546 long start = System.currentTimeMillis(); 547 for (int i = 0 ; i < n; i++) 548 { 549 session.sendString(str10000); 550 } 551 long end = System.currentTimeMillis(); 552 getLog().info("IIOP sendString(10000): " + 553 ((end - start) / (double)n) + " ms/call"); 554 } 555 556 561 public void testJRMPReceiveString10000() 562 throws Exception 563 { 564 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 565 getInitialContext().lookup(SessionHome.JNDI_NAME), 566 SessionHome.class); 567 Session session = home.create(); 568 session.sendString(str10000); 569 int n = getIterationCount(); 570 long start = System.currentTimeMillis(); 571 for (int i = 0 ; i < n; i++) 572 { 573 session.receiveString(); 574 } 575 long end = System.currentTimeMillis(); 576 getLog().info("JRMP receiveString(10000): " + 577 ((end - start) / (double)n) + " ms/call"); 578 } 579 580 585 public void testIIOPReceiveString10000() 586 throws Exception 587 { 588 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 589 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 590 SessionHome.class); 591 Session session = home.create(); 592 session.sendString(str10000); 593 int n = getIterationCount(); 594 long start = System.currentTimeMillis(); 595 for (int i = 0 ; i < n; i++) 596 { 597 session.receiveString(); 598 } 599 long end = System.currentTimeMillis(); 600 getLog().info("IIOP receiveString(10000): " + 601 ((end - start) / (double)n) + " ms/call"); 602 } 603 604 609 public void testJRMPSendReceiveString10000() 610 throws Exception 611 { 612 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 613 getInitialContext().lookup(SessionHome.JNDI_NAME), 614 SessionHome.class); 615 Session session = home.create(); 616 int n = getIterationCount(); 617 long start = System.currentTimeMillis(); 618 for (int i = 0 ; i < n; i++) 619 { 620 session.sendReceiveString(str10000); 621 } 622 long end = System.currentTimeMillis(); 623 getLog().info("JRMP sendReceiveString(10000): " + 624 ((end - start) / (double)n) + " ms/call"); 625 } 626 627 632 public void testIIOPSendReceiveString10000() 633 throws Exception 634 { 635 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 636 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 637 SessionHome.class); 638 Session session = home.create(); 639 int n = getIterationCount(); 640 long start = System.currentTimeMillis(); 641 for (int i = 0 ; i < n; i++) 642 { 643 session.sendReceiveString(str10000); 644 } 645 long end = System.currentTimeMillis(); 646 getLog().info("IIOP sendReceiveString(10000): " + 647 ((end - start) / (double)n) + " ms/call"); 648 } 649 650 public static Test suite() throws Exception 651 { 652 return getDeploySetup(T1PassStringsTestCase.class, "iiopperf.jar"); 653 } 654 655 } 656 | Popular Tags |