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 2017/01/31 17:41:20 UTC

[3/3] camel git commit: CAMEL-10523: Added more test

CAMEL-10523: Added more test


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

Branch: refs/heads/master
Commit: 56d8b551433727ce7c6d5b9b0d0612e9d37598a6
Parents: 57ccbe1
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jan 31 18:38:57 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jan 31 18:41:06 2017 +0100

----------------------------------------------------------------------
 ...ponentConfigurationAndDocumentationTest.java | 58 ++++++++++++++++++++
 ...nguageConfigurationAndDocumentationTest.java | 43 +++++++++++++++
 2 files changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/56d8b551/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/FtpComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/FtpComponentConfigurationAndDocumentationTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/FtpComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..7765360
--- /dev/null
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/FtpComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.itest.doc;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.component.file.remote.FtpComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class FtpComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        FtpComponent comp = context.getComponent("ftp", FtpComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("ftp://myhost?username=foo&password=secret&soTimeout=1234");
+
+        assertEquals("foo", conf.getParameter("username"));
+        assertEquals("secret", conf.getParameter("password"));
+        assertEquals("1234", conf.getParameter("soTimeout"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"minDepth\": { \"kind\": \"parameter\", \"group\": \"filter\", \"label\": \"consumer,filter\", \"type\": \"integer\", \"javaType\": \"int\""));
+        assertTrue(json.contains("\"username\": { \"kind\": \"parameter\", \"group\": \"security\", \"label\": \"security\", \"type\": \"string\""));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("ftp");
+        assertNotNull("Should have found some auto-generated HTML", html);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/56d8b551/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/GroovyLanguageConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/GroovyLanguageConfigurationAndDocumentationTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/GroovyLanguageConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..3adcc48
--- /dev/null
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/doc/GroovyLanguageConfigurationAndDocumentationTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.itest.doc;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class GroovyLanguageConfigurationAndDocumentationTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testLanguageJsonSchema() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String json = context.getLanguageParameterJsonSchema("groovy");
+        assertNotNull("Should have found some auto-generated JSON", json);
+        log.info(json);
+
+        assertTrue(json.contains("\"name\": \"groovy\""));
+        assertTrue(json.contains("\"modelName\": \"groovy\""));
+    }
+
+}
+