use of org.apache.camel.Endpoint in project camel by apache.
the class CMISQueryProducerTest method getResultCountFromHeader.
@Test
public void getResultCountFromHeader() throws Exception {
Endpoint endpoint = context.getEndpoint("cmis://" + getUrl() + "?queryMode=true");
Producer producer = endpoint.createProducer();
Exchange exchange = createExchangeWithInBody("SELECT * FROM cmis:document WHERE CONTAINS('Camel test content.')");
producer.process(exchange);
@SuppressWarnings("unchecked") List<Map<String, Object>> documents = exchange.getOut().getBody(List.class);
assertEquals(2, documents.size());
assertEquals(2, exchange.getOut().getHeader("CamelCMISResultCount"));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class CMISQueryProducerTest method limitNumberOfResultsWithReadSizeHeader.
@Test
public void limitNumberOfResultsWithReadSizeHeader() throws Exception {
Endpoint endpoint = context.getEndpoint("cmis://" + getUrl() + "?queryMode=true");
Producer producer = endpoint.createProducer();
Exchange exchange = createExchangeWithInBody("SELECT * FROM cmis:document WHERE CONTAINS('Camel test content.')");
exchange.getIn().getHeaders().put("CamelCMISReadSize", 1);
producer.process(exchange);
@SuppressWarnings("unchecked") List<Map<String, Object>> documents = exchange.getOut().getBody(List.class);
assertEquals(1, documents.size());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class CMISQueryProducerTest method retrieveAlsoDocumentContent.
@Test
public void retrieveAlsoDocumentContent() throws Exception {
Endpoint endpoint = context.getEndpoint("cmis://" + getUrl() + "?queryMode=true");
Producer producer = endpoint.createProducer();
Exchange exchange = createExchangeWithInBody("SELECT * FROM cmis:document WHERE cmis:name='test1.txt'");
exchange.getIn().getHeaders().put("CamelCMISRetrieveContent", true);
producer.process(exchange);
@SuppressWarnings("unchecked") List<Map<String, Object>> documents = exchange.getOut().getBody(List.class);
InputStream content = (InputStream) documents.get(0).get("CamelCMISContent");
assertEquals("This is the first Camel test content.", readFromStream(content));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class CouchbaseComponentTest method testEndpointCreated.
@Test
public void testEndpointCreated() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
String uri = "couchbase:http://localhost:9191/bucket";
String remaining = "http://localhost:9191/bucket";
Endpoint endpoint = new CouchbaseComponent(context).createEndpoint(uri, remaining, params);
assertNotNull(endpoint);
}
use of org.apache.camel.Endpoint in project camel by apache.
the class AbstractCamelFluentProducerTemplateFactoryBean method getObject.
public FluentProducerTemplate getObject() throws Exception {
CamelContext context = getCamelContext();
if (defaultEndpoint != null) {
Endpoint endpoint = context.getEndpoint(defaultEndpoint);
if (endpoint == null) {
throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
} else {
template = new DefaultFluentProducerTemplate(context);
template.setDefaultEndpoint(endpoint);
}
} else {
template = new DefaultFluentProducerTemplate(context);
}
// set custom cache size if provided
if (maximumCacheSize != null) {
template.setMaximumCacheSize(maximumCacheSize);
}
// must start it so its ready to use
ServiceHelper.startService(template);
return template;
}
Aggregations