You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/01/20 21:29:05 UTC

svn commit: r1234112 - /camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java

Author: bvahdat
Date: Fri Jan 20 20:29:04 2012
New Revision: 1234112

URL: http://svn.apache.org/viewvc?rev=1234112&view=rev
Log:
Avoid deprecated API usage

Modified:
    camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java

Modified: camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java?rev=1234112&r1=1234111&r2=1234112&view=diff
==============================================================================
--- camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java (original)
+++ camel/trunk/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormatTest.java Fri Jan 20 20:29:04 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.dataformat.xmlsecurity;
 
-import java.net.URL;
-import java.security.KeyStore;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -140,15 +138,14 @@ public class XMLSecurityDataFormatTest e
 
     @Test
     public void testFullPayloadAsymmetricKeyEncryption() throws Exception {
-        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
-        URL trustStoreUrl = getClass().getClassLoader().getResource("sender.ts");
-        trustStore.load(trustStoreUrl.openStream(), "password".toCharArray());
+        KeyStoreParameters tsParameters = new KeyStoreParameters();
+        tsParameters.setPassword("password");
+        tsParameters.setResource("sender.ts");
 
         final XMLSecurityDataFormat xmlEncDataFormat = new XMLSecurityDataFormat();
         xmlEncDataFormat.setKeyCipherAlgorithm(XMLCipher.RSA_v1dot5);
+        xmlEncDataFormat.setKeyOrTrustStoreParameters(tsParameters);
         xmlEncDataFormat.setXmlCipherAlgorithm(testCypherAlgorithm);
-        xmlEncDataFormat.setTrustStore(trustStore);
-        xmlEncDataFormat.setTrustStorePassword("password");
         xmlEncDataFormat.setRecipientKeyAlias("recipient");
 
         context.addRoutes(new RouteBuilder() {
@@ -162,7 +159,6 @@ public class XMLSecurityDataFormatTest e
 
     @Test
     public void testPartialPayloadAsymmetricKeyEncryptionWithContextTruststoreProperties() throws Exception {
-        
         final KeyStoreParameters tsParameters = new KeyStoreParameters();
         tsParameters.setPassword("password");
         tsParameters.setResource("sender.ts");
@@ -309,7 +305,6 @@ public class XMLSecurityDataFormatTest e
 
     @Test
     public void testPartialPayloadAsymmetricKeyDecryption() throws Exception {
-                
         final Map<String, String> namespaces = new HashMap<String, String>();
         namespaces.put("ns1", "http://cheese.xmlsecurity.camel.apache.org/");
         
@@ -333,7 +328,6 @@ public class XMLSecurityDataFormatTest e
     
     @Test
     public void testPartialPayloadAsymmetricKeyDecryptionCustomNS() throws Exception {
-        
         final KeyStoreParameters tsParameters = new KeyStoreParameters();
         tsParameters.setPassword("password");
         tsParameters.setResource("sender.ts");