You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2018/10/12 11:26:15 UTC
[camel] 11/44: [CAMEL-12818] Remove deprecated stuff from
camel-rabbitmq
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4df0d7a3a8868243059dd513f93d77cc873c0d69
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Sep 24 08:42:04 2018 +0200
[CAMEL-12818] Remove deprecated stuff from camel-rabbitmq
---
.../src/main/docs/rabbitmq-component.adoc | 7 +-
.../camel/component/rabbitmq/ArgsConfigurer.java | 40 ----
.../component/rabbitmq/RabbitMQComponent.java | 6 -
.../component/rabbitmq/RabbitMQDeclareSupport.java | 14 +-
.../camel/component/rabbitmq/RabbitMQEndpoint.java | 88 +--------
.../rabbitmq/RabbitMQConsumerIntTest.java | 4 +-
.../component/rabbitmq/RabbitMQEndpointTest.java | 76 +------
.../component/rabbitmq/RabbitMQInOutIntTest.java | 8 +-
.../camel/component/restlet/RestletComponent.java | 15 --
.../camel/component/restlet/RestletEndpoint.java | 18 --
.../org/apache/camel/test/junit4/TestSupport.java | 34 ----
.../xmlsecurity/XMLSecurityDataFormat.java | 218 +--------------------
.../xmlsecurity/XMLSecurityDataFormatTest.java | 30 +--
13 files changed, 24 insertions(+), 534 deletions(-)
diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
index a529c1d..afbbec1 100644
--- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
+++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
@@ -127,7 +127,7 @@ with the following path and query parameters:
|===
-==== Query Parameters (62 parameters):
+==== Query Parameters (57 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -175,14 +175,9 @@ with the following path and query parameters:
| *publisherAcknowledgements Timeout* (producer) | The amount of time in milliseconds to wait for a basic.ack response from RabbitMQ server | | long
| *args* (advanced) | Specify arguments for configuring the different RabbitMQ concepts, a different prefix is required for each: Exchange: arg.exchange. Queue: arg.queue. Binding: arg.binding. For example to declare a queue with message ttl argument: http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000 | | Map
| *automaticRecoveryEnabled* (advanced) | Enables connection automatic recovery (uses connection implementation that performs automatic recovery when connection shutdown is not initiated by the application) | | Boolean
-| *bindingArgs* (advanced) | *Deprecated* Key/value args for configuring the queue binding parameters when declare=true | | Map
| *clientProperties* (advanced) | Connection client properties (client info used in negotiating with the server) | | Map
| *connectionTimeout* (advanced) | Connection timeout | 60000 | int
-| *exchangeArgs* (advanced) | *Deprecated* Key/value args for configuring the exchange parameters when declare=true | | Map
-| *exchangeArgsConfigurer* (advanced) | *Deprecated* Set the configurer for setting the exchange args in Channel.exchangeDeclare | | ArgsConfigurer
| *networkRecoveryInterval* (advanced) | Network recovery interval in milliseconds (interval used when recovering from network failure) | 5000 | Integer
-| *queueArgs* (advanced) | *Deprecated* Key/value args for configuring the queue parameters when declare=true | | Map
-| *queueArgsConfigurer* (advanced) | *Deprecated* Set the configurer for setting the queue args in Channel.queueDeclare | | ArgsConfigurer
| *requestedChannelMax* (advanced) | Connection requested channel max (max number of channels offered) | 2047 | int
| *requestedFrameMax* (advanced) | Connection requested frame max (max size of frame offered) | 0 | int
| *requestedHeartbeat* (advanced) | Connection requested heartbeat (heart-beat in seconds offered) | 60 | int
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/ArgsConfigurer.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/ArgsConfigurer.java
deleted file mode 100644
index 0ed1bbb..0000000
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/ArgsConfigurer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.rabbitmq;
-
-import java.util.Map;
-
-/**
- * @deprecated The endpoint uri properties
- * <ul>
- * <li>{@link RabbitMQEndpoint#setExchangeArgs(Map)}</li>
- * <li>{@link RabbitMQEndpoint#setQueueArgs(Map)}</li>
- * <li>{@link RabbitMQEndpoint#setBindingArgs(Map)}</li>
- * </ul>
- *
- * are favoured over their configurer counterparts.
- */
-@Deprecated
-public interface ArgsConfigurer {
-
- /**
- * Configure the args maps for RabbitMQ to use
- * @param args the map need to be configured
- */
- void configurArgs(Map<String, Object> args);
-
-}
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
index f50fb5c..fe9b7ff 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
@@ -259,12 +259,6 @@ public class RabbitMQComponent extends DefaultComponent {
localArgs.putAll(IntrospectionSupport.extractProperties(params, ARG_PREFIX));
endpoint.setArgs(localArgs);
- Map<String, Object> argsCopy = new HashMap<>(localArgs);
-
- // Combine the three types of rabbit arguments with their individual endpoint properties
- endpoint.getExchangeArgs().putAll(IntrospectionSupport.extractProperties(argsCopy, EXCHANGE_ARG_PREFIX));
- endpoint.getQueueArgs().putAll(IntrospectionSupport.extractProperties(argsCopy, QUEUE_ARG_PREFIX));
- endpoint.getBindingArgs().putAll(IntrospectionSupport.extractProperties(argsCopy, BINDING_ARG_PREFIX));
// Change null headers processing for message converter
endpoint.getMessageConverter().setAllowNullHeaders(endpoint.isAllowNullHeaders());
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
index 766cf41..0dafc46 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
@@ -59,7 +59,6 @@ public class RabbitMQDeclareSupport {
private Map<String, Object> resolvedQueueArguments() {
Map<String, Object> queueArgs = new HashMap<>();
populateQueueArgumentsFromDeadLetterExchange(queueArgs);
- populateQueueArgumentsFromConfigurer(queueArgs);
queueArgs.putAll(endpoint.getQueueArgs());
formatSpecialQueueArguments(queueArgs);
return queueArgs;
@@ -91,12 +90,7 @@ public class RabbitMQDeclareSupport {
}
private Map<String, Object> resolvedExchangeArguments() {
- Map<String, Object> exchangeArgs = new HashMap<>();
- if (endpoint.getExchangeArgsConfigurer() != null) {
- endpoint.getExchangeArgsConfigurer().configurArgs(exchangeArgs);
- }
- exchangeArgs.putAll(endpoint.getExchangeArgs());
- return exchangeArgs;
+ return endpoint.getExchangeArgs();
}
private boolean shouldDeclareQueue() {
@@ -111,12 +105,6 @@ public class RabbitMQDeclareSupport {
return !endpoint.isSkipQueueBind();
}
- private void populateQueueArgumentsFromConfigurer(final Map<String, Object> queueArgs) {
- if (endpoint.getQueueArgsConfigurer() != null) {
- endpoint.getQueueArgsConfigurer().configurArgs(queueArgs);
- }
- }
-
private void declareExchange(final Channel channel, final String exchange, final String exchangeType, final Map<String, Object> exchangeArgs) throws IOException {
if (endpoint.isPassive()) {
channel.exchangeDeclarePassive(exchange);
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
index c715514..4e3eb71 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
@@ -42,6 +42,11 @@ import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.IntrospectionSupport;
+
+import static org.apache.camel.component.rabbitmq.RabbitMQComponent.BINDING_ARG_PREFIX;
+import static org.apache.camel.component.rabbitmq.RabbitMQComponent.EXCHANGE_ARG_PREFIX;
+import static org.apache.camel.component.rabbitmq.RabbitMQComponent.QUEUE_ARG_PREFIX;
/**
* The rabbitmq component allows you produce and consume messages from
@@ -147,21 +152,6 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
private boolean immediate;
@UriParam(label = "advanced", prefix = "arg.", multiValue = true)
private Map<String, Object> args;
- @UriParam(label = "advanced")
- @Deprecated
- private Map<String, Object> exchangeArgs = new HashMap<>();
- @UriParam(label = "advanced")
- @Deprecated
- private Map<String, Object> queueArgs = new HashMap<>();
- @UriParam(label = "advanced")
- @Deprecated
- private Map<String, Object> bindingArgs = new HashMap<>();
- @UriParam(label = "advanced")
- @Deprecated
- private ArgsConfigurer queueArgsConfigurer;
- @UriParam(label = "advanced")
- @Deprecated
- private ArgsConfigurer exchangeArgsConfigurer;
@UriParam(label = "advanced", defaultValue = "20000")
private long requestTimeout = 20000;
@UriParam(label = "advanced", defaultValue = "1000")
@@ -809,79 +799,19 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
return args;
}
- /**
- * Key/value args for configuring the exchange parameters when declare=true
- *
- * @Deprecated Use args instead e.g arg.exchange.x-message-ttl=1000
- */
- @Deprecated
- public void setExchangeArgs(Map<String, Object> exchangeArgs) {
- this.exchangeArgs = exchangeArgs;
- }
-
public Map<String, Object> getExchangeArgs() {
- return exchangeArgs;
- }
-
- /**
- * Key/value args for configuring the queue parameters when declare=true
- *
- * @Deprecated Use args instead e.g arg.queue.x-message-ttl=1000
- */
- public void setQueueArgs(Map<String, Object> queueArgs) {
- this.queueArgs = queueArgs;
+ return IntrospectionSupport.extractProperties(args, EXCHANGE_ARG_PREFIX);
}
public Map<String, Object> getQueueArgs() {
- return queueArgs;
- }
-
- /**
- * Key/value args for configuring the queue binding parameters when
- * declare=true
- *
- * @Deprecated Use args instead e.g arg.binding.foo=bar
- */
- public void setBindingArgs(Map<String, Object> bindingArgs) {
- this.bindingArgs = bindingArgs;
+ return IntrospectionSupport.extractProperties(args, QUEUE_ARG_PREFIX);
}
public Map<String, Object> getBindingArgs() {
- return bindingArgs;
- }
-
- @Deprecated
- public ArgsConfigurer getQueueArgsConfigurer() {
- return queueArgsConfigurer;
- }
-
- /**
- * Set the configurer for setting the queue args in Channel.queueDeclare
- *
- * @deprecated Use args instead e.g arg.queue.x-message-ttl=1000
- */
- @Deprecated
- public void setQueueArgsConfigurer(ArgsConfigurer queueArgsConfigurer) {
- this.queueArgsConfigurer = queueArgsConfigurer;
+ return IntrospectionSupport.extractProperties(args, BINDING_ARG_PREFIX);
}
- @Deprecated
- public ArgsConfigurer getExchangeArgsConfigurer() {
- return exchangeArgsConfigurer;
- }
-
- /**
- * Set the configurer for setting the exchange args in
- * Channel.exchangeDeclare
- *
- * @deprecated Use args instead e.g arg.exchange.x-message-ttl=1000
- */
- @Deprecated
- public void setExchangeArgsConfigurer(ArgsConfigurer exchangeArgsConfigurer) {
- this.exchangeArgsConfigurer = exchangeArgsConfigurer;
- }
-
- /**
+ /**
* Set timeout for waiting for a reply when using the InOut Exchange Pattern
* (in milliseconds)
*/
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java
index 1b3826b..18aa700 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerIntTest.java
@@ -46,7 +46,7 @@ public class RabbitMQConsumerIntTest extends AbstractRabbitMQIntTest {
@EndpointInject(uri = "mock:result")
private MockEndpoint to;
- @EndpointInject(uri = "rabbitmq:localhost:5672/" + HEADERS_EXCHANGE + "?username=cameltest&password=cameltest&exchangeType=headers&queue=" + QUEUE + "&bindingArgs=#bindArgs")
+ @EndpointInject(uri = "rabbitmq:localhost:5672/" + HEADERS_EXCHANGE + "?username=cameltest&password=cameltest&exchangeType=headers&queue=" + QUEUE + "&args=#args")
private Endpoint headersExchangeWithQueue;
@EndpointInject(uri = "rabbitmq:localhost:5672/" + "ex7" + "?username=cameltest&password=cameltest&exchangeType=headers&autoDelete=false&durable=true&queue=q7&arg.binding.fizz=buzz")
@@ -70,7 +70,7 @@ public class RabbitMQConsumerIntTest extends AbstractRabbitMQIntTest {
JndiRegistry jndi = super.createRegistry();
Map<String, Object> bindingArgs = new HashMap<>();
- jndi.bind("bindArgs", bindingArgs);
+ jndi.bind("args", bindingArgs);
return jndi;
}
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
index 9308460..198a923 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
@@ -46,13 +46,6 @@ public class RabbitMQEndpointTest extends CamelTestSupport {
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
- registry.bind("argsConfigurer", new ArgsConfigurer() {
- @Override
- public void configurArgs(Map<String, Object> args) {
- // do nothing here
- }
-
- });
HashMap<String, Object> args = new HashMap<>();
args.put("foo", "bar");
@@ -161,53 +154,16 @@ public class RabbitMQEndpointTest extends CamelTestSupport {
@Test
public void createEndpointWithAutoAckDisabled() throws Exception {
RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?autoAck=false", RabbitMQEndpoint.class);
- assertEquals(false, endpoint.isAutoAck());
+ assertFalse(endpoint.isAutoAck());
}
@Test
public void assertSingleton() throws Exception {
RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange", RabbitMQEndpoint.class);
-
assertTrue(endpoint.isSingleton());
}
@Test
- public void testQueueArgsConfigurer() throws Exception {
- RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?queueArgsConfigurer=#argsConfigurer", RabbitMQEndpoint.class);
- assertNotNull("We should get the queueArgsConfigurer here.", endpoint.getQueueArgsConfigurer());
- assertNull("We should not get the exchangeArgsConfigurer here.", endpoint.getExchangeArgsConfigurer());
- assertTrue("We should not get the bindingArgsConfigurer here.", endpoint.getBindingArgs().isEmpty());
- }
-
- @Test
- public void testBindingArgs() throws Exception {
- RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?bindingArgs=#args", RabbitMQEndpoint.class);
- assertEquals("We should get the bindingArgsConfigurer here.", 1, endpoint.getBindingArgs().size());
- assertNull("We should not get the queueArgsConfigurer here.", endpoint.getQueueArgsConfigurer());
- assertNull("We should not get the exchangeArgsConfigurer here.", endpoint.getExchangeArgsConfigurer());
- }
-
- @Test
- public void testQueueArgs() throws Exception {
- RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?queueArgs=#args", RabbitMQEndpoint.class);
- assertEquals("We should get the queueArgs here.", 1, endpoint.getQueueArgs().size());
- assertTrue("We should not get the binding args here.", endpoint.getBindingArgs().isEmpty());
- assertTrue("We should not get the exchange args here.", endpoint.getExchangeArgs().isEmpty());
- assertNull("We should not get the exchangeArgsConfigurer here.", endpoint.getExchangeArgsConfigurer());
- assertNull("We should not get the queueArgsConfigurer here.", endpoint.getQueueArgsConfigurer());
- }
-
- @Test
- public void testExchangeArgs() throws Exception {
- RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?exchangeArgs=#args", RabbitMQEndpoint.class);
- assertEquals("We should get the exchangeArgs here.", 1, endpoint.getExchangeArgs().size());
- assertTrue("We should not get the binding args here.", endpoint.getBindingArgs().isEmpty());
- assertTrue("We should not get the queue args here.", endpoint.getQueueArgs().isEmpty());
- assertNull("We should not get the exchangeArgsConfigurer here.", endpoint.getExchangeArgsConfigurer());
- assertNull("We should not get the queueArgsConfigurer here.", endpoint.getQueueArgsConfigurer());
- }
-
- @Test
public void testMultiArgsPopulateCorrectEndpointProperties() throws Exception {
RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?arg.exchange.e1=v1&arg.exchange.e2=v2&arg.queue.q1=v3&arg.binding.b1=v4",
RabbitMQEndpoint.class);
@@ -218,36 +174,6 @@ public class RabbitMQEndpointTest extends CamelTestSupport {
}
@Test
- public void testMultiArgsCombinedWithIndividuallySpecified() throws Exception {
- // setup two arguments for each rabbit fundamental.
- // Configured inline and via named map in the camel registry
- RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange" + "?arg.exchange.e1=v1&exchangeArgs=#args" + "&arg.queue.q1=v2&queueArgs=#moreArgs"
- + "&arg.binding.b1=v3&bindingArgs=#evenMoreArgs", RabbitMQEndpoint.class);
-
- // The multi-value inline has 3
- Map<String, Object> inlineArgs = endpoint.getArgs();
- assertEquals("Wrong number of args", 3, inlineArgs.size());
- assertTrue(inlineArgs.containsKey("exchange.e1"));
- assertTrue(inlineArgs.containsKey("queue.q1"));
- assertTrue(inlineArgs.containsKey("binding.b1"));
-
- Map<String, Object> exchangeArgs = endpoint.getExchangeArgs();
- assertEquals("Wrong number of exchange args", 2, exchangeArgs.size());
- assertTrue("Should contain the individually specified exchange args", exchangeArgs.containsKey("foo"));
- assertTrue("Should contain the args in the multi-value map", exchangeArgs.containsKey("e1"));
-
- Map<String, Object> queueArgs = endpoint.getQueueArgs();
- assertEquals("Wrong number of queue args", 2, queueArgs.size());
- assertTrue("Should contain the individually specified queue args", queueArgs.containsKey("fizz"));
- assertTrue("Should contain the args in the multi-value map", queueArgs.containsKey("q1"));
-
- Map<String, Object> bindingArgs = endpoint.getBindingArgs();
- assertEquals("Wrong number of binding args", 2, bindingArgs.size());
- assertTrue("Should contain the individually specified binding args", bindingArgs.containsKey("ping"));
- assertTrue("Should contain the args in the multi-value map", bindingArgs.containsKey("b1"));
- }
-
- @Test
public void brokerEndpointAddressesSettings() throws Exception {
RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?addresses=server1:12345,server2:12345", RabbitMQEndpoint.class);
assertEquals("Wrong size of endpoint addresses.", 2, endpoint.getAddresses().length);
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java
index 61a7e53..105d2d6 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java
@@ -63,7 +63,7 @@ public class RabbitMQInOutIntTest extends AbstractRabbitMQIntTest {
@EndpointInject(uri = "rabbitmq:localhost:5672/" + EXCHANGE_NO_ACK + "?threadPoolSize=1&exchangeType=direct&username=cameltest&password=cameltest"
+ "&autoAck=false&autoDelete=false&durable=false&queue=q5&routingKey=" + ROUTING_KEY
+ "&transferException=true&requestTimeout=" + TIMEOUT_MS
- + "&queueArgs=#queueArgs")
+ + "&args=#args")
private Endpoint noAutoAckEndpoint;
@EndpointInject(uri = "mock:result")
@@ -73,9 +73,9 @@ public class RabbitMQInOutIntTest extends AbstractRabbitMQIntTest {
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
- HashMap<String, Object> queueArgs = new HashMap<>();
- queueArgs.put("x-expires", 60000);
- jndi.bind("queueArgs", queueArgs);
+ HashMap<String, Object> args = new HashMap<>();
+ args.put("queue.x-expires", 60000);
+ jndi.bind("args", args);
return jndi;
}
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index b73e874..5512e21 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -255,12 +255,6 @@ public class RestletComponent extends DefaultComponent implements RestConsumerFa
if (endpoint.getUriPattern() != null && endpoint.getUriPattern().length() > 0) {
attachUriPatternToRestlet(offsetPath, endpoint.getUriPattern(), endpoint, consumer.getRestlet());
}
-
- if (endpoint.getRestletUriPatterns() != null) {
- for (String uriPattern : endpoint.getRestletUriPatterns()) {
- attachUriPatternToRestlet(offsetPath, uriPattern, endpoint, consumer.getRestlet());
- }
- }
}
public void disconnect(RestletConsumer consumer) throws Exception {
@@ -276,15 +270,6 @@ public class RestletComponent extends DefaultComponent implements RestConsumerFa
}
}
- if (endpoint.getRestletUriPatterns() != null) {
- for (String uriPattern : endpoint.getRestletUriPatterns()) {
- MethodBasedRouter methodRouter = getMethodRouter(uriPattern, false);
- if (methodRouter != null) {
- routesToRemove.add(methodRouter);
- }
- }
- }
-
for (MethodBasedRouter router : routesToRemove) {
List<Method> methods = new ArrayList<>();
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
index 5c23846..4e7515a 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
@@ -66,9 +66,6 @@ public class RestletEndpoint extends DefaultEndpoint implements AsyncEndpoint, H
private Method restletMethod = Method.GET;
@UriParam(label = "consumer", javaType = "java.lang.String")
private Method[] restletMethods;
- @UriParam(label = "consumer,advanced")
- @Deprecated
- private List<String> restletUriPatterns;
@UriParam(label = "security")
private Map<String, String> restletRealm;
@UriParam(label = "advanced")
@@ -268,21 +265,6 @@ public class RestletEndpoint extends DefaultEndpoint implements AsyncEndpoint, H
return restletMethods;
}
- /**
- * Specify one ore more URI templates to be serviced by a restlet consumer endpoint, using the # notation to
- * reference a List<String> in the Camel Registry.
- * If a URI pattern has been defined in the endpoint URI, both the URI pattern defined in the endpoint and the restletUriPatterns option will be honored.
- */
- @Deprecated
- public void setRestletUriPatterns(List<String> restletUriPatterns) {
- this.restletUriPatterns = restletUriPatterns;
- }
-
- @Deprecated
- public List<String> getRestletUriPatterns() {
- return restletUriPatterns;
- }
-
public boolean isThrowExceptionOnFailure() {
return throwExceptionOnFailure;
}
diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
index 3d753a9..b01e7c9 100644
--- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
@@ -338,40 +338,6 @@ public abstract class TestSupport extends Assert {
}
/**
- * If a processor is wrapped with a bunch of DelegateProcessor or DelegateAsyncProcessor objects
- * this call will drill through them and return the wrapped Processor.
- */
- @Deprecated
- public static Processor unwrap(Processor processor) {
- while (true) {
- if (processor instanceof DelegateProcessor) {
- processor = ((DelegateProcessor)processor).getProcessor();
- } else {
- return processor;
- }
- }
- }
-
- /**
- * If a processor is wrapped with a bunch of DelegateProcessor or DelegateAsyncProcessor objects
- * this call will drill through them and return the Channel.
- * <p/>
- * Returns null if no channel is found.
- */
- @Deprecated
- public static Channel unwrapChannel(Processor processor) {
- while (true) {
- if (processor instanceof Channel) {
- return (Channel) processor;
- } else if (processor instanceof DelegateProcessor) {
- processor = ((DelegateProcessor)processor).getProcessor();
- } else {
- return null;
- }
- }
- }
-
- /**
* Recursively delete a directory, useful to zapping test data
*
* @param file the directory to be deleted
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
index 9417b4f..24e7e01 100644
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
@@ -20,7 +20,6 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
-import java.net.URL;
import java.security.AccessController;
import java.security.InvalidKeyException;
import java.security.Key;
@@ -70,42 +69,6 @@ import org.slf4j.LoggerFactory;
public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat, DataFormatName, CamelContextAware {
- /**
- * @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public static final String XML_ENC_RECIPIENT_ALIAS = "CamelXmlEncryptionRecipientAlias";
-
- /**
- * @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public static final String XML_ENC_TRUST_STORE_URL = "CamelXmlEncryptionTrustStoreUrl";
-
- /**
- * @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public static final String XML_ENC_TRUST_STORE_PASSWORD = "CamelXmlEncryptionTrustStorePassword";
-
- /**
- * @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public static final String XML_ENC_KEY_STORE_URL = "CamelXmlEncryptionKeyStoreUrl";
-
- /**
- * @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public static final String XML_ENC_KEY_STORE_PASSWORD = "CamelXmlEncryptionKeyStorePassword";
-
- /**
- * @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public static final String XML_ENC_KEY_STORE_ALIAS = "CamelXmlEncryptionKeyAlias";
-
private static final Logger LOG = LoggerFactory.getLogger(XMLSecurityDataFormat.class);
private static final String DEFAULT_KEY = "Just another 24 Byte key";
@@ -221,37 +184,8 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
this.setPassPhrase(passPhrase);
this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
}
-
- /**
- * @deprecated use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, String)} or
- * {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public XMLSecurityDataFormat(String secureTag, boolean secureTagContents, String xmlCipherAlgorithm,
- String keyCipherAlgorithm) {
- this();
- this.setSecureTag(secureTag);
- this.setSecureTagContents(secureTagContents);
- this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
- this.setKeyCipherAlgorithm(keyCipherAlgorithm);
- }
-
- /**
- * @deprecated use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, String)} or
- * {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
- */
- @Deprecated
- public XMLSecurityDataFormat(String secureTag, boolean secureTagContents, String recipientKeyAlias,
- String xmlCipherAlgorithm, String keyCipherAlgorithm) {
- this();
- this.setSecureTag(secureTag);
- this.setSecureTagContents(secureTagContents);
- this.setXmlCipherAlgorithm(xmlCipherAlgorithm);
- this.setRecipientKeyAlias(recipientKeyAlias);
- this.setKeyCipherAlgorithm(keyCipherAlgorithm);
- }
-
- public XMLSecurityDataFormat(String secureTag, boolean secureTagContents, String recipientKeyAlias,
+
+ public XMLSecurityDataFormat(String secureTag, boolean secureTagContents, String recipientKeyAlias,
String xmlCipherAlgorithm, String keyCipherAlgorithm, String keyOrTrustStoreParametersId) {
this();
this.setSecureTag(secureTag);
@@ -374,11 +308,6 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
@Override
public void setCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
- try {
- setDefaultsFromContext(camelContext);
- } catch (Exception e) {
- throw new IllegalStateException("Could not initialize XMLSecurityDataFormat with camelContext. ", e);
- }
}
@Override
@@ -396,44 +325,7 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
// noop
}
- /**
- * Sets missing properties that are defined in the Camel context.
- * @deprecated this operation populates the data format using depreciated properties and will be
- * removed at the end of the deprecation period
- */
- @Deprecated
- private void setDefaultsFromContext(CamelContext context) throws Exception {
- Map<String, String> contextProps = context.getGlobalOptions();
-
- if (this.recipientKeyAlias == null) {
- recipientKeyAlias = context.getGlobalOption(XML_ENC_RECIPIENT_ALIAS);
- }
-
- if (this.trustStore == null && contextProps.containsKey(XML_ENC_TRUST_STORE_URL)) {
- trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
- URL trustStoreUrl = new URL(context.getGlobalOption(XML_ENC_TRUST_STORE_URL));
- if (trustStorePassword == null) {
- trustStorePassword = context.getGlobalOption(XML_ENC_TRUST_STORE_PASSWORD);
- }
- trustStore.load(trustStoreUrl.openStream(), trustStorePassword.toCharArray());
- }
-
- if (this.keyStore == null && contextProps.containsKey(XML_ENC_KEY_STORE_URL)) {
- keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
- URL keyStoreUrl = new URL(context.getGlobalOption(XML_ENC_KEY_STORE_URL));
- if (keyStorePassword == null) {
- keyStorePassword = context.getGlobalOption(XML_ENC_KEY_STORE_PASSWORD);
- }
- keyStore.load(keyStoreUrl.openStream(), keyStorePassword.toCharArray());
- }
-
- if (context.getGlobalOptions().containsKey(XML_ENC_KEY_STORE_ALIAS) && this.recipientKeyAlias == null) {
- recipientKeyAlias = context.getGlobalOption(XML_ENC_KEY_STORE_ALIAS);
- }
- }
-
-
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
// Retrieve the message body as input stream
InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, graph);
@@ -461,7 +353,7 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
* or recipient list.
*/
private void encryptAsymmetric(Exchange exchange, Document document, OutputStream stream) throws Exception {
- String exchangeRecipientAlias = getRecipientKeyAlias(exchange);
+ String exchangeRecipientAlias = getRecipientKeyAlias();
if (null == exchangeRecipientAlias) {
throw new IllegalStateException("The recipient's key alias must be defined for asymmetric key encryption.");
@@ -810,16 +702,6 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
return algorithmKeyWrap;
}
- private String getRecipientKeyAlias(Exchange exchange) {
- String alias = exchange.getIn().getHeader(XML_ENC_RECIPIENT_ALIAS, String.class);
- if (alias != null) {
- exchange.getIn().setHeader(XML_ENC_RECIPIENT_ALIAS, null);
- } else {
- alias = recipientKeyAlias;
- }
- return alias;
- }
-
// Check to see if the asymmetric key transport algorithm is allowed
private void checkEncryptionAlgorithm(Key keyEncryptionKey, Element parentElement) throws Exception {
if (XMLCipher.RSA_v1dot5.equals(keyCipherAlgorithm)
@@ -917,12 +799,7 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
public void setXmlCipherAlgorithm(String xmlCipherAlgorithm) {
this.xmlCipherAlgorithm = xmlCipherAlgorithm;
}
-
- @Deprecated
- public String getKeyCyperAlgorithm() {
- return keyCipherAlgorithm;
- }
-
+
public String getKeyCipherAlgorithm() {
return keyCipherAlgorithm;
}
@@ -966,92 +843,7 @@ public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat,
public void setSecureTagContents(boolean secureTagContents) {
this.secureTagContents = secureTagContents;
}
-
- /**
- * Gets the KeyStore configured for this data format.
- * @deprecated Will change to private access in the future.
- */
- @Deprecated
- public KeyStore getKeyStore() {
- if (keyStore == null && this.keyOrTrustStoreParameters != null) {
- try {
- keyStore = keyOrTrustStoreParameters.createKeyStore();
- } catch (Exception e) {
- throw new RuntimeException("Unable to create KeyStore with configured KeyStoreParameters. " + e.getMessage(), e);
- }
- }
- return this.keyStore;
- }
-
- /**
- * @deprecated Use {@link #getKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public void setKeyStore(KeyStore keyStore) {
- this.keyStore = keyStore;
- }
-
- /**
- * @deprecated Will change to private access in the future. Use {@link #getKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public KeyStore getTrustStore() {
- if (trustStore == null && this.keyOrTrustStoreParameters != null) {
- try {
- trustStore = keyOrTrustStoreParameters.createKeyStore();
- } catch (Exception e) {
- throw new RuntimeException("Unable to create KeyStore with configured KeyStoreParameters. " + e.getMessage(), e);
- }
- }
- return this.trustStore;
- }
-
- /**
- * @deprecated Use {@link #setKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public void setTrustStore(KeyStore trustStore) {
- this.trustStore = trustStore;
- }
-
- /**
- * @deprecated Will change to private access in the future. Use {@link #getKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public String getKeyStorePassword() {
- if (this.keyOrTrustStoreParameters != null) {
- return keyOrTrustStoreParameters.getPassword();
- }
- return this.keyStorePassword;
- }
-
- /**
- * @deprecated Use {@link #setKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public void setKeyStorePassword(String keyStorePassword) {
- this.keyStorePassword = keyStorePassword;
- }
-
- /**
- * @deprecated Will change to private access in the future. Use {@link #setKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public String getTrustStorePassword() {
- if (this.keyOrTrustStoreParameters != null) {
- return keyOrTrustStoreParameters.getPassword();
- }
- return this.trustStorePassword;
- }
-
- /**
- * @deprecated Use {@link #setKeyOrTrustStoreParameters()} instead.
- */
- @Deprecated
- public void setTrustStorePassword(String trustStorePassword) {
- this.trustStorePassword = trustStorePassword;
- }
-
+
public void setKeyOrTrustStoreParameters(KeyStoreParameters parameters) {
this.keyOrTrustStoreParameters = parameters;
}
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
index 1125ae9..4c75171 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
@@ -198,9 +198,6 @@ public class XMLSecurityDataFormatTest extends CamelTestSupport {
tsParameters.setPassword("password");
tsParameters.setResource("sender.ts");
- Map<String, String> contextProps = context.getGlobalOptions();
- contextProps.put(XMLSecurityDataFormat.XML_ENC_TRUST_STORE_PASSWORD, "password");
-
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:start")
@@ -210,32 +207,7 @@ public class XMLSecurityDataFormatTest extends CamelTestSupport {
});
xmlsecTestHelper.testEncryption(context);
}
-
- @Test
- @SuppressWarnings("deprecation")
- public void testPartialPayloadAsymmetricKeyEncryptionWithExchangeRecipientAlias() throws Exception {
- MockEndpoint resultEndpoint = context.getEndpoint("mock:foo", MockEndpoint.class);
- resultEndpoint.setExpectedMessageCount(1);
-
- final KeyStoreParameters tsParameters = new KeyStoreParameters();
- tsParameters.setPassword("password");
- tsParameters.setResource("sender.ts");
-
- context.addRoutes(new RouteBuilder() {
- public void configure() {
- from("direct:start")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader(XMLSecurityDataFormat.XML_ENC_RECIPIENT_ALIAS, "recipient");
- }
- })
- .marshal().secureXML("//cheesesites/italy/cheese", true, null, testCypherAlgorithm, XMLCipher.RSA_v1dot5, tsParameters)
- .to("mock:encrypted");
- }
- });
- xmlsecTestHelper.testEncryption(context);
- }
-
+
@Test
public void testAsymmetricEncryptionAddKeyValue() throws Exception {
KeyStoreParameters tsParameters = new KeyStoreParameters();