camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject camel git commit: Fixed the unit test errors of camel-xmlsecurity
Date Wed, 03 Dec 2014 02:30:45 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x 9334a870c -> 279b7f3d0


Fixed the unit test errors of camel-xmlsecurity


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

Branch: refs/heads/camel-2.14.x
Commit: 279b7f3d0fe12abbc516aecc64979c6c9fb1c754
Parents: 9334a87
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Dec 3 10:12:36 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Dec 3 10:30:31 2014 +0800

----------------------------------------------------------------------
 .../camel/model/dataformat/XMLSecurityDataFormat.java     | 10 ++++++----
 .../dataformat/xmlsecurity/XMLSecurityDataFormat.java     |  2 +-
 .../dataformat/xmlsecurity/XMLSecurityDataFormatTest.java |  6 ++++--
 3 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/279b7f3d/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
b/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
index b5e02f6..c2170df 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
@@ -61,7 +61,7 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements
Names
     @XmlAttribute
     private String mgfAlgorithm;
     @XmlAttribute
-    private boolean addKeyValueForEncryptedKey = true;
+    private Boolean addKeyValueForEncryptedKey;
 
     @XmlTransient
     private KeyStoreParameters keyOrTrustStoreParameters;
@@ -276,8 +276,9 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements
Names
         if (mgfAlgorithm != null) {
             setProperty(camelContext, dataFormat, "mgfAlgorithm", this.getMgfAlgorithm());
         }
-        
-        setProperty(camelContext, dataFormat, "addKeyValueForEncryptedKey", isAddKeyValueForEncryptedKey());
+        if (addKeyValueForEncryptedKey != null) {
+            setProperty(camelContext, dataFormat, "addKeyValueForEncryptedKey", isAddKeyValueForEncryptedKey());
+        }
     }
 
     public String getXmlCipherAlgorithm() {
@@ -369,7 +370,8 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements
Names
     }
     
     public boolean isAddKeyValueForEncryptedKey() {
-        return addKeyValueForEncryptedKey;
+        // The default value is true
+        return addKeyValueForEncryptedKey != null ? addKeyValueForEncryptedKey : true;
     }
 
     public void setAddKeyValueForEncryptedKey(boolean addKeyValueForEncryptedKey) {

http://git-wip-us.apache.org/repos/asf/camel/blob/279b7f3d/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
index b31deae..51e3a96 100755
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
@@ -715,7 +715,7 @@ public class XMLSecurityDataFormat implements DataFormat, CamelContextAware
{
         EncryptedKey encryptedKey = keyCipher.encryptKey(document, dataEncryptionkey, mgfAlgorithm,
null);
         if (addKeyValueForEncryptedKey && keyEncryptionKey instanceof PublicKey)
{
             KeyInfo keyInfo = new KeyInfo(document);
-            keyInfo.add(((PublicKey)keyEncryptionKey));
+            keyInfo.add((PublicKey)keyEncryptionKey);
             encryptedKey.setKeyInfo(keyInfo);
         }
         

http://git-wip-us.apache.org/repos/asf/camel/blob/279b7f3d/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
index f29fb6c..458af06 100755
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
@@ -21,6 +21,9 @@ import java.util.Map;
 
 import javax.xml.transform.OutputKeys;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
@@ -31,8 +34,7 @@ import org.apache.camel.util.jsse.KeyStoreParameters;
 import org.apache.xml.security.encryption.XMLCipher;
 import org.junit.Assert;
 import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
+
 
 /**
  * Unit test of the encryptXML data format.


Mime
View raw message