1 10 11 package org.mule.test.integration.service; 12 13 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; 14 15 import javax.jms.TextMessage ; 16 17 import org.apache.commons.logging.Log; 18 import org.apache.commons.logging.LogFactory; 19 20 public class TestComponent implements ITestComponent 21 { 22 public static final String EXCEPTION_MESSAGE = "Test Component fired an Exception"; 23 24 private static final Log logger = LogFactory.getLog(TestComponent.class); 25 26 private AtomicInteger count = new AtomicInteger(0); 27 28 public String receive(String message) throws Exception 29 { 30 logger.info("Received: " + message + " number: " + inc() + " in thread: " 31 + Thread.currentThread().getName()); 32 return "Received: " + message; 33 } 34 35 public String throwsException(String message) throws Exception 36 { 37 throw new TestComponentException(EXCEPTION_MESSAGE); 38 } 39 40 public String receiveJms(TextMessage message) throws Exception 41 { 42 logger.info("Received: " + message.getText() + " Number: " + inc() + " in thread: " 43 + Thread.currentThread().getName()); 44 return "Received: " + message.getText(); 45 } 46 47 protected int inc() 48 { 49 return count.incrementAndGet(); 50 } 51 52 } 53 | Popular Tags |