oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r963056 - in /incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature: AbstractSimpleMethodTestCase.java hmac/HmacSha1MethodTestCase.java plaintext/PlaintextMethodTestCase.java
Date Sun, 11 Jul 2010 11:52:38 GMT
Author: simonetripodi
Date: Sun Jul 11 11:52:38 2010
New Revision: 963056

URL: http://svn.apache.org/viewvc?rev=963056&view=rev
Log:
modified test structure to prepare RSA test

Modified:
    incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/AbstractSimpleMethodTestCase.java
    incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/hmac/HmacSha1MethodTestCase.java
    incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/plaintext/PlaintextMethodTestCase.java

Modified: incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/AbstractSimpleMethodTestCase.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/AbstractSimpleMethodTestCase.java?rev=963056&r1=963055&r2=963056&view=diff
==============================================================================
--- incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/AbstractSimpleMethodTestCase.java
(original)
+++ incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/AbstractSimpleMethodTestCase.java
Sun Jul 11 11:52:38 2010
@@ -27,9 +27,6 @@ import org.apache.amber.OAuthRequest;
 import org.apache.amber.OAuthRequestParameter;
 import org.apache.amber.OAuthToken;
 import org.apache.amber.Version;
-import org.apache.amber.signature.SignatureMethod;
-import org.apache.amber.signature.SigningKey;
-import org.apache.amber.signature.VerifyingKey;
 
 /**
  * Abstract implementation of OAuth signature method algorithm test case.
@@ -39,7 +36,8 @@ import org.apache.amber.signature.Verify
  */
 public abstract class AbstractSimpleMethodTestCase {
 
-    protected void verifySignature(SignatureMethod signatureMethod,
+    protected void verifySignature(VerifyingKey verifyingKey,
+            SignatureMethod signatureMethod,
             String expectedSignature) throws Exception {
         OAuthRequest request = new FakeOAuthRequest();
         request.setRequestURL(new URL("http://photos.example.net/photos"));
@@ -56,8 +54,6 @@ public abstract class AbstractSimpleMeth
         OAuthToken token = new FakeToken();
         token.setTokenSecret("pfkkdhi9sl3r4s00");
 
-        VerifyingKey verifyingKey = new BasicKey("kd94hf93k423kf44");
-
         assertTrue(signatureMethod.verify(expectedSignature, verifyingKey, token, request));
     }
 

Modified: incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/hmac/HmacSha1MethodTestCase.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/hmac/HmacSha1MethodTestCase.java?rev=963056&r1=963055&r2=963056&view=diff
==============================================================================
--- incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/hmac/HmacSha1MethodTestCase.java
(original)
+++ incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/hmac/HmacSha1MethodTestCase.java
Sun Jul 11 11:52:38 2010
@@ -17,6 +17,7 @@
 package org.apache.amber.signature.hmac;
 
 import org.apache.amber.signature.AbstractSimpleMethodTestCase;
+import org.apache.amber.signature.BasicKey;
 import org.junit.Test;
 
 /**
@@ -28,7 +29,9 @@ public class HmacSha1MethodTestCase exte
 
     @Test
     public void verifyHmacSha1MethodAlgorithm() throws Exception {
-        this.verifySignature(new HmacSha1Method(), "tR3+Ty81lMeYAr/Fid0kMTYa/WM=");
+        this.verifySignature(new BasicKey("kd94hf93k423kf44"),
+                new HmacSha1Method(),
+                "tR3+Ty81lMeYAr/Fid0kMTYa/WM=");
     }
 
 }

Modified: incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/plaintext/PlaintextMethodTestCase.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/plaintext/PlaintextMethodTestCase.java?rev=963056&r1=963055&r2=963056&view=diff
==============================================================================
--- incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/plaintext/PlaintextMethodTestCase.java
(original)
+++ incubator/amber/trunk/signature-api/src/test/java/org/apache/amber/signature/plaintext/PlaintextMethodTestCase.java
Sun Jul 11 11:52:38 2010
@@ -17,6 +17,7 @@
 package org.apache.amber.signature.plaintext;
 
 import org.apache.amber.signature.AbstractSimpleMethodTestCase;
+import org.apache.amber.signature.BasicKey;
 import org.junit.Test;
 
 /**
@@ -28,7 +29,9 @@ public class PlaintextMethodTestCase ext
 
     @Test
     public void verifyHmacSha1MethodAlgorithm() throws Exception {
-        this.verifySignature(new PlaintextMethod(), "kd94hf93k423kf44&pfkkdhi9sl3r4s00");
+        this.verifySignature(new BasicKey("kd94hf93k423kf44"),
+                new PlaintextMethod(),
+                "kd94hf93k423kf44&pfkkdhi9sl3r4s00");
     }
 
 }



Mime
View raw message