use of org.apache.camel.ComponentConfiguration in project camel by apache.
the class LogComponentConfigurationAndDocumentationTest method testComponentConfiguration.
@Test
public void testComponentConfiguration() throws Exception {
LogComponent comp = context.getComponent("log", LogComponent.class);
EndpointConfiguration conf = comp.createConfiguration("log:foo?level=DEBUG");
assertEquals("DEBUG", conf.getParameter("level"));
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
assertTrue(json.contains("\"loggerName\": { \"kind\": \"path\", \"displayName\": \"Logger Name\", \"group\": \"producer\", \"required\": true"));
assertTrue(json.contains("\"level\": { \"kind\": \"parameter\", \"displayName\": \"Level\", \"group\": \"producer\", \"type\": \"string\""));
assertTrue(json.contains("\"showBody\": { \"kind\": \"parameter\", \"displayName\": \"Show Body\", \"group\": \"formatting\", \"label\": \"formatting\""));
}
use of org.apache.camel.ComponentConfiguration in project camel by apache.
the class MockComponentConfigurationAndDocumentationTest method testComponentConfiguration.
@Test
public void testComponentConfiguration() throws Exception {
MockComponent comp = context.getComponent("mock", MockComponent.class);
EndpointConfiguration conf = comp.createConfiguration("mock:foo?retainFirst=10");
assertEquals("10", conf.getParameter("retainFirst"));
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"displayName\": \"Name\", \"group\": \"producer\", \"required\": true"));
assertTrue(json.contains("\"expectedCount\": { \"kind\": \"parameter\", \"displayName\": \"Expected Count\", \"group\": \"producer\", \"label\": \"producer\""));
assertTrue(json.contains("\"retainFirst\": { \"kind\": \"parameter\", \"displayName\": \"Retain First\", \"group\": \"producer\", \"label\": \"producer\""));
}
use of org.apache.camel.ComponentConfiguration in project camel by apache.
the class SedaComponentConfigurationAndDocumentationTest method testComponentConfiguration.
@Test
public void testComponentConfiguration() throws Exception {
SedaComponent comp = context.getComponent("seda", SedaComponent.class);
EndpointConfiguration conf = comp.createConfiguration("seda:foo?blockWhenFull=true");
assertEquals("true", conf.getParameter("blockWhenFull"));
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
assertTrue(json.contains("\"concurrentConsumers\": { \"kind\": \"parameter\", \"displayName\": \"Concurrent Consumers\", \"group\": \"consumer\", \"label\": \"consumer\""));
assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"displayName\": \"Timeout\", \"group\": \"producer\", \"label\": \"producer\""));
}
use of org.apache.camel.ComponentConfiguration in project camel by apache.
the class SalesforceComponentConfigurationIntegrationTest method testConfiguration.
@Test
public void testConfiguration() throws Exception {
Component component = context().getComponent(componentName);
ComponentConfiguration configuration = component.createComponentConfiguration();
SortedMap<String, ParameterConfiguration> parameterConfigurationMap = configuration.getParameterConfigurationMap();
if (verbose) {
Set<Map.Entry<String, ParameterConfiguration>> entries = parameterConfigurationMap.entrySet();
for (Map.Entry<String, ParameterConfiguration> entry : entries) {
String name = entry.getKey();
ParameterConfiguration config = entry.getValue();
LOG.info("Has name: {} with type {}", name, config.getParameterType().getName());
}
}
assertParameterConfig(configuration, "format", PayloadFormat.class);
assertParameterConfig(configuration, "sObjectName", String.class);
assertParameterConfig(configuration, "sObjectFields", String.class);
assertParameterConfig(configuration, "updateTopic", boolean.class);
configuration.setParameter("format", PayloadFormat.XML);
configuration.setParameter("sObjectName", "Merchandise__c");
configuration.setParameter("sObjectFields", "Description__c,Total_Inventory__c");
configuration.setParameter("updateTopic", false);
// operation name is base uri
configuration.setBaseUri(componentName + ":getSObject");
SalesforceEndpoint endpoint = assertIsInstanceOf(SalesforceEndpoint.class, configuration.createEndpoint());
final SalesforceEndpointConfig endpointConfig = endpoint.getConfiguration();
assertEquals("endpoint.format", PayloadFormat.XML, endpointConfig.getFormat());
assertEquals("endpoint.sObjectName", "Merchandise__c", endpointConfig.getSObjectName());
assertEquals("endpoint.sObjectFields", "Description__c,Total_Inventory__c", endpointConfig.getSObjectFields());
assertEquals("endpoint.updateTopic", false, endpointConfig.isUpdateTopic());
}
use of org.apache.camel.ComponentConfiguration in project camel by apache.
the class JmsComponentConfigurationTest method testConfiguration.
@Test
public void testConfiguration() throws Exception {
Component component = context().getComponent(componentName);
ComponentConfiguration configuration = component.createComponentConfiguration();
SortedMap<String, ParameterConfiguration> parameterConfigurationMap = configuration.getParameterConfigurationMap();
if (verbose) {
Set<Map.Entry<String, ParameterConfiguration>> entries = parameterConfigurationMap.entrySet();
for (Map.Entry<String, ParameterConfiguration> entry : entries) {
String name = entry.getKey();
ParameterConfiguration config = entry.getValue();
LOG.info("Has name: {} with type {}", name, config.getParameterType().getName());
}
}
assertParameterConfig(configuration, "concurrentConsumers", int.class);
assertParameterConfig(configuration, "clientId", String.class);
assertParameterConfig(configuration, "disableReplyTo", boolean.class);
assertParameterConfig(configuration, "timeToLive", long.class);
configuration.setParameter("concurrentConsumers", 10);
configuration.setParameter("clientId", "foo");
configuration.setParameter("disableReplyTo", true);
configuration.setParameter("timeToLive", 1000L);
JmsEndpoint endpoint = assertIsInstanceOf(JmsEndpoint.class, configuration.createEndpoint());
assertEquals("endpoint.concurrentConsumers", 10, endpoint.getConcurrentConsumers());
assertEquals("endpoint.clientId", "foo", endpoint.getClientId());
assertEquals("endpoint.disableReplyTo", true, endpoint.isDisableReplyTo());
assertEquals("endpoint.timeToLive", 1000L, endpoint.getTimeToLive());
}
Aggregations