Repository: camel
Updated Branches:
  refs/heads/master 53a290578 -> bd92689f2


CAMEL-7386: camel-openshift component.


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

Branch: refs/heads/master
Commit: bd92689f2825347226cadc3b5815ac1ce73ff7dd
Parents: 53a2905
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Apr 23 11:18:13 2014 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Apr 23 11:18:13 2014 +0200

----------------------------------------------------------------------
 .../component/openshift/OpenShiftEndpoint.java  | 18 +++++--
 ...ponentConfigurationAndDocumentationTest.java | 57 ++++++++++++++++++++
 2 files changed, 72 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bd92689f/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
 
b/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
index 3bdd1a6..7439a48 100644
--- 
a/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
+++ 
b/components/camel-openshift/src/main/java/org/apache/camel/component/openshift/OpenShiftEndpoint.java
@@ -22,17 +22,25 @@ import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 
 @UriEndpoint(scheme = "openshift")
 public class OpenShiftEndpoint extends DefaultEndpoint {
 
+    @UriParam
     private String username;
+    @UriParam
     private String password;
+    @UriParam
     private String clientId;
+    @UriParam
     private String domain;
+    @UriParam
     private String server;
-    private OpenShiftOperation operation;
+    @UriParam
+    private String operation;
+    @UriParam
     private String application;
 
     public OpenShiftEndpoint(String endpointUri, Component component) {
@@ -97,14 +105,18 @@ public class OpenShiftEndpoint extends DefaultEndpoint {
         this.server = server;
     }
 
-    public OpenShiftOperation getOperation() {
+    public String getOperation() {
         return operation;
     }
 
-    public void setOperation(OpenShiftOperation operation) {
+    public void setOperation(String operation) {
         this.operation = operation;
     }
 
+    public void setOperation(OpenShiftOperation operation) {
+        this.operation = operation.name();
+    }
+
     public String getApplication() {
         return application;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/bd92689f/components/camel-openshift/src/test/java/org/apache/camel/component/openshift/OpenShiftComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-openshift/src/test/java/org/apache/camel/component/openshift/OpenShiftComponentConfigurationAndDocumentationTest.java
 
b/components/camel-openshift/src/test/java/org/apache/camel/component/openshift/OpenShiftComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..d24f94a
--- /dev/null
+++ 
b/components/camel-openshift/src/test/java/org/apache/camel/component/openshift/OpenShiftComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.openshift;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class OpenShiftComponentConfigurationAndDocumentationTest extends 
CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        OpenShiftComponent comp = context.getComponent("openshift", 
OpenShiftComponent.class);
+        EndpointConfiguration conf = 
comp.createConfiguration("openshift:myApp?username=foo&password=secret&operation=list");
+
+        assertEquals("foo", conf.getParameter("username"));
+        assertEquals("secret", conf.getParameter("password"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"application\": { \"type\": 
\"java.lang.String\" }"));
+        assertTrue(json.contains("\"clientId\": { \"type\": 
\"java.lang.String\" }"));
+        assertTrue(json.contains("\"operation\": { \"type\": 
\"java.lang.String\" }"));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("openshift");
+        assertNotNull("Should have found some auto-generated HTML if on Java 
7", html);
+    }
+
+}

Reply via email to