use of org.apache.camel.component.file.FileComponent in project camel by apache.
the class CamelMockBundleContext method getService.
public Object getService(@SuppressWarnings("rawtypes") ServiceReference reference) {
String[] classNames = (String[]) reference.getProperty(Constants.OBJECTCLASS);
String classNames0 = classNames != null ? classNames[0] : null;
String pid = (String) reference.getProperty(Constants.SERVICE_PID);
if (classNames0 != null && classNames0.equals("org.apache.camel.core.osgi.test.MyService")) {
return new MyService();
} else if (pid != null && pid.equals(SERVICE_PID_PREFIX + "org.apache.camel.core.osgi.test.MyService")) {
return new MyService();
} else if (classNames0 != null && classNames0.equals(ComponentResolver.class.getName())) {
return new ComponentResolver() {
public Component resolveComponent(String name, CamelContext context) throws Exception {
if (name.equals("file_test")) {
return new FileComponent();
}
return null;
}
};
} else if (classNames0 != null && classNames0.equals(LanguageResolver.class.getName())) {
return new LanguageResolver() {
public Language resolveLanguage(String name, CamelContext context) {
if (name.equals("simple")) {
return new SimpleLanguage();
}
return null;
}
};
} else {
return null;
}
}
use of org.apache.camel.component.file.FileComponent in project camel by apache.
the class FileComponentAutoConfiguration method configureFileComponent.
@Lazy
@Bean(name = "file-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(FileComponent.class)
public FileComponent configureFileComponent(CamelContext camelContext) throws Exception {
FileComponent component = new FileComponent();
component.setCamelContext(camelContext);
return component;
}
use of org.apache.camel.component.file.FileComponent in project camel by apache.
the class FileComponentConfigurationAndDocumentationTest method testComponentConfiguration.
@Test
public void testComponentConfiguration() throws Exception {
FileComponent comp = context.getComponent("file", FileComponent.class);
EndpointConfiguration conf = comp.createConfiguration("file:target/foo?delete=true");
assertEquals("true", conf.getParameter("delete"));
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
assertTrue(json.contains("\"directoryName\": { \"kind\": \"path\", \"displayName\": \"Directory Name\", \"group\": \"common\", \"required\": true"));
assertTrue(json.contains("\"autoCreate\": { \"kind\": \"parameter\", \"displayName\": \"Auto Create\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
assertTrue(json.contains("\"readLockMinAge\": { \"kind\": \"parameter\", \"displayName\": \"Read Lock Min Age\", \"group\": \"lock\", \"label\": \"consumer,lock\""));
}
use of org.apache.camel.component.file.FileComponent in project camel by apache.
the class OsgiComponentResolverTest method testOsgiResolverFindComponentTest.
@Test
public void testOsgiResolverFindComponentTest() throws Exception {
CamelContext camelContext = new DefaultCamelContext();
OsgiComponentResolver resolver = new OsgiComponentResolver(getBundleContext());
Component component = resolver.resolveComponent("file_test", camelContext);
assertNotNull("We should find file_test component", component);
assertTrue("We should get the file component here", component instanceof FileComponent);
}
Aggregations