Search in sources :

Example 1 with ParameterConfiguration

use of org.apache.camel.impl.ParameterConfiguration 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());
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) Component(org.apache.camel.Component) ParameterConfiguration(org.apache.camel.impl.ParameterConfiguration) Map(java.util.Map) SortedMap(java.util.SortedMap) Test(org.junit.Test) MSPTest(org.apache.camel.component.salesforce.dto.generated.MSPTest)

Example 2 with ParameterConfiguration

use of org.apache.camel.impl.ParameterConfiguration in project camel by apache.

the class SalesforceComponentConfigurationIntegrationTest method assertParameterConfig.

public static void assertParameterConfig(ComponentConfiguration configuration, String name, Class<?> parameterType) {
    ParameterConfiguration config = configuration.getParameterConfiguration(name);
    assertNotNull("ParameterConfiguration should exist for parameter name " + name, config);
    assertEquals("ParameterConfiguration." + name + ".getName()", name, config.getName());
    assertEquals("ParameterConfiguration." + name + ".getParameterType()", parameterType, config.getParameterType());
}
Also used : ParameterConfiguration(org.apache.camel.impl.ParameterConfiguration)

Example 3 with ParameterConfiguration

use of org.apache.camel.impl.ParameterConfiguration 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());
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) Component(org.apache.camel.Component) ParameterConfiguration(org.apache.camel.impl.ParameterConfiguration) Map(java.util.Map) SortedMap(java.util.SortedMap) Test(org.junit.Test)

Example 4 with ParameterConfiguration

use of org.apache.camel.impl.ParameterConfiguration in project camel by apache.

the class JmsComponentConfigurationTest method assertParameterConfig.

public static void assertParameterConfig(ComponentConfiguration configuration, String name, Class<?> parameterType) {
    ParameterConfiguration config = configuration.getParameterConfiguration(name);
    assertNotNull("ParameterConfiguration should exist for parameter name " + name, config);
    assertEquals("ParameterConfiguration." + name + ".getName()", name, config.getName());
    assertEquals("ParameterConfiguration." + name + ".getParameterType()", parameterType, config.getParameterType());
}
Also used : ParameterConfiguration(org.apache.camel.impl.ParameterConfiguration)

Aggregations

ParameterConfiguration (org.apache.camel.impl.ParameterConfiguration)4 Map (java.util.Map)2 SortedMap (java.util.SortedMap)2 Component (org.apache.camel.Component)2 ComponentConfiguration (org.apache.camel.ComponentConfiguration)2 Test (org.junit.Test)2 MSPTest (org.apache.camel.component.salesforce.dto.generated.MSPTest)1