use of org.apache.camel.Component in project camel by apache.
the class ComponentConfigurationTest method testSetParametersFromUriStringOnDefaultComponent.
/**
* Tests that parameters can be used on non-{@link UriEndpointComponent} implementations
* but that their types tend to be String until we try to create an Endpoint
*/
@Test
public void testSetParametersFromUriStringOnDefaultComponent() throws Exception {
Component component = context.getComponent("cheese");
ComponentConfiguration configuration = component.createComponentConfiguration();
assertNotNull("Should have created a ComponentConfiguration for component " + component, configuration);
// configure the uri and query parameters
configuration.setUriString("somePath?foo=something&bar=123");
// notice the parameters are all Strings since we don't use UriEndpointComponent
assertEquals("foo", "something", configuration.getParameter("foo"));
assertEquals("bar", "123", configuration.getParameter("bar"));
configuration.setUriString("somePath?foo=another&bar=456");
assertEquals("foo", "another", configuration.getParameter("foo"));
assertEquals("bar", "456", configuration.getParameter("bar"));
}
use of org.apache.camel.Component in project camel by apache.
the class DefaultCamelContextResolverTest method testComponentWithBothNames.
@Test
public void testComponentWithBothNames() throws Exception {
Component component = context.getComponent("yellow");
assertNotNull("Component not found in registry", component);
assertTrue("Wrong instance type of the Component", component instanceof SampleComponent);
assertFalse("Here we should NOT have the fallback Component", ((SampleComponent) component).isFallback());
}
use of org.apache.camel.Component in project camel by apache.
the class DefaultCamelContextResolverTest method testNullLookupComponent.
@Test
public void testNullLookupComponent() throws Exception {
Component component = context.getComponent("xxxxxxxxx");
assertNull("Non-existent Component should be null", component);
}
use of org.apache.camel.Component in project camel by apache.
the class DefaultCamelContextTest method testAutoCreateComponentsOff.
public void testAutoCreateComponentsOff() {
DefaultCamelContext ctx = new DefaultCamelContext();
ctx.disableJMX();
ctx.setAutoCreateComponents(false);
Component component = ctx.getComponent("bean");
assertNull(component);
}
use of org.apache.camel.Component in project camel by apache.
the class DefaultCamelContextTest method testAutoCreateComponentsOn.
public void testAutoCreateComponentsOn() {
DefaultCamelContext ctx = new DefaultCamelContext();
ctx.disableJMX();
Component component = ctx.getComponent("bean");
assertNotNull(component);
assertEquals(component.getClass(), BeanComponent.class);
}
Aggregations