Java Code Examples for org.apache.camel.component.box.BoxConfiguration#setAuthenticationType()
The following examples show how to use
org.apache.camel.component.box.BoxConfiguration#setAuthenticationType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BoxConnector.java From syndesis with Apache License 2.0 | 5 votes |
@Override protected void configureDelegateComponent(ComponentDefinition definition, Component component, Map<String, Object> options) { super.configureDelegateComponent(definition, component, options); if (component instanceof BoxComponent) { BoxConfiguration configuration = new BoxConfiguration(); configuration.setAuthenticationType(authenticationType); configuration.setUserName(userName); configuration.setUserPassword(userPassword); configuration.setClientId(clientId); configuration.setClientSecret(clientSecret); ((BoxComponent) component).setConfiguration(configuration); } }
Example 2
Source File: BoxIntegrationTest.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Test public void testBoxComponent() throws Exception { Map<String, Object> boxOptions = createBoxOptions(); // Do nothing if the required credentials are not present Assume.assumeTrue(boxOptions.size() == BoxOption.values().length); CamelContext camelctx = new DefaultCamelContext(); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start"). to("box://folders/createFolder"); } }); BoxConfiguration configuration = new BoxConfiguration(); configuration.setAuthenticationType(BoxConfiguration.STANDARD_AUTHENTICATION); IntrospectionSupport.setProperties(configuration, boxOptions); BoxComponent component = new BoxComponent(camelctx); component.setConfiguration(configuration); camelctx.addComponent("box", component); BoxFolder folder = null; camelctx.start(); try { Map<String, Object> headers = new HashMap<>(); headers.put("CamelBox.parentFolderId", "0"); headers.put("CamelBox.folderName", "TestFolder"); ProducerTemplate template = camelctx.createProducerTemplate(); folder = template.requestBodyAndHeaders("direct:start", null, headers, BoxFolder.class); Assert.assertNotNull("Folder was null", folder); Assert.assertEquals("Expected folder name to be TestFolder", "TestFolder", folder.getInfo().getName()); } finally { // Clean up if (folder != null) { folder.delete(true); } camelctx.close(); } }