You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/23 07:30:58 UTC
[camel] 06/06: Avoid using mockito when possible
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f1378086875633003be3e56d86839e6fb16c3ca3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 09:18:57 2019 +0200
Avoid using mockito when possible
---
.../component/rabbitmq/RabbitMQComponentTest.java | 20 ++++++++------------
.../src/main/docs/spring-ws-component.adoc | 4 ++--
.../spring/ws/SpringWebserviceConfiguration.java | 4 ++--
.../dsl/SpringWebserviceEndpointBuilderFactory.java | 10 +++++-----
4 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java
index 4025f02..10183d9 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java
@@ -23,19 +23,16 @@ import com.rabbitmq.client.ConnectionFactory;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.support.SimpleRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
import org.mockito.Mockito;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.mockito.AdditionalAnswers.returnsFirstArg;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
+public class RabbitMQComponentTest extends CamelTestSupport {
-public class RabbitMQComponentTest {
-
- private CamelContext context = Mockito.mock(CamelContext.class);
+ @Override
+ public boolean isUseRouteBuilder() {
+ return super.isUseRouteBuilder();
+ }
@Test
public void testDefaultProperties() throws Exception {
@@ -100,10 +97,9 @@ public class RabbitMQComponentTest {
String uri = "rabbitmq:special.host:14/queuey";
String remaining = "special.host:14/queuey";
- RabbitMQComponent comp = new RabbitMQComponent(context);
- when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
+ RabbitMQComponent comp = context.getComponent("rabbitmq", RabbitMQComponent.class);
comp.setAutoDetectConnectionFactory(false);
- return comp.createEndpoint(uri, remaining, params);
+ return (RabbitMQEndpoint) comp.createEndpoint(uri, params);
}
@Test
diff --git a/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc b/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
index 1b88ba8..905ad2d 100644
--- a/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
+++ b/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
@@ -113,9 +113,9 @@ with the following path and query parameters:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
+| *type* | Endpoint mapping type if endpoint mapping is used. rootqname - Offers the option to map web service requests based on the qualified name of the root element contained in the message. soapaction - Used to map web service requests based on the SOAP action specified in the header of the message. uri - In order to map web service requests that target a specific URI. xpathresult - Used to map web service requests based on the evaluation of an XPath expression against the incoming m [...]
+| *lookupKey* | Endpoint mapping key if endpoint mapping is used | | String
| *webServiceEndpointUri* | The default Web Service endpoint uri to use for the producer. | | String
-| *endpointMappingType* | Endpoint mapping type if endpoint mapping is used. rootqname - Offers the option to map web service requests based on the qualified name of the root element contained in the message. soapaction - Used to map web service requests based on the SOAP action specified in the header of the message. uri - In order to map web service requests that target a specific URI. xpathresult - Used to map web service requests based on the evaluation of an XPath expression against [...]
-| *endpointMappingLookupKey* | Endpoint mapping key if endpoint mapping is used | | String
| *expression* | The XPath expression to use when option type=xpathresult. Then this option is required to be configured. | | String
|===
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
index bc727d7..f162773 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
@@ -77,9 +77,9 @@ public class SpringWebserviceConfiguration {
private boolean allowResponseAttachmentOverride;
/* Consumer configuration */
- @UriPath(label = "consumer")
+ @UriPath(label = "consumer", name = "type")
private EndpointMappingType endpointMappingType;
- @UriPath(label = "consumer")
+ @UriPath(label = "consumer", name = "lookupKey")
private String endpointMappingLookupKey;
@UriPath(label = "consumer")
private String expression;
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
index cefc3d0..f5a00c9 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
@@ -1002,10 +1002,7 @@ public interface SpringWebserviceEndpointBuilderFactory {
*
* Syntax: <code>spring-ws:type:lookupKey:webServiceEndpointUri</code>
*
- * Path parameter: webServiceEndpointUri
- * The default Web Service endpoint uri to use for the producer.
- *
- * Path parameter: endpointMappingType
+ * Path parameter: type
* Endpoint mapping type if endpoint mapping is used. rootqname - Offers the
* option to map web service requests based on the qualified name of the
* root element contained in the message. soapaction - Used to map web
@@ -1021,9 +1018,12 @@ public interface SpringWebserviceEndpointBuilderFactory {
* The value can be one of: ROOT_QNAME, ACTION, TO, SOAP_ACTION,
* XPATHRESULT, URI, URI_PATH, BEANNAME
*
- * Path parameter: endpointMappingLookupKey
+ * Path parameter: lookupKey
* Endpoint mapping key if endpoint mapping is used
*
+ * Path parameter: webServiceEndpointUri
+ * The default Web Service endpoint uri to use for the producer.
+ *
* Path parameter: expression
* The XPath expression to use when option type=xpathresult. Then this
* option is required to be configured.