1 22 package org.jboss.test.iiopperf.test; 23 24 import java.util.ArrayList ; 25 import java.util.Collection ; 26 import javax.ejb.*; 27 import javax.naming.*; 28 import javax.rmi.PortableRemoteObject ; 29 30 import org.jboss.test.iiopperf.interfaces.*; 31 32 import junit.framework.Test; 33 import junit.framework.TestCase; 34 import junit.framework.TestSuite; 35 import org.jboss.test.JBossTestCase; 36 37 38 42 public class T7PassCollectionsTestCase 43 extends JBossTestCase 44 { 45 47 private java.util.Properties cosnamingJndiProps; 49 Collection c10; 50 Collection c100; 51 Collection c1000; 52 Collection c10000; 53 54 56 public T7PassCollectionsTestCase(String name) 58 throws java.io.IOException 59 { 60 super(name); 61 java.net.URL url; 62 63 url = ClassLoader.getSystemResource("cosnaming.jndi.properties"); 64 cosnamingJndiProps = new java.util.Properties (); 65 cosnamingJndiProps.load(url.openStream()); 66 67 c10 = new ArrayList (10); 68 for (int i = 0; i < 10; i++) 69 c10.add(new Foo(i, "This is serializable #" + i)); 70 71 c100 = new ArrayList (100); 72 for (int i = 0; i < 100; i++) 73 c100.add(new Foo(i, "This is serializable #" + i)); 74 75 c1000 = new ArrayList (1000); 76 for (int i = 0; i < 1000; i++) 77 c1000.add(new Foo(i, "This is serializable #" + i)); 78 79 c10000 = new ArrayList (10000); 80 for (int i = 0; i < 10000; i++) 81 c10000.add(new Foo(i, "This is serializable #" + i)); 82 83 } 84 85 87 InitialContext getInitialContext(java.util.Properties jndiProps) 88 throws Exception 89 { 90 return new InitialContext(jndiProps); 91 } 92 93 95 100 public void testJRMPSendCollection10() 101 throws Exception 102 { 103 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 104 getInitialContext().lookup(SessionHome.JNDI_NAME), 105 SessionHome.class); 106 Session session = home.create(); 107 int n = getIterationCount(); 108 long start = System.currentTimeMillis(); 109 for (int i = 0 ; i < n; i++) 110 { 111 session.sendCollection(c10); 112 } 113 long end = System.currentTimeMillis(); 114 getLog().info("JRMP sendCollection(10): " + 115 ((end - start) / (double)n) + " ms/call"); 116 } 117 118 123 public void testIIOPSendCollection10() 124 throws Exception 125 { 126 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 127 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 128 SessionHome.class); 129 Session session = home.create(); 130 int n = getIterationCount(); 131 long start = System.currentTimeMillis(); 132 for (int i = 0 ; i < n; i++) 133 { 134 session.sendCollection(c10); 135 } 136 long end = System.currentTimeMillis(); 137 getLog().info("IIOP sendCollection(10): " + 138 ((end - start) / (double)n) + " ms/call"); 139 } 140 141 146 public void testJRMPReceiveCollection10() 147 throws Exception 148 { 149 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 150 getInitialContext().lookup(SessionHome.JNDI_NAME), 151 SessionHome.class); 152 Session session = home.create(); 153 session.sendCollection(c10); 154 int n = getIterationCount(); 155 long start = System.currentTimeMillis(); 156 for (int i = 0 ; i < n; i++) 157 { 158 session.receiveCollection(); 159 } 160 long end = System.currentTimeMillis(); 161 getLog().info("JRMP receiveCollection(10): " + 162 ((end - start) / (double)n) + " ms/call"); 163 } 164 165 170 public void testIIOPReceiveCollection10() 171 throws Exception 172 { 173 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 174 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 175 SessionHome.class); 176 Session session = home.create(); 177 session.sendCollection(c10); 178 int n = getIterationCount(); 179 long start = System.currentTimeMillis(); 180 for (int i = 0 ; i < n; i++) 181 { 182 session.receiveCollection(); 183 } 184 long end = System.currentTimeMillis(); 185 getLog().info("IIOP receiveCollection(10): " + 186 ((end - start) / (double)n) + " ms/call"); 187 } 188 189 194 public void testJRMPSendReceiveCollection10() 195 throws Exception 196 { 197 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 198 getInitialContext().lookup(SessionHome.JNDI_NAME), 199 SessionHome.class); 200 Session session = home.create(); 201 int n = getIterationCount(); 202 long start = System.currentTimeMillis(); 203 for (int i = 0 ; i < n; i++) 204 { 205 session.sendReceiveCollection(c10); 206 } 207 long end = System.currentTimeMillis(); 208 getLog().info("JRMP sendReceiveCollection(10): " + 209 ((end - start) / (double)n) + " ms/call"); 210 } 211 212 217 public void testIIOPSendReceiveCollection10() 218 throws Exception 219 { 220 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 221 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 222 SessionHome.class); 223 Session session = home.create(); 224 int n = getIterationCount(); 225 long start = System.currentTimeMillis(); 226 for (int i = 0 ; i < n; i++) 227 { 228 session.sendReceiveCollection(c10); 229 } 230 long end = System.currentTimeMillis(); 231 getLog().info("IIOP sendReceiveCollection(10): " + 232 ((end - start) / (double)n) + " ms/call"); 233 } 234 235 240 public void testJRMPSendCollection100() 241 throws Exception 242 { 243 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 244 getInitialContext().lookup(SessionHome.JNDI_NAME), 245 SessionHome.class); 246 Session session = home.create(); 247 int n = getIterationCount(); 248 long start = System.currentTimeMillis(); 249 for (int i = 0 ; i < n; i++) 250 { 251 session.sendCollection(c100); 252 } 253 long end = System.currentTimeMillis(); 254 getLog().info("JRMP sendCollection(100): " + 255 ((end - start) / (double)n) + " ms/call"); 256 } 257 258 263 public void testIIOPSendCollection100() 264 throws Exception 265 { 266 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 267 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 268 SessionHome.class); 269 Session session = home.create(); 270 int n = getIterationCount(); 271 long start = System.currentTimeMillis(); 272 for (int i = 0 ; i < n; i++) 273 { 274 session.sendCollection(c100); 275 } 276 long end = System.currentTimeMillis(); 277 getLog().info("IIOP sendCollection(100): " + 278 ((end - start) / (double)n) + " ms/call"); 279 } 280 281 286 public void testJRMPReceiveCollection100() 287 throws Exception 288 { 289 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 290 getInitialContext().lookup(SessionHome.JNDI_NAME), 291 SessionHome.class); 292 Session session = home.create(); 293 session.sendCollection(c100); 294 int n = getIterationCount(); 295 long start = System.currentTimeMillis(); 296 for (int i = 0 ; i < n; i++) 297 { 298 session.receiveCollection(); 299 } 300 long end = System.currentTimeMillis(); 301 getLog().info("JRMP receiveCollection(100): " + 302 ((end - start) / (double)n) + " ms/call"); 303 } 304 305 310 public void testIIOPReceiveCollection100() 311 throws Exception 312 { 313 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 314 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 315 SessionHome.class); 316 Session session = home.create(); 317 session.sendCollection(c100); 318 int n = getIterationCount(); 319 long start = System.currentTimeMillis(); 320 for (int i = 0 ; i < n; i++) 321 { 322 session.receiveCollection(); 323 } 324 long end = System.currentTimeMillis(); 325 getLog().info("IIOP receiveCollection(100): " + 326 ((end - start) / (double)n) + " ms/call"); 327 } 328 329 334 public void testJRMPSendReceiveCollection100() 335 throws Exception 336 { 337 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 338 getInitialContext().lookup(SessionHome.JNDI_NAME), 339 SessionHome.class); 340 Session session = home.create(); 341 int n = getIterationCount(); 342 long start = System.currentTimeMillis(); 343 for (int i = 0 ; i < n; i++) 344 { 345 session.sendReceiveCollection(c100); 346 } 347 long end = System.currentTimeMillis(); 348 getLog().info("JRMP sendReceiveCollection(100): " + 349 ((end - start) / (double)n) + " ms/call"); 350 } 351 352 357 public void testIIOPSendReceiveCollection100() 358 throws Exception 359 { 360 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 361 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 362 SessionHome.class); 363 Session session = home.create(); 364 int n = getIterationCount(); 365 long start = System.currentTimeMillis(); 366 for (int i = 0 ; i < n; i++) 367 { 368 session.sendReceiveCollection(c100); 369 } 370 long end = System.currentTimeMillis(); 371 getLog().info("IIOP sendReceiveCollection(100): " + 372 ((end - start) / (double)n) + " ms/call"); 373 } 374 375 380 public void testJRMPSendCollection1000() 381 throws Exception 382 { 383 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 384 getInitialContext().lookup(SessionHome.JNDI_NAME), 385 SessionHome.class); 386 Session session = home.create(); 387 int n = getIterationCount(); 388 long start = System.currentTimeMillis(); 389 for (int i = 0 ; i < n; i++) 390 { 391 session.sendCollection(c1000); 392 } 393 long end = System.currentTimeMillis(); 394 getLog().info("JRMP sendCollection(1000): " + 395 ((end - start) / (double)n) + " ms/call"); 396 } 397 398 403 public void testIIOPSendCollection1000() 404 throws Exception 405 { 406 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 407 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 408 SessionHome.class); 409 Session session = home.create(); 410 int n = getIterationCount(); 411 long start = System.currentTimeMillis(); 412 for (int i = 0 ; i < n; i++) 413 { 414 session.sendCollection(c1000); 415 } 416 long end = System.currentTimeMillis(); 417 getLog().info("IIOP sendCollection(1000): " + 418 ((end - start) / (double)n) + " ms/call"); 419 } 420 421 426 public void testJRMPReceiveCollection1000() 427 throws Exception 428 { 429 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 430 getInitialContext().lookup(SessionHome.JNDI_NAME), 431 SessionHome.class); 432 Session session = home.create(); 433 session.sendCollection(c1000); 434 int n = getIterationCount(); 435 long start = System.currentTimeMillis(); 436 for (int i = 0 ; i < n; i++) 437 { 438 session.receiveCollection(); 439 } 440 long end = System.currentTimeMillis(); 441 getLog().info("JRMP receiveCollection(1000): " + 442 ((end - start) / (double)n) + " ms/call"); 443 } 444 445 450 public void testIIOPReceiveCollection1000() 451 throws Exception 452 { 453 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 454 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 455 SessionHome.class); 456 Session session = home.create(); 457 session.sendCollection(c1000); 458 int n = getIterationCount(); 459 long start = System.currentTimeMillis(); 460 for (int i = 0 ; i < n; i++) 461 { 462 session.receiveCollection(); 463 } 464 long end = System.currentTimeMillis(); 465 getLog().info("IIOP receiveCollection(1000): " + 466 ((end - start) / (double)n) + " ms/call"); 467 } 468 469 474 public void testJRMPSendReceiveCollection1000() 475 throws Exception 476 { 477 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 478 getInitialContext().lookup(SessionHome.JNDI_NAME), 479 SessionHome.class); 480 Session session = home.create(); 481 int n = getIterationCount(); 482 long start = System.currentTimeMillis(); 483 for (int i = 0 ; i < n; i++) 484 { 485 session.sendReceiveCollection(c1000); 486 } 487 long end = System.currentTimeMillis(); 488 getLog().info("JRMP sendReceiveCollection(1000): " + 489 ((end - start) / (double)n) + " ms/call"); 490 } 491 492 497 public void testIIOPSendReceiveCollection1000() 498 throws Exception 499 { 500 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 501 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 502 SessionHome.class); 503 Session session = home.create(); 504 int n = getIterationCount(); 505 long start = System.currentTimeMillis(); 506 for (int i = 0 ; i < n; i++) 507 { 508 session.sendReceiveCollection(c1000); 509 } 510 long end = System.currentTimeMillis(); 511 getLog().info("IIOP sendReceiveCollection(1000): " + 512 ((end - start) / (double)n) + " ms/call"); 513 } 514 515 520 public void testJRMPSendCollection10000() 521 throws Exception 522 { 523 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 524 getInitialContext().lookup(SessionHome.JNDI_NAME), 525 SessionHome.class); 526 Session session = home.create(); 527 int n = getIterationCount(); 528 long start = System.currentTimeMillis(); 529 for (int i = 0 ; i < n; i++) 530 { 531 session.sendCollection(c10000); 532 } 533 long end = System.currentTimeMillis(); 534 getLog().info("JRMP sendCollection(10000): " + 535 ((end - start) / (double)n) + " ms/call"); 536 } 537 538 543 public void testIIOPSendCollection10000() 544 throws Exception 545 { 546 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 547 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 548 SessionHome.class); 549 Session session = home.create(); 550 int n = getIterationCount(); 551 long start = System.currentTimeMillis(); 552 for (int i = 0 ; i < n; i++) 553 { 554 session.sendCollection(c10000); 555 } 556 long end = System.currentTimeMillis(); 557 getLog().info("IIOP sendCollection(10000): " + 558 ((end - start) / (double)n) + " ms/call"); 559 } 560 561 566 public void testJRMPReceiveCollection10000() 567 throws Exception 568 { 569 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 570 getInitialContext().lookup(SessionHome.JNDI_NAME), 571 SessionHome.class); 572 Session session = home.create(); 573 session.sendCollection(c10000); 574 int n = getIterationCount(); 575 long start = System.currentTimeMillis(); 576 for (int i = 0 ; i < n; i++) 577 { 578 session.receiveCollection(); 579 } 580 long end = System.currentTimeMillis(); 581 getLog().info("JRMP receiveCollection(10000): " + 582 ((end - start) / (double)n) + " ms/call"); 583 } 584 585 590 public void testIIOPReceiveCollection10000() 591 throws Exception 592 { 593 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 594 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 595 SessionHome.class); 596 Session session = home.create(); 597 session.sendCollection(c10000); 598 int n = getIterationCount(); 599 long start = System.currentTimeMillis(); 600 for (int i = 0 ; i < n; i++) 601 { 602 session.receiveCollection(); 603 } 604 long end = System.currentTimeMillis(); 605 getLog().info("IIOP receiveCollection(10000): " + 606 ((end - start) / (double)n) + " ms/call"); 607 } 608 609 614 public void testJRMPSendReceiveCollection10000() 615 throws Exception 616 { 617 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 618 getInitialContext().lookup(SessionHome.JNDI_NAME), 619 SessionHome.class); 620 Session session = home.create(); 621 int n = getIterationCount(); 622 long start = System.currentTimeMillis(); 623 for (int i = 0 ; i < n; i++) 624 { 625 session.sendReceiveCollection(c10000); 626 } 627 long end = System.currentTimeMillis(); 628 getLog().info("JRMP sendReceiveCollection(10000): " + 629 ((end - start) / (double)n) + " ms/call"); 630 } 631 632 637 public void testIIOPSendReceiveCollection10000() 638 throws Exception 639 { 640 SessionHome home = (SessionHome)PortableRemoteObject.narrow( 641 getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME), 642 SessionHome.class); 643 Session session = home.create(); 644 int n = getIterationCount(); 645 long start = System.currentTimeMillis(); 646 for (int i = 0 ; i < n; i++) 647 { 648 session.sendReceiveCollection(c10000); 649 } 650 long end = System.currentTimeMillis(); 651 getLog().info("IIOP sendReceiveCollection(10000): " + 652 ((end - start) / (double)n) + " ms/call"); 653 } 654 655 public static Test suite() throws Exception 656 { 657 return getDeploySetup(T7PassCollectionsTestCase.class, "iiopperf.jar"); 658 } 659 660 } 661 | Popular Tags |