Here is the MockComponent that I mentioned, you just need to register it into
the camel context, then you can you get what you need :)

package org.apache.camel.component.mock;

import java.util.HashMap;
import java.util.Map;

import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;

public class MyMockComponent extends DefaultComponent {
    private Map<String, MockEndpoint> endpoints = new HashMap<String,
MockEndpoint>();;

    @Override
    protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
        MockEndpoint endpoint = null;
        // deal with the uri which is end with *
        if (remaining.endsWith("*")) {
            String key = remaining.substring(0, remaining.length() - 1);
            if (endpoints.containsKey(key)) {
                endpoint = endpoints.get(key);
            } 
            endpoint = new MockEndpoint(uri, this);
            endpoints.put(key, endpoint);
            
        }
        // check if the remaining is used here
        if (endpoints.containsKey(remaining)) {
            endpoint = endpoints.get(remaining);
        } else {
            endpoint = new MockEndpoint(uri, this);
        }
        return endpoint;
    }
}


--
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
(English)
http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-mock-endpoints-taking-lots-of-different-query-parameters-values-tp5719629p5719669.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to