1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.tck.testmodels.services; |
8 | |
|
9 | |
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; |
10 | |
import org.apache.commons.logging.Log; |
11 | |
import org.apache.commons.logging.LogFactory; |
12 | |
|
13 | 0 | public class TestComponent implements ITestComponent |
14 | |
{ |
15 | |
public static final String EXCEPTION_MESSAGE = "Test Service fired an Exception"; |
16 | |
|
17 | 0 | protected static final Log logger = LogFactory.getLog(TestComponent.class); |
18 | |
|
19 | 0 | protected AtomicInteger count = new AtomicInteger(0); |
20 | |
|
21 | |
public String receive(String message) throws Exception |
22 | |
{ |
23 | 0 | logger.info("Received: " + message + " number: " + inc() + " in thread: " |
24 | |
+ Thread.currentThread().getName()); |
25 | 0 | return "Received: " + message; |
26 | |
} |
27 | |
|
28 | |
public String receiveBytes(byte[] message) throws Exception |
29 | |
{ |
30 | 0 | return receive(new String(message)); |
31 | |
} |
32 | |
|
33 | |
public String throwsException(String message) throws Exception |
34 | |
{ |
35 | 0 | throw new TestComponentException(EXCEPTION_MESSAGE); |
36 | |
} |
37 | |
|
38 | |
protected int inc() |
39 | |
{ |
40 | 0 | return count.incrementAndGet(); |
41 | |
} |
42 | |
|
43 | |
} |