This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 71e2c03 CAMEL-14921: Fixed endpoint DSL
71e2c03 is described below
commit 71e2c0357c61135ad7a4dc68990ecc51c8f014ce
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Apr 17 06:46:46 2020 +0200
CAMEL-14921: Fixed endpoint DSL
---
.../apache/camel/builder/endpoint/PahoTest.java | 53 ++++++++++++++++++++++
.../org/apache/camel/support/DefaultComponent.java | 2 +-
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git
a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/PahoTest.java
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/PahoTest.java
new file mode 100644
index 0000000..dac1ff1
--- /dev/null
+++
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/PahoTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.builder.endpoint;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.endpoint.dsl.PahoEndpointBuilderFactory;
+import org.apache.camel.component.paho.PahoEndpoint;
+import org.junit.Test;
+
+public class PahoTest extends ContextTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testPaho() throws Exception {
+ context.start();
+
+ context.addRoutes(new EndpointRouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ PahoEndpointBuilderFactory.PahoEndpointBuilder builder =
paho("mytopic").brokerUrl("mybroker:1234").userName("myUser").password("myPassword");
+ Endpoint endpoint = builder.resolve(context);
+ assertNotNull(endpoint);
+ PahoEndpoint pe = assertIsInstanceOf(PahoEndpoint.class,
endpoint);
+ assertEquals("mybroker:1234",
pe.getConfiguration().getBrokerUrl());
+ assertEquals("myUser", pe.getConfiguration().getUserName());
+ assertEquals("myPassword",
pe.getConfiguration().getPassword());
+ assertEquals("mytopic", pe.getTopic());
+ }
+ });
+
+ context.stop();
+ }
+
+}
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
index e8aba62..a531f97 100644
---
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
+++
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
@@ -392,7 +392,7 @@ public abstract class DefaultComponent extends
ServiceSupport implements Compone
}
@Override
- protected void doInit() throws Exception {
+ protected void doBuild() throws Exception {
org.apache.camel.spi.annotations.Component ann =
ObjectHelper.getAnnotation(this,
org.apache.camel.spi.annotations.Component.class);
if (ann != null) {
String name = ann.value();