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 T5PassStringArraysTestCase 42 extends JBossTestCase 43 { 44 46 private java.util.Properties cosnamingJndiProps; 48 String [] sa10; 49 String [] sa100; 50 String [] sa1000; 51 String [] sa10000; 52 53 55 public T5PassStringArraysTestCase(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 sa10 = new String [10]; 67 for (int i = 0; i < sa10.length; i++) 68 sa10[i] = "" + i; 69 70 sa100 = new String [100]; 71 for (int i = 0; i < sa100.length; i++) 72 sa100[i] = "" + i; 73 74 sa1000 = new String [1000]; 75 for (int i = 0; i < sa1000.length; i++) 76 sa1000[i] = "" + i; 77 78 sa10000 = new String [10000]; 79 for (int i = 0; i < sa10000.length; i++) 80 sa10000[i] = "" + i; 81 } 82 83 85 InitialContext getInitialContext(java.util.Properties jndiProps) 86 throws Exception 87 { 88 return new InitialContext(jndiProps); 89 } 90 91 93 98 public void testJRMPSendStringArray10() 99 throws Exception 100 { 101 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 102 getInitialContext().lookup(SessionHome.JNDI_NAME), 103 SessionHome.class); 104 Session session = home.create(); 105 int n = getIterationCount(); 106 long start = System.currentTimeMillis(); 107 for (int i = 0 ; i < n; i++) 108 { 109 session.sendStringArray(sa10); 110 } 111 long end = System.currentTimeMillis(); 112 getLog().info("JRMP sendStringArray(10): " + 113 ((end - start) / (double)n) + " ms/call"); 114 } 115 116 121 public void testIIOPSendStringArray10() 122 throws Exception 123 { 124 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 125 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 126 SessionHome.class); 127 Session session = home.create(); 128 int n = getIterationCount(); 129 long start = System.currentTimeMillis(); 130 for (int i = 0 ; i < n; i++) 131 { 132 session.sendStringArray(sa10); 133 } 134 long end = System.currentTimeMillis(); 135 getLog().info("IIOP sendStringArray(10): " + 136 ((end - start) / (double)n) + " ms/call"); 137 } 138 139 144 public void testJRMPReceiveStringArray10() 145 throws Exception 146 { 147 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 148 getInitialContext().lookup(SessionHome.JNDI_NAME), 149 SessionHome.class); 150 Session session = home.create(); 151 session.sendStringArray(sa10); 152 int n = getIterationCount(); 153 long start = System.currentTimeMillis(); 154 for (int i = 0 ; i < n; i++) 155 { 156 session.receiveStringArray(); 157 } 158 long end = System.currentTimeMillis(); 159 getLog().info("JRMP receiveStringArray(10): " + 160 ((end - start) / (double)n) + " ms/call"); 161 } 162 163 168 public void testIIOPReceiveStringArray10() 169 throws Exception 170 { 171 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 172 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 173 SessionHome.class); 174 Session session = home.create(); 175 session.sendStringArray(sa10); 176 int n = getIterationCount(); 177 long start = System.currentTimeMillis(); 178 for (int i = 0 ; i < n; i++) 179 { 180 session.receiveStringArray(); 181 } 182 long end = System.currentTimeMillis(); 183 getLog().info("IIOP receiveStringArray(10): " + 184 ((end - start) / (double)n) + " ms/call"); 185 } 186 187 192 public void testJRMPSendReceiveStringArray10() 193 throws Exception 194 { 195 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 196 getInitialContext().lookup(SessionHome.JNDI_NAME), 197 SessionHome.class); 198 Session session = home.create(); 199 int n = getIterationCount(); 200 long start = System.currentTimeMillis(); 201 for (int i = 0 ; i < n; i++) 202 { 203 session.sendReceiveStringArray(sa10); 204 } 205 long end = System.currentTimeMillis(); 206 getLog().info("JRMP sendReceiveStringArray(10): " + 207 ((end - start) / (double)n) + " ms/call"); 208 } 209 210 215 public void testIIOPSendReceiveStringArray10() 216 throws Exception 217 { 218 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 219 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 220 SessionHome.class); 221 Session session = home.create(); 222 int n = getIterationCount(); 223 long start = System.currentTimeMillis(); 224 for (int i = 0 ; i < n; i++) 225 { 226 session.sendReceiveStringArray(sa10); 227 } 228 long end = System.currentTimeMillis(); 229 getLog().info("IIOP sendReceiveStringArray(10): " + 230 ((end - start) / (double)n) + " ms/call"); 231 } 232 233 238 public void testJRMPSendStringArray100() 239 throws Exception 240 { 241 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 242 getInitialContext().lookup(SessionHome.JNDI_NAME), 243 SessionHome.class); 244 Session session = home.create(); 245 int n = getIterationCount(); 246 long start = System.currentTimeMillis(); 247 for (int i = 0 ; i < n; i++) 248 { 249 session.sendStringArray(sa100); 250 } 251 long end = System.currentTimeMillis(); 252 getLog().info("JRMP sendStringArray(100): " + 253 ((end - start) / (double)n) + " ms/call"); 254 } 255 256 261 public void testIIOPSendStringArray100() 262 throws Exception 263 { 264 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 265 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 266 SessionHome.class); 267 Session session = home.create(); 268 int n = getIterationCount(); 269 long start = System.currentTimeMillis(); 270 for (int i = 0 ; i < n; i++) 271 { 272 session.sendStringArray(sa100); 273 } 274 long end = System.currentTimeMillis(); 275 getLog().info("IIOP sendStringArray(100): " + 276 ((end - start) / (double)n) + " ms/call"); 277 } 278 279 284 public void testJRMPReceiveStringArray100() 285 throws Exception 286 { 287 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 288 getInitialContext().lookup(SessionHome.JNDI_NAME), 289 SessionHome.class); 290 Session session = home.create(); 291 session.sendStringArray(sa100); 292 int n = getIterationCount(); 293 long start = System.currentTimeMillis(); 294 for (int i = 0 ; i < n; i++) 295 { 296 session.receiveStringArray(); 297 } 298 long end = System.currentTimeMillis(); 299 getLog().info("JRMP receiveStringArray(100): " + 300 ((end - start) / (double)n) + " ms/call"); 301 } 302 303 308 public void testIIOPReceiveStringArray100() 309 throws Exception 310 { 311 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 312 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 313 SessionHome.class); 314 Session session = home.create(); 315 session.sendStringArray(sa100); 316 int n = getIterationCount(); 317 long start = System.currentTimeMillis(); 318 for (int i = 0 ; i < n; i++) 319 { 320 session.receiveStringArray(); 321 } 322 long end = System.currentTimeMillis(); 323 getLog().info("IIOP receiveStringArray(100): " + 324 ((end - start) / (double)n) + " ms/call"); 325 } 326 327 332 public void testJRMPSendReceiveStringArray100() 333 throws Exception 334 { 335 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 336 getInitialContext().lookup(SessionHome.JNDI_NAME), 337 SessionHome.class); 338 Session session = home.create(); 339 int n = getIterationCount(); 340 long start = System.currentTimeMillis(); 341 for (int i = 0 ; i < n; i++) 342 { 343 session.sendReceiveStringArray(sa100); 344 } 345 long end = System.currentTimeMillis(); 346 getLog().info("JRMP sendReceiveStringArray(100): " + 347 ((end - start) / (double)n) + " ms/call"); 348 } 349 350 355 public void testIIOPSendReceiveStringArray100() 356 throws Exception 357 { 358 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 359 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 360 SessionHome.class); 361 Session session = home.create(); 362 int n = getIterationCount(); 363 long start = System.currentTimeMillis(); 364 for (int i = 0 ; i < n; i++) 365 { 366 session.sendReceiveStringArray(sa100); 367 } 368 long end = System.currentTimeMillis(); 369 getLog().info("IIOP sendReceiveStringArray(100): " + 370 ((end - start) / (double)n) + " ms/call"); 371 } 372 373 378 public void testJRMPSendStringArray1000() 379 throws Exception 380 { 381 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 382 getInitialContext().lookup(SessionHome.JNDI_NAME), 383 SessionHome.class); 384 Session session = home.create(); 385 int n = getIterationCount(); 386 long start = System.currentTimeMillis(); 387 for (int i = 0 ; i < n; i++) 388 { 389 session.sendStringArray(sa1000); 390 } 391 long end = System.currentTimeMillis(); 392 getLog().info("JRMP sendStringArray(1000): " + 393 ((end - start) / (double)n) + " ms/call"); 394 } 395 396 401 public void testIIOPSendStringArray1000() 402 throws Exception 403 { 404 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 405 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 406 SessionHome.class); 407 Session session = home.create(); 408 int n = getIterationCount(); 409 long start = System.currentTimeMillis(); 410 for (int i = 0 ; i < n; i++) 411 { 412 session.sendStringArray(sa1000); 413 } 414 long end = System.currentTimeMillis(); 415 getLog().info("IIOP sendStringArray(1000): " + 416 ((end - start) / (double)n) + " ms/call"); 417 } 418 419 424 public void testJRMPReceiveStringArray1000() 425 throws Exception 426 { 427 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 428 getInitialContext().lookup(SessionHome.JNDI_NAME), 429 SessionHome.class); 430 Session session = home.create(); 431 session.sendStringArray(sa1000); 432 int n = getIterationCount(); 433 long start = System.currentTimeMillis(); 434 for (int i = 0 ; i < n; i++) 435 { 436 session.receiveStringArray(); 437 } 438 long end = System.currentTimeMillis(); 439 getLog().info("JRMP receiveStringArray(1000): " + 440 ((end - start) / (double)n) + " ms/call"); 441 } 442 443 448 public void testIIOPReceiveStringArray1000() 449 throws Exception 450 { 451 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 452 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 453 SessionHome.class); 454 Session session = home.create(); 455 session.sendStringArray(sa1000); 456 int n = getIterationCount(); 457 long start = System.currentTimeMillis(); 458 for (int i = 0 ; i < n; i++) 459 { 460 session.receiveStringArray(); 461 } 462 long end = System.currentTimeMillis(); 463 getLog().info("IIOP receiveStringArray(1000): " + 464 ((end - start) / (double)n) + " ms/call"); 465 } 466 467 472 public void testJRMPSendReceiveStringArray1000() 473 throws Exception 474 { 475 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 476 getInitialContext().lookup(SessionHome.JNDI_NAME), 477 SessionHome.class); 478 Session session = home.create(); 479 int n = getIterationCount(); 480 long start = System.currentTimeMillis(); 481 for (int i = 0 ; i < n; i++) 482 { 483 session.sendReceiveStringArray(sa1000); 484 } 485 long end = System.currentTimeMillis(); 486 getLog().info("JRMP sendReceiveStringArray(1000): " + 487 ((end - start) / (double)n) + " ms/call"); 488 } 489 490 495 public void testIIOPSendReceiveStringArray1000() 496 throws Exception 497 { 498 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 499 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 500 SessionHome.class); 501 Session session = home.create(); 502 int n = getIterationCount(); 503 long start = System.currentTimeMillis(); 504 for (int i = 0 ; i < n; i++) 505 { 506 session.sendReceiveStringArray(sa1000); 507 } 508 long end = System.currentTimeMillis(); 509 getLog().info("IIOP sendReceiveStringArray(1000): " + 510 ((end - start) / (double)n) + " ms/call"); 511 } 512 513 518 public void testJRMPSendStringArray10000() 519 throws Exception 520 { 521 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 522 getInitialContext().lookup(SessionHome.JNDI_NAME), 523 SessionHome.class); 524 Session session = home.create(); 525 int n = getIterationCount(); 526 long start = System.currentTimeMillis(); 527 for (int i = 0 ; i < n; i++) 528 { 529 session.sendStringArray(sa10000); 530 } 531 long end = System.currentTimeMillis(); 532 getLog().info("JRMP sendStringArray(10000): " + 533 ((end - start) / (double)n) + " ms/call"); 534 } 535 536 541 public void testIIOPSendStringArray10000() 542 throws Exception 543 { 544 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 545 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 546 SessionHome.class); 547 Session session = home.create(); 548 int n = getIterationCount(); 549 long start = System.currentTimeMillis(); 550 for (int i = 0 ; i < n; i++) 551 { 552 session.sendStringArray(sa10000); 553 } 554 long end = System.currentTimeMillis(); 555 getLog().info("IIOP sendStringArray(10000): " + 556 ((end - start) / (double)n) + " ms/call"); 557 } 558 559 564 public void testJRMPReceiveStringArray10000() 565 throws Exception 566 { 567 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 568 getInitialContext().lookup(SessionHome.JNDI_NAME), 569 SessionHome.class); 570 Session session = home.create(); 571 session.sendStringArray(sa10000); 572 int n = getIterationCount(); 573 long start = System.currentTimeMillis(); 574 for (int i = 0 ; i < n; i++) 575 { 576 session.receiveStringArray(); 577 } 578 long end = System.currentTimeMillis(); 579 getLog().info("JRMP receiveStringArray(10000): " + 580 ((end - start) / (double)n) + " ms/call"); 581 } 582 583 588 public void testIIOPReceiveStringArray10000() 589 throws Exception 590 { 591 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 592 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 593 SessionHome.class); 594 Session session = home.create(); 595 session.sendStringArray(sa10000); 596 int n = getIterationCount(); 597 long start = System.currentTimeMillis(); 598 for (int i = 0 ; i < n; i++) 599 { 600 session.receiveStringArray(); 601 } 602 long end = System.currentTimeMillis(); 603 getLog().info("IIOP receiveStringArray(10000): " + 604 ((end - start) / (double)n) + " ms/call"); 605 } 606 607 612 public void testJRMPSendReceiveStringArray10000() 613 throws Exception 614 { 615 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 616 getInitialContext().lookup(SessionHome.JNDI_NAME), 617 SessionHome.class); 618 Session session = home.create(); 619 int n = getIterationCount(); 620 long start = System.currentTimeMillis(); 621 for (int i = 0 ; i < n; i++) 622 { 623 session.sendReceiveStringArray(sa10000); 624 } 625 long end = System.currentTimeMillis(); 626 getLog().info("JRMP sendReceiveStringArray(10000): " + 627 ((end - start) / (double)n) + " ms/call"); 628 } 629 630 635 public void testIIOPSendReceiveStringArray10000() 636 throws Exception 637 { 638 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 639 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 640 SessionHome.class); 641 Session session = home.create(); 642 int n = getIterationCount(); 643 long start = System.currentTimeMillis(); 644 for (int i = 0 ; i < n; i++) 645 { 646 session.sendReceiveStringArray(sa10000); 647 } 648 long end = System.currentTimeMillis(); 649 getLog().info("IIOP sendReceiveStringArray(10000): " + 650 ((end - start) / (double)n) + " ms/call"); 651 } 652 653 public static Test suite() throws Exception 654 { 655 return getDeploySetup(T5PassStringArraysTestCase.class, "iiopperf.jar"); 656 } 657 658 } 659 | Popular Tags |