abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckopp...@apache.org
Subject svn commit: r944863 - in /abdera/java/trunk: security/src/test/java/org/apache/abdera/test/security/ server/src/test/java/org/apache/abdera/protocol/server/test/basic/ server/src/test/java/org/apache/abdera/protocol/server/test/custom/
Date Sun, 16 May 2010 15:39:11 GMT
Author: ckoppelt
Date: Sun May 16 15:39:10 2010
New Revision: 944863

URL: http://svn.apache.org/viewvc?rev=944863&view=rev
Log:
fix for ABDERA-102

Modified:
    abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DigitalSignatureTest.java
    abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/EncryptionTest.java
    abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
    abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java

Modified: abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DigitalSignatureTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DigitalSignatureTest.java?rev=944863&r1=944862&r2=944863&view=diff
==============================================================================
--- abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DigitalSignatureTest.java
(original)
+++ abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/DigitalSignatureTest.java
Sun May 16 15:39:10 2010
@@ -99,8 +99,8 @@ public class DigitalSignatureTest {
       
     X509Certificate[] certs = sig.getValidSignatureCertificates(entry, options);
     assertNotNull(certs);
-    assertEquals(certs.length, 1);
-    assertEquals(certs[0].getSubjectDN().getName(), "CN=James M Snell, OU=WebAhead, O=IBM,
L=Hanford, ST=California, C=US");
+    assertEquals(1, certs.length);
+    assertEquals("CN=James M Snell, OU=WebAhead, O=IBM, L=Hanford, ST=California, C=US",
certs[0].getSubjectDN().getName());
     
     // Check the round trip
     ByteArrayOutputStream out = new ByteArrayOutputStream();

Modified: abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/EncryptionTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/EncryptionTest.java?rev=944863&r1=944862&r2=944863&view=diff
==============================================================================
--- abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/EncryptionTest.java
(original)
+++ abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/EncryptionTest.java
Sun May 16 15:39:10 2010
@@ -85,20 +85,16 @@ public class EncryptionTest {
     // Encrypt the document using the generated key
     Document enc_doc = enc.encrypt(entry.getDocument(), options);
     
-    assertEquals(
-      enc_doc.getRoot().getQName(), 
-      new QName(
-        "http://www.w3.org/2001/04/xmlenc#", 
-        "EncryptedData"));
+    assertEquals(new QName("http://www.w3.org/2001/04/xmlenc#", 
+        "EncryptedData"),  enc_doc.getRoot().getQName());
     
     // Decrypt the document using the generated key
     Document<Entry> entry_doc = enc.decrypt(enc_doc, options);
 
     assertTrue(entry_doc.getRoot() instanceof Entry);
     
-    assertEquals(
-      entry_doc.getRoot().getId().toString(), 
-      "http://example.org/foo/entry");
+    assertEquals("http://example.org/foo/entry",
+      entry_doc.getRoot().getId().toString());
     
   }
   

Modified: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java?rev=944863&r1=944862&r2=944863&view=diff
==============================================================================
--- abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
(original)
+++ abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
Sun May 16 15:39:10 2010
@@ -47,8 +47,6 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import junit.framework.Assert;
-
 public class BasicTest {
 
   private static JettyServer server;
@@ -79,31 +77,31 @@ public class BasicTest {
   public void testGetService() {
     ClientResponse resp = client.get("http://localhost:9002/");
     assertNotNull(resp);
-    assertEquals(resp.getType(), ResponseType.SUCCESS);
+    assertEquals( ResponseType.SUCCESS, resp.getType());
     assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.APP_MEDIA_TYPE));
     Document<Service> doc = resp.getDocument();
     Service service = doc.getRoot();
-    assertEquals(service.getWorkspaces().size(), 1);
+    assertEquals( 1, service.getWorkspaces().size());
     Workspace workspace = service.getWorkspace("Abdera");
-    assertEquals(workspace.getCollections().size(), 1);
+    assertEquals( 1, workspace.getCollections().size());
     Collection collection = workspace.getCollection("title for any sample feed");
     assertNotNull(collection);
     assertTrue(collection.acceptsEntry());
-    assertEquals(collection.getResolvedHref().toString(), "http://localhost:9002/sample");
+    assertEquals( "http://localhost:9002/sample", collection.getResolvedHref().toString());
     resp.release();
   }
   @Test
   public void testGetFeed() {
     ClientResponse resp = client.get("http://localhost:9002/sample");
     assertNotNull(resp);
-    assertEquals(resp.getType(), ResponseType.SUCCESS);
+    assertEquals( ResponseType.SUCCESS, resp.getType());
     assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.FEED_MEDIA_TYPE));
   
     Document<Feed> doc = resp.getDocument();    
     Feed feed = doc.getRoot();
-    assertEquals(feed.getId().toString(), "http://localhost:9002/sample");
-    assertEquals(feed.getTitle(), "title for any sample feed");
-    assertEquals(feed.getAuthor().getName(), "rayc");
-    assertEquals(feed.getEntries().size(), 0);
+    assertEquals( "http://localhost:9002/sample", feed.getId().toString());
+    assertEquals( "title for any sample feed", feed.getTitle());
+    assertEquals( "rayc", feed.getAuthor().getName());
+    assertEquals( 0, feed.getEntries().size());
     resp.release();
   }
   @Test
@@ -117,14 +115,14 @@ public class BasicTest {
     entry.addAuthor("James");
     ClientResponse resp = client.post("http://localhost:9002/sample", entry);
     assertNotNull(resp);
-    assertEquals(resp.getType(), ResponseType.SUCCESS);
-    assertEquals(resp.getStatus(), 201);
-    assertEquals(resp.getLocation().toString(), "http://localhost:9002/sample/foo");
+    assertEquals( ResponseType.SUCCESS, resp.getType());
+    assertEquals( 201, resp.getStatus());
+    assertEquals( "http://localhost:9002/sample/foo", resp.getLocation().toString());
     resp.release();
     resp = client.get("http://localhost:9002/sample");
     Document<Feed> feed_doc = resp.getDocument();
     Feed feed = feed_doc.getRoot();
-    assertEquals(feed.getEntries().size(), 1);
+    assertEquals( 1, feed.getEntries().size());
     resp.release();
   }
   @Test
@@ -133,8 +131,8 @@ public class BasicTest {
     RequestOptions options = client.getDefaultRequestOptions();
     options.setContentType("application/octet-stream");
     ClientResponse resp = client.post("http://localhost:9002/sample", in, options);
-    assertEquals(resp.getType(), ResponseType.CLIENT_ERROR);
-    assertEquals(resp.getStatus(), 405);
+    assertEquals( ResponseType.CLIENT_ERROR, resp.getType());
+    assertEquals( 405, resp.getStatus());
     resp.release();
   }
   @Test
@@ -146,30 +144,30 @@ public class BasicTest {
     entry.setTitle("This is the modified title");
     resp.release();
     resp = client.put("http://localhost:9002/sample/foo", entry);
-    assertEquals(resp.getType(), ResponseType.SUCCESS);
-    assertEquals(resp.getStatus(), 200);
+    assertEquals( ResponseType.SUCCESS, resp.getType());
+    assertEquals( 200, resp.getStatus());
     resp.release();
     resp = client.get("http://localhost:9002/sample/foo");
     doc = resp.getDocument();
     entry = doc.getRoot();
-    assertEquals(entry.getTitle(), "This is the modified title");
+    assertEquals( "This is the modified title", entry.getTitle());
     resp.release();
     resp = client.get("http://localhost:9002/sample");
     Document<Feed> feed_doc = resp.getDocument();
     Feed feed = feed_doc.getRoot();
-    assertEquals(feed.getEntries().size(), 1);
+    assertEquals( 1, feed.getEntries().size());
     resp.release();
   }
 
   @Test
   public void testDeleteEntry() {
     ClientResponse resp = client.delete("http://localhost:9002/sample/foo");
-    assertEquals(resp.getType(), ResponseType.SUCCESS);
+    assertEquals( ResponseType.SUCCESS, resp.getType());
     resp.release();
     resp = client.get("http://localhost:9002/sample");
     Document<Feed> feed_doc = resp.getDocument();
     Feed feed = feed_doc.getRoot();
-    assertEquals(feed.getEntries().size(), 0);
+    assertEquals( 0, feed.getEntries().size());
     resp.release();
   }
 }

Modified: abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java?rev=944863&r1=944862&r2=944863&view=diff
==============================================================================
--- abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
(original)
+++ abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
Sun May 16 15:39:10 2010
@@ -81,12 +81,12 @@ prettyPrint(doc);
 } catch (Exception e) {}
     Service service = doc.getRoot();
     prettyPrint(service);
-    assertEquals(service.getWorkspaces().size(), 1);
+    assertEquals( 1, service.getWorkspaces().size());
     Workspace workspace = service.getWorkspaces().get(0);
-    assertEquals(workspace.getCollections().size(), 1);
+    assertEquals( 1, workspace.getCollections().size());
     Collection collection = workspace.getCollections().get(0);
-    assertEquals(collection.getResolvedHref().toString(), BASE + "/feed");
-    assertEquals(collection.getTitle().toString(), "A simple feed");
+    assertEquals( BASE + "/feed", collection.getResolvedHref().toString());
+    assertEquals( "A simple feed", collection.getTitle().toString());
     resp.release();
   }
 
@@ -98,10 +98,10 @@ prettyPrint(doc);
     assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.CAT_MEDIA_TYPE));
     Document<Categories> doc = resp.getDocument();
     Categories cats = doc.getRoot();
-    assertEquals(cats.getCategories().size(), 3);
-    assertEquals(cats.getCategories().get(0).getTerm(), "foo");
-    assertEquals(cats.getCategories().get(1).getTerm(), "bar");
-    assertEquals(cats.getCategories().get(2).getTerm(), "baz");
+    assertEquals( 3, cats.getCategories().size());
+    assertEquals( "foo", cats.getCategories().get(0).getTerm());
+    assertEquals( "bar", cats.getCategories().get(1).getTerm());
+    assertEquals( "baz", cats.getCategories().get(2).getTerm());
     assertFalse(cats.isFixed());
   }
 
@@ -114,9 +114,9 @@ prettyPrint(doc);
     Document<Feed> doc = resp.getDocument();
     Feed feed = doc.getRoot();
     assertEquals("tag:example.org,2008:feed", feed.getId().toString());
-    assertEquals(feed.getTitle(), "A simple feed");
-    assertEquals(feed.getAuthor().getName(), "Simple McGee");
-    assertEquals(feed.getEntries().size(), 0);
+    assertEquals( "A simple feed", feed.getTitle());
+    assertEquals( "Simple McGee", feed.getAuthor().getName());
+    assertEquals( 0, feed.getEntries().size());
     resp.release();
   }
 
@@ -140,13 +140,13 @@ prettyPrint(doc);
     ClientResponse resp = client.post(BASE + "/feed", entry);
     assertNotNull(resp);
     assertEquals(ResponseType.SUCCESS, resp.getType());
-    assertEquals(resp.getStatus(), 201);
+    assertEquals( 201, resp.getStatus());
     assertNotNull(resp.getLocation());
     resp.release();
     resp = client.get(BASE + "/feed");
     Document<Feed> feed_doc = resp.getDocument();
     Feed feed = feed_doc.getRoot();
-    assertEquals(feed.getEntries().size(), 1);
+    assertEquals( 1, feed.getEntries().size());
   }
 
   @Test
@@ -155,8 +155,8 @@ prettyPrint(doc);
     RequestOptions options = client.getDefaultRequestOptions();
     options.setContentType("application/octet-stream");
     ClientResponse resp = client.post(BASE + "/feed", in, options);
-    assertEquals(resp.getType(), ResponseType.CLIENT_ERROR);
-    assertEquals(resp.getStatus(), 405);
+    assertEquals( ResponseType.CLIENT_ERROR, resp.getType());
+    assertEquals( 405, resp.getStatus());
     resp.release();
   }
 
@@ -178,17 +178,17 @@ prettyPrint(doc);
     resp.release();
     resp = client.put(edit, entry);
     assertEquals(ResponseType.SUCCESS, resp.getType());
-    assertEquals(resp.getStatus(), 204);
+    assertEquals( 204, resp.getStatus());
     resp.release();
     resp = client.get(edit);
     doc = resp.getDocument();
     entry = doc.getRoot();
-    assertEquals(entry.getTitle(), "This is the modified title");
+    assertEquals( "This is the modified title", entry.getTitle());
     resp.release();
     resp = client.get(BASE + "/feed");
     feed_doc = resp.getDocument();
     feed = feed_doc.getRoot();
-    assertEquals(feed.getEntries().size(), 1);
+    assertEquals( 1, feed.getEntries().size());
     resp.release();
   }
 
@@ -206,7 +206,7 @@ prettyPrint(doc);
     resp = client.get(BASE + "/feed");
     feed_doc = resp.getDocument();
     feed = feed_doc.getRoot();
-    assertEquals(feed.getEntries().size(), 0);
+    assertEquals( 0, feed.getEntries().size());
     resp.release();
   }
 }



Mime
View raw message