Repository: camel
Updated Branches:
  refs/heads/master 7ae1aac78 -> efee1f707


CAMEL-11655 - Camel-Nagios: Use Encryption enum instead of EncryptionMethod


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

Branch: refs/heads/master
Commit: efee1f707a41f3091955e11beab26d0afbf916cd
Parents: 7ae1aac
Author: Andrea Cosentino <anco...@gmail.com>
Authored: Wed Aug 9 14:38:46 2017 +0200
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Wed Aug 9 14:38:46 2017 +0200

----------------------------------------------------------------------
 .../src/main/docs/nagios-component.adoc         |  2 +-
 .../component/nagios/NagiosConfiguration.java   | 24 ++++++++++----------
 .../nagios/NagiosXorEncryptionTest.java         |  2 +-
 .../NagiosComponentConfiguration.java           | 12 +++++-----
 4 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/efee1f70/components/camel-nagios/src/main/docs/nagios-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/main/docs/nagios-component.adoc 
b/components/camel-nagios/src/main/docs/nagios-component.adoc
index 9bc6501..dd040ac 100644
--- a/components/camel-nagios/src/main/docs/nagios-component.adoc
+++ b/components/camel-nagios/src/main/docs/nagios-component.adoc
@@ -81,7 +81,7 @@ with the following path and query parameters:
 | **sendSync** (producer) | Whether or not to use synchronous when sending a 
passive check. Setting it to false will allow Camel to continue routing the 
message and the passive check message will be send asynchronously. | true | 
boolean
 | **timeout** (producer) | Sending timeout in millis. | 5000 | int
 | **synchronous** (advanced) | Sets whether synchronous processing should be 
strictly used or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
-| **encryptionMethod** (security) | To specify an encryption method. |  | 
NagiosEncryptionMethod
+| **encryption** (security) | To specify an encryption method. |  | Encryption
 | **password** (security) | Password to be authenticated when sending checks 
to Nagios. |  | String
 |=======================================================================
 // endpoint options: END

http://git-wip-us.apache.org/repos/asf/camel/blob/efee1f70/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
 
b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
index 69cdcee..a4b160a 100644
--- 
a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
+++ 
b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
@@ -47,7 +47,7 @@ public class NagiosConfiguration implements Cloneable {
     @UriParam(label = "security", secret = true)
     private String password;
     @UriParam(label = "security")
-    private NagiosEncryptionMethod encryptionMethod;
+    private Encryption encryption = Encryption.NONE;
 
     /**
      * Returns a copy of this configuration
@@ -89,19 +89,19 @@ public class NagiosConfiguration implements Cloneable {
             nagiosSettings.setPort(getPort());
             nagiosSettings.setPassword(getPassword());
 
-            if (encryptionMethod != null) {
-                if (NagiosEncryptionMethod.No == encryptionMethod) {
+            if (encryption != null) {
+                if (Encryption.NONE == encryption) {
                     nagiosSettings.setEncryption(Encryption.NONE);
-                } else if (NagiosEncryptionMethod.Xor == encryptionMethod) {
+                } else if (Encryption.XOR == encryption) {
                     nagiosSettings.setEncryption(Encryption.XOR);
-                } else if (NagiosEncryptionMethod.TripleDes == 
encryptionMethod) {
+                } else if (Encryption.TRIPLE_DES == encryption) {
                     nagiosSettings.setEncryption(Encryption.TRIPLE_DES);
                 } else {
-                    throw new IllegalArgumentException("Unknown encryption 
method: " + encryptionMethod);
+                    throw new IllegalArgumentException("Unknown encryption 
method: " + encryption);
                 }
             }
         }
-
+        
         return nagiosSettings;
     }
 
@@ -164,21 +164,21 @@ public class NagiosConfiguration implements Cloneable {
         this.password = password;
     }
 
-    public NagiosEncryptionMethod getEncryptionMethod() {
-        return encryptionMethod;
+    public Encryption getEncryptionMethod() {
+        return encryption;
     }
 
     /**
      * To specify an encryption method.
      */
-    public void setEncryptionMethod(NagiosEncryptionMethod encryptionMethod) {
-        this.encryptionMethod = encryptionMethod;
+    public void setEncryption(Encryption encryptionMethod) {
+        this.encryption = encryption;
     }
 
     @Override
     public String toString() {
         return "NagiosConfiguration[host=" + host + ":" + port + ", 
connectionTimeout=" + connectionTimeout
-                + ", timeout=" + timeout + ", encryptionMethod=" + 
encryptionMethod + "]";
+                + ", timeout=" + timeout + ", encryption=" + encryption + "]";
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/efee1f70/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
 
b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
index d9e5346..cf4766c 100644
--- 
a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
+++ 
b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
@@ -72,7 +72,7 @@ public class NagiosXorEncryptionTest extends CamelTestSupport 
{
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String uri = 
"nagios:127.0.0.1:25664?password=secret&encryptionMethod=Xor";
+                String uri = 
"nagios:127.0.0.1:25664?password=secret&encryption=Xor";
 
                 NagiosComponent nagiosComponent = new NagiosComponent();
                 nagiosComponent.setCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/efee1f70/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
----------------------------------------------------------------------
diff --git 
a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
index cf7611c..bcbb527 100644
--- 
a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
+++ 
b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.nagios.springboot;
 
 import javax.annotation.Generated;
 import com.googlecode.jsendnsca.NagiosSettings;
-import org.apache.camel.component.nagios.NagiosEncryptionMethod;
+import com.googlecode.jsendnsca.encryption.Encryption;
 import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.NestedConfigurationProperty;
@@ -90,7 +90,7 @@ public class NagiosComponentConfiguration
         /**
          * To specify an encryption method.
          */
-        private NagiosEncryptionMethod encryptionMethod;
+        private Encryption encryption;
 
         public NagiosSettings getNagiosSettings() {
             return nagiosSettings;
@@ -140,12 +140,12 @@ public class NagiosComponentConfiguration
             this.password = password;
         }
 
-        public NagiosEncryptionMethod getEncryptionMethod() {
-            return encryptionMethod;
+        public Encryption getEncryption() {
+            return encryption;
         }
 
-        public void setEncryptionMethod(NagiosEncryptionMethod 
encryptionMethod) {
-            this.encryptionMethod = encryptionMethod;
+        public void setEncryption(Encryption encryption) {
+            this.encryption = encryption;
         }
     }
 }
\ No newline at end of file

Reply via email to