Hi, I'm using the camel proxy feature to inject a proxy interface into my class 
for remoting.

Example:

<!-- camel JMS Producer: can send messages to ActiveMQ server -->
  <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="${camel.broker.url}" />
  </bean>

<bean id="myBean" name="myBean" 
class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
        <property name="serviceUrl" value="jms:queue:incoming" />
        <property name="serviceInterface" value="com.example.MyBeanInterface" />
</bean>

So, in deployment the server will be on a remote node.  I can wire up a test 
case like this:

@ContextConfiguration(locations={"classpath:applicationContext.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class MyTest {

   @Resource(name="myBean") MyBeanInterface bean;

   @Test
   public void test() throws Exception {
      String retval = bean.callSomeMethod();
   }
}

So, this all works if the AMQ JMS server is up and running, but what I want to 
do is have it test instead against the camel mock endpoint, but it isn't clear 
to me exactly how I can do this.  The examples I've seen don't tend to talk 
about the CamelProxyFactoryBean so much.

What I'd like to do is when my test calls:

   String retval = bean.callSomeMethod();

I want it to go against the camel mock endpoint and then return a value I 
specify (this is using the JMS InOut pattern).

Can someone show me a clean way to accomplish that?

Reply via email to