1 package org.jacorb.test.notification.bugs; 2 3 22 23 import junit.framework.Test; 24 25 import org.jacorb.test.notification.StructuredPushReceiver; 26 import org.jacorb.test.notification.StructuredPushSender; 27 import org.jacorb.test.notification.common.NotifyServerTestCase; 28 import org.jacorb.test.notification.common.NotifyServerTestSetup; 29 import org.omg.CORBA.Any ; 30 import org.omg.CosNotification.EventHeader; 31 import org.omg.CosNotification.EventType; 32 import org.omg.CosNotification.FixedEventHeader; 33 import org.omg.CosNotification.Property; 34 import org.omg.CosNotification.StructuredEvent; 35 import org.omg.CosNotifyChannelAdmin.EventChannel; 36 37 44 public class MultipleDeliveryBugTest extends NotifyServerTestCase 45 { 46 private EventChannel objectUnderTest_; 47 48 public MultipleDeliveryBugTest(String name, NotifyServerTestSetup setup) 49 { 50 super(name, setup); 51 } 52 53 public void setUpTest() throws Exception 54 { 55 objectUnderTest_ = getDefaultChannel(); 56 } 57 58 public void testMultipleSendUnderHighLoad() throws Exception 59 { 60 int testSize = 200; 61 62 StructuredEvent[] events = new StructuredEvent[testSize]; 63 64 FixedEventHeader fixedHeader = new FixedEventHeader(); 65 fixedHeader.event_name = "TEST"; 66 fixedHeader.event_type = new EventType("TESTING", "TESTING"); 67 EventHeader header = new EventHeader(fixedHeader, new Property[0]); 68 69 StructuredPushReceiver _receiver = new StructuredPushReceiver(getClientORB(), testSize); 70 StructuredPushSender _sender = new StructuredPushSender(getClientORB()); 71 72 _receiver.setTimeOut(testSize * 100); 73 74 _sender.connect(objectUnderTest_, false); 75 _receiver.connect(objectUnderTest_, false); 76 77 _receiver.start(); 78 79 for (int x = 0; x < events.length; ++x) 80 { 81 Any any = getClientORB().create_any(); 82 any.insert_long(x); 83 events[x] = new StructuredEvent(header, new Property[0], any); 84 } 85 86 _sender.pushEvents(events); 87 88 _receiver.join(); 89 90 assertTrue(_receiver.isEventHandled()); 91 } 92 93 public static Test suite() throws Exception 94 { 95 return NotifyServerTestCase.suite(MultipleDeliveryBugTest.class); 96 } 97 } 98 | Popular Tags |