abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1201391 - in /abdera/abdera2: common/src/main/java/org/apache/abdera2/common/geo/ common/src/main/java/org/apache/abdera2/common/http/ common/src/main/java/org/apache/abdera2/common/protocol/ common/src/main/java/org/apache/abdera2/common/...
Date Sun, 13 Nov 2011 02:04:13 GMT
Author: jmsnell
Date: Sun Nov 13 02:04:12 2011
New Revision: 1201391

URL: http://svn.apache.org/viewvc?rev=1201391&view=rev
Log:
bug fixes

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractProvider.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CharUtils.java
    abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/processors/MultipartRelatedServiceRequestProcessor.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/BasicTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/mediatype/MimeTypeHelperTest.java
    abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/geo/Multiple.java Sun Nov
13 02:04:12 2011
@@ -44,7 +44,7 @@ public abstract class Multiple extends P
     }
     
     private static void checkMaxPoints(int points, int max) {
-      checkState(points <= max, "Maximum coordinates exceeded", max);
+      checkState(max == -1 || points <= max, "Maximum coordinates exceeded", max);
     }
     
     public <P extends Builder<X>>P maximumCoordinates(int max) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControl.java Sun
Nov 13 02:04:12 2011
@@ -115,7 +115,7 @@ public final class CacheControl implemen
       for (Map.Entry<String, Object> entry : exts.entrySet()) {
         String name = entry.getKey().toLowerCase(Locale.US);
         checkReserved(name);
-        exts.put(
+        this.exts.put(
           name, 
           entry.getValue());
       }
@@ -220,12 +220,14 @@ public final class CacheControl implemen
     }
 
     public Builder privateHeaders(String... headers) {
+      if (headers == null) return this;
       this.private_headers = ImmutableSet.copyOf(headers);
       if (headers.length > 0) isPrivate();
       return this;
     }
 
     public Builder noCacheHeaders(String... headers) {
+      if (headers == null) return this;
       this.nocache_headers = ImmutableSet.copyOf(headers);
       if (headers.length > 0) noCache();
       return this;

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/http/CacheControlUtil.java
Sun Nov 13 02:04:12 2011
@@ -45,21 +45,21 @@ public final class CacheControlUtil {
      */
     public static String buildCacheControl(CacheControl cc) {
         StringBuilder buf = new StringBuilder();
-        appendif(cc.isPrivate(), buf, "private");
+        appendwithsepif(cc.isPrivate(), buf, "private");
         appendif(cc.isPrivate(), buf, cc.getPrivateHeaders());
-        appendif(cc.isPublic(), buf, "public");
-        appendif(cc.isNoCache(), buf, "no-cache");
+        appendwithsepif(cc.isPublic(), buf, "public");
+        appendwithsepif(cc.isNoCache(), buf, "no-cache");
         appendif(cc.isNoCache(), buf, cc.getNoCacheHeaders());  
-        appendif(cc.isNoStore(), buf, "no-store");
-        appendif(cc.isNoTransform(), buf, "no-transform");
-        appendif(cc.isOnlyIfCached(), buf, "only-if-cached");
-        appendif(cc.isMustRevalidate(), buf, "must-revalidate");
-        appendif(cc.isProxyRevalidate(), buf, "proxy-revalidate");
-        appendif(cc.getMaxAge() != -1, buf, "max-age=%d", cc.getMaxAge());
-        appendif (cc.getMaxStale() != -1, buf, "max-stale=%d", cc.getMaxStale());
-        appendif (cc.getMinFresh() != -1, buf, "min-fresh=%d", cc.getMinFresh());
-        appendif (cc.getStaleIfError() != -1, buf, "stale-if-error=%d", cc.getStaleIfError());
-        appendif (cc.getStaleWhileRevalidate() != -1, buf, "stale-while-revalidate=%d", cc.getStaleWhileRevalidate());
+        appendwithsepif(cc.isNoStore(), buf, "no-store");
+        appendwithsepif(cc.isNoTransform(), buf, "no-transform");
+        appendwithsepif(cc.isOnlyIfCached(), buf, "only-if-cached");
+        appendwithsepif(cc.isMustRevalidate(), buf, "must-revalidate");
+        appendwithsepif(cc.isProxyRevalidate(), buf, "proxy-revalidate");
+        appendwithsepif(cc.getMaxAge() != -1, buf, "max-age=%d", cc.getMaxAge());
+        appendwithsepif (cc.getMaxStale() != -1, buf, "max-stale=%d", cc.getMaxStale());
+        appendwithsepif (cc.getMinFresh() != -1, buf, "min-fresh=%d", cc.getMinFresh());
+        appendwithsepif (cc.getStaleIfError() != -1, buf, "stale-if-error=%d", cc.getStaleIfError());
+        appendwithsepif (cc.getStaleWhileRevalidate() != -1, buf, "stale-while-revalidate=%d",
cc.getStaleWhileRevalidate());
         for (String ext : cc.listExtensions()) {
           append(buf, ext);
           Object val = cc.getExtension(ext); 
@@ -172,7 +172,7 @@ public final class CacheControlUtil {
       implements Iterable<Directive> {
 
         private static final String REGEX =
-            "\\s*([\\w\\-]+)\\s*(=)?\\s*(\\d+|\\\"([^\"\\\\]*(\\\\.[^\"\\\\]*)*)+\\\")?\\s*";
+            "\\s*([\\w\\-]+)\\s*(=)?\\s*(\\d+|\\\"([^\"\\\\]*(\\\\.[^\"\\\\]*)*)+\\\"|[^,]+)?\\s*";
 
         private static final Pattern pattern = Pattern.compile(REGEX);
 

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractProvider.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractProvider.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractProvider.java
Sun Nov 13 02:04:12 2011
@@ -187,7 +187,7 @@ public abstract class AbstractProvider
           CollectionAdapter,
           ? extends RequestProcessor>> 
             requestProcessors) {
-        requestProcessors.putAll(requestProcessors);
+        this.requestProcessors.putAll(requestProcessors);
     }
 
     public Map<TargetType, Function<CollectionAdapter,? extends RequestProcessor>>
getRequestProcessors() {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CharUtils.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CharUtils.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CharUtils.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/text/CharUtils.java Sun
Nov 13 02:04:12 2011
@@ -187,9 +187,13 @@ public final class CharUtils {
           buf.append(", ");
       buf.append(value);
   }
-  
+
+    public static void appendwithsepif(boolean exp, StringBuilder buf, String value, Object...
args) {
+      if (exp) append(buf,format(value,args));
+    }
+    
   public static void appendif(boolean exp, StringBuilder buf, String value, Object... args)
{
-    if (exp) append(buf, format(value,args));
+    if (exp) buf.append(format(value,args));
   }
 
   public static void appendif(boolean exp, StringBuilder buf, Iterable<String> items)
{

Modified: abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/processors/MultipartRelatedServiceRequestProcessor.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/processors/MultipartRelatedServiceRequestProcessor.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/processors/MultipartRelatedServiceRequestProcessor.java
(original)
+++ abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/processors/MultipartRelatedServiceRequestProcessor.java
Sun Nov 13 02:04:12 2011
@@ -62,7 +62,6 @@ public class MultipartRelatedServiceRequ
       final WorkspaceManager workspaceManager) {
         return new StreamWriterResponseContext(
             AbstractAtompubProvider.getAbdera(request)) {
-
             @Override
             protected void writeTo(StreamWriter sw) throws IOException {
                 sw.startDocument().startService();

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/BasicTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/BasicTest.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/BasicTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/BasicTest.java
Sun Nov 13 02:04:12 2011
@@ -124,7 +124,10 @@ public class BasicTest {
         resp.release();
         assertTrue(object instanceof Activity);
         Activity activity = (Activity) object;
-        activity = activity.<Activity,ActivityBuilder>template(withoutFields("title")).get();
+        activity = 
+          activity.<Activity,ActivityBuilder>template(withoutFields("title"))
+            .title("This is the modified title")
+            .get();
         ActivityEntity ae = new ActivityEntity(activity);
         resp = session.put("http://localhost:9002/sample/foo", ae);
         assertEquals(ResponseType.SUCCESSFUL, resp.getType());

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java Sun Nov
13 02:04:12 2011
@@ -381,10 +381,9 @@ public class AppTest {
 
     @Test
     public void testRequestOptions() throws Exception {
-        Client abderaClient = new BasicClient();
-        Session session = abderaClient.newSession();
+
         RequestOptions options = 
-          session.getDefaultRequestOptions()
+          RequestOptions.make()
             .ifModifiedSinceNow()
             .requestException4xx()
             .requestException5xx()
@@ -418,7 +417,7 @@ public class AppTest {
         assertNotNull(options.getIfModifiedSince());
         assertTrue(options.is4xxRequestException());
         assertTrue(options.is5xxRequestException());
-        abderaClient.shutdown();
+
     }
 
     @Test

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java
Sun Nov 13 02:04:12 2011
@@ -10,7 +10,7 @@ import com.google.common.collect.Iterabl
 
 public class CacheControlTest {
 
-  public static final String CC = "private=\"A\", public, no-cache=\"A\", no-store, no-transform,
only-if-cached, must-revalidate, proxy-revalidate, max-age=10, max-stale=10, min-fresh=10,
stale-if-error=10, stale-while-revalidate=10, a=\"b\"";
+  public static final String CC = "private=\"A\", public, no-cache=\"A\", no-store, no-transform,
only-if-cached, must-revalidate, proxy-revalidate, max-age=10, max-stale=10, min-fresh=10,
stale-if-error=10, stale-while-revalidate=10, a=b";
   
   @Test
   public void testCacheControl() {

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/mediatype/MimeTypeHelperTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/mediatype/MimeTypeHelperTest.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/mediatype/MimeTypeHelperTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/mediatype/MimeTypeHelperTest.java
Sun Nov 13 02:04:12 2011
@@ -89,7 +89,6 @@ public class MimeTypeHelperTest {
         assertTrue(MimeTypeHelper.isMatch("*/*", "application/atom+xml;type=feed"));
         assertTrue(MimeTypeHelper.isMatch("application/atom+xml;type=entry", "*/*"));
         assertFalse(MimeTypeHelper.isMatch(null, "application/atom+xml;type=feed"));
-        assertFalse(MimeTypeHelper.isMatch("blafasel", "application/atom+xml;type=feed"));
 
         MimeType mimeType1 = new MimeType("application/atom+xml;type=entry");
         MimeType mimeType2 = new MimeType("application/atom+xml;type=feed");

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java?rev=1201391&r1=1201390&r2=1201391&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java
(original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java
Sun Nov 13 02:04:12 2011
@@ -92,6 +92,7 @@ public class FeatureTest {
             .select(
               service, 
               xpath()
+                .using(abdera.getXPath())
                 .path(String.format("f:features/f:feature[@ref='%s']",
                   FeaturesHelper.FEATURE_SUPPORTS_DRAFTS))
                 .with("f",FeaturesHelper.FNS)



Mime
View raw message