You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2017/03/02 12:55:23 UTC

[2/2] camel git commit: Moving test to a different package to use auto-configuration

Moving test to a different package to use auto-configuration


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/239a6b0d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/239a6b0d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/239a6b0d

Branch: refs/heads/master
Commit: 239a6b0d5c4ea0d99a44f760b5fb500ca6e2cc9e
Parents: dd6f9ba
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Thu Mar 2 13:51:00 2017 +0100
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Thu Mar 2 13:55:00 2017 +0100

----------------------------------------------------------------------
 .../ServletMappingAutoConfigurationTest.java    | 71 --------------------
 .../springboot/ServletMappingDisablingTest.java | 71 --------------------
 .../ServletMappingAutoConfigurationTest.java    | 70 +++++++++++++++++++
 .../test/ServletMappingDisablingTest.java       | 71 ++++++++++++++++++++
 4 files changed, 141 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/239a6b0d/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfigurationTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfigurationTest.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfigurationTest.java
deleted file mode 100644
index 2246780..0000000
--- a/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingAutoConfigurationTest.java
+++ /dev/null
@@ -1,71 +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.servlet.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Ignore;
-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.context.SpringBootTest;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-/**
- * Testing the servlet mapping
- */
-@RunWith(SpringRunner.class)
-@SpringBootApplication
-@DirtiesContext
-@ContextConfiguration(classes = {ServletMappingAutoConfiguration.class, CamelAutoConfiguration.class})
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-public class ServletMappingAutoConfigurationTest {
-
-    @Autowired
-    private TestRestTemplate restTemplate;
-
-    @Autowired
-    private CamelContext context;
-
-    @Before
-    public void setup() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-
-                rest().get("/thepath")
-                        .produces("text/plain")
-                        .route()
-                        .transform().constant("Hello");
-            }
-        });
-    }
-
-    @Test
-    public void testServletMapping() {
-        Assert.assertEquals("Hello", restTemplate.getForEntity("/camel/thepath", String.class).getBody());
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/camel/blob/239a6b0d/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingDisablingTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingDisablingTest.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingDisablingTest.java
deleted file mode 100644
index 4bd1854..0000000
--- a/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/ServletMappingDisablingTest.java
+++ /dev/null
@@ -1,71 +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.servlet.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Assert;
-import org.junit.Before;
-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.context.SpringBootTest;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-/**
- * Testing that the servlet mapping can be disabled.
- */
-@RunWith(SpringRunner.class)
-@SpringBootApplication
-@DirtiesContext
-@ContextConfiguration(classes = ServletMappingDisablingTest.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
-        "camel.component.servlet.mapping.enabled=false"
-})
-public class ServletMappingDisablingTest {
-
-    @Autowired
-    private TestRestTemplate restTemplate;
-
-    @Autowired
-    private CamelContext context;
-
-    @Before
-    public void setup() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-
-                rest().get("/thepath")
-                        .produces("text/plain")
-                        .route()
-                        .transform().constant("Hello");
-            }
-        });
-    }
-
-    @Test
-    public void testServletMapping() {
-        Assert.assertEquals(404, restTemplate.getForEntity("/camel/thepath", String.class).getStatusCodeValue());
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/camel/blob/239a6b0d/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingAutoConfigurationTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingAutoConfigurationTest.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingAutoConfigurationTest.java
new file mode 100644
index 0000000..6c869e2
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingAutoConfigurationTest.java
@@ -0,0 +1,70 @@
+/**
+ * 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.servlet.springboot.test;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Before;
+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.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * Testing the servlet mapping
+ */
+@RunWith(SpringRunner.class)
+@SpringBootApplication
+@DirtiesContext
+@ContextConfiguration(classes = ServletMappingAutoConfigurationTest.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class ServletMappingAutoConfigurationTest {
+
+    @Autowired
+    private TestRestTemplate restTemplate;
+
+    @Autowired
+    private CamelContext context;
+
+    @Before
+    public void setup() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+
+                rest().get("/thepath")
+                        .produces("text/plain")
+                        .route()
+                        .transform().constant("Hello");
+            }
+        });
+    }
+
+    @Test
+    public void testServletMapping() {
+        Assert.assertEquals("Hello", restTemplate.getForEntity("/camel/thepath", String.class).getBody());
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/239a6b0d/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingDisablingTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingDisablingTest.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingDisablingTest.java
new file mode 100644
index 0000000..6feb8ee
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-servlet-starter/src/test/java/org/apache/camel/component/servlet/springboot/test/ServletMappingDisablingTest.java
@@ -0,0 +1,71 @@
+/**
+ * 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.servlet.springboot.test;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Assert;
+import org.junit.Before;
+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.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * Testing that the servlet mapping can be disabled.
+ */
+@RunWith(SpringRunner.class)
+@SpringBootApplication
+@DirtiesContext
+@ContextConfiguration(classes = ServletMappingDisablingTest.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
+        "camel.component.servlet.mapping.enabled=false"
+})
+public class ServletMappingDisablingTest {
+
+    @Autowired
+    private TestRestTemplate restTemplate;
+
+    @Autowired
+    private CamelContext context;
+
+    @Before
+    public void setup() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+
+                rest().get("/thepath")
+                        .produces("text/plain")
+                        .route()
+                        .transform().constant("Hello");
+            }
+        });
+    }
+
+    @Test
+    public void testServletMapping() {
+        Assert.assertEquals(404, restTemplate.getForEntity("/camel/thepath", String.class).getStatusCodeValue());
+    }
+
+}
+