You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by he...@apache.org on 2015/03/04 17:57:10 UTC
[2/2] camel git commit: [Spring Boot] Added @Component test.
[Spring Boot] Added @Component test.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3470575
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3470575
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3470575
Branch: refs/heads/master
Commit: f3470575496d7f60eb440fcfc8602d4725aef771
Parents: 2b0e1e2
Author: Henryk Konsek <he...@gmail.com>
Authored: Wed Mar 4 17:56:40 2015 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Wed Mar 4 17:56:58 2015 +0100
----------------------------------------------------------------------
.../boot/componentroute/ComponentRoute.java | 30 +++++++++++
.../boot/componentroute/ComponentRouteTest.java | 55 ++++++++++++++++++++
2 files changed, 85 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f3470575/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java
new file mode 100644
index 0000000..9dad981
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java
@@ -0,0 +1,30 @@
+/**
+ * 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.spring.boot.componentroute;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ComponentRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:componentRoute").to("mock:componentRoute");
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/f3470575/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java
new file mode 100644
index 0000000..c950f1e
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.spring.boot.componentroute;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootApplication
+@SpringApplicationConfiguration(classes = ComponentRouteTest.class)
+public class ComponentRouteTest extends Assert {
+
+ @EndpointInject(uri = "mock:componentRoute")
+ MockEndpoint mock;
+
+ @Autowired
+ ProducerTemplate producerTemplate;
+
+ @Test
+ public void shouldNotProvideConverter() throws InterruptedException {
+ // Given
+ String msg = "msg";
+ mock.expectedBodiesReceived(msg);
+
+ // When
+ producerTemplate.sendBody("direct:componentRoute", msg);
+
+ // Then
+ mock.assertIsSatisfied();
+ }
+
+}
+