1 17 package org.apache.servicemix.components.pojo; 18 19 import org.apache.servicemix.tck.SpringTestSupport; 20 import org.springframework.context.support.AbstractXmlApplicationContext; 21 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; 22 23 26 public class PojoTest extends SpringTestSupport { 27 28 public void testSendAndReceiveOfMessages() throws Exception { 29 MySender sender = (MySender) getBean("sender"); 30 sender.sendMessages(messageCount); 31 32 MyReceiver receiver = (MyReceiver) getBean("receiver"); 33 assertMessagesReceived(receiver.getMessageList(), messageCount); 34 } 35 36 public void testPerfSendAndReceiveOfMessages() throws Exception { 37 MySender sender = (MySender) getBean("sender"); 38 MyReceiver receiver = (MyReceiver) getBean("receiver"); 39 sender.sendMessages(100); 40 assertMessagesReceived(receiver.getMessageList(), 100); 41 receiver.getMessageList().flushMessages(); 42 43 int messageCount = 500; 44 long start = System.currentTimeMillis(); 45 sender.sendMessages(messageCount); 46 assertMessagesReceived(receiver.getMessageList(), messageCount); 47 long end = System.currentTimeMillis(); 48 49 System.err.println((end - start) + " ms to send " + messageCount + " messages"); 50 } 51 52 protected AbstractXmlApplicationContext createBeanFactory() { 53 return new ClassPathXmlApplicationContext("org/apache/servicemix/components/pojo/example.xml"); 54 } 55 } 56 | Popular Tags |