org.apache.camel.component.box.BoxConfiguration Java Examples

The following examples show how to use org.apache.camel.component.box.BoxConfiguration. 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: BoxProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep()
UnbannedReflectiveBuildItem boxEndpointConfigurations() {
    return new UnbannedReflectiveBuildItem(
            BoxCollaborationsManagerEndpointConfiguration.class.getCanonicalName(),
            BoxCommentsManagerEndpointConfiguration.class.getCanonicalName(),
            BoxEventLogsManagerEndpointConfiguration.class.getCanonicalName(),
            BoxEventsManagerEndpointConfiguration.class.getCanonicalName(),
            BoxFilesManagerEndpointConfiguration.class.getCanonicalName(),
            BoxFoldersManagerEndpointConfiguration.class.getCanonicalName(),
            BoxGroupsManagerEndpointConfiguration.class.getCanonicalName(),
            BoxSearchManagerEndpointConfiguration.class.getCanonicalName(),
            BoxTasksManagerEndpointConfiguration.class.getCanonicalName(),
            BoxUsersManagerEndpointConfiguration.class.getCanonicalName(),
            BoxConfiguration.class.getCanonicalName());
}
 
Example #2
Source File: BoxProcessor.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep()
ReflectiveClassBuildItem boxEndpointConfiguration() {
    return new ReflectiveClassBuildItem(true, true,
            BoxCollaborationsManagerEndpointConfiguration.class,
            BoxCommentsManagerEndpointConfiguration.class,
            BoxEventLogsManagerEndpointConfiguration.class,
            BoxEventsManagerEndpointConfiguration.class,
            BoxFilesManagerEndpointConfiguration.class,
            BoxFoldersManagerEndpointConfiguration.class,
            BoxGroupsManagerEndpointConfiguration.class,
            BoxSearchManagerEndpointConfiguration.class,
            BoxTasksManagerEndpointConfiguration.class,
            BoxUsersManagerEndpointConfiguration.class,
            BoxConfiguration.class);
}
 
Example #3
Source File: BoxConnector.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@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 #4
Source File: BoxVerifierExtension.java    From syndesis with Apache License 2.0 5 votes vote down vote up
private void verifyCredentials(ResultBuilder builder, Map<String, Object> parameters) {
    try {
        BoxConfiguration configuration = new BoxConfiguration();
        parameters.put("authenticationType", BoxConfiguration.STANDARD_AUTHENTICATION);
        setProperties(configuration, parameters);

        BoxAPIConnection connection = BoxConnectionHelper.createConnection(configuration);
        BoxUser.getCurrentUser(connection);
    } catch (Exception e) {
        LOG.error("Credentials verification faild", e);
        builder.error(ResultErrorBuilder
            .withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage())
            .build());
    }
}
 
Example #5
Source File: BoxIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@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();
    }
}