Source:
<code>public void testProducerProperties() throws Exception { RedisTestBinder binder = getBinder(); Binding<MessageChannel> consumerBinding = binder.bindConsumer("props.0", "test", new DirectChannel(), createConsumerProperties()); Binding<MessageChannel> producerBinding = binder.bindProducer("props.0", new DirectChannel(), createProducerProperties()); AbstractEndpoint producerEndpoint = extractEndpoint(producerBinding); @SuppressWarnings("unchecked") Map<String, RedisQueueOutboundChannelAdapter> adapters = TestUtils.getPropertyValue(producerEndpoint, "handler.adapters", Map.class); RedisQueueOutboundChannelAdapter adapter = adapters.get("test"); assertEquals( "props.0.test", TestUtils.getPropertyValue(adapter, "queueNameExpression", Expression.class).getExpressionString()); producerBinding.unbind(); assertFalse(producerEndpoint.isRunning()); ProducerProperties producerProperties = new ProducerProperties(); <START> producerProperties.setPartitionKeyExpression("'foo'"); <END> producerProperties.setPartitionKeyExtractorClass("foo"); producerProperties.setPartitionSelectorExpression("0"); producerProperties.setPartitionSelectorClass("foo"); producerProperties.setPartitionCount(1); producerBinding = binder.bindProducer("props.0", new DirectChannel(), producerProperties); producerEndpoint = extractEndpoint(producerBinding); adapter = (RedisQueueOutboundChannelAdapter) TestUtils.getPropertyValue(producerEndpoint, "handler.adapters", Map.class).get("test"); assertEquals( "'props.0.test-' + headers['partition']", TestUtils.getPropertyValue(adapter, "queueNameExpression", Expression.class).getExpressionString()); producerBinding.unbind(); consumerBinding.unbind(); assertFalse(producerEndpoint.isRunning()); assertFalse(extractEndpoint(consumerBinding).isRunning()); }</code><technical_language>properties mutually exclusive (validated props?): - partitionKeyExpression partitionKeyExtractorClass - partitionSelectorExpression partitionSelectorClass</technical_language>

Target:
public void testProducerProperties() throws Exception { RedisTestBinder binder = getBinder(); Binding<MessageChannel> consumerBinding = binder.bindConsumer("props.0", "test", new DirectChannel(), createConsumerProperties()); Binding<MessageChannel> producerBinding = binder.bindProducer("props.0", new DirectChannel(), createProducerProperties()); AbstractEndpoint producerEndpoint = extractEndpoint(producerBinding); @SuppressWarnings("unchecked") Map<String, RedisQueueOutboundChannelAdapter> adapters = TestUtils.getPropertyValue(producerEndpoint, "handler.adapters", Map.class); RedisQueueOutboundChannelAdapter adapter = adapters.get("test"); assertEquals( "props.0.test", TestUtils.getPropertyValue(adapter, "queueNameExpression", Expression.class).getExpressionString()); producerBinding.unbind(); assertFalse(producerEndpoint.isRunning()); ProducerProperties producerProperties = new ProducerProperties(); producerProperties.setPartitionKeyExpression(spelExpressionParser.parseExpression("'foo'")); producerProperties.setPartitionKeyExtractorClass(AbstractRedisSerializerTests.Foo.class); producerProperties.setPartitionSelectorExpression(spelExpressionParser.parseExpression("0")); producerProperties.setPartitionSelectorClass(AbstractRedisSerializerTests.Foo.class); producerProperties.setPartitionCount(1); producerBinding = binder.bindProducer("props.0", new DirectChannel(), producerProperties); producerEndpoint = extractEndpoint(producerBinding); adapter = (RedisQueueOutboundChannelAdapter) TestUtils.getPropertyValue(producerEndpoint, "handler.adapters", Map.class).get("test"); assertEquals( "'props.0.test-' + headers['partition']", TestUtils.getPropertyValue(adapter, "queueNameExpression", Expression.class).getExpressionString()); producerBinding.unbind(); consumerBinding.unbind(); assertFalse(producerEndpoint.isRunning()); assertFalse(extractEndpoint(consumerBinding).isRunning()); }