use of org.apache.camel.component.dropbox.integration.consumer.DropboxScheduledPollGetConsumer in project camel by apache.
the class DropboxEndpoint method createConsumer.
/**
* Create one of the camel consumer available based on the configuration
* @param processor the given processor
* @return the camel consumer
* @throws Exception
*/
public Consumer createConsumer(Processor processor) throws Exception {
LOG.trace("Resolve consumer dropbox endpoint {" + configuration.getOperation().toString() + "}");
LOG.trace("Resolve consumer dropbox attached client:" + configuration.getClient());
DropboxScheduledPollConsumer consumer;
if (this.configuration.getOperation() == DropboxOperation.search) {
consumer = new DropboxScheduledPollSearchConsumer(this, processor, configuration);
consumer.setDelay(POLL_CONSUMER_DELAY);
return consumer;
} else if (this.configuration.getOperation() == DropboxOperation.get) {
consumer = new DropboxScheduledPollGetConsumer(this, processor, configuration);
consumer.setDelay(POLL_CONSUMER_DELAY);
return consumer;
} else {
throw new DropboxException("Operation specified is not valid for consumer!");
}
}
use of org.apache.camel.component.dropbox.integration.consumer.DropboxScheduledPollGetConsumer in project camel by apache.
the class DropboxConsumerTest method shouldCreateGetConsumer.
@Test
public void shouldCreateGetConsumer() throws Exception {
// Given
Endpoint dropboxEndpoint1 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path");
// When
Consumer consumer1 = dropboxEndpoint1.createConsumer(null);
// Then
Assert.assertTrue(consumer1 instanceof DropboxScheduledPollGetConsumer);
// Given
Endpoint dropboxEndpoint2 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path with spaces/file");
// When
Consumer consumer2 = dropboxEndpoint2.createConsumer(null);
// Then
Assert.assertTrue(consumer2 instanceof DropboxScheduledPollGetConsumer);
}
Aggregations